Skip to content

Commit b7c76e3

Browse files
🔃 [EngCom] Public Pull Requests - 2.3-develop
Accepted Public Pull Requests: - #14684: [Forwardport] Fix for Issue #13950 - Cache issue with configurable products related to currency-conversions (by @rostyslav-hymon) - #14666: [Forwardport] Fixed 'Non-numeric value' warning on account create/save when DOB field is visible (by @rostyslav-hymon) - #14652: Eliminate usage of "else" statements (by @nuzil) - #13402: #13296: Category name with special characters brakes � (by @vinayshah) Fixed GitHub Issues: - #12146: Customer with empty "Date of Birth" cannot be saved (reported by @JanisE) has been fixed in #14666 by @rostyslav-hymon in 2.3-develop branch Related commits: 1. 4801d74 - #13296: Category name with special characters brakes in url rewrites category tree (reported by @galanis-a) has been fixed in #13402 by @vinayshah in 2.3-develop branch Related commits: 1. bd5834c 2. 46feb0b 3. aa31ff8 4. c136ce8 5. 9b67a3e 6. 6e1ac10 7. 9a73e4c 8. f6c4efd 9. b8b000b 10. 33144f9 11. 47b5440 12. 2ef98ac 13. 3ce79eb 14. 8b8d5ce 15. 2c97259 16. de3b966 17. 597d548 18. 30989e1 19. b9d2e53 20. b52787a
2 parents 4822bb1 + 2834b69 commit b7c76e3

File tree

26 files changed

+137
-66
lines changed

26 files changed

+137
-66
lines changed

app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Radio.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ public function getCondition()
3131
{
3232
if ($this->getValue()) {
3333
return $this->getColumn()->getValue();
34-
} else {
35-
return [['neq' => $this->getColumn()->getValue()], ['is' => new \Zend_Db_Expr('NULL')]];
3634
}
35+
return [['neq' => $this->getColumn()->getValue()], ['is' => new \Zend_Db_Expr('NULL')]];
3736
}
3837
}

app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,8 @@ public function getSelectedJson()
223223
if ($selected = $this->getRequest()->getParam($this->getFormFieldNameInternal())) {
224224
$selected = explode(',', $selected);
225225
return join(',', $selected);
226-
} else {
227-
return '';
228226
}
227+
return '';
229228
}
230229

