Skip to content

Commit ca36872

Browse files
committed
ENGCOM-1463: Merge branch '2.2-develop' of github.com:magento-engcom/magento2ce into ENGCOM-1463-magento-magento2-15019
2 parents 965dc7e + 5ed3aa3 commit ca36872

File tree

41 files changed

+274
-114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+274
-114
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ language: php
1515
php:
1616
- 7.0
1717
- 7.1
18+
git:
19+
depth: 5
1820
env:
1921
global:
2022
- COMPOSER_BIN_DIR=~/bin

app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Massaction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function render(\Magento\Framework\DataObject $row)
6565
*/
6666
protected function _getCheckboxHtml($value, $checked)
6767
{
68-
$id = 'id_' . rand(0, 999);
68+
$id = 'id_' . random_int(0, 999);
6969
$html = '<label class="data-grid-checkbox-cell-inner" for="'. $id .'">';
7070
$html .= '<input type="checkbox" name="' . $this->getColumn()->getName() . '" ';
7171
$html .= 'id="' . $id . '" data-role="select-row"';

app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper/AttributeFilter.php

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,25 @@ class AttributeFilter
2828
public function prepareProductAttributes(Product $product, array $productData, array $useDefaults)
2929
{
3030
foreach ($productData as $attribute => $value) {
31-
$considerUseDefaultsAttribute = !isset($useDefaults[$attribute]) || $useDefaults[$attribute] === "1";
32-
if ($value === '' && $considerUseDefaultsAttribute) {
33-
/** @var $product Product */
34-
if ((bool)$product->getData($attribute) === (bool)$value) {
35-
unset($productData[$attribute]);
36-
}
31+
if ($this->isAttributeShouldNotBeUpdated($product, $useDefaults, $attribute, $value)) {
32+
unset($productData[$attribute]);
3733
}
3834
}
35+
3936
return $productData;
4037
}
38+
39+
/**
40+
* @param Product $product
41+
* @param $useDefaults
42+
* @param $attribute
43+
* @param $value
44+
* @return bool
45+
*/
46+
private function isAttributeShouldNotBeUpdated(Product $product, $useDefaults, $attribute, $value)
47+
{
48+
$considerUseDefaultsAttribute = !isset($useDefaults[$attribute]) || $useDefaults[$attribute] === "1";
49+
50+
return ($value === '' && $considerUseDefaultsAttribute && !$product->getData($attribute));
51+
}
4152
}

app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ protected function getTemporaryTreeIndexTableName()
594594
if (empty($this->tempTreeIndexTableName)) {
595595
$this->tempTreeIndexTableName = $this->connection->getTableName('temp_catalog_category_tree_index')
596596
. '_'
597-
. substr(md5(time() . rand(0, 999999999)), 0, 8);
597+
. substr(md5(time() . random_int(0, 999999999)), 0, 8);
598598
}
599599

600600
return $this->tempTreeIndexTableName;

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,8 @@ private function getTierPriceStructure($tierPricePath)
500500
'validation' => [
501501
'required-entry' => true,
502502
'validate-greater-than-zero' => true,
503-
'validate-digits' => true,
503+
'validate-digits' => false,
504+
'validate-number' => true,
504505
],
505506
],
506507
],

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ protected function customizeAdvancedPriceFormat(array $data)
106106
$value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE] =
107107
$this->formatPrice($value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE]);
108108
$value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE_QTY] =
109-
(int)$value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE_QTY];
109+
(float) $value[ProductAttributeInterface::CODE_TIER_PRICE_FIELD_PRICE_QTY];
110110
}
111111
}
112112

