Skip to content

Commit dbd3a0b

Browse files
committed
Merge remote-tracking branch 'mainline/2.4.1-develop' into 2.4.1-develop
# Conflicts: # app/code/Magento/Braintree/Model/Paypal/Helper/ShippingMethodUpdater.php # app/code/Magento/Braintree/Test/Unit/Model/Paypal/Helper/ShippingMethodUpdaterTest.php # app/code/Magento/Braintree/view/adminhtml/web/js/braintree.js # app/code/Magento/Braintree/view/adminhtml/web/js/vault.js # dev/tests/integration/testsuite/Magento/Vault/Model/Paypal/Helper/ShippingMethodUpdaterTest.php
2 parents 929b202 + 697d4b7 commit dbd3a0b

File tree

57 files changed

+2637
-464
lines changed

Some content is hidden

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

57 files changed

+2637
-464
lines changed

app/code/Magento/Analytics/Controller/Adminhtml/Reports/Show.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Show extends Action implements HttpGetActionInterface
2727
/**
2828
* @inheritdoc
2929
*/
30-
const ADMIN_RESOURCE = 'Magento_Analytics::analytics_settings';
30+
const ADMIN_RESOURCE = 'Magento_Analytics::advanced_reporting';
3131

3232
/**
3333
* @param Context $context

app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(
5151
* @param string $value
5252
* @param int $length
5353
* @param string $etc
54-
* @param string &$remainder
54+
* @param string $remainder
5555
* @param bool $breakWords
5656
* @return string
5757
*/
@@ -83,6 +83,7 @@ public function getChildren($item)
8383
}
8484

