Skip to content

Commit 410bc0b

Browse files
committed
MAGETWO-34253: CLONE - Postal code is still mandatory for Non-US addresses that don't use it
- Fixed typos - Fixed default value
1 parent 71ec353 commit 410bc0b

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

app/code/Magento/Ui/view/base/web/js/form/element/abstract.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ define([
77
'mage/utils',
88
'Magento_Ui/js/form/component',
99
'Magento_Ui/js/lib/validation/validator'
10-
], function (_, utils, Component, validator, posCodeFix) {
10+
], function (_, utils, Component, validator) {
1111
'use strict';
1212

1313
/**

app/code/Magento/Ui/view/base/web/js/form/element/post-code-fix.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,46 @@
33
* See COPYING.txt for license details.
44
*/
55
define([
6+
'underscore',
67
'Magento_Ui/js/lib/registry/registry',
78
'./abstract'
8-
], function (registry, Abstract) {
9+
], function (_, registry, Abstract) {
910
'use strict';
1011

1112
return Abstract.extend({
1213
/**
13-
* Converts the result of parent 'getInitialValue' call to boolean
14-
*
15-
* @return {Boolean}
14+
* @return {this}
1615
*/
1716
initListeners: function(){
18-
this._super();
19-
this.provider.data.on('update:'+this.parentScope+'.country_id', this.update.bind(this));
17+
this._super()
18+
.update()
19+
.provider.data.on('update:'+this.parentScope+'.country_id', this.update.bind(this));
20+
2021
return this;
2122
},
2223

23-
update: function(value){
24+
update: function(){
2425
var parentScope = this.getPart(this.getPart(this.name, -2), -2),
25-
component = registry.get(parentScope + '.country_id.0'),
26+
countryComponent = registry.get(parentScope + '.country_id.0'),
27+
value = countryComponent.value(),
2628
element;
2729

28-
component
30+
countryComponent
2931
.options()
30-
.some(function (el, idx) {
32+
.some(function (el) {
3133
element = el;
3234
return el.value === value;
3335
});
3436

3537
if(!element.is_region_required) {
3638
this.error(false);
39+
this.validation = _.omit(this.validation, 'required-entry');
40+
} else {
41+
this.validation['required-entry'] = true;
3742
}
3843
this.required(!!element.is_region_required);
44+
45+
return this;
3946
}
4047
});
4148
});

0 commit comments

Comments
 (0)