Skip to content

Commit

Permalink
Update a non-existing filter shows an error message.
Browse files Browse the repository at this point in the history
  • Loading branch information
martineiber authored and mattamon committed Mar 28, 2023
1 parent 9b9d1ac commit 220a920
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Controller/Admin/Customers/FilterDefinitionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,15 @@ public function updateAction(Request $request, CustomerViewInterface $customerVi
{
// fetch object parameters from request
$filterDefinition = $this->getFilterDefinitionFromRequest($request, true, true);

// check if a filter is selected
if (empty($filterDefinition)) {
// add error message for missing filter
$errors[] = $customerView->translate('cmf_filter_definition_errors_filter_missing');

return $this->getRedirectToFilter(0, $errors);
}

// check mandatory FilterDefinition name
if (empty($filterDefinition->getName())) {
// add error message for missing filter name
Expand Down
1 change: 1 addition & 0 deletions src/Resources/translations/admin.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ cmf_filter_definition_errors_access: "Not allowed to access filter."
cmf_filter_definition_errors_change: "Not allowed to change filter."
cmf_filter_definition_errors_deletion_failed: "Deletion of filter failed. (%s)"
cmf_filter_definition_errors_name_missing: "Please provide a filter name."
cmf_filter_definition_errors_filter_missing: "Please select a filter."
cmf_filter_definition_errors_save_failed: "Save of filter failed. (%s)"
cmf_filter_definition_errors_share_failed: "Sharing filter failed. (%s)"

Expand Down

0 comments on commit 220a920

Please sign in to comment.