From fdd06dbd4f19a008e992b3413ac47a3785602c30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20DECALOM?= Date: Tue, 2 Jul 2024 16:15:05 +0200 Subject: [PATCH 1/6] Fixe bug 4069 fix bug on created_at in customer_entity table on update --- .../Model/Entity/Attribute/Backend/Time/Created.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php index 63dd3e1caff..fdd12707446 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php @@ -53,11 +53,22 @@ public function beforeSave($object) } else { // convert to UTC $zendDate = Mage::app()->getLocale()->utcDate(null, $date, true, $this->_getFormat($date)); - $object->setData($attributeCode, $zendDate->getIso()); + $date = $this->removeTimezone($zendDate->getIso()); + $object->setData($attributeCode, $date); } return $this; } + + /** + * @param $date + * + * @return string + */ + public function removeTimezone($date): string + { + return strtr($date, ["+00:00" => "", "T" => " "]); + } /** * Convert create date from UTC to current store time zone From c64eaeb9ab16e839bfede51f14259742c7d5b9ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20DECALOM?= Date: Tue, 2 Jul 2024 17:03:56 +0200 Subject: [PATCH 2/6] Update Created.php --- .../Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php index fdd12707446..977aad3b1fc 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php @@ -61,8 +61,9 @@ public function beforeSave($object) } /** - * @param $date + * Remove the timezone format * + * @param string $date * @return string */ public function removeTimezone($date): string From 0933db9de83349367b617dabb4321aafe34820d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20DECALOM?= Date: Tue, 2 Jul 2024 17:15:51 +0200 Subject: [PATCH 3/6] Add my contributor name --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index cb3551ec970..925998b9009 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -21,6 +21,15 @@ "code" ] }, + { + "login": "sdecalom", + "name": "Sebastien DECALOM", + "avatar_url": "https://avatars.githubusercontent.com/u/3275377?s=96&v=4", + "profile": "https://github.com/sdecalom", + "contributions": [ + "code" + ] + } { "login": "LeeSaferite", "name": "Lee Saferite", From dac57dbd2a68c473af27186e53516c32908f316d Mon Sep 17 00:00:00 2001 From: Fabrizio Balliano Date: Wed, 3 Jul 2024 22:55:31 +0100 Subject: [PATCH 4/6] phpcs --- .../Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php index 977aad3b1fc..5929d962170 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php @@ -59,7 +59,6 @@ public function beforeSave($object) return $this; } - /** * Remove the timezone format * From 55285d7cc8fb5b8d40a4b762ca804be715249c8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20DECALOM?= Date: Thu, 4 Jul 2024 17:26:33 +0200 Subject: [PATCH 5/6] Refactor to set date with this format yyyy-MM-dd HH:mm:ss --- .../Entity/Attribute/Backend/Time/Created.php | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php index 5929d962170..67f8ed98e7b 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php @@ -53,23 +53,11 @@ public function beforeSave($object) } else { // convert to UTC $zendDate = Mage::app()->getLocale()->utcDate(null, $date, true, $this->_getFormat($date)); - $date = $this->removeTimezone($zendDate->getIso()); - $object->setData($attributeCode, $date); + $object->setData($attributeCode, $zendDate->toString('yyyy-MM-dd HH:mm:ss')); } return $this; } - /** - * Remove the timezone format - * - * @param string $date - * @return string - */ - public function removeTimezone($date): string - { - return strtr($date, ["+00:00" => "", "T" => " "]); - } - /** * Convert create date from UTC to current store time zone * From ff59f3650623aa3748b8ad78bb85acce90e18d29 Mon Sep 17 00:00:00 2001 From: Fabrizio Balliano Date: Sat, 6 Jul 2024 10:04:35 +0100 Subject: [PATCH 6/6] whitespace --- .../Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php index 67f8ed98e7b..f7ff3951716 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php @@ -35,6 +35,7 @@ protected function _getFormat($date) } return null; } + /** * Set created date * Set created date in UTC time zone @@ -58,6 +59,7 @@ public function beforeSave($object) return $this; } + /** * Convert create date from UTC to current store time zone *