Skip to content

Commit 02a512f

Browse files
author
Oleksii Korshenko
authored
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - #14388: [FIX] Remove duplicated case statement (by @coderimus) - #14327: #10057 (by @swnsma) - #14308: Added language translation, make proper sentence and removed unused delete html container (by @yogeshks) - #14361: Removed cache backend option which explicitly set file permissions (by @xtremeperf) - #14347: [Backport 2.2] Add json and xml support to the post method in socket client (by @simpleadm) - #13414: Add getters to product image builder (by @VincentMarmiesse) Fixed GitHub Issues: - #10057: Editing order with backordered items results in new order not correctly marking order items as backordered (reported by @develpr) has been fixed in #14327 by @swnsma in 2.2-develop branch Related commits: 1. 9addb44 - #10700: Magento 2 Admin panel show loading on each page (reported by @historylife) has been fixed in #14361 by @xtremeperf in 2.2-develop branch Related commits: 1. 9baa83f - #11930: setup:di:compile's generated cache files inaccessible by the web-server user (reported by @JanisE) has been fixed in #14361 by @xtremeperf in 2.2-develop branch Related commits: 1. 9baa83f
2 parents 60a4372 + 4236bd9 commit 02a512f

File tree

14 files changed

+68
-33
lines changed

14 files changed

+68
-33
lines changed

app/code/Magento/Backend/view/adminhtml/templates/widget/form/element.phtml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
<?php break;
2020
case 'column': ?>
2121
<?php break;
22-
case 'hidden': ?>
23-
<input type="<?= /* @escapeNotVerified */ $element->getType() ?>" name="<?= /* @escapeNotVerified */ $element->getName() ?>" id="<?= $element->getHtmlId() ?>" value="<?= /* @escapeNotVerified */ $element->getValue() ?>">
24-
<?php break;
2522
case 'select': ?>
2623
<span class="form_row">
2724
<?php if ($element->getLabel()): ?><label for="<?= $element->getHtmlId() ?>"><?= /* @escapeNotVerified */ $element->getLabel() ?>:</label><?php endif; ?>

app/code/Magento/Catalog/Block/Product/ImageBuilder.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ public function create()
154154
'custom_attributes' => $this->getCustomAttributes(),
155155
'resized_image_width' => $imagesize[0],
156156
'resized_image_height' => $imagesize[1],
157+
'product_id' => $this->product->getId()
157158
],
158159
];
159160

app/code/Magento/Catalog/Test/Unit/Block/Product/ImageBuilderTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ private function getTestDataWithoutAttributes(): array
252252
'custom_attributes' => '',
253253
'resized_image_width' => 100,
254254
'resized_image_height' => 100,
255+
'product_id' => null
255256
],
256257
],
257258
];
@@ -286,6 +287,7 @@ private function getTestDataWithAttributes(): array
286287
'custom_attributes' => 'name_1="value_1" name_2="value_2"',
287288
'resized_image_width' => 120,
288289
'resized_image_height' => 70,
290+
'product_id' => null
289291
],
290292
],
291293
];

app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ public function validate(Observer $observer)
103103
$quoteItem = $observer->getEvent()->getItem();
104104
if (!$quoteItem ||
105105
!$quoteItem->getProductId() ||
106-
!$quoteItem->getQuote() ||
107-
$quoteItem->getQuote()->getIsSuperMode()
106+
!$quoteItem->getQuote()
108107
) {
109108
return;
110109
}
@@ -117,6 +116,18 @@ public function validate(Observer $observer)
117116
throw new LocalizedException(__('The stock item for Product is not valid.'));
118117
}
119118

119+
if (($options = $quoteItem->getQtyOptions()) && $qty > 0) {
120+
foreach ($options as $option) {
121+
$this->optionInitializer->initialize($option, $quoteItem, $qty);
122+
}
123+
} else {
124+
$this->stockItemInitializer->initialize($stockItem, $quoteItem, $qty);
125+
}
126+
127+
if ($quoteItem->getQuote()->getIsSuperMode()) {
128+
return;
129+
}
130+
120131
/* @var \Magento\CatalogInventory\Api\Data\StockStatusInterface $stockStatus */
121132
$stockStatus = $this->stockRegistry->getStockStatus($product->getId(), $product->getStore()->getWebsiteId());
122133

