Commit 490cf8620332d2021a23eb241137e909249173d8

Authored by Dima
2 parents 1a9db8d9 1b590868

Merge remote-tracking branch 'origin/master' into master_new

src/app/backend/controllers/CustomersController.php
... ... @@ -18,9 +18,10 @@ class CustomersController extends \Phalcon\Mvc\Controller
18 18  
19 19 $search_name = $this->request->getPost('search_name', 'string', NULL);
20 20 $search_phone = $this->request->getPost('search_phone', 'string', NULL);
  21 + $search_submit = $this->request->getPost('search_submit', 'string', NULL);
21 22 $this->session->set('search_name', $search_name);
22 23 $this->session->set('search_phone', $search_phone);
23   - if (!empty($search_name) && !empty($search_phone)) {
  24 + if (!empty($search_name) && (!empty($search_phone) || $search_phone == '0')) {
24 25 $data = $this->models->getCustomers()->getDataByNameAndPhone($search_name, $search_phone);
25 26 $total = 1;
26 27 }
... ... @@ -28,15 +29,19 @@ class CustomersController extends \Phalcon\Mvc\Controller
28 29 $data = $this->models->getCustomers()->getDataByName($search_name);
29 30 $total = 1;
30 31 }
31   - elseif(!empty($search_phone)) {
  32 + elseif(!empty($search_phone) || $search_phone == '0') {
32 33 $data = $this->models->getCustomers()->getDataByPhone($search_phone);
33 34 $total = 1;
34 35 }
35   - else {
  36 + elseif (isset($search_submit)) {
36 37 $this->flash->notice("Параметры поиска не указаны");
37 38 $data = $this->models->getCustomers()->getAllData($page);
38 39 $total = $this->models->getCustomers()->countData();
39 40 }
  41 + else {
  42 + $data = $this->models->getCustomers()->getAllData($page);
  43 + $total = $this->models->getCustomers()->countData();
  44 + }
40 45  
41 46 if( $total['0']['total'] > \config::get( 'limits/items') )
42 47 {
... ...
src/app/backend/views/customers/index.php
... ... @@ -13,9 +13,9 @@
13 13 <div class="table_name header_gradient">Пользователи</div>
14 14 <div class="table_add_page"><a href="<?= $this->url->get([ 'for' => 'customers_add' ]) ?>" title="Добавить">Добавить</a></div>
15 15 <form method="post" action="" style="margin:10px;">
16   - <input type="text" name="search_name" placeholder="поиск по имени" value="<?= $this->session->get('search_name'); ?>" />
  16 + <input type="text" name="search_name" size="50" placeholder="поиск по имени" value="<?= $this->session->get('search_name'); ?>" />
17 17 <input type="text" name="search_phone" placeholder="поиск по телефону" value="<?= $this->session->get('search_phone'); ?>" />
18   - <input type="submit" value="Поиск" />
  18 + <input type="submit" name="search_submit" value="Поиск" />
19 19 </form>
20 20 <div class="table_pages_wrapper">
21 21  
... ...