Skip to content

Commit ca72609

Browse files
committed
[backport]fix wrong check CustomerMiddleName
1 parent 9d858b3 commit ca72609

File tree

2 files changed

+17
-31
lines changed
  • app/code/Magento/Catalog

2 files changed

+17
-31
lines changed

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Inventory.php

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
*/
66
namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Action\Attribute\Tab;
77

8-
use Magento\Customer\Api\Data\GroupInterface;
9-
108
/**
119
* Products mass update inventory tab
1210
*
@@ -31,11 +29,6 @@ class Inventory extends \Magento\Backend\Block\Widget implements \Magento\Backen
3129
*/
3230
protected $disabledFields = [];
3331

34-
/**
35-
* @var \Magento\Framework\Serialize\SerializerInterface
36-
*/
37-
private $serializer;
38-
3932
/**
4033
* @param \Magento\Backend\Block\Template\Context $context
4134
* @param \Magento\CatalogInventory\Model\Source\Backorders $backorders
@@ -46,13 +39,10 @@ public function __construct(
4639
\Magento\Backend\Block\Template\Context $context,
4740
\Magento\CatalogInventory\Model\Source\Backorders $backorders,
4841
\Magento\CatalogInventory\Api\StockConfigurationInterface $stockConfiguration,
49-
array $data = [],
50-
\Magento\Framework\Serialize\SerializerInterface $serializer = null
42+
array $data = []
5143
) {
5244
$this->_backorders = $backorders;
5345
$this->stockConfiguration = $stockConfiguration;
54-
$this->serializer = $serializer ?? \Magento\Framework\App\ObjectManager::getInstance()
55-
->get(\Magento\Framework\Serialize\SerializerInterface::class);
5646
parent::__construct($context, $data);
5747
}
5848

@@ -80,11 +70,11 @@ public function getFieldSuffix()
8070
* Retrieve current store id
8171
*
8272
* @return int
73+
* @SuppressWarnings(PHPMD.RequestAwareBlockMethod)
8374
*/
8475
public function getStoreId()
8576
{
86-
$storeId = $this->getRequest()->getParam('store');
87-
return (int) $storeId;
77+
return (int)$this->getRequest()->getParam('store');
8878
}
8979

9080
/**
@@ -98,21 +88,6 @@ public function getDefaultConfigValue($field)
9888
return $this->stockConfiguration->getDefaultConfigValue($field);
9989
}
10090

101-
/**
102-
* Returns min_sale_qty configuration for the ALL Customer Group
103-
* @return int
104-
*/
105-
public function getDefaultMinSaleQty()
106-
{
107-
$default = $this->stockConfiguration->getDefaultConfigValue('min_sale_qty');
108-
if (!is_numeric($default)) {
109-
$default = $this->serializer->unserialize($default);
110-
$default = isset($default[GroupInterface::CUST_GROUP_ALL]) ? $default[GroupInterface::CUST_GROUP_ALL] : 1;
111-
}
112-
113-
return (int) $default;
114-
}
115-
11691
/**
11792
* Tab settings
11893
*
@@ -124,6 +99,8 @@ public function getTabLabel()
12499
}
125100

126101
/**
102+
* Return Tab title.
103+
*
127104
* @return \Magento\Framework\Phrase
128105
*/
129106
public function getTabTitle()
@@ -132,22 +109,24 @@ public function getTabTitle()
132109
}
133110

134111
/**
135-
* @return bool
112+
* @inheritdoc
136113
*/
137114
public function canShowTab()
138115
{
139116
return true;
140117
}
141118

142119
/**
143-
* @return bool
120+
* @inheritdoc
144121
*/
145122
public function isHidden()
146123
{
147124
return false;
148125
}
149126

150127
/**
128+
* Get availability status.
129+
*
151130
* @param string $fieldName
152131
* @return bool
153132
* @SuppressWarnings(PHPMD.UnusedFormalParameter)

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@
3030
});
3131
</script>
3232

33+
<?php
34+
$defaultMinSaleQty = $block->getDefaultConfigValue('min_sale_qty');
35+
if (!is_numeric($defaultMinSaleQty)) {
36+
$defaultMinSaleQty = json_decode($defaultMinSaleQty, true);
37+
$defaultMinSaleQty = (float) $defaultMinSaleQty[\Magento\Customer\Api\Data\GroupInterface::CUST_GROUP_ALL] ?? 1;
38+
}
39+
?>
3340
<div class="fieldset-wrapper form-inline advanced-inventory-edit">
3441
<div class="fieldset-wrapper-title">
3542
<strong class="title">
@@ -132,7 +139,7 @@
132139
<div class="field">
133140
<input type="text" class="input-text validate-number" id="inventory_min_sale_qty"
134141
name="<?= /* @escapeNotVerified */ $block->getFieldSuffix() ?>[min_sale_qty]"
135-
value="<?= /* @escapeNotVerified */ $block->getDefaultMinSaleQty() * 1 ?>"
142+
value="<?= /* @escapeNotVerified */ $defaultMinSaleQty ?>"
136143
disabled="disabled"/>
137144
</div>
138145
<div class="field choice">

0 commit comments

Comments
 (0)