Skip to content

Commit 8953e85

Browse files
committed
Merge remote-tracking branch 'mainline/2.4-develop' into 2.4-develop-s3
2 parents 15390c4 + 323676f commit 8953e85

File tree

326 files changed

+6946
-1725
lines changed

Some content is hidden

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

326 files changed

+6946
-1725
lines changed

.editorconfig

+6
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@ trim_trailing_whitespace = true
1010

1111
[*.md]
1212
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml,json}]
15+
indent_size = 2
16+
17+
[{composer, auth}.json]
18+
indent_size = 4

app/code/Magento/AdminNotification/Test/Mftf/Section/AdminSystemMessagesSection.xml

+2
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@
1515
<element name="success" type="text" selector="#system_messages div.message-success"/>
1616
<element name="warning" type="text" selector="#system_messages div.message-warning"/>
1717
<element name="notice" type="text" selector="#system_messages div.message-notice"/>
18+
<element name="info" type="text" selector="#system_messages div.message-info"/>
19+
<element name="viewDetailsLink" type="button" selector="//div[contains(@class, 'message-system-short')]/a[contains(text(), 'View Details')]" timeout="30"/>
1820
</section>
1921
</sections>

app/code/Magento/Analytics/Model/ReportUrlProvider.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ class ReportUrlProvider
4747
*/
4848
private $urlReportConfigPath = 'analytics/url/report';
4949

50+
/**
51+
* Path to Advanced Reporting documentation URL.
52+
*
53+
* @var string
54+
*/
55+
private $urlReportDocConfigPath = 'analytics/url/documentation';
56+
5057
/**
5158
* @param AnalyticsToken $analyticsToken
5259
* @param OTPRequest $otpRequest
@@ -80,13 +87,15 @@ public function getUrl()
8087
));
8188
}
8289

83-
$url = $this->config->getValue($this->urlReportConfigPath);
8490
if ($this->analyticsToken->isTokenExist()) {
91+
$url = $this->config->getValue($this->urlReportConfigPath);
8592
$otp = $this->otpRequest->call();
8693
if ($otp) {
8794
$query = http_build_query(['otp' => $otp], '', '&');
8895
$url .= '?' . $query;
8996
}
97+
} else {
98+
$url = $this->config->getValue($this->urlReportDocConfigPath);
9099
}
91100

92101
return $url;

app/code/Magento/Analytics/Test/Mftf/ActionGroup/AssertAdminAdvancedReportingPageUrlActionGroup.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515

1616
<switchToNextTab stepKey="switchToNewTab"/>
1717
<waitForPageLoad stepKey="waitForAdvancedReportingPageLoad"/>
18-
<seeInCurrentUrl url="advancedreporting.rjmetrics.com/report" stepKey="seeAssertAdvancedReportingPageUrl"/>
18+
<seeInCurrentUrl url="reports/advanced-reporting" stepKey="seeAssertAdvancedReportingPageUrl"/>
1919
</actionGroup>
2020
</actionGroups>

app/code/Magento/Analytics/Test/Unit/Model/ReportUrlProviderTest.php

+14-22
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,10 @@ class ReportUrlProviderTest extends TestCase
4343
*/
4444
private $flagManagerMock;
4545

46-
/**
47-
* @var ObjectManagerHelper
48-
*/
49-
private $objectManagerHelper;
50-
5146
/**
5247
* @var ReportUrlProvider
5348
*/
54-
private $reportUrlProvider;
55-
56-
/**
57-
* @var string
58-
*/
59-
private $urlReportConfigPath = 'path/url/report';
49+
private $model;
6050

6151
/**
6252
* @return void
@@ -71,35 +61,36 @@ protected function setUp(): void
7161

7262
$this->flagManagerMock = $this->createMock(FlagManager::class);
7363

74-
$this->objectManagerHelper = new ObjectManagerHelper($this);
64+
$objectManagerHelper = new ObjectManagerHelper($this);
7565

76-
$this->reportUrlProvider = $this->objectManagerHelper->getObject(
66+
$this->model = $objectManagerHelper->getObject(
7767
ReportUrlProvider::class,
7868
[
7969
'config' => $this->configMock,
8070
'analyticsToken' => $this->analyticsTokenMock,
8171
'otpRequest' => $this->otpRequestMock,
8272
'flagManager' => $this->flagManagerMock,
83-
'urlReportConfigPath' => $this->urlReportConfigPath,
8473
]
8574
);
8675
}
8776

8877
/**
8978
* @param bool $isTokenExist
9079
* @param string|null $otp If null OTP was not received.
80+
* @param string $configPath
81+
* @return void
9182
*
9283
* @dataProvider getUrlDataProvider
9384
*/
94-
public function testGetUrl($isTokenExist, $otp)
85+
public function testGetUrl(bool $isTokenExist, ?string $otp, string $configPath): void
9586
{
9687
$reportUrl = 'https://example.com/report';
9788
$url = '';
9889

9990
$this->configMock
10091
->expects($this->once())
10192
->method('getValue')
102-
->with($this->urlReportConfigPath)
93+
->with($configPath)
10394
->willReturn($reportUrl);
10495
$this->analyticsTokenMock
10596
->expects($this->once())
@@ -114,18 +105,19 @@ public function testGetUrl($isTokenExist, $otp)
114105
if ($isTokenExist && $otp) {
115106
$url = $reportUrl . '?' . http_build_query(['otp' => $otp], '', '&');
116107
}
117-
$this->assertSame($url ?: $reportUrl, $this->reportUrlProvider->getUrl());
108+
109+
$this->assertSame($url ?: $reportUrl, $this->model->getUrl());
118110
}
119111

