From 516fb1aa8135e9bf3c586e4afad0bb1fa0f7efcf Mon Sep 17 00:00:00 2001 From: Maxime Bruchet Date: Thu, 8 Mar 2018 11:55:26 +0100 Subject: [PATCH] Fix pagination issue in customer search --- Controller/CustomerController.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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'); + } } }