Commit 44675e95d630923e2333d12ddd1c9ba3c526d2b9
1 parent
6b081599
user_group_id remove bug fix
Showing
2 changed files
with
49 additions
and
17 deletions
Show diff stats
src/app/frontend/controllers/CustomerController.php
@@ -528,7 +528,8 @@ class CustomerController extends \controllers\ControllerBase | @@ -528,7 +528,8 @@ class CustomerController extends \controllers\ControllerBase | ||
528 | if( $this->models->getCustomers()->editCustomer( $customer_edit ) ) | 528 | if( $this->models->getCustomers()->editCustomer( $customer_edit ) ) |
529 | { | 529 | { |
530 | $this->flash->success( $this->languages->getTranslation()->_("successfully_changed_your_profile") ); | 530 | $this->flash->success( $this->languages->getTranslation()->_("successfully_changed_your_profile") ); |
531 | - $this->session->set('users_group_id', $customer_edit['users_group_id']); | 531 | + |
532 | + if (!empty($customer_edit['users_group_id'])) $this->session->set('users_group_id', $customer_edit['users_group_id']); | ||
532 | return $this->response->redirect($_SERVER['HTTP_REFERER']); | 533 | return $this->response->redirect($_SERVER['HTTP_REFERER']); |
533 | } | 534 | } |
534 | else | 535 | else |
src/lib/models/customers.php
@@ -634,9 +634,9 @@ class customers extends \db | @@ -634,9 +634,9 @@ class customers extends \db | ||
634 | } | 634 | } |
635 | public function editCustomer( $customer_edit ) | 635 | public function editCustomer( $customer_edit ) |
636 | { | 636 | { |
637 | - | ||
638 | - return $this->exec( | ||
639 | - ' | 637 | + if (!empty($customer_edit['users_group_id'])) { |
638 | + return $this->exec( | ||
639 | + ' | ||
640 | UPDATE | 640 | UPDATE |
641 | public.customers | 641 | public.customers |
642 | SET | 642 | SET |
@@ -654,19 +654,50 @@ class customers extends \db | @@ -654,19 +654,50 @@ class customers extends \db | ||
654 | WHERE | 654 | WHERE |
655 | id=:id | 655 | id=:id |
656 | ', | 656 | ', |
657 | - [ | ||
658 | - 'name' => $customer_edit['name'], | ||
659 | - 'passwd' => $customer_edit['passwd'], | ||
660 | - 'email' => $customer_edit['email'], | ||
661 | - 'birth_date' => $customer_edit['birth_date'], | ||
662 | - 'phone' => $customer_edit['phone'], | ||
663 | - 'city' => $customer_edit['city'], | ||
664 | - 'address' => !empty($customer_edit['address']) ? $customer_edit['address'] : '', | ||
665 | - 'subscribed' => $customer_edit['subscribed'], | ||
666 | - 'id' => $customer_edit['id'], | ||
667 | - 'users_group_id'=> !empty($customer_edit['users_group_id']) ? $customer_edit['users_group_id'] : null | ||
668 | - ] | ||
669 | - ); | 657 | + [ |
658 | + 'name' => $customer_edit['name'], | ||
659 | + 'passwd' => $customer_edit['passwd'], | ||
660 | + 'email' => $customer_edit['email'], | ||
661 | + 'birth_date' => $customer_edit['birth_date'], | ||
662 | + 'phone' => $customer_edit['phone'], | ||
663 | + 'city' => $customer_edit['city'], | ||
664 | + 'address' => !empty($customer_edit['address']) ? $customer_edit['address'] : '', | ||
665 | + 'subscribed' => $customer_edit['subscribed'], | ||
666 | + 'id' => $customer_edit['id'], | ||
667 | + 'users_group_id'=> !empty($customer_edit['users_group_id']) ? $customer_edit['users_group_id'] : null | ||
668 | + ] | ||
669 | + ); | ||
670 | + } | ||
671 | + else { | ||
672 | + return $this->exec( | ||
673 | + ' | ||
674 | + UPDATE | ||
675 | + public.customers | ||
676 | + SET | ||
677 | + name = :name, | ||
678 | + passwd = :passwd, | ||
679 | + email = :email, | ||
680 | + birth_date = :birth_date, | ||
681 | + phone = :phone, | ||
682 | + city = :city, | ||
683 | + address = :address, | ||
684 | + subscribed = :subscribed | ||
685 | + WHERE | ||
686 | + id=:id | ||
687 | + ', | ||
688 | + [ | ||
689 | + 'name' => $customer_edit['name'], | ||
690 | + 'passwd' => $customer_edit['passwd'], | ||
691 | + 'email' => $customer_edit['email'], | ||
692 | + 'birth_date' => $customer_edit['birth_date'], | ||
693 | + 'phone' => $customer_edit['phone'], | ||
694 | + 'city' => $customer_edit['city'], | ||
695 | + 'address' => !empty($customer_edit['address']) ? $customer_edit['address'] : '', | ||
696 | + 'subscribed' => $customer_edit['subscribed'], | ||
697 | + 'id' => $customer_edit['id'] | ||
698 | + ] | ||
699 | + ); | ||
700 | + } | ||
670 | } | 701 | } |
671 | 702 | ||
672 | ///////////////////////////////////////////////////////////////////////////// | 703 | ///////////////////////////////////////////////////////////////////////////// |