Skip to content

Commit 0a19738

Browse files
author
silinmykola
committed
fix after code review
1 parent 2f9293f commit 0a19738

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

app/code/Magento/Catalog/Ui/DataProvider/CatalogEavValidationRules.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,20 @@ public function build(ProductAttributeInterface $attribute, array $data)
3838

3939
foreach ($validationClasses as $class) {
4040
if (preg_match('/^maximum-length-(\d+)$/', $class, $matches)) {
41-
$rules['max_text_length'] = $matches[1];
41+
$rules['max_text_length'][] = $matches[1];
4242
continue;
4343
}
4444
if (preg_match('/^minimum-length-(\d+)$/', $class, $matches)) {
45-
$rules['min_text_length'] = $matches[1];
45+
$rules['min_text_length'][] = $matches[1];
4646
continue;
4747
}
4848

49+
if (isset($rules['max_text_length'])) {
50+
$rules['max_text_length'] = array_merge([], ...$rules['max_text_length']);
51+
}
52+
if (isset($rules['min_text_length'])) {
53+
$rules['min_text_length'] = array_merge([], ...$rules['min_text_length']);
54+
}
4955
$rules = $this->mapRules($class, $rules);
5056
}
5157

app/code/Magento/Tax/Model/Calculation/RateRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ private function validate(\Magento\Tax\Api\Data\TaxRateInterface $taxRate)
272272
);
273273
}
274274

275-
if ($taxRate->getCode() !== null
275+
if ($taxRate->getCode() === null
276276
|| !\Zend_Validate::is(trim($taxRate->getCode()), 'NotEmpty')
277277
) {
278278
$exception->addError(__('"%fieldName" is required. Enter and try again.', ['fieldName' => 'code']));
@@ -297,7 +297,7 @@ private function validate(\Magento\Tax\Api\Data\TaxRateInterface $taxRate)
297297
$exception->addError(__('Range To should be equal or greater than Range From.'));
298298
}
299299
} else {
300-
if ($taxRate->getTaxPostcode() !== null
300+
if ($taxRate->getTaxPostcode() === null
301301
|| !\Zend_Validate::is(trim($taxRate->getTaxPostcode()), 'NotEmpty')
302302
) {
303303
$exception->addError(

0 commit comments

Comments
 (0)