231230
/**
@@ -238,9 +237,8 @@ public function getSelected()
238237
if ($selected = $this->getRequest()->getParam($this->getFormFieldNameInternal())) {
239238
$selected = explode(',', $selected);
240239
return $selected;
241-
} else {
242-
return [];
243240
}
241+
return [];
244242
}
245243

246244
/**

app/code/Magento/Backend/Block/Widget/Grid/Massaction/Extended.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,8 @@ public function getSelectedJson()
219219
if ($selected = $this->getRequest()->getParam($this->getFormFieldNameInternal())) {
220220
$selected = explode(',', $selected);
221221
return join(',', $selected);
222-
} else {
223-
return '';
224222
}
223+
return '';
225224
}
226225

227226
/**
@@ -234,9 +233,8 @@ public function getSelected()
234233
if ($selected = $this->getRequest()->getParam($this->getFormFieldNameInternal())) {
235234
$selected = explode(',', $selected);
236235
return $selected;
237-
} else {
238-
return [];
239236
}
237+
return [];
240238
}
241239

242240
/**

app/code/Magento/Backend/Controller/Adminhtml/Auth/Login.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,8 @@ public function execute()
5050
// redirect according to rewrite rule
5151
if ($requestUrl != $backendUrl) {
5252
return $this->getRedirect($backendUrl);
53-
} else {
54-
return $this->resultPageFactory->create();
5553
}
54+
return $this->resultPageFactory->create();
5655
}
5756

5857
/**

app/code/Magento/Backend/Controller/Adminhtml/System/Account/Save.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ private function getSecurityCookie()
3232
{
3333
if (!($this->securityCookie instanceof SecurityCookie)) {
3434
return \Magento\Framework\App\ObjectManager::getInstance()->get(SecurityCookie::class);
35-
} else {
36-
return $this->securityCookie;
3735
}
36+
return $this->securityCookie;
3837
}
3938

4039
/**

app/code/Magento/Backend/Model/Menu/Item.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,12 +503,11 @@ public function populateFromArray(array $data)
503503
$this->_tooltip = $this->_getArgument($data, 'toolTip');
504504
$this->_title = $this->_getArgument($data, 'title');
505505
$this->target = $this->_getArgument($data, 'target');
506+
$this->_submenu = null;
506507
if (isset($data['sub_menu'])) {
507508
$menu = $this->_menuFactory->create();
508509
$menu->populateFromArray($data['sub_menu']);
509510
$this->_submenu = $menu;
510-
} else {
511-
$this->_submenu = null;
512511
}
513512
}
514513
}

app/code/Magento/Braintree/Test/Unit/Model/Report/BraintreeTransactionStub.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ public function __get($name)
3434
{
3535
if (array_key_exists($name, $this->_attributes)) {
3636
return $this->_attributes[$name];
37-
} else {
38-
trigger_error('Undefined property on ' . get_class($this) . ': ' . $name, E_USER_NOTICE);
39-
return null;
4037
}
38+
trigger_error('Undefined property on ' . get_class($this) . ': ' . $name, E_USER_NOTICE);
39+
return null;
4140
}
4241

4342
/**

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,8 @@ public function getChildren($item)
9595

9696
if (isset($itemsArray[$item->getOrderItem()->getId()])) {
9797
return $itemsArray[$item->getOrderItem()->getId()];
98-
} else {
99-
return null;
10098
}
99+
return null;
101100
}
102101

103102
/**
@@ -219,9 +218,8 @@ public function getOrderItem()
219218
{
220219
if ($this->getItem() instanceof \Magento\Sales\Model\Order\Item) {
221220
return $this->getItem();
222-
} else {
223-
return $this->getItem()->getOrderItem();
224221
}
222+
return $this->getItem()->getOrderItem();
225223
}
226224

227225
/**

app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,8 @@ public function isSelected($selection)
189189
return in_array($selection->getSelectionId(), $selectedOptions);
190190
} elseif ($selectedOptions == 'None') {
191191
return false;
192-
} else {
193-
return $selection->getIsDefault() && $selection->isSaleable();
194192
}
193+
return $selection->getIsDefault() && $selection->isSaleable();
195194
}
196195

197196
/**

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,8 @@ public function getValueHtml($item)
142142
if ($attributes = $this->getSelectionAttributes($item)) {
143143
return sprintf('%d', $attributes['qty']) . ' x ' . $this->escapeHtml($item->getName()) . " "
144144
. $this->getOrder()->formatPrice($attributes['price']);
145-
} else {
146-
return $this->escapeHtml($item->getName());
147145
}
146+
return $this->escapeHtml($item->getName());
148147
}
149148

150149
/**
@@ -179,9 +178,8 @@ public function getChildren($item)
179178

180179
if (isset($itemsArray[$item->getOrderItem()->getId()])) {
181180
return $itemsArray[$item->getOrderItem()->getId()];
182-
} else {
183-
return null;
184181
}
182+
return null;
185183
}
186184

187185
/**

app/code/Magento/Bundle/Model/Plugin/PriceBackend.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ public function aroundValidate(
2929
&& $object->getPriceType() == \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC
3030
) {
3131
return true;
32-
} else {
33-
return $proceed($object);
3432
}
33+
return $proceed($object);
3534
}
3635
}

app/code/Magento/Bundle/Model/Product/Type.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,9 +1007,8 @@ public function shakeSelections($firstItem, $secondItem)
10071007
];
10081008
if ($aPosition == $bPosition) {
10091009
return 0;
1010-
} else {
1011-
return $aPosition < $bPosition ? -1 : 1;
10121010
}
1011+
return $aPosition < $bPosition ? -1 : 1;
10131012
}
10141013

10151014
/**

app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/AbstractItems.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,8 @@ public function getChildren($item)
9292

9393
if (isset($itemsArray[$item->getOrderItem()->getId()])) {
9494
return $itemsArray[$item->getOrderItem()->getId()];
95-
} else {
96-
return null;
9795
}
96+
return null;
9897
}
9998

10099
/**
@@ -244,9 +243,8 @@ public function getOrderItem()
244243
{
245244
if ($this->getItem() instanceof \Magento\Sales\Model\Order\Item) {
246245
return $this->getItem();
247-
} else {
248-
return $this->getItem()->getOrderItem();
249246
}
247+
return $this->getItem()->getOrderItem();
250248
}
251249

252250
/**

app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,8 @@ public function calculateBundleAmount($basePriceValue, $bundleProduct, $selectio
271271
{
272272
if ($bundleProduct->getPriceType() == Price::PRICE_TYPE_FIXED) {
273273
return $this->calculateFixedBundleAmount($basePriceValue, $bundleProduct, $selectionPriceList, $exclude);
274-
} else {
275-
return $this->calculateDynamicBundleAmount($basePriceValue, $bundleProduct, $selectionPriceList, $exclude);
276274
}
275+
return $this->calculateDynamicBundleAmount($basePriceValue, $bundleProduct, $selectionPriceList, $exclude);
277276
}
278277

279278
/**

app/code/Magento/Bundle/Pricing/Price/BundleSelectionPrice.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ public function getProduct()
178178
{
179179
if ($this->bundleProduct->getPriceType() == Price::PRICE_TYPE_DYNAMIC) {
180180
return parent::getProduct();
181-
} else {
182-
return $this->bundleProduct;
183181
}
182+
return $this->bundleProduct;
184183
}
185184
}

app/code/Magento/Bundle/Pricing/Price/ConfiguredPrice.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,8 @@ public function getValue()
140140
$this->priceInfo
141141
->getPrice(BundleDiscountPrice::PRICE_CODE)
142142
->calculateDiscount($configuredOptionsAmount);
143-
} else {
144-
return parent::getValue();
145143
}
144+
return parent::getValue();
146145
}
147146

148147
/**

app/code/Magento/Catalog/view/adminhtml/web/js/category-tree.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55

66
define([
77
'jquery',
8+
'mageUtils',
89
'jquery/ui',
910
'jquery/jstree/jquery.jstree'
10-
], function ($) {
11+
], function ($, utils) {
1112
'use strict';
1213

1314
$.widget('mage.categoryTree', {
@@ -90,7 +91,7 @@ define([
9091
}
9192
result = {
9293
data: {
93-
title: node.name + ' (' + node['product_count'] + ')'
94+
title: utils.unescape(node.name) + ' (' + node['product_count'] + ')'
9495
},
9596
attr: {
9697
'class': node.cls + (!!node.disabled ? ' disabled' : '') //eslint-disable-line no-extra-boolean-cast

app/code/Magento/CatalogWidget/Block/Product/ProductsList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function getCacheKeyInfo()
160160

161161
return [
162162
'CATALOG_PRODUCTS_LIST_WIDGET',
163-
$this->getPriceCurrency()->getCurrencySymbol(),
163+
$this->getPriceCurrency()->getCurrency()->getCode(),
164164
$this->_storeManager->getStore()->getId(),
165165
$this->_design->getDesignTheme()->getId(),
166166
$this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_GROUP),

app/code/Magento/CatalogWidget/Test/Unit/Block/Product/ProductsListTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ public function testGetCacheKeyInfo()
147147
$this->request->expects($this->once())->method('getParam')->with('page_number')->willReturn(1);
148148

149149
$this->request->expects($this->once())->method('getParams')->willReturn('request_params');
150-
$this->priceCurrency->expects($this->once())->method('getCurrencySymbol')->willReturn('$');
150+
$currency = $this->createMock(\Magento\Directory\Model\Currency::class);
151+
$currency->expects($this->once())->method('getCode')->willReturn('USD');
152+
$this->priceCurrency->expects($this->once())->method('getCurrency')->willReturn($currency);
151153

152154
$this->serializer->expects($this->any())
153155
->method('serialize')
@@ -157,7 +159,7 @@ public function testGetCacheKeyInfo()
157159

158160
$cacheKey = [
159161
'CATALOG_PRODUCTS_LIST_WIDGET',
160-
'$',
162+
'USD',
161163
1,
162164
'blank',
163165
'context_group',

app/code/Magento/UrlRewrite/Block/Catalog/Category/Tree.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\UrlRewrite\Block\Catalog\Category;
78

89
use Magento\Catalog\Api\CategoryRepositoryInterface;

app/code/Magento/UrlRewrite/view/adminhtml/templates/categories.phtml

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,27 @@
88

99
/** @var \Magento\UrlRewrite\Block\Catalog\Category\Tree $block */
1010
?>
11-
<fieldset class="admin__fieldset" data-ui-id="category-selector">
12-
<legend class="admin__legend"><span><?= $block->escapeHtml(__('Select Category')) ?></span></legend>
13-
<div class="content content-category-tree">
14-
<input type="hidden" name="categories" id="product_categories" value="" />
15-
<?php if ($block->getRoot()): ?>
16-
<div data-mage-init='<?php /* @noEscape */ echo $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode(
17-
[
18-
'categoryTree' => [
19-
'data' => $block->getTreeArray(),
20-
'url' => $block->escapeUrl($block->getLoadTreeUrl()),
21-
],
22-
]
23-
); ?>' class="jstree-default"></div>
24-
<?php endif; ?>
25-
</div>
26-
</fieldset>
11+
<fieldset class="admin__fieldset" data-ui-id="category-selector">
12+
<legend class="admin__legend"><span><?= $block->escapeHtml(__('Select Category')) ?></span></legend>
13+
<div class="content content-category-tree">
14+
<input type="hidden" name="categories" id="product_categories" value=""/>
15+
<?php if ($block->getRoot()): ?>
16+
<div class="jstree-default"></div>
17+
<?php endif; ?>
18+
</div>
19+
</fieldset>
20+
<?php if ($block->getRoot()): ?>
21+
<script type="text/x-magento-init">
22+
{
23+
".jstree-default": {
24+
"categoryTree": {
25+
"data": <?php /* @noEscape */
26+
echo $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode($block->getTreeArray()); ?>,
27+
"url": "<?php /* @noEscape */
28+
echo $block->escapeUrl($block->getLoadTreeUrl()); ?>"
29+
}
30+
}
31+
}
32+
33+
</script>
34+
<?php endif; ?>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
/** @var $category \Magento\Catalog\Model\Category */
9+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
10+
11+
$categoryFirst = $objectManager->create(\Magento\Catalog\Model\Category::class);
12+
$categoryFirst->setName('Category 1')
13+
->setPath('1/2')
14+
->setLevel(2)
15+
->setAvailableSortBy('name')
16+
->setDefaultSortBy('name')
17+
->setIsActive(true)
18+
->setPosition(1)
19+
->save();
20+
21+
// products from this fixture were moved to indexer_catalog_products.php
22+
$categorySecond = $objectManager->create(\Magento\Catalog\Model\Category::class);
23+
$categorySecond->setName('"Category 6"')
24+
->setPath($categoryFirst->getPath())
25+
->setLevel(3)
26+
->setAvailableSortBy('name')
27+
->setDefaultSortBy('name')
28+
->setIsActive(true)
29+
->setPosition(1)
30+
->save();

0 commit comments

Comments
 (0)