diff --git a/app/Mage.php b/app/Mage.php index e61add57ceb..b4a9b10647d 100644 --- a/app/Mage.php +++ b/app/Mage.php @@ -474,7 +474,7 @@ public static function getConfig() } /** - * Add observer to even object + * Add observer to events object * * @param string $eventName * @param callback $callback diff --git a/app/design/adminhtml/default/default/template/system/shipping/ups.phtml b/app/design/adminhtml/default/default/template/system/shipping/ups.phtml index d61284f6764..b1e03ab4924 100644 --- a/app/design/adminhtml/default/default/template/system/shipping/ups.phtml +++ b/app/design/adminhtml/default/default/template/system/shipping/ups.phtml @@ -108,6 +108,7 @@ if (!Mage::helper('usa')->validateUpsType($storedUpsType)) { this.setFormValues(); Event.observe($(this.carriersUpsTypeId), 'change', this.setFormValues.bind(this)); + Event.observe($('carriers_ups_active'), 'change', this.setFormValues.bind(this)); }, updateAllowedMethods: function(originShipmentTitle) { @@ -158,23 +159,15 @@ if (!Mage::helper('usa')->validateUpsType($storedUpsType)) { setFormValues: function() { var a; - if ($F(this.carriersUpsTypeId) == 'UPS') { - for (a = 0; a < this.checkingUpsXmlId.length; a++) { - $(this.checkingUpsXmlId[a]).removeClassName('required-entry'); - } - for (a = 0; a < this.checkingUpsId.length; a++) { - $(this.checkingUpsXmlId[a]).addClassName('required-entry'); - } - Event.stopObserving($('carriers_ups_origin_shipment'), 'change', this.changeOriginShipment.bind(this)); - showRowArrayElements(this.onlyUpsElements); - hideRowArrayElements(this.onlyUpsXmlElements); - this.changeOriginShipment(null, 'default'); - } else { - for (a = 0; a < this.checkingUpsXmlId.length; a++) { - $(this.checkingUpsXmlId[a]).addClassName('required-entry'); - } - for (a = 0; a < this.checkingUpsId.length; a++) { - $(this.checkingUpsXmlId[a]).removeClassName('required-entry'); + if ($F(this.carriersUpsTypeId) == 'UPS_XML') { + if (document.getElementById('carriers_ups_active').value == 1) { + for (a = 0; a < this.checkingUpsXmlId.length; a++) { + $(this.checkingUpsXmlId[a]).addClassName('required-entry'); + } + } else { + for (a = 0; a < this.checkingUpsXmlId.length; a++) { + $(this.checkingUpsXmlId[a]).removeClassName('required-entry'); + } } Event.observe($('carriers_ups_origin_shipment'), 'change', this.changeOriginShipment.bind(this)); showRowArrayElements(this.onlyUpsXmlElements); diff --git a/composer.lock b/composer.lock index f70e897a351..05fdd28b50d 100644 --- a/composer.lock +++ b/composer.lock @@ -3373,16 +3373,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.25", + "version": "1.10.26", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "578f4e70d117f9a90699324c555922800ac38d8c" + "reference": "5d660cbb7e1b89253a47147ae44044f49832351f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/578f4e70d117f9a90699324c555922800ac38d8c", - "reference": "578f4e70d117f9a90699324c555922800ac38d8c", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5d660cbb7e1b89253a47147ae44044f49832351f", + "reference": "5d660cbb7e1b89253a47147ae44044f49832351f", "shasum": "" }, "require": { @@ -3431,7 +3431,7 @@ "type": "tidelift" } ], - "time": "2023-07-06T12:11:37+00:00" + "time": "2023-07-19T12:44:37+00:00" }, { "name": "phpunit/php-code-coverage",