@@ -159,7 +170,7 @@ public function validate(Observer $observer)
159170
/**
160171
* Check item for options
161172
*/
162-
if (($options = $quoteItem->getQtyOptions()) && $qty > 0) {
173+
if ($options) {
163174
$qty = $product->getTypeInstance()->prepareQuoteItemQty($qty, $product);
164175
$quoteItem->setData('qty', $qty);
165176
if ($stockStatus) {
@@ -193,7 +204,7 @@ public function validate(Observer $observer)
193204
$removeError = true;
194205

195206
foreach ($options as $option) {
196-
$result = $this->optionInitializer->initialize($option, $quoteItem, $qty);
207+
$result = $option->getStockStateResult();
197208
if ($result->getHasError()) {
198209
$option->setHasError(true);
199210
//Setting this to false, so no error statuses are cleared
@@ -206,7 +217,7 @@ public function validate(Observer $observer)
206217
}
207218
} else {
208219
if ($quoteItem->getParentItem() === null) {
209-
$result = $this->stockItemInitializer->initialize($stockItem, $quoteItem, $qty);
220+
$result = $quoteItem->getStockStateResult();
210221
if ($result->getHasError()) {
211222
$this->addErrorInfoToQuote($result, $quoteItem);
212223
} else {

app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/Option.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ public function initialize(
133133

134134
$stockItem->unsIsChildItem();
135135

136+
$option->setStockStateResult($result);
137+
136138
return $result;
137139
}
138140
}

app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/StockItem.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ public function initialize(
135135
$quoteItem->setBackorders($result->getItemBackorders());
136136
}
137137

138+
$quoteItem->setStockStateResult($result);
139+
138140
return $result;
139141
}
140142
}

app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/QuantityValidatorTest.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,11 @@ public function testValidateWithOptions()
278278
{
279279
$optionMock = $this->getMockBuilder(OptionItem::class)
280280
->disableOriginalConstructor()
281-
->setMethods(['setHasError'])
281+
->setMethods(['setHasError', 'getStockStateResult'])
282282
->getMock();
283+
$optionMock->expects($this->once())
284+
->method('getStockStateResult')
285+
->willReturn($this->resultMock);
283286
$this->stockRegistryMock->expects($this->at(0))
284287
->method('getStockItem')
285288
->willReturn($this->stockItemMock);
@@ -316,14 +319,17 @@ public function testValidateWithOptionsAndError()
316319
{
317320
$optionMock = $this->getMockBuilder(OptionItem::class)
318321
->disableOriginalConstructor()
319-
->setMethods(['setHasError'])
322+
->setMethods(['setHasError', 'getStockStateResult'])
320323
->getMock();
321324
$this->stockRegistryMock->expects($this->at(0))
322325
->method('getStockItem')
323326
->willReturn($this->stockItemMock);
324327
$this->stockRegistryMock->expects($this->at(1))
325328
->method('getStockStatus')
326329
->willReturn($this->stockStatusMock);
330+
$optionMock->expects($this->once())
331+
->method('getStockStateResult')
332+
->willReturn($this->resultMock);
327333
$options = [$optionMock];
328334
$this->createInitialStub(1);
329335
$this->setUpStubForQuantity(1, true);
@@ -354,12 +360,15 @@ public function testValidateAndRemoveErrorsFromQuote()
354360
{
355361
$optionMock = $this->getMockBuilder(OptionItem::class)
356362
->disableOriginalConstructor()
357-
->setMethods(['setHasError'])
363+
->setMethods(['setHasError', 'getStockStateResult'])
358364
->getMock();
359365
$quoteItem = $this->getMockBuilder(Item::class)
360366
->disableOriginalConstructor()
361367
->setMethods(['getItemId', 'getErrorInfos'])
362368
->getMock();
369+
$optionMock->expects($this->once())
370+
->method('getStockStateResult')
371+
->willReturn($this->resultMock);
363372
$this->stockRegistryMock->expects($this->at(0))
364373
->method('getStockItem')
365374
->willReturn($this->stockItemMock);

app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/Initializer/StockItemTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public function testInitializeWithSubitem()
8484
'setMessage',
8585
'setBackorders',
8686
'__wakeup',
87+
'setStockStateResult'
8788
]
8889
)
8990
->disableOriginalConstructor()
@@ -178,6 +179,7 @@ public function testInitializeWithSubitem()
178179
$quoteItem->expects($this->once())->method('setMessage')->with('message')->will($this->returnSelf());
179180
$result->expects($this->exactly(2))->method('getItemBackorders')->will($this->returnValue('backorders'));
180181
$quoteItem->expects($this->once())->method('setBackorders')->with('backorders')->will($this->returnSelf());
182+
$quoteItem->expects($this->once())->method('setStockStateResult')->with($result)->will($this->returnSelf());
181183

182184
$this->model->initialize($stockItem, $quoteItem, $qty);
183185
}

app/code/Magento/Integration/i18n/en_US.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Reset,Reset
9393
"A token with consumer ID 0 does not exist","A token with consumer ID 0 does not exist"
9494
"The integration you selected asks you to approve access to the following:","The integration you selected asks you to approve access to the following:"
9595
"No permissions requested","No permissions requested"
96-
"Are you sure ?","Are you sure ?"
96+
"Are you sure?","Are you sure?"
9797
"Are you sure you want to delete this integration? You can't undo this action.","Are you sure you want to delete this integration? You can't undo this action."
9898
"Please setup or sign in into your 3rd party account to complete setup of this integration.","Please setup or sign in into your 3rd party account to complete setup of this integration."
9999
"Available APIs","Available APIs"

app/code/Magento/Integration/view/adminhtml/templates/integration/popup_container.phtml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
$('div#integrationGrid').on('click', 'button#delete', function (e) {
3434

3535
new Confirm({
36-
title: 'Are you sure?',
37-
content: "Are you sure you want to delete this integration? You can't undo this action.",
36+
title: '<?= /* @escapeNotVerified */ __('Are you sure?') ?>',
37+
content: "<?= /* @escapeNotVerified */ __("Are you sure you want to delete this integration? You can't undo this action.") ?>",
3838
actions: {
3939
confirm: function () {
4040
window.location.href = $(e.target).data('url');
@@ -47,14 +47,4 @@
4747
});
4848
</script>
4949

50-
<div id="integration-popup-container" style="display: none;"></div>
51-
<div id="integration-delete-container"
52-
class="messages"
53-
style="display: none;"
54-
title="<?= /* @escapeNotVerified */ __('Are you sure ?') ?>">
55-
<div class="message message-notice notice">
56-
<div>
57-
<?= /* @escapeNotVerified */ __("Are you sure you want to delete this integration? You can't undo this action.") ?>
58-
</div>
59-
</div>
60-
</div>
50+
<div id="integration-popup-container" style="display: none;"></div>

0 commit comments

Comments
 (0)