From 00c4deb9ff52d52f91cdd4b6b4fc55a100c6d78c Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Tue, 28 May 2024 16:09:32 +0530 Subject: [PATCH] Validation messages are improved for invalid date selection of the dates from calendar in admin dashboard --- controllers/admin/AdminDashboardController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminDashboardController.php b/controllers/admin/AdminDashboardController.php index 11ffe69e6..1fc4a45ae 100644 --- a/controllers/admin/AdminDashboardController.php +++ b/controllers/admin/AdminDashboardController.php @@ -295,9 +295,12 @@ class AdminDashboardControllerCore extends AdminController public function postProcess() { if (Tools::isSubmit('submitDateRange')) { - if (!Validate::isDate(Tools::getValue('date_from')) - || !Validate::isDate(Tools::getValue('date_to'))) { + if (!Validate::isDate(Tools::getValue('date_from')) && !Validate::isDate(Tools::getValue('date_to'))) { $this->errors[] = Tools::displayError('The selected date range is not valid.'); + } elseif (!Validate::isDate(Tools::getValue('date_from'))) { + $this->errors[] = Tools::displayError('Date from in not selected. Please select a date range from the calendar.'); + } elseif (!Validate::isDate(Tools::getValue('date_to'))) { + $this->errors[] = Tools::displayError('Date to in not selected. Please select a date range from the calendar.'); } if (Tools::getValue('datepicker_compare')) {