Skip to content

Commit 39cfaa7

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.3-develop expedited
Accepted Community Pull Requests: - #24158: 24151 collapsed js issue fix (by @sunilit42) - #23372: Use variadics instead of func_get_args() (by @kassner) - #24072: Set isMultiShipping to 0 in database so it can be used correctly by rest api requests on checkout page (by @websnap) - #23253: Fixed issue #21650 (by @geet07) - #23820: #3993; Fix same level categories (position)re-index on category move. (by @sergey-solo) - #21798: It is not possible to add MS tile image meta via default_head_blocks.xml (by @vasilii-b) Fixed GitHub Issues: - #24151: Uncaught TypeError: Cannot read property 'collapsed' of null (reported by @TomashKhamlai) has been fixed in #24158 by @sunilit42 in 2.3-develop branch Related commits: 1. 8189449 2. 8e08b21 - #3993: Category Sort Order is not saved in Flat Table (reported by @stanislav-zgr) has been fixed in #23820 by @sergey-solo in 2.3-develop branch Related commits: 1. 089bebc 2. 592922e - #5023: It is not possible to add MS tile image meta via default_head_blocks.xml (reported by @chicgeek) has been fixed in #21798 by @vasilii-b in 2.3-develop branch Related commits: 1. a2551af 2. 3d193bf 3. 2faa1ec 4. 56a368f 5. b488bd4 6. 8892b0b 7. a917ee7
2 parents 20db8f6 + 3731000 commit 39cfaa7

File tree

10 files changed

+195
-25
lines changed

10 files changed

+195
-25
lines changed

app/code/Magento/Catalog/Model/Category.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,9 @@ public function move($parentId, $afterCategoryId)
448448
if ($this->flatState->isFlatEnabled()) {
449449
$flatIndexer = $this->indexerRegistry->get(Indexer\Category\Flat\State::INDEXER_ID);
450450
if (!$flatIndexer->isScheduled()) {
451-
$flatIndexer->reindexList([$this->getId(), $oldParentId, $parentId]);
451+
$sameLevelCategories = explode(',', $this->getParentCategory()->getChildren());
452+
$list = array_unique(array_merge($sameLevelCategories, [$this->getId(), $oldParentId, $parentId]));
453+
$flatIndexer->reindexList($list);
452454
}
453455
}
454456
$productIndexer = $this->indexerRegistry->get(Indexer\Category\Product::INDEXER_ID);

app/code/Magento/Config/view/adminhtml/templates/system/config/edit.phtml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,16 @@ require([
5858

5959
var parentSection = groupElement.parents('.section-config');
6060
parentSection.addClass('highlighted');
61+
parentSection.addClass('active');
6162
setTimeout(function() {
6263
parentSection.removeClass('highlighted', 2000, "easeInBack");
6364
}, 3000);
6465
if (!parentSection.hasClass('active')) {
66+
if(section == 'payment') {
67+
var openSection = jQuery('.open').first().attr('id');
68+
var splitIdArray = openSection.split('_');
69+
section = section + '_' + splitIdArray[1];
70+
}
6571
Fieldset.toggleCollapse(section + '_' + group);
6672
}
6773
}

app/code/Magento/Multishipping/Controller/Checkout/Plugin.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
6+
declare(strict_types=1);
7+
78
namespace Magento\Multishipping\Controller\Checkout;
89

10+
/**
11+
* Turns Off Multishipping mode for Quote.
12+
*/
913
class Plugin
1014
{
1115
/**
@@ -30,6 +34,10 @@ public function __construct(\Magento\Checkout\Model\Cart $cart)
3034
*/
3135
public function beforeExecute(\Magento\Framework\App\Action\Action $subject)
3236
{
33-
$this->cart->getQuote()->setIsMultiShipping(0);
37+
$quote = $this->cart->getQuote();
38+
if ($quote->getIsMultiShipping()) {
39+
$quote->setIsMultiShipping(0);
40+
$this->cart->saveQuote();
41+
}
3442
}
3543
}

app/code/Magento/Multishipping/Test/Unit/Controller/Checkout/PluginTest.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
* Copyright © Magento, Inc. All rights reserved.
55
* See COPYING.txt for license details.
66
*/
7+
8+
declare(strict_types=1);
9+
710
namespace Magento\Multishipping\Test\Unit\Controller\Checkout;
811

912
use Magento\Multishipping\Controller\Checkout\Plugin;
@@ -30,16 +33,27 @@ protected function setUp()
3033
$this->cartMock = $this->createMock(\Magento\Checkout\Model\Cart::class);
3134
$this->quoteMock = $this->createPartialMock(
3235
\Magento\Quote\Model\Quote::class,
33-
['__wakeUp', 'setIsMultiShipping']
36+
['__wakeUp', 'setIsMultiShipping', 'getIsMultiShipping']
3437
);
3538
$this->cartMock->expects($this->once())->method('getQuote')->will($this->returnValue($this->quoteMock));
3639
$this->object = new \Magento\Multishipping\Controller\Checkout\Plugin($this->cartMock);
3740
}
3841

