Skip to content
Permalink
Browse files

MAGETWO-69922: #9139 Unable to set negative product's quantity fixes …

…commit. #9770

 - Merge Pull Request #9770 from poongud/magento2:negative-product-qty
 - Merged commits:
   1. 0c691f4
  • Loading branch information...
okorshenko committed Jun 23, 2017
2 parents ce739c2 + 0c691f4 commit 11bcdcc83d6d5d3adc4151cfefd62b6f4cdcd680
@@ -213,7 +213,7 @@ private function prepareMeta()
'dataScope' => 'qty',
'validation' => [
'validate-number' => true,
'validate-digits' => true,
'validate-integer' => true,
'less-than-equals-to' => StockDataFilter::MAX_QTY_VALUE,
],
'imports' => [
@@ -95,7 +95,7 @@
<item name="dataScope" xsi:type="string">quantity_and_stock_status.qty</item>
<item name="validation" xsi:type="array">
<item name="validate-number" xsi:type="boolean">true</item>
<item name="validate-digits" xsi:type="boolean">true</item>
<item name="validate-integer" xsi:type="boolean">true</item>
<item name="less-than-equals-to" xsi:type="number">99999999</item>
</item>
<item name="sortOrder" xsi:type="number">200</item>
@@ -19,8 +19,7 @@ define([
handleChanges: function (value) {
var isDigits = value !== 1;

this.validation['validate-number'] = !isDigits;
this.validation['validate-digits'] = isDigits;
this.validation['validate-integer'] = isDigits;
this.validation['less-than-equals-to'] = isDigits ? 99999999 : 99999999.9999;
this.validate();
}
@@ -572,6 +572,15 @@ define([
},
$.mage.__('Please enter a valid number in this field.')
],
"validate-integer": [
function(value) {
return (
utils.isEmptyNoTrim(value)
|| (!isNaN(utils.parseNumber(value)) && /^\s*-?\d*\s*$/.test(value))
);
},
$.mage.__('Please enter a valid integer in this field.')
],
"validate-number-range": [
function(value, param) {
if (utils.isEmptyNoTrim(value)) {

0 comments on commit 11bcdcc

Please sign in to comment.
You can’t perform that action at this time.