diff --git a/src/app/backend/controllers/CustomersController.php b/src/app/backend/controllers/CustomersController.php index fd098ed..99c892f 100644 --- a/src/app/backend/controllers/CustomersController.php +++ b/src/app/backend/controllers/CustomersController.php @@ -20,7 +20,11 @@ class CustomersController extends \Phalcon\Mvc\Controller $search_phone = $this->request->getPost('search_phone', 'int', NULL); $this->session->set('search_name', $search_name); $this->session->set('search_phone', $search_phone); - if (!empty($search_name)) { + if (!empty($search_name) && !empty($search_phone)) { + $data = $this->models->getCustomers()->getDataByNameAndPhone($search_name, $search_phone); + $total = 1; + } + elseif (!empty($search_name)) { $data = $this->models->getCustomers()->getDataByName($search_name); $total = 1; } diff --git a/src/lib/models/customers.php b/src/lib/models/customers.php index c41cdea..f5be046 100644 --- a/src/lib/models/customers.php +++ b/src/lib/models/customers.php @@ -1323,6 +1323,26 @@ class customers extends \db } + public function getDataByNameAndPhone($name, $phone) { + + return $this->get( + ' + SELECT * FROM + public.customers + WHERE + phone LIKE \'%'.$phone.'%\' + AND + name LIKE \'%'.$name.'%\' + + ' + , + [ + ], + -1 + ); + + } + } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// \ No newline at end of file -- libgit2 0.21.4