Skip to content
Snippets Groups Projects

Issue #3517662: Fix the broken invoice link within the user invoices view.

1 file
+ 19
0
Compare changes
  • Side-by-side
  • Inline
@@ -109,3 +109,22 @@ function commerce_invoice_post_update_5() {
return $message;
}
/**
* Update the customer invoices view to fix the default url rewrite pattern.
*/
function commerce_invoice_post_update_6() {
$config_factory = \Drupal::configFactory();
$view = $config_factory->getEditable('views.view.commerce_user_invoices');
if ($view->get('display.default.display_options.fields.invoice_number.alter.path') === 'user/{{ raw_arguments.uid }}/invoices/{{ invoice_id }}') {
return "The view is already up-to-date.";
}
if ($view->get('display.default.display_options.fields.invoice_number.alter.path') === 'user/{{ arguments.uid }}/invoices/{{ invoice_id }}') {
$view->set('display.default.display_options.fields.invoice_number.alter.path', 'user/{{ raw_arguments.uid }}/invoices/{{ invoice_id }}');
$view->save(TRUE);
return "The views.view.commerce_user_invoices view was updated";
}
return "The views.view.commerce_user_invoices couldn't be updated as the default path for the title field has been overridden with custom value. Test if rewrite pattern is correct.";
}
Loading