From 0aeb8be718352ed894cea82b5b1ac3c17110eaf2 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 18 Sep 2023 15:55:29 +0530 Subject: [PATCH] Fixed: Admin is unable to set empty birthday for a customer --- controllers/admin/AdminCustomersController.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index b7078a0f1..e4eaac7de 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -966,6 +966,21 @@ class AdminCustomersControllerCore extends AdminController return parent::processSave(); } + protected function copyFromPost(&$object, $table) + { + parent::copyFromPost($object, $table); + + $years = Tools::getValue('years'); + $months = Tools::getValue('months'); + $days = Tools::getValue('days'); + + if ($years != '' && $months != '' && $days != '') { + $object->birthday = (int) $years.'-'.(int) $months.'-'.(int) $days; + } elseif ($years == '' && $months == '' && $days == '') { + $object->birthday = null; + } + } + protected function afterDelete($object, $old_id) { $customer = new Customer($old_id);