From a3307750fee86c8cd9e2fdcad6cd9233148fcb35 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 30 Nov 2023 13:34:36 +0530 Subject: [PATCH] Improve --- classes/controller/AdminController.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index ea3a469f7..7e71d8701 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -4018,9 +4018,23 @@ class AdminControllerCore extends Controller $object = new $this->className((int)$id); $object->setFieldsToUpdate(array('active' => true)); $object->active = (int)$status; - $result &= $object->update(); + $isUpdated = (bool) $object->update(); + $result &= $isUpdated; + + if (!$isUpdated) { + $this->errors[] = sprintf($this->l('Can\'t update #%d status.'), (int) $id); + } } + + if ($result) { + $this->redirect_after = self::$currentIndex.'&conf=5&token='.$this->token; + } else { + $this->errors[] = $this->l('An error occurred while updating the status.'); + } + } else { + $this->errors[] = $this->l('You must select at least one item to perform a bulk action.'); } + return $result; }