diff --git a/Controller/CustomerController.php b/Controller/CustomerController.php index 24399dc..1c03173 100644 --- a/Controller/CustomerController.php +++ b/Controller/CustomerController.php @@ -48,6 +48,24 @@ public function searchAction(Request $request) $this->getParserContext()->addForm($baseForm); - return $this->render('customers'); + $data = $baseForm->getForm()->getData(); + + $choice = []; + foreach ($data as $d) { + $choice[] = $d; + } + + if ($data['company'] === null + && $data['lastname'] === null + && $data['firstname'] === null + && $data['email'] === null + && $data['subscriptionDateMin'] === null + && $data['subscriptionDateMax'] === null + && !empty(array_intersect($choice, ['all'])) + ) { + return $this->generateRedirectFromRoute('admin.customers'); + } else { + return $this->render('customers'); + } } }