Skip to content

Commit 8e203be

Browse files
committed
MAGETWO-88504: Tiered pricing and quantity Increments do not work with decimal inventory
1 parent f83bb6b commit 8e203be

File tree

3 files changed

+3
-47
lines changed

3 files changed

+3
-47
lines changed

app/code/Magento/Bundle/Ui/DataProvider/Product/BundleDataProvider.php

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
99
use Magento\Catalog\Ui\DataProvider\Product\ProductDataProvider;
1010
use Magento\Bundle\Helper\Data;
11-
use Magento\CatalogInventory\Api\StockRegistryInterface;
12-
use Magento\Framework\Exception\NoSuchEntityException;
1311

1412
class BundleDataProvider extends ProductDataProvider
1513
{
@@ -18,11 +16,6 @@ class BundleDataProvider extends ProductDataProvider
1816
*/
1917
protected $dataHelper;
2018

21-
/**
22-
* @var StockRegistryInterface
23-
*/
24-
private $stockRegistry;
25-
2619
/**
2720
* Construct
2821
*
@@ -35,7 +28,6 @@ class BundleDataProvider extends ProductDataProvider
3528
* @param \Magento\Ui\DataProvider\AddFilterToCollectionInterface[] $addFilterStrategies
3629
* @param array $meta
3730
* @param array $data
38-
* @param StockRegistryInterface $stockRegistry
3931
*/
4032
public function __construct(
4133
$name,
@@ -46,8 +38,7 @@ public function __construct(
4638
array $meta = [],
4739
array $data = [],
4840
array $addFieldStrategies = [],
49-
array $addFilterStrategies = [],
50-
StockRegistryInterface $stockRegistry = null
41+
array $addFilterStrategies = []
5142
) {
5243
parent::__construct(
5344
$name,
@@ -61,8 +52,6 @@ public function __construct(
6152
);
6253

6354
$this->dataHelper = $dataHelper;
64-
$this->stockRegistry = $stockRegistry
65-
?: \Magento\Framework\App\ObjectManager::getInstance()->get(StockRegistryInterface::class);
6655
}
6756

6857
/**
@@ -85,29 +74,9 @@ public function getData()
8574
}
8675
$items = $this->getCollection()->toArray();
8776

88-
foreach ($items as $index => $item) {
89-
$items[$index]['selection_qty_is_integer'] = !$this->isProductQtyDecimal($item['entity_id']);
90-
}
91-
9277
return [
9378
'totalRecords' => $this->getCollection()->getSize(),
9479
'items' => array_values($items),
9580
];
9681
}
97-
98-
/**
99-
* @param int $productId
100-
* @return bool
101-
*/
102-
private function isProductQtyDecimal(int $productId): bool
103-
{
104-
try {
105-
$productStock = $this->stockRegistry->getStockItem($productId);
106-
$result = $productStock->getIsQtyDecimal();
107-
} catch (NoSuchEntityException $e) {
108-
$result = false;
109-
}
110-
111-
return $result;
112-
}
11382
}

app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePanel.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,6 @@ protected function getBundleOptions()
377377
'selection_price_type' => '',
378378
'selection_price_value' => '',
379379
'selection_qty' => '',
380-
'selection_qty_is_integer' => '',
381380
],
382381
'links' => ['insertData' => '${ $.provider }:${ $.dataProvider }'],
383382
'imports' => [
@@ -683,11 +682,10 @@ protected function getBundleSelections()
683682
'validation' => [
684683
'required-entry' => true,
685684
'validate-number' => true,
686-
'validate-digits' => true,
687685
'validate-greater-than-zero' => true
688686
],
689687
'imports' => [
690-
'validateDigits' => '${ $.provider }:${ $.parentScope }.selection_qty_is_integer',
688+
'isInteger' => '${ $.provider }:${ $.parentScope }.selection_qty_is_integer'
691689
],
692690
],
693691
],

app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-option-qty.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ define([
1313
valueUpdate: 'input',
1414
isInteger: true,
1515
validation: {
16-
'validate-number': true,
17-
'validate-digits': true
16+
'validate-number': true
1817
}
1918
},
2019

@@ -33,16 +32,6 @@ define([
3332
var notEqual = this.value() !== this.initialValue.toString();
3433

3534
return !this.visible() ? false : notEqual;
36-
},
37-
38-
/**
39-
* Update field validation rules
40-
*
41-
* @param value
42-
*/
43-
validateDigits: function(value) {
44-
this.isInteger = value;
45-
this.validation['validate-digits'] = this.isInteger;
4635
}
4736

4837
});

0 commit comments

Comments
 (0)