Skip to content

Commit 98ef7d6

Browse files
committed
MC-16222: Cannot save Shipping Methods page because in UPS method have required fields
1 parent 1ffe1e3 commit 98ef7d6

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

app/code/Magento/Ups/view/adminhtml/templates/system/shipping/carrier_config.phtml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ require(["prototype"], function(){
6767
upsXml.prototype = {
6868
initialize: function()
6969
{
70+
this.carriersUpsActiveId = 'carriers_ups_active';
7071
this.carriersUpsTypeId = 'carriers_ups_type';
7172
if (!$(this.carriersUpsTypeId)) {
7273
return;
@@ -94,6 +95,7 @@ require(["prototype"], function(){
9495

9596
this.setFormValues();
9697
Event.observe($(this.carriersUpsTypeId), 'change', this.setFormValues.bind(this));
98+
Event.observe($(this.carriersUpsActiveId), 'change', this.setFormValues.bind(this));
9799
},
98100
updateAllowedMethods: function(originShipmentTitle)
99101
{
@@ -121,7 +123,7 @@ require(["prototype"], function(){
121123
freeMethod.insert(option);
122124

123125
option = new Element('option', {value:code}).update(originShipment[code]);
124-
if (this.storedUpsType == 'UPS_XML') {
126+
if (this.storedUpsType == 'UPS') {
125127
if (originShipmentTitle != 'default' || inArray(this.storedAllowedMethods, code)) {
126128
option.selected = true;
127129
}
@@ -143,7 +145,7 @@ require(["prototype"], function(){
143145
setFormValues: function()
144146
{
145147
var a;
146-
if ($F(this.carriersUpsTypeId) == 'UPS_XML') {
148+
if ($F(this.carriersUpsTypeId) == 'UPS') {
147149
for (a = 0; a < this.checkingUpsXmlId.length; a++) {
148150
$(this.checkingUpsXmlId[a]).removeClassName('required-entry');
149151
}
@@ -156,7 +158,15 @@ require(["prototype"], function(){
156158
this.changeOriginShipment(null, 'default');
157159
} else {
158160
for (a = 0; a < this.checkingUpsXmlId.length; a++) {
159-
$(this.checkingUpsXmlId[a]).addClassName('required-entry');
161+
if ($F(this.carriersUpsActiveId) === '1') {
162+
$(this.checkingUpsXmlId[a]).addClassName('required-entry').disabled = false;
163+
} else {
164+
$(this.checkingUpsXmlId[a]).removeClassName('required-entry').disabled = true;
165+
if ($(this.checkingUpsXmlId[a]).next() !== undefined) {
166+
$(this.checkingUpsXmlId[a]).removeClassName('mage-error').next().remove();
167+
$(this.checkingUpsXmlId[a]).removeAttribute('style');
168+
}
169+
}
160170
}
161171
for (a = 0; a < this.checkingUpsId.length; a++) {
162172
$(this.checkingUpsXmlId[a]).removeClassName('required-entry');

0 commit comments

Comments
 (0)