Skip to content

Commit e0a8abe

Browse files
committed
MAGETWO-91465: Once integer is stored for State/Province field, it can not be changed to alphanumeric
1 parent 9f0fda6 commit e0a8abe

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

app/code/Magento/Customer/Model/Address/Validator/Country.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ private function validateRegion(AbstractAddress $address)
9595
$countryId = $address->getCountryId();
9696
$countryModel = $address->getCountryModel();
9797
$regionCollection = $countryModel->getRegionCollection();
98-
$region = $address->getData('region');
99-
$regionId = (string)$address->getData('region_id');
98+
$region = $address->getRegion();
99+
$regionId = (string)$address->getRegionId();
100100
$allowedRegions = $regionCollection->getAllIds();
101101
$isRegionRequired = $this->directoryData->isRegionRequired($countryId);
102102
if ($isRegionRequired && empty($allowedRegions) && !\Zend_Validate::is($region, 'NotEmpty')) {

app/code/Magento/Customer/Test/Unit/Model/Address/Validator/CountryTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,14 @@ public function validateDataProvider()
161161
'region_id2' => [
162162
array_merge($data, ['country_id' => $countryId, 'region_id' => 2]),
163163
[$countryId++],
164-
[1],
165164
[],
165+
[],
166+
],
167+
'region_id3' => [
168+
array_merge($data, ['country_id' => $countryId, 'region_id' => 2]),
169+
[$countryId++],
170+
[1, 3],
171+
['Invalid value of "2" provided for the regionId field.'],
166172
],
167173
'validated' => [
168174
array_merge($data, ['country_id' => $countryId]),

app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ define([
757757
],
758758
'validate-not-number-first': [
759759
function (value) {
760-
return utils.isEmptyNoTrim(value) || /^[^0-9].*$/.test(value);
760+
return utils.isEmptyNoTrim(value) || /^[^0-9-\.].*$/.test(value);
761761
},
762762
$.mage.__('First character must be letter.')//eslint-disable-line max-len
763763
],

0 commit comments

Comments
 (0)