120112
/**
121113
* @return array
122114
*/
123-
public function getUrlDataProvider()
115+
public function getUrlDataProvider(): array
124116
{
125117
return [
126-
'TokenDoesNotExist' => [false, null],
127-
'TokenExistAndOtpEmpty' => [true, null],
128-
'TokenExistAndOtpValid' => [true, '249e6b658877bde2a77bc4ab'],
118+
'TokenDoesNotExist' => [false, null, 'analytics/url/documentation'],
119+
'TokenExistAndOtpEmpty' => [true, null, 'analytics/url/report'],
120+
'TokenExistAndOtpValid' => [true, '249e6b658877bde2a77bc4ab', 'analytics/url/report'],
129121
];
130122
}
131123

@@ -140,6 +132,6 @@ public function testGetUrlWhenSubscriptionUpdateRunning()
140132
->with(SubscriptionUpdateHandler::PREVIOUS_BASE_URL_FLAG_CODE)
141133
->willReturn('http://store.com');
142134
$this->expectException(SubscriptionUpdateException::class);
143-
$this->reportUrlProvider->getUrl();
135+
$this->model->getUrl();
144136
}
145137
}

app/code/Magento/Analytics/etc/config.xml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<otp>https://advancedreporting.rjmetrics.com/otp</otp>
1616
<report>https://advancedreporting.rjmetrics.com/report</report>
1717
<notify_data_changed>https://advancedreporting.rjmetrics.com/report</notify_data_changed>
18+
<documentation>https://docs.magento.com/user-guide/reports/advanced-reporting.html</documentation>
1819
</url>
1920
<integration_name>Magento Analytics user</integration_name>
2021
<general>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminBulkDetailsModalSection">
12+
<element name="descriptionValue" type="text" selector="//aside//div[@data-index='description']//span[@name='description']"/>
13+
<element name="summaryValue" type="text" selector="//aside//div[@data-index='summary']//span[@name='summary']" />
14+
<element name="startTimeValue" type="text" selector="//aside//div[@data-index='start_time']//span[@name='start_time']" />
15+
</section>
16+
</sections>

app/code/Magento/Backend/view/adminhtml/layout/default.xml

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<body>
1818
<attribute name="id" value="html-body"/>
1919
<block name="require.js" class="Magento\Backend\Block\Page\RequireJs" template="Magento_Backend::page/js/require_js.phtml"/>
20+
<block class="Magento\Framework\View\Element\Template" name="head.additional" template="Magento_Backend::page/container.phtml"/>
2021
<referenceContainer name="global.notices">
2122
<block class="Magento\Backend\Block\Page\Notices" name="global_notices" as="global_notices" template="Magento_Backend::page/notices.phtml"/>
2223
</referenceContainer>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
?>
7+
<?= $block->getChildHtml(); ?>

app/code/Magento/Bundle/view/adminhtml/ui_component/bundle_product_listing.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<label translate="true">Status</label>
5959
<dataScope>status</dataScope>
6060
<imports>
61-
<link name="visible">componentType = column, index = ${ $.index }:visible</link>
61+
<link name="visible">ns = ${ $.ns }, index = ${ $.index }:visible</link>
6262
</imports>
6363
</settings>
6464
</filterSelect>

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

+14-10
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ public function __construct(
4242
}
4343

4444
/**
45+
* Construct block
46+
*
4547
* @return void
4648
*/
4749
protected function _construct()
@@ -51,6 +53,14 @@ protected function _construct()
5153

5254
parent::_construct();
5355

56+
$this->buttonList->update('save', 'label', __('Save Attribute'));
57+
$this->buttonList->update('save', 'class', 'save primary');
58+
$this->buttonList->update(
59+
'save',
60+
'data_attribute',
61+
['mage-init' => ['button' => ['event' => 'save', 'target' => '#edit_form']]]
62+
);
63+
5464
if ($this->getRequest()->getParam('popup')) {
5565
$this->buttonList->remove('back');
5666
if ($this->getRequest()->getParam('product_tab') != 'variations') {
@@ -64,6 +74,8 @@ protected function _construct()
6474
100
6575
);
6676
}
77+
$this->buttonList->update('reset', 'level', 10);
78+
$this->buttonList->update('save', 'class', 'save action-secondary');
6779
} else {
6880
$this->addButton(
6981
'save_and_edit_button',
@@ -79,14 +91,6 @@ protected function _construct()
7991
);
8092
}
8193

