Merge pull request #813 from abhishek-webkul/gli-1084

Fixed: Success message is not displayed for bulk status updates in a list at back office
This commit is contained in:
Rohit Jain
2024-03-12 20:28:24 +05:30
committed by GitHub

View File

@@ -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;
}