File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed
Catalog/Ui/DataProvider/Product/Form/Modifier
Ui/view/base/web/js/lib/validation Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -154,9 +154,7 @@ private function getUpdatedTierPriceStructure(array $priceMeta)
154
154
'addbefore ' => '% ' ,
155
155
'validation ' => [
156
156
'required-entry ' => true ,
157
- 'validate-number ' => true ,
158
- 'validate-greater-than-zero ' => true ,
159
- 'less-than-equals-to ' => 100
157
+ 'validate-positive-percent-decimal ' => true
160
158
],
161
159
'visible ' => $ firstOption
162
160
&& $ firstOption ['value ' ] == ProductPriceOptionsInterface::VALUE_PERCENT ,
Original file line number Diff line number Diff line change @@ -686,6 +686,24 @@ define([
686
686
} ,
687
687
$ . mage . __ ( 'The value is not within the specified range.' )
688
688
] ,
689
+ 'validate-positive-percent-decimal' : [
690
+ function ( value ) {
691
+ var numValue ;
692
+
693
+ if ( utils . isEmptyNoTrim ( value ) || ! / ^ \s * - ? \d * ( \. \d * ) ? \s * $ / . test ( value ) ) {
694
+ return false ;
695
+ }
696
+
697
+ numValue = utils . parseNumber ( value ) ;
698
+
699
+ if ( isNaN ( numValue ) ) {
700
+ return false ;
701
+ }
702
+
703
+ return utils . isBetween ( numValue , 0.01 , 100 ) ;
704
+ } ,
705
+ $ . mage . __ ( 'Please enter a valid percentage discount value greater than 0.' )
706
+ ] ,
689
707
'validate-digits' : [
690
708
function ( value ) {
691
709
return utils . isEmptyNoTrim ( value ) || ! / [ ^ \d ] / . test ( value ) ;
You can’t perform that action at this time.
0 commit comments