82-
$this->buttonList->update('save', 'label', __('Save Attribute'));
83-
$this->buttonList->update('save', 'class', 'save primary');
84-
$this->buttonList->update(
85-
'save',
86-
'data_attribute',
87-
['mage-init' => ['button' => ['event' => 'save', 'target' => '#edit_form']]]
88-
);
89-
9094
$entityAttribute = $this->_coreRegistry->registry('entity_attribute');
9195
if (!$entityAttribute || !$entityAttribute->getIsUserDefined()) {
9296
$this->buttonList->remove('delete');
@@ -96,14 +100,14 @@ protected function _construct()
96100
}
97101

98102
/**
99-
* {@inheritdoc}
103+
* @inheritdoc
100104
*/
101105
public function addButton($buttonId, $data, $level = 0, $sortOrder = 0, $region = 'toolbar')
102106
{
103107
if ($this->getRequest()->getParam('popup')) {
104108
$region = 'header';
105109
}
106-
parent::addButton($buttonId, $data, $level, $sortOrder, $region);
110+
return parent::addButton($buttonId, $data, $level, $sortOrder, $region);
107111
}
108112

109113
/**

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ public function getIdentities()
367367
$identities[] = $item->getIdentities();
368368
}
369369
}
370-
$identities = array_merge(...$identities);
370+
$identities = array_merge([], ...$identities);
371371

372372
return $identities;
373373
}

app/code/Magento/Catalog/Block/Product/ProductList/Related.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ public function getItems()
143143
*/
144144
public function getIdentities()
145145
{
146-
$identities = [[]];
146+
$identities = [];
147147
foreach ($this->getItems() as $item) {
148148
$identities[] = $item->getIdentities();
149149
}
150-
return array_merge(...$identities);
150+
return array_merge([], ...$identities);
151151
}
152152

153153
/**

app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,10 @@ public function getItemLimit($type = '')
267267
*/
268268
public function getIdentities()
269269
{
270-
$identities = array_map(function (DataObject $item) {
271-
return $item->getIdentities();
272-
}, $this->getItems()) ?: [[]];
273-
274-
return array_merge(...$identities);
270+
$identities = [];
271+
foreach ($this->getItems() as $item) {
272+
$identities[] = $item->getIdentities();
273+
}
274+
return array_merge([], ...$identities);
275275
}
276276
}

app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php

+26-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212

1313
namespace Magento\Catalog\Block\Product\View\Options;
1414

15+
use Magento\Catalog\Pricing\Price\BasePrice;
16+
use Magento\Catalog\Pricing\Price\CalculateCustomOptionCatalogRule;
1517
use Magento\Catalog\Pricing\Price\CustomOptionPriceInterface;
18+
use Magento\Framework\App\ObjectManager;
1619

1720
/**
1821
* Product options section abstract block.
@@ -47,20 +50,29 @@ abstract class AbstractOptions extends \Magento\Framework\View\Element\Template
4750
*/
4851
protected $_catalogHelper;
4952

53+
/**
54+
* @var CalculateCustomOptionCatalogRule
55+
*/
56+
private $calculateCustomOptionCatalogRule;
57+
5058
/**
5159
* @param \Magento\Framework\View\Element\Template\Context $context
5260
* @param \Magento\Framework\Pricing\Helper\Data $pricingHelper
5361
* @param \Magento\Catalog\Helper\Data $catalogData
5462
* @param array $data
63+
* @param CalculateCustomOptionCatalogRule|null $calculateCustomOptionCatalogRule
5564
*/
5665
public function __construct(
5766
\Magento\Framework\View\Element\Template\Context $context,
5867
\Magento\Framework\Pricing\Helper\Data $pricingHelper,
5968
\Magento\Catalog\Helper\Data $catalogData,
60-
array $data = []
69+
array $data = [],
70+
CalculateCustomOptionCatalogRule $calculateCustomOptionCatalogRule = null
6171
) {
6272
$this->pricingHelper = $pricingHelper;
6373
$this->_catalogHelper = $catalogData;
74+
$this->calculateCustomOptionCatalogRule = $calculateCustomOptionCatalogRule
75+
?? ObjectManager::getInstance()->get(CalculateCustomOptionCatalogRule::class);
6476
parent::__construct($context, $data);
6577
}
6678

@@ -162,6 +174,19 @@ protected function _formatPrice($value, $flag = true)
162174
$priceStr = $sign;
163175

164176
$customOptionPrice = $this->getProduct()->getPriceInfo()->getPrice('custom_option_price');
177+
$isPercent = (bool) $value['is_percent'];
178+
179+
if (!$isPercent) {
180+
$catalogPriceValue = $this->calculateCustomOptionCatalogRule->execute(
181+
$this->getProduct(),
182+
(float)$value['pricing_value'],
183+
$isPercent
184+
);
185+
if ($catalogPriceValue !== null) {
186+
$value['pricing_value'] = $catalogPriceValue;
187+
}
188+
}
189+
165190
$context = [CustomOptionPriceInterface::CONFIGURATION_OPTION_FLAG => true];
166191
$optionAmount = $customOptionPrice->getCustomAmount($value['pricing_value'], null, $context);
167192
$priceStr .= $this->getLayout()->getBlock('product.price.render.default')->renderAmount(

0 commit comments

Comments
 (0)