Skip to content

Commit c935663

Browse files
committed
MC-16222: Cannot save Shipping Methods page because in UPS method have required fields
1 parent 40ec245 commit c935663

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

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

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -150,31 +150,20 @@ require(["prototype"], function(){
150150
$(this.checkingUpsXmlId[a]).removeClassName('required-entry');
151151
}
152152
for (a = 0; a < this.checkingUpsId.length; a++) {
153-
$(this.checkingUpsXmlId[a]).addClassName('required-entry');
153+
$(this.checkingUpsId[a]).addClassName('required-entry');
154+
this.changeFieldsDisabledState(this.checkingUpsId, a);
154155
}
155156
Event.stopObserving($('carriers_ups_origin_shipment'), 'change', this.changeOriginShipment.bind(this));
156157
showRowArrayElements(this.onlyUpsElements);
157158
hideRowArrayElements(this.onlyUpsXmlElements);
158159
this.changeOriginShipment(null, 'default');
159160
} else {
160161
for (a = 0; a < this.checkingUpsXmlId.length; a++) {
161-
if ($F(this.carriersUpsActiveId) === '1') {
162-
if ($(this.checkingUpsXmlId[a] + '_inherit') !== null
163-
&& $F(this.checkingUpsXmlId[a] + '_inherit') === '1'
164-
) {
165-
continue;
166-
}
167-
$(this.checkingUpsXmlId[a]).addClassName('required-entry').disabled = false;
168-
} else {
169-
$(this.checkingUpsXmlId[a]).removeClassName('required-entry').disabled = true;
170-
if ($(this.checkingUpsXmlId[a]).next() !== undefined) {
171-
$(this.checkingUpsXmlId[a]).removeClassName('mage-error').next().remove();
172-
$(this.checkingUpsXmlId[a]).removeAttribute('style');
173-
}
174-
}
162+
$(this.checkingUpsXmlId[a]).addClassName('required-entry');
163+
this.changeFieldsDisabledState(this.checkingUpsXmlId, a);
175164
}
176165
for (a = 0; a < this.checkingUpsId.length; a++) {
177-
$(this.checkingUpsXmlId[a]).removeClassName('required-entry');
166+
$(this.checkingUpsId[a]).removeClassName('required-entry');
178167
}
179168
Event.observe($('carriers_ups_origin_shipment'), 'change', this.changeOriginShipment.bind(this));
180169
showRowArrayElements(this.onlyUpsXmlElements);
@@ -186,6 +175,16 @@ require(["prototype"], function(){
186175
{
187176
this.originShipmentTitle = key ? key : $F('carriers_ups_origin_shipment');
188177
this.updateAllowedMethods(this.originShipmentTitle);
178+
},
179+
changeFieldsDisabledState: function (fields, key) {
180+
$(fields[key]).disabled = $F(this.carriersUpsActiveId) !== '1'
181+
|| $(fields[key] + '_inherit') !== null
182+
&& $F(fields[key] + '_inherit') === '1';
183+
184+
if ($(fields[key]).next() !== undefined) {
185+
$(fields[key]).removeClassName('mage-error').next().remove();
186+
$(fields[key]).removeAttribute('style');
187+
}
189188
}
190189
};
191190
xml = new upsXml();

0 commit comments

Comments
 (0)