From 51ca7421ac0676cbb894cb13b850f7190fd0e2f9 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 27 Sep 2024 09:41:44 +0530 Subject: [PATCH 1/2] Added: Admin is now unable to edit deleted/banned customers --- controllers/admin/AdminCustomersController.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index c523ffd3c..49584fba8 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -375,6 +375,10 @@ class AdminCustomersControllerCore extends AdminController /** @var Customer $obj */ if (!($obj = $this->loadObject(true))) { return; + } else if ($this->object->deleted == Customer::STATUS_DELETED) { + $this->errors[] = $this->l('You cannot update a deleted customer.'); + } else if ($this->object->deleted == Customer::STATUS_BANNED) { + $this->errors[] = $this->l('You cannot update a banned customer.'); } $genders = Gender::getGenders(); @@ -1114,6 +1118,14 @@ class AdminCustomersControllerCore extends AdminController public function processUpdate() { if (Validate::isLoadedObject($this->object)) { + if ($this->object->deleted == Customer::STATUS_DELETED) { + $this->errors[] = $this->l('You can not update a deleted customer.'); + return false; + } else if ($this->object->deleted == Customer::STATUS_BANNED) { + $this->errors[] = $this->l('You can not update a banned customer.'); + return false; + } + $customer_email = trim(strval(Tools::getValue('email'))); // check if e-mail already used From 95410ac3a0c5ce64e30a45f453b09b4c89a3fa82 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 27 Sep 2024 17:02:44 +0530 Subject: [PATCH 2/2] Fixed: The warning messages for the banned and deleted customer update process --- controllers/admin/AdminCustomersController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 49584fba8..da544628e 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -376,9 +376,9 @@ class AdminCustomersControllerCore extends AdminController if (!($obj = $this->loadObject(true))) { return; } else if ($this->object->deleted == Customer::STATUS_DELETED) { - $this->errors[] = $this->l('You cannot update a deleted customer.'); + $this->warnings[] = $this->l('This is a deleted customer and you cannot update the information of a deleted customer.'); } else if ($this->object->deleted == Customer::STATUS_BANNED) { - $this->errors[] = $this->l('You cannot update a banned customer.'); + $this->warnings[] = $this->l('This is a banned customer and you cannot update the information of a banned customer.'); } $genders = Gender::getGenders();