app/code/Magento/Catalog/view/frontend/templates/product/view/gallery.phtml

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,11 @@
4747
"data": <?= /* @escapeNotVerified */ $block->getGalleryImagesJson() ?>,
4848
"options": {
4949
"nav": "<?= /* @escapeNotVerified */ $block->getVar("gallery/nav") ?>",
50-
<?php if (($block->getVar("gallery/loop"))): ?>
51-
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/loop") ?>,
52-
<?php endif; ?>
53-
<?php if (($block->getVar("gallery/keyboard"))): ?>
54-
"keyboard": <?= /* @escapeNotVerified */ $block->getVar("gallery/keyboard") ?>,
55-
<?php endif; ?>
56-
<?php if (($block->getVar("gallery/arrows"))): ?>
57-
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/arrows") ?>,
58-
<?php endif; ?>
59-
<?php if (($block->getVar("gallery/allowfullscreen"))): ?>
60-
"allowfullscreen": <?= /* @escapeNotVerified */ $block->getVar("gallery/allowfullscreen") ?>,
61-
<?php endif; ?>
62-
<?php if (($block->getVar("gallery/caption"))): ?>
63-
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/caption") ?>,
64-
<?php endif; ?>
50+
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/loop") ? 'true' : 'false' ?>,
51+
"keyboard": <?= /* @escapeNotVerified */ $block->getVar("gallery/keyboard") ? 'true' : 'false' ?>,
52+
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/arrows") ? 'true' : 'false' ?>,
53+
"allowfullscreen": <?= /* @escapeNotVerified */ $block->getVar("gallery/allowfullscreen") ? 'true' : 'false' ?>,
54+
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/caption") ? 'true' : 'false' ?>,
6555
"width": "<?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_medium', 'width') ?>",
6656
"thumbwidth": "<?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_small', 'width') ?>",
6757
<?php if ($block->getImageAttribute('product_page_image_small', 'height') || $block->getImageAttribute('product_page_image_small', 'width')): ?>
@@ -79,28 +69,18 @@
7969
"transitionduration": <?= /* @escapeNotVerified */ $block->getVar("gallery/transition/duration") ?>,
8070
<?php endif; ?>
8171
"transition": "<?= /* @escapeNotVerified */ $block->getVar("gallery/transition/effect") ?>",
82-
<?php if (($block->getVar("gallery/navarrows"))): ?>
83-
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/navarrows") ?>,
84-
<?php endif; ?>
72+
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/navarrows") ? 'true' : 'false' ?>,
8573
"navtype": "<?= /* @escapeNotVerified */ $block->getVar("gallery/navtype") ?>",
8674
"navdir": "<?= /* @escapeNotVerified */ $block->getVar("gallery/navdir") ?>"
8775
},
8876
"fullscreen": {
8977
"nav": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/nav") ?>",
90-
<?php if ($block->getVar("gallery/fullscreen/loop")): ?>
91-
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/loop") ?>,
92-
<?php endif; ?>
78+
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/loop") ? 'true' : 'false' ?>,
9379
"navdir": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navdir") ?>",
94-
<?php if ($block->getVar("gallery/transition/navarrows")): ?>
95-
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navarrows") ?>,
96-
<?php endif; ?>
80+
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navarrows") ? 'true' : 'false' ?>,
9781
"navtype": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navtype") ?>",
98-
<?php if ($block->getVar("gallery/fullscreen/arrows")): ?>
99-
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/arrows") ?>,
100-
<?php endif; ?>
101-
<?php if ($block->getVar("gallery/fullscreen/caption")): ?>
102-
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/caption") ?>,
103-
<?php endif; ?>
82+
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/arrows") ? 'true' : 'false' ?>,
83+
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/caption") ? 'true' : 'false' ?>,
10484
<?php if ($block->getVar("gallery/fullscreen/transition/duration")): ?>
10585
"transitionduration": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/transition/duration") ?>,
10686
<?php endif; ?>

app/code/Magento/CatalogInventory/Model/Stock/Item.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,8 @@ public function getQtyIncrements()
401401
if ($this->getUseConfigQtyIncrements()) {
402402
$this->qtyIncrements = $this->stockConfiguration->getQtyIncrements($this->getStoreId());
403403
} else {
404-
$this->qtyIncrements = (int) $this->getData(static::QTY_INCREMENTS);
404+
$qtyIncrements = $this->getData(static::QTY_INCREMENTS);
405+
$this->qtyIncrements = $this->getIsQtyDecimal() ? (float) $qtyIncrements : (int) $qtyIncrements;
405406
}
406407
}
407408
if ($this->qtyIncrements <= 0) {

app/code/Magento/CatalogInventory/Model/Stock/StockItemRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Magento\CatalogInventory\Api\Data\StockItemInterface;
1111
use Magento\CatalogInventory\Api\Data\StockItemInterfaceFactory;
1212
use Magento\CatalogInventory\Api\StockConfigurationInterface;
13-
use Magento\CatalogInventory\Api\StockItemRepositoryInterface as StockItemRepositoryInterface;
13+
use Magento\CatalogInventory\Api\StockItemRepositoryInterface;
1414
use Magento\CatalogInventory\Model\Indexer\Stock\Processor;
1515
use Magento\CatalogInventory\Model\ResourceModel\Stock\Item as StockItemResource;
1616
use Magento\CatalogInventory\Model\Spi\StockStateProviderInterface;

app/code/Magento/CatalogInventory/Test/Unit/Model/Stock/ItemTest.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ public function testGetQtyIncrements($config, $expected)
394394
$this->setDataArrayValue('qty_increments', $config['qty_increments']);
395395
$this->setDataArrayValue('enable_qty_increments', $config['enable_qty_increments']);
396396
$this->setDataArrayValue('use_config_qty_increments', $config['use_config_qty_increments']);
397+
$this->setDataArrayValue('is_qty_decimal', $config['is_qty_decimal']);
397398
if ($config['use_config_qty_increments']) {
398399
$this->stockConfiguration->expects($this->once())
399400
->method('getQtyIncrements')
@@ -415,26 +416,38 @@ public function getQtyIncrementsDataProvider()
415416
[
416417
'qty_increments' => 1,
417418
'enable_qty_increments' => true,
418-
'use_config_qty_increments' => true
419+
'use_config_qty_increments' => true,
420+
'is_qty_decimal' => false
419421
],
420422
1
421423
],
422424
[
423425
[
424426
'qty_increments' => -2,
425427
'enable_qty_increments' => true,
426-
'use_config_qty_increments' => true
428+
'use_config_qty_increments' => true,
429+
'is_qty_decimal' => false
427430
],
428431
false
429432
],
430433
[
431434
[
432435
'qty_increments' => 3,
433436
'enable_qty_increments' => true,
434-
'use_config_qty_increments' => false
437+
'use_config_qty_increments' => false,
438+
'is_qty_decimal' => false
435439
],
436440
3
437441
],
442+
[
443+
[
444+
'qty_increments' => 0.5,
445+
'enable_qty_increments' => true,
446+
'use_config_qty_increments' => false,
447+
'is_qty_decimal' => true
448+
],
449+
0.5
450+
],
438451
];
439452
}
440453

0 commit comments

Comments
 (0)