From ac2fe45c30c8b5356fdbc6d63fb076d5bc82fcd7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Jul 2023 09:24:46 +0100 Subject: [PATCH 1/5] Bump friendsofphp/php-cs-fixer from 3.19.2 to 3.20.0 (#3360) --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index 4622fcf0096..76561ece7f7 100644 --- a/composer.lock +++ b/composer.lock @@ -2664,16 +2664,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.19.2", + "version": "v3.20.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "210dd89560edb27a8e0d5086b734ac5b5fd4e0e4" + "reference": "0e8249e0b15e2bc022fbbd1090ce29d071481e69" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/210dd89560edb27a8e0d5086b734ac5b5fd4e0e4", - "reference": "210dd89560edb27a8e0d5086b734ac5b5fd4e0e4", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/0e8249e0b15e2bc022fbbd1090ce29d071481e69", + "reference": "0e8249e0b15e2bc022fbbd1090ce29d071481e69", "shasum": "" }, "require": { @@ -2748,7 +2748,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.19.2" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.20.0" }, "funding": [ { @@ -2756,7 +2756,7 @@ "type": "github" } ], - "time": "2023-06-25T16:42:58+00:00" + "time": "2023-06-27T20:22:39+00:00" }, { "name": "macopedia/phpstan-magento1", @@ -5357,16 +5357,16 @@ }, { "name": "symfony/filesystem", - "version": "v5.4.23", + "version": "v5.4.25", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "b2f79d86cd9e7de0fff6d03baa80eaed7a5f38b5" + "reference": "0ce3a62c9579a53358d3a7eb6b3dfb79789a6364" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/b2f79d86cd9e7de0fff6d03baa80eaed7a5f38b5", - "reference": "b2f79d86cd9e7de0fff6d03baa80eaed7a5f38b5", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/0ce3a62c9579a53358d3a7eb6b3dfb79789a6364", + "reference": "0ce3a62c9579a53358d3a7eb6b3dfb79789a6364", "shasum": "" }, "require": { @@ -5401,7 +5401,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.23" + "source": "https://github.com/symfony/filesystem/tree/v5.4.25" }, "funding": [ { @@ -5417,7 +5417,7 @@ "type": "tidelift" } ], - "time": "2023-03-02T11:38:35+00:00" + "time": "2023-05-31T13:04:02+00:00" }, { "name": "symfony/finder", From 17bc336ad0c379f4e573379db6d26e46750eaf26 Mon Sep 17 00:00:00 2001 From: Fabrizio Balliano Date: Mon, 3 Jul 2023 10:36:57 +0200 Subject: [PATCH 2/5] Removed support for UPS CGI API which was shut down in May 2023 (#3287) --- README.md | 2 ++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php | 7 +------ .../Mage/Usa/Model/Shipping/Carrier/Ups/Source/Type.php | 2 -- app/code/core/Mage/Usa/etc/config.xml | 1 - 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b5ba4b55514..0e4e63e6cfa 100644 --- a/README.md +++ b/README.md @@ -264,6 +264,8 @@ not compatible with the new implementations made by ZF1-Future, which is much mo This may generate a problem with `Zend_Db_Select' statements that do not use 'Zend_Db_Expr' to quote expressions. If you see SQL errors after upgrading please remember to check for this specific issue in your code. +UPS shut down their old CGI APIs so we removed the support for it from the Mage_Usa module. + ### New Config Options - `admin/design/use_legacy_theme` diff --git a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php index eb2a59c7ec2..0dce39492e6 100644 --- a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php +++ b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php @@ -305,9 +305,6 @@ public function getResult() protected function _getQuotes() { switch ($this->getConfigData('type')) { - case 'UPS': - return $this->_getCgiQuotes(); - case 'UPS_XML': return $this->_getXmlQuotes(); } @@ -1058,9 +1055,7 @@ public function getTracking($trackings) $trackings = [$trackings]; } - if ($this->getConfigData('type') == 'UPS') { - $this->_getCgiTracking($trackings); - } elseif ($this->getConfigData('type') == 'UPS_XML') { + if ($this->getConfigData('type') == 'UPS_XML') { $this->setXMLAccessRequest(); $this->_getXmlTracking($trackings); } diff --git a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Type.php b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Type.php index 51ce51b2d51..25a87592302 100644 --- a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Type.php +++ b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Type.php @@ -25,8 +25,6 @@ class Mage_Usa_Model_Shipping_Carrier_Ups_Source_Type public function toOptionArray() { return [ - ['value' => 'UPS', 'label' => Mage::helper('usa')->__('United Parcel Service')], - #array('value' => Mage_Paypal_Model_Api_Abstract::PAYMENT_TYPE_ORDER, 'label' => Mage::helper('usa')->__('Order')), ['value' => 'UPS_XML', 'label' => Mage::helper('usa')->__('United Parcel Service XML')], ]; } diff --git a/app/code/core/Mage/Usa/etc/config.xml b/app/code/core/Mage/Usa/etc/config.xml index 8875aebf016..4dac78bc100 100644 --- a/app/code/core/Mage/Usa/etc/config.xml +++ b/app/code/core/Mage/Usa/etc/config.xml @@ -154,7 +154,6 @@ RES GND - http://www.ups.com/using/services/rave/qcostcgi.cgi https://onlinetools.ups.com/ups.app/xml/Rate https://onlinetools.ups.com/ups.app/xml/Track https://onlinetools.ups.com/ups.app/xml/ShipConfirm From e7e10cfc7940126ce2c2939759fb88fc37e8c129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20MARTINEZ?= Date: Mon, 3 Jul 2023 11:08:21 +0200 Subject: [PATCH 3/5] Old inactive quotes are now actually purged from the database (#1489) Co-authored-by: Fabrizio Balliano --- app/code/core/Mage/Checkout/etc/system.xml | 1 + app/code/core/Mage/Sales/Model/Observer.php | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/code/core/Mage/Checkout/etc/system.xml b/app/code/core/Mage/Checkout/etc/system.xml index 2f3013325fc..59443e3d568 100644 --- a/app/code/core/Mage/Checkout/etc/system.xml +++ b/app/code/core/Mage/Checkout/etc/system.xml @@ -80,6 +80,7 @@ + validate-not-negative-number 1 1 1 diff --git a/app/code/core/Mage/Sales/Model/Observer.php b/app/code/core/Mage/Sales/Model/Observer.php index 53398f05dd2..eba17cfd3d6 100644 --- a/app/code/core/Mage/Sales/Model/Observer.php +++ b/app/code/core/Mage/Sales/Model/Observer.php @@ -38,17 +38,19 @@ class Mage_Sales_Model_Observer public function cleanExpiredQuotes($schedule) { Mage::dispatchEvent('clear_expired_quotes_before', ['sales_observer' => $this]); - $lifetimes = Mage::getConfig()->getStoresConfigByPath('checkout/cart/delete_quote_after'); - foreach ($lifetimes as $storeId => $lifetime) { - $lifetime = (int)$lifetime * 86400; - /** @var Mage_Sales_Model_Resource_Quote_Collection $quotes */ - $quotes = Mage::getModel('sales/quote')->getCollection(); + foreach ($lifetimes as $storeId => $day) { + $day = (int) $day; + $lifetime = 86400 * $day; + /** @var Mage_Sales_Model_Resource_Quote_Collection $quotes */ + $quotes = Mage::getResourceModel('sales/quote_collection'); $quotes->addFieldToFilter('store_id', $storeId); - $quotes->addFieldToFilter('updated_at', ['to' => date("Y-m-d", time() - $lifetime)]); - $quotes->addFieldToFilter('is_active', 0); + $quotes->addFieldToFilter('updated_at', ['to' => date('Y-m-d', time() - $lifetime)]); + if ($day == 0) { + $quotes->addFieldToFilter('is_active', 0); + } foreach ($this->getExpireQuotesAdditionalFilterFields() as $field => $condition) { $quotes->addFieldToFilter($field, $condition); @@ -56,6 +58,7 @@ public function cleanExpiredQuotes($schedule) $quotes->walk('delete'); } + return $this; } From 8bb21fa774269f176559d7f2d78419c6052e0b70 Mon Sep 17 00:00:00 2001 From: Fabrizio Balliano Date: Mon, 3 Jul 2023 16:51:11 +0200 Subject: [PATCH 4/5] Added support for Google Tag Manager injection, compatible with Analytics 4 and enhanced ecommerce data (#3356) --- .../core/Mage/GoogleAnalytics/Block/Ga.php | 9 +--- .../core/Mage/GoogleAnalytics/Block/Gtm.php | 44 +++++++++++++++++++ .../core/Mage/GoogleAnalytics/Helper/Data.php | 37 ++++++++++++++++ .../core/Mage/GoogleAnalytics/etc/system.xml | 37 +++++++++++----- .../base/default/layout/googleanalytics.xml | 1 + .../default/template/googleanalytics/ga.phtml | 40 ++--------------- .../template/googleanalytics/gtm.phtml | 33 ++++++++++++++ 7 files changed, 146 insertions(+), 55 deletions(-) create mode 100644 app/code/core/Mage/GoogleAnalytics/Block/Gtm.php create mode 100644 app/design/frontend/base/default/template/googleanalytics/gtm.phtml diff --git a/app/code/core/Mage/GoogleAnalytics/Block/Ga.php b/app/code/core/Mage/GoogleAnalytics/Block/Ga.php index 211a5aee159..e589dd44dee 100644 --- a/app/code/core/Mage/GoogleAnalytics/Block/Ga.php +++ b/app/code/core/Mage/GoogleAnalytics/Block/Ga.php @@ -109,15 +109,10 @@ protected function _getPageTrackingCodeAnalytics($accountId) * * @return string * @throws Mage_Core_Model_Store_Exception + * @deprecated */ protected function _getOrdersTrackingCode() { - /** @var Mage_GoogleAnalytics_Helper_Data $helper */ - $helper = $this->helper('googleanalytics'); - if ($helper->isUseAnalytics4()) { - return $this->_getOrdersTrackingCodeAnalytics4(); - } - return ''; } @@ -127,7 +122,7 @@ protected function _getOrdersTrackingCode() * @return string * @throws JsonException */ - protected function _getOrdersTrackingCodeAnalytics4() + protected function _getEnhancedEcommerceDataForAnalytics4() { $result = []; $request = $this->getRequest(); diff --git a/app/code/core/Mage/GoogleAnalytics/Block/Gtm.php b/app/code/core/Mage/GoogleAnalytics/Block/Gtm.php new file mode 100644 index 00000000000..b1d07dadfbb --- /dev/null +++ b/app/code/core/Mage/GoogleAnalytics/Block/Gtm.php @@ -0,0 +1,44 @@ +isGoogleTagManagerAvailable(); + } + + /** + * Render GA tracking scripts + * + * @return string + */ + protected function _toHtml() + { + if (!$this->_isAvailable()) { + return ''; + } + return parent::_toHtml(); + } +} diff --git a/app/code/core/Mage/GoogleAnalytics/Helper/Data.php b/app/code/core/Mage/GoogleAnalytics/Helper/Data.php index 759fc2ca5f9..49b4b098987 100644 --- a/app/code/core/Mage/GoogleAnalytics/Helper/Data.php +++ b/app/code/core/Mage/GoogleAnalytics/Helper/Data.php @@ -30,6 +30,9 @@ class Mage_GoogleAnalytics_Helper_Data extends Mage_Core_Helper_Abstract public const XML_PATH_DEBUG = 'google/analytics/debug'; public const XML_PATH_USERID = 'google/analytics/user_id'; + public const XML_PATH_GTM_ACTIVE = 'google/gtm/active'; + public const XML_PATH_GTM_CONTAINER_ID = 'google/gtm/container_id'; + /** * @var string google analytics 4 */ @@ -40,6 +43,18 @@ class Mage_GoogleAnalytics_Helper_Data extends Mage_Core_Helper_Abstract */ protected $_moduleName = 'Mage_GoogleAnalytics'; + /** + * Whether GTM is ready to use + * + * @param mixed $store + * @return bool + */ + public function isGoogleTagManagerAvailable($store = null) + { + $containerId = Mage::getStoreConfig(self::XML_PATH_GTM_CONTAINER_ID, $store); + return $containerId && Mage::getStoreConfigFlag(self::XML_PATH_GTM_ACTIVE, $store); + } + /** * Whether GA is ready to use * @@ -75,6 +90,17 @@ public function getAccountId($store = null) return Mage::getStoreConfig(self::XML_PATH_ACCOUNT, $store); } + /** + * Get GTM account id + * + * @param string $store + * @return string + */ + public function getGoogleTagManagerContainerId($store = null) + { + return Mage::getStoreConfig(self::XML_PATH_GTM_CONTAINER_ID, $store); + } + /** * Returns true if should use Google Universal Analytics * @@ -87,6 +113,17 @@ public function isUseUniversalAnalytics($store = null) return false; } + /** + * Returns true if should use Google Tag Manager + * + * @param string $store + * @return bool + */ + public function isUseGoogleTagManager($store = null) + { + return Mage::getStoreConfigFlag(self::XML_PATH_GTM_ACTIVE, $store); + } + /** * Returns true if should use Google Universal Analytics 4 * diff --git a/app/code/core/Mage/GoogleAnalytics/etc/system.xml b/app/code/core/Mage/GoogleAnalytics/etc/system.xml index 9631f0fe728..6c35dee2553 100644 --- a/app/code/core/Mage/GoogleAnalytics/etc/system.xml +++ b/app/code/core/Mage/GoogleAnalytics/etc/system.xml @@ -24,6 +24,31 @@ 1 1 + + + 10 + 1 + 1 + 1 + + + + select + adminhtml/system_config_source_yesno + 10 + 1 + 1 + 1 + + + + 20 + 1 + 1 + 1 + + + 10 @@ -83,18 +108,6 @@ analytics4 - - - select - adminhtml/system_config_source_yesno - 30 - 1 - 1 - 1 - - universal - - diff --git a/app/design/frontend/base/default/layout/googleanalytics.xml b/app/design/frontend/base/default/layout/googleanalytics.xml index da267c1d11e..68abd84a276 100644 --- a/app/design/frontend/base/default/layout/googleanalytics.xml +++ b/app/design/frontend/base/default/layout/googleanalytics.xml @@ -23,6 +23,7 @@ Default layout, loads most of the pages + diff --git a/app/design/frontend/base/default/template/googleanalytics/ga.phtml b/app/design/frontend/base/default/template/googleanalytics/ga.phtml index d0a3fab571b..e922a545dd0 100644 --- a/app/design/frontend/base/default/template/googleanalytics/ga.phtml +++ b/app/design/frontend/base/default/template/googleanalytics/ga.phtml @@ -16,50 +16,18 @@ helper('googleanalytics'); -$_accountId = $_helper->getAccountId(); ?> helper('core/cookie')->isUserNotAllowSaveCookie()): ?> isUseAnalytics4()): ?> + getAccountId() ?> - + - isUseUniversalAnalytics()): ?> - - - - - - - diff --git a/app/design/frontend/base/default/template/googleanalytics/gtm.phtml b/app/design/frontend/base/default/template/googleanalytics/gtm.phtml new file mode 100644 index 00000000000..a1c841fb494 --- /dev/null +++ b/app/design/frontend/base/default/template/googleanalytics/gtm.phtml @@ -0,0 +1,33 @@ + +helper('googleanalytics'); +?> +helper('core/cookie')->isUserNotAllowSaveCookie()): ?> + isUseGoogleTagManager()): ?> + getGoogleTagManagerContainerId() ?> + + + + + + From 2764d0c4611bd6328bf70e9a217eea5084d95f91 Mon Sep 17 00:00:00 2001 From: Fabrizio Balliano Date: Mon, 3 Jul 2023 20:09:28 +0100 Subject: [PATCH 5/5] Version bump --- app/Mage.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Mage.php b/app/Mage.php index 448e1f89657..e61add57ceb 100644 --- a/app/Mage.php +++ b/app/Mage.php @@ -217,7 +217,7 @@ public static function getOpenMageVersionInfo(): array 'major' => '20', 'minor' => '1', 'patch' => '0', - 'stability' => 'rc6', // beta,alpha,rc + 'stability' => 'rc7', // beta,alpha,rc 'number' => '', // 1,2,3,0.3.7,x.7.z.92 @see https://semver.org/#spec-item-9 ]; } @@ -226,7 +226,7 @@ public static function getOpenMageVersionInfo(): array 'major' => '19', 'minor' => '5', 'patch' => '0', - 'stability' => 'rc6', // beta,alpha,rc + 'stability' => 'rc7', // beta,alpha,rc 'number' => '', // 1,2,3,0.3.7,x.7.z.92 @see https://semver.org/#spec-item-9 ]; }