8585
if ($items) {
86+
$itemsArray[$item->getOrderItem()->getId()][$item->getOrderItemId()] = $item;
8687
foreach ($items as $value) {
8788
$parentItem = $value->getOrderItem()->getParentItem();
8889
if ($parentItem) {

app/code/Magento/Bundle/Test/Unit/Block/Adminhtml/Sales/Order/Items/RendererTest.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
use PHPUnit\Framework\MockObject\MockObject;
1818
use PHPUnit\Framework\TestCase;
1919

20+
/**
21+
* Test Renderer order item
22+
*/
2023
class RendererTest extends TestCase
2124
{
2225
/** @var Item|MockObject */
@@ -98,25 +101,27 @@ public function testGetChildren($parentItem)
98101
$parentItem = $this->createPartialMock(Item::class, ['getId', '__wakeup']);
99102
$parentItem->expects($this->any())->method('getId')->willReturn(1);
100103
}
101-
$this->orderItem->expects($this->any())->method('getOrderItem')->willReturnSelf();
102-
$this->orderItem->expects($this->any())->method('getParentItem')->willReturn($parentItem);
103-
$this->orderItem->expects($this->any())->method('getOrderItemId')->willReturn(2);
104-
$this->orderItem->expects($this->any())->method('getId')->willReturn(1);
104+
$this->orderItem->method('getOrderItem')->willReturnSelf();
105+
$this->orderItem->method('getParentItem')->willReturn($parentItem);
106+
$this->orderItem->method('getOrderItemId')->willReturn(2);
107+
$this->orderItem->method('getId')->willReturn(1);
105108

106109
$salesModel = $this->createPartialMock(
107110
Invoice::class,
108111
['getAllItems', '__wakeup']
109112
);
110-
$salesModel->expects($this->once())->method('getAllItems')->willReturn([$this->orderItem]);
113+
$salesModel->method('getAllItems')->willReturn([$this->orderItem]);
111114

112115
$item = $this->createPartialMock(
113116
\Magento\Sales\Model\Order\Invoice\Item::class,
114-
['getInvoice', 'getOrderItem', '__wakeup']
117+
['getInvoice', 'getOrderItem', 'getOrderItemId', '__wakeup']
115118
);
116-
$item->expects($this->once())->method('getInvoice')->willReturn($salesModel);
117-
$item->expects($this->any())->method('getOrderItem')->willReturn($this->orderItem);
119+
$item->method('getInvoice')->willReturn($salesModel);
120+
$item->method('getOrderItem')->willReturn($this->orderItem);
121+
$item->method('getOrderItemId')->willReturn($this->orderItem->getOrderItemId());
118122

119-
$this->assertSame([2 => $this->orderItem], $this->model->getChildren($item));
123+
$orderItem = $this->model->getChildren($item);
124+
$this->assertSame([2 => $this->orderItem], $orderItem);
120125
}
121126

122127
/**

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

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
$defaultMinSaleQty = $block->getDefaultConfigValue('min_sale_qty');
3434
if (!is_numeric($defaultMinSaleQty)) {
3535
$defaultMinSaleQty = json_decode($defaultMinSaleQty, true);
36-
$defaultMinSaleQty = (float) $defaultMinSaleQty[\Magento\Customer\Api\Data\GroupInterface::CUST_GROUP_ALL] ?? 1;
36+
$defaultMinSaleQty = (float) ($defaultMinSaleQty[\Magento\Customer\Api\Data\GroupInterface::CUST_GROUP_ALL] ?? 1);
3737
}
3838
?>
3939
<div class="fieldset-wrapper form-inline advanced-inventory-edit">
@@ -52,17 +52,19 @@ if (!is_numeric($defaultMinSaleQty)) {
5252
<div class="control">
5353
<div class="fields-group-2">
5454
<div class="field">
55-
<select id="inventory_manage_stock" name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[manage_stock]"
55+
<select id="inventory_manage_stock"
56+
name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[manage_stock]"
5657
class="select" disabled="disabled">
5758
<option value="1"><?= $block->escapeHtml(__('Yes')) ?></option>
5859
<option value="0"
59-
<?php if ($block->getFieldValue('manage_stock') == 0) :?>
60+
<?php if ($block->getFieldValue('manage_stock') == 0):?>
6061
selected="selected"
6162
<?php endif; ?>><?= $block->escapeHtml(__('No')) ?></option>
6263
</select>
6364
</div>
6465
<div class="field choice">
65-
<input name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_manage_stock]" type="checkbox"
66+
<input name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[use_config_manage_stock]"
67+
type="checkbox"
6668
id="inventory_use_config_manage_stock" data-role="toggle-editability" value="1"
6769
checked="checked" disabled="disabled"/>
6870
<label for="inventory_use_config_manage_stock"
@@ -211,13 +213,15 @@ if (!is_numeric($defaultMinSaleQty)) {
211213
disabled="disabled">
212214
<option value="0"><?= $block->escapeHtml(__('No')) ?></option>
213215
<option value="1"
214-
<?php if ($block->getDefaultConfigValue('is_qty_decimal') == 1) :?>
216+
<?php if ($block->getDefaultConfigValue('is_qty_decimal') == 1):?>
215217
selected="selected"
216218
<?php endif; ?>><?= $block->escapeHtml(__('Yes')) ?></option>
217219
</select>
218220
</div>
219221
<div class="field choice">
220-
<input type="checkbox" id="inventory_is_qty_decimal_checkbox" data-role="toggle-editability-all"/>
222+
<input type="checkbox"
223+
id="inventory_is_qty_decimal_checkbox"
224+
data-role="toggle-editability-all"/>
221225
<label for="inventory_is_qty_decimal_checkbox"
222226
class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label>
223227
</div>
@@ -238,10 +242,12 @@ if (!is_numeric($defaultMinSaleQty)) {
238242
name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[backorders]"
239243
class="select"
240244
disabled="disabled">
241-
<?php foreach ($block->getBackordersOption() as $option) :?>
242-
<?php $_selected = ($option['value'] == $block->getDefaultConfigValue('backorders')) ? ' selected="selected"' : '' ?>
243-
<option
244-
value="<?= $block->escapeHtmlAttr($option['value']) ?>"<?= /* @noEscape */ $_selected ?>><?= $block->escapeHtml($option['label']) ?></option>
245+
<?php foreach ($block->getBackordersOption() as $option):?>
246+
<?php $_selected = ($option['value'] == $block->getDefaultConfigValue('backorders'))
247+
? ' selected="selected"' : '' ?>
248+
<option value="<?= $block->escapeHtmlAttr($option['value']) ?>"
249+
<?= /* @noEscape */ $_selected ?>><?= $block->escapeHtml($option['label']) ?>
250+
</option>
245251
<?php endforeach; ?>
246252
</select>
247253
</div>
@@ -291,7 +297,9 @@ if (!is_numeric($defaultMinSaleQty)) {
291297
class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label>
292298
</div>
293299
<div class="field choice">
294-
<input type="checkbox" id="inventory_notify_stock_qty_checkbox" data-role="toggle-editability-all"/>
300+
<input type="checkbox"
301+
id="inventory_notify_stock_qty_checkbox"
302+
data-role="toggle-editability-all"/>
295303
<label for="inventory_notify_stock_qty_checkbox"
296304
class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label>
297305
</div>
@@ -314,7 +322,7 @@ if (!is_numeric($defaultMinSaleQty)) {
314322
disabled="disabled">
315323
<option value="1"><?= $block->escapeHtml(__('Yes')) ?></option>
316324
<option value="0"
317-
<?php if ($block->getDefaultConfigValue('enable_qty_increments') == 0) :?>
325+
<?php if ($block->getDefaultConfigValue('enable_qty_increments') == 0):?>
318326
selected="selected"
319327
<?php endif; ?>><?= $block->escapeHtml(__('No')) ?></option>
320328
</select>
@@ -330,7 +338,9 @@ if (!is_numeric($defaultMinSaleQty)) {
330338
class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label>
331339
</div>
332340
<div class="field choice">
333-
<input type="checkbox" id="inventory_enable_qty_increments_checkbox" data-role="toggle-editability-all"/>
341+
<input type="checkbox"
342+
id="inventory_enable_qty_increments_checkbox"
343+
data-role="toggle-editability-all"/>
334344
<label for="inventory_enable_qty_increments_checkbox"
335345
class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label>
336346
</div>
@@ -364,7 +374,9 @@ if (!is_numeric($defaultMinSaleQty)) {
364374
class="label"><span><?= $block->escapeHtml(__('Use Config Settings')) ?></span></label>
365375
</div>
366376
<div class="field choice">
367-
<input type="checkbox" id="inventory_qty_increments_checkbox" data-role="toggle-editability-all"/>
377+
<input type="checkbox"
378+
id="inventory_qty_increments_checkbox"
379+
data-role="toggle-editability-all"/>
368380
<label for="inventory_qty_increments_checkbox"
369381
class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label>
370382
</div>
@@ -385,11 +397,15 @@ if (!is_numeric($defaultMinSaleQty)) {
385397
name="<?= /* @noEscape */ $block->getFieldSuffix() ?>[is_in_stock]" class="select"
386398
disabled="disabled">
387399
<option value="1"><?= $block->escapeHtml(__('In Stock')) ?></option>
388-
<option value="0"<?php if ($block->getDefaultConfigValue('is_in_stock') == 0) :?> selected<?php endif; ?>><?= $block->escapeHtml(__('Out of Stock')) ?></option>
400+
<option value="0"<?php if ($block->getDefaultConfigValue('is_in_stock') == 0):?>
401+
selected<?php endif; ?>><?= $block->escapeHtml(__('Out of Stock')) ?>
402+
</option>
389403
</select>
390404
</div>
391405
<div class="field choice">
392-
<input type="checkbox" id="inventory_stock_availability_checkbox" data-role="toggle-editability-all"/>
406+
<input type="checkbox"
407+
id="inventory_stock_availability_checkbox"
408+
data-role="toggle-editability-all"/>
393409
<label for="inventory_stock_availability_checkbox"
394410
class="label"><span><?= $block->escapeHtml(__('Change')) ?></span></label>
395411
</div>

app/code/Magento/CatalogRule/Model/Rule/Condition/ConditionsToSearchCriteriaMapper.php

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,46 @@
77

88
namespace Magento\CatalogRule\Model\Rule\Condition;
99

10-
use Magento\Framework\Exception\InputException;
11-
use Magento\Rule\Model\Condition\ConditionInterface;
1210
use Magento\CatalogRule\Model\Rule\Condition\Combine as CombinedCondition;
1311
use Magento\CatalogRule\Model\Rule\Condition\Product as SimpleCondition;
1412
use Magento\Framework\Api\CombinedFilterGroup as FilterGroup;
13+
use Magento\Framework\Api\CombinedFilterGroupFactory;
1514
use Magento\Framework\Api\Filter;
15+
use Magento\Framework\Api\FilterFactory;
1616
use Magento\Framework\Api\SearchCriteria;
17+
use Magento\Framework\Api\SearchCriteriaBuilderFactory;
18+
use Magento\Framework\Exception\InputException;
19+
use Magento\Rule\Model\Condition\ConditionInterface;
1720

1821
/**
1922
* Maps catalog price rule conditions to search criteria
2023
*/
2124
class ConditionsToSearchCriteriaMapper
2225
{
2326
/**
24-
* @var \Magento\Framework\Api\SearchCriteriaBuilderFactory
27+
* @var SearchCriteriaBuilderFactory
2528
*/
2629
private $searchCriteriaBuilderFactory;
2730

2831
/**
29-
* @var \Magento\Framework\Api\CombinedFilterGroupFactory
32+
* @var CombinedFilterGroupFactory
3033
*/
3134
private $combinedFilterGroupFactory;
3235

3336
/**
34-
* @var \Magento\Framework\Api\FilterFactory
37+
* @var FilterFactory
3538
*/
3639
private $filterFactory;
3740

3841
/**
39-
* @param \Magento\Framework\Api\SearchCriteriaBuilderFactory $searchCriteriaBuilderFactory
40-
* @param \Magento\Framework\Api\CombinedFilterGroupFactory $combinedFilterGroupFactory
41-
* @param \Magento\Framework\Api\FilterFactory $filterFactory
42+
* @param SearchCriteriaBuilderFactory $searchCriteriaBuilderFactory
43+
* @param CombinedFilterGroupFactory $combinedFilterGroupFactory
44+
* @param FilterFactory $filterFactory
4245
*/
4346
public function __construct(
44-
\Magento\Framework\Api\SearchCriteriaBuilderFactory $searchCriteriaBuilderFactory,
45-
\Magento\Framework\Api\CombinedFilterGroupFactory $combinedFilterGroupFactory,
46-
\Magento\Framework\Api\FilterFactory $filterFactory
47+
SearchCriteriaBuilderFactory $searchCriteriaBuilderFactory,
48+
CombinedFilterGroupFactory $combinedFilterGroupFactory,
49+
FilterFactory $filterFactory
4750
) {
4851
$this->searchCriteriaBuilderFactory = $searchCriteriaBuilderFactory;
4952
$this->combinedFilterGroupFactory = $combinedFilterGroupFactory;
@@ -74,7 +77,7 @@ public function mapConditionsToSearchCriteria(CombinedCondition $conditions): Se
7477
* Convert condition to filter group
7578
*
7679
* @param ConditionInterface $condition
77-
* @return null|\Magento\Framework\Api\CombinedFilterGroup|\Magento\Framework\Api\Filter
80+
* @return null|FilterGroup|Filter
7881
* @throws InputException
7982
*/
8083
private function mapConditionToFilterGroup(ConditionInterface $condition)
@@ -94,7 +97,7 @@ private function mapConditionToFilterGroup(ConditionInterface $condition)
9497
* Convert combined condition to filter group
9598
*
9699
* @param Combine $combinedCondition
97-
* @return null|\Magento\Framework\Api\CombinedFilterGroup
100+
* @return null|FilterGroup
98101
* @throws InputException
99102
*/
100103
private function mapCombinedConditionToFilterGroup(CombinedCondition $combinedCondition)
@@ -111,7 +114,7 @@ private function mapCombinedConditionToFilterGroup(CombinedCondition $combinedCo
111114
// This required to solve cases when condition is configured like:
112115
// "If ALL/ANY of these conditions are FALSE" - we need to reverse SQL operator for this "FALSE"
113116
if ((bool)$combinedCondition->getValue() === false) {
114-
$this->reverseSqlOperatorInFilter($filter);
117+
$this->reverseSqlOperatorInFilterRecursively($filter);
115118
}
116119

117120
$filters[] = $filter;
@@ -183,6 +186,24 @@ private function getGlueForArrayValues(string $operator): string
183186
return 'any';
184187
}
185188

189+
/**
190+
* Recursively reverse sql conditions to their corresponding negative analog for the entire FilterGroup
191+
*
192+
* @param Filter|FilterGroup $filter
193+
* @return void
194+
* @throws InputException
195+
*/
196+
private function reverseSqlOperatorInFilterRecursively($filter): void
197+
{
198+
if ($filter instanceof FilterGroup) {
199+
foreach ($filter->getFilters() as &$currentFilter) {
200+
$this->reverseSqlOperatorInFilterRecursively($currentFilter);
201+
}
202+
} else {
203+
$this->reverseSqlOperatorInFilter($filter);
204+
}
205+
}
206+
186207
/**
187208
* Reverse sql conditions to their corresponding negative analog
188209
*

0 commit comments

Comments
 (0)