Skip to content

Commit bc0546d

Browse files
committed
MC-32651: A Gift Card with minimum value of an open amount, greater than maximum value, can be created
1 parent 800acfa commit bc0546d

File tree

1 file changed

+18
-2
lines changed
  • app/code/Magento/Ui/view/base/web/js/lib/validation

1 file changed

+18
-2
lines changed

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -836,23 +836,39 @@ define([
836836
],
837837
'less-than-equals-to': [
838838
function (value, params) {
839+
if (!$.isNumeric(params)) {
840+
params = $(params).val();
841+
}
842+
839843
if ($.isNumeric(params) && $.isNumeric(value)) {
844+
this.lteToVal = params;
845+
840846
return parseFloat(value) <= parseFloat(params);
841847
}
842848

843849
return true;
844850
},
845-
$.mage.__('Please enter a value less than or equal to {0}.')
851+
function () {
852+
return $.mage.__('Please enter a value less than or equal to %s.').replace('%s', this.lteToVal);
853+
}
846854
],
847855
'greater-than-equals-to': [
848856
function (value, params) {
857+
if (!$.isNumeric(params)) {
858+
params = $(params).val();
859+
}
860+
849861
if ($.isNumeric(params) && $.isNumeric(value)) {
862+
this.gteToVal = params;
863+
850864
return parseFloat(value) >= parseFloat(params);
851865
}
852866

853867
return true;
854868
},
855-
$.mage.__('Please enter a value greater than or equal to {0}.')
869+
function () {
870+
return $.mage.__('Please enter a value greater than or equal to %s.').replace('%s', this.gteToVal);
871+
}
856872
],
857873
'validate-emails': [
858874
function (value) {

0 commit comments

Comments
 (0)