File tree Expand file tree Collapse file tree 2 files changed +25
-4
lines changed
Catalog/Ui/DataProvider/Product/Form/Modifier
Ui/view/base/web/js/lib/validation Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ public function __construct(
45
45
}
46
46
47
47
/**
48
- * { @inheritdoc}
48
+ * @inheritdoc
49
49
* @since 101.1.0
50
50
*/
51
51
public function modifyData (array $ data )
@@ -54,8 +54,11 @@ public function modifyData(array $data)
54
54
}
55
55
56
56
/**
57
- * {@inheritdoc}
57
+ * Add tier price info to meta array.
58
+ *
58
59
* @since 101.1.0
60
+ * @param array $meta
61
+ * @return array
59
62
*/
60
63
public function modifyMeta (array $ meta )
61
64
{
@@ -150,8 +153,8 @@ private function getUpdatedTierPriceStructure(array $priceMeta)
150
153
'dataType ' => Price::NAME ,
151
154
'addbefore ' => '% ' ,
152
155
'validation ' => [
153
- 'validate-number ' => true ,
154
- 'less-than-equals-to ' => 100
156
+ 'required-entry ' => true ,
157
+ 'validate-positive-percent-decimal ' => true
155
158
],
156
159
'visible ' => $ firstOption
157
160
&& $ firstOption ['value ' ] == ProductPriceOptionsInterface::VALUE_PERCENT ,
Original file line number Diff line number Diff line change @@ -692,6 +692,24 @@ define([
692
692
} ,
693
693
$ . mage . __ ( 'The value is not within the specified range.' )
694
694
] ,
695
+ 'validate-positive-percent-decimal' : [
696
+ function ( value ) {
697
+ var numValue ;
698
+
699
+ if ( utils . isEmptyNoTrim ( value ) || ! / ^ \s * - ? \d * ( \. \d * ) ? \s * $ / . test ( value ) ) {
700
+ return false ;
701
+ }
702
+
703
+ numValue = utils . parseNumber ( value ) ;
704
+
705
+ if ( isNaN ( numValue ) ) {
706
+ return false ;
707
+ }
708
+
709
+ return utils . isBetween ( numValue , 0.01 , 100 ) ;
710
+ } ,
711
+ $ . mage . __ ( 'Please enter a valid percentage discount value greater than 0.' )
712
+ ] ,
695
713
'validate-digits' : [
696
714
function ( value ) {
697
715
return utils . isEmptyNoTrim ( value ) || ! / [ ^ \d ] / . test ( value ) ;
You can’t perform that action at this time.
0 commit comments