39-
public function testExecuteTurnsOffMultishippingModeOnQuote()
42+
public function testExecuteTurnsOffMultishippingModeOnMultishippingQuote(): void
4043
{
4144
$subject = $this->createMock(\Magento\Checkout\Controller\Index\Index::class);
45+
$this->quoteMock->expects($this->once())->method('getIsMultiShipping')->willReturn(1);
4246
$this->quoteMock->expects($this->once())->method('setIsMultiShipping')->with(0);
47+
$this->cartMock->expects($this->once())->method('saveQuote');
48+
$this->object->beforeExecute($subject);
49+
}
50+
51+
public function testExecuteTurnsOffMultishippingModeOnNotMultishippingQuote(): void
52+
{
53+
$subject = $this->createMock(\Magento\Checkout\Controller\Index\Index::class);
54+
$this->quoteMock->expects($this->once())->method('getIsMultiShipping')->willReturn(0);
55+
$this->quoteMock->expects($this->never())->method('setIsMultiShipping');
56+
$this->cartMock->expects($this->never())->method('saveQuote');
4357
$this->object->beforeExecute($subject);
4458
}
4559
}

app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,8 @@ define([
651651
'validate-number': [
652652
function (value) {
653653
return utils.isEmptyNoTrim(value) ||
654-
!isNaN(utils.parseNumber(value)) && /^\s*-?\d*(,\d*)*(\.\d*)?\s*$/.test(value);
654+
!isNaN(utils.parseNumber(value)) &&
655+
/^\s*-?\d*(?:[.,|'|\s]\d+)*(?:[.,|'|\s]\d{2})?-?\s*$/.test(value);
655656
},
656657
$.mage.__('Please enter a valid number in this field.')
657658
],

dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/lib/validation/rules.test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,36 @@ define([
5858
expect(rules['validate-number'].handler(value)).toBe(true);
5959
});
6060

61+
it('Check on float without leading zero', function () {
62+
var value = '.50';
63+
64+
expect(rules['validate-number'].handler(value)).toBe(true);
65+
});
66+
6167
it('Check on formatted float', function () {
6268
var value = '1,000,000.50';
6369

6470
expect(rules['validate-number'].handler(value)).toBe(true);
6571
});
6672

73+
it('Check on space', function () {
74+
var value = '10 000';
75+
76+
expect(rules['validate-number'].handler(value)).toBe(true);
77+
});
78+
79+
it('Check on formatted float (For International price)', function () {
80+
var value = '10.000,00';
81+
82+
expect(rules['validate-number'].handler(value)).toBe(true);
83+
});
84+
85+
it('Check on formatted float (For International price)', function () {
86+
var value = '10\'000.00';
87+
88+
expect(rules['validate-number'].handler(value)).toBe(true);
89+
});
90+
6791
it('Check on not a number', function () {
6892
var value = 'string';
6993

lib/internal/Magento/Framework/Phrase/__.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77

88
/**
99
* Create value-object \Magento\Framework\Phrase
10+
*
1011
* @SuppressWarnings(PHPMD.ShortMethodName)
12+
* phpcs:disable Squiz.Functions.GlobalFunction
13+
* @param array $argc
1114
* @return \Magento\Framework\Phrase
1215
*/
13-
function __()
16+
function __(...$argc)
1417
{
15-
$argc = func_get_args();
16-
1718
$text = array_shift($argc);
1819
if (!empty($argc) && is_array($argc[0])) {
1920
$argc = $argc[0];
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
namespace Magento\Framework\View\Page\Config\Metadata;
9+
10+
use Magento\Framework\View\Asset\Repository as AssetRepository;
11+
12+
/**
13+
* Class MsApplicationTileImage
14+
*
15+
* Returns the URL for page `msapplication-TileImage` meta
16+
*/
17+
class MsApplicationTileImage
18+
{
19+
/**#@+
20+
* Constant of asset name
21+
*/
22+
const META_NAME = 'msapplication-TileImage';
23+
24+
/**
25+
* @var AssetRepository
26+
*/
27+
private $assetRepo;
28+
29+
/**
30+
* @param AssetRepository $assetRepo
31+
*/
32+
public function __construct(AssetRepository $assetRepo)
33+
{
34+
$this->assetRepo = $assetRepo;
35+
}
36+
37+
/**
38+
* Get asset URL from given metadata content
39+
*
40+
* @param string $content
41+
*
42+
* @return string
43+
*/
44+
public function getUrl(string $content): string
45+
{
46+
if (!parse_url($content, PHP_URL_SCHEME)) {
47+
return $this->assetRepo->getUrl($content);
48+
}
49+
50+
return $content;
51+
}
52+
}

lib/internal/Magento/Framework/View/Page/Config/Renderer.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Magento\Framework\Exception\LocalizedException;
1010
use Magento\Framework\View\Asset\GroupedCollection;
1111
use Magento\Framework\View\Page\Config;
12+
use Magento\Framework\View\Page\Config\Metadata\MsApplicationTileImage;
1213

1314
/**
1415
* Page config Renderer model
@@ -74,28 +75,37 @@ class Renderer implements RendererInterface
7475
*/
7576
protected $urlBuilder;
7677

78+
/**
79+
* @var MsApplicationTileImage
80+
*/
81+
private $msApplicationTileImage;
82+
7783
/**
7884
* @param Config $pageConfig
7985
* @param \Magento\Framework\View\Asset\MergeService $assetMergeService
8086
* @param \Magento\Framework\UrlInterface $urlBuilder
8187
* @param \Magento\Framework\Escaper $escaper
8288
* @param \Magento\Framework\Stdlib\StringUtils $string
8389
* @param \Psr\Log\LoggerInterface $logger
90+
* @param MsApplicationTileImage|null $msApplicationTileImage
8491
*/
8592
public function __construct(
8693
Config $pageConfig,
8794
\Magento\Framework\View\Asset\MergeService $assetMergeService,
8895
\Magento\Framework\UrlInterface $urlBuilder,
8996
\Magento\Framework\Escaper $escaper,
9097
\Magento\Framework\Stdlib\StringUtils $string,
91-
\Psr\Log\LoggerInterface $logger
98+
\Psr\Log\LoggerInterface $logger,
99+
MsApplicationTileImage $msApplicationTileImage = null
92100
) {
93101
$this->pageConfig = $pageConfig;
94102
$this->assetMergeService = $assetMergeService;
95103
$this->urlBuilder = $urlBuilder;
96104
$this->escaper = $escaper;
97105
$this->string = $string;
98106
$this->logger = $logger;
107+
$this->msApplicationTileImage = $msApplicationTileImage ?:
108+
\Magento\Framework\App\ObjectManager::getInstance()->get(MsApplicationTileImage::class);
99109
}
100110

101111
/**
@@ -179,6 +189,10 @@ protected function processMetadataContent($name, $content)
179189
if (method_exists($this->pageConfig, $method)) {
180190
$content = $this->pageConfig->$method();
181191
}
192+
if ($content && $name === $this->msApplicationTileImage::META_NAME) {
193+
$content = $this->msApplicationTileImage->getUrl($content);
194+
}
195+
182196
return $content;
183197
}
184198

0 commit comments

Comments
 (0)