Skip to content

Commit de1ccb8

Browse files
committed
Merge remote-tracking branch 'origin/2.4-develop' into MC-38927
2 parents c11b859 + 3fef6d1 commit de1ccb8

File tree

607 files changed

+13626
-2115
lines changed

Some content is hidden

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

607 files changed

+13626
-2115
lines changed

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@ indent_size = 2
1616

1717
[{composer, auth}.json]
1818
indent_size = 4
19+
20+
[db_schema_whitelist.json]
21+
indent_size = 4
22+
trim_trailing_whitespace = false

app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,8 @@ private function fetchTierPrices(array $productIds): array
486486
)
487487
->where(
488488
'ap.' . $productEntityLinkField . ' IN (?)',
489-
$productIds
489+
$productIds,
490+
\Zend_Db::INT_TYPE
490491
);
491492

492493
if ($priceFromFilter !== null) {

app/code/Magento/Backend/App/Area/FrontNameResolver.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,13 @@ public function isHostBackend()
123123
if ($this->scopeConfig->getValue(self::XML_PATH_USE_CUSTOM_ADMIN_URL, ScopeInterface::SCOPE_STORE)) {
124124
$backendUrl = $this->scopeConfig->getValue(self::XML_PATH_CUSTOM_ADMIN_URL, ScopeInterface::SCOPE_STORE);
125125
} else {
126-
$backendUrl = $this->scopeConfig->getValue(Store::XML_PATH_UNSECURE_BASE_URL, ScopeInterface::SCOPE_STORE);
126+
$backendUrl = $this->config->getValue(Store::XML_PATH_UNSECURE_BASE_URL);
127+
if ($backendUrl === null) {
128+
$backendUrl = $this->scopeConfig->getValue(
129+
Store::XML_PATH_UNSECURE_BASE_URL,
130+
ScopeInterface::SCOPE_STORE
131+
);
132+
}
127133
}
128134
$host = $this->request->getServer('HTTP_HOST', '');
129135
return stripos($this->getHostWithPort($backendUrl), (string) $host) !== false;

app/code/Magento/Backend/Block/Widget/Button.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
*/
66
namespace Magento\Backend\Block\Widget;
77

8+
use Magento\Backend\Block\Template\Context;
89
use Magento\Framework\App\ObjectManager;
910
use Magento\Framework\Math\Random;
10-
use Magento\Backend\Block\Template\Context;
1111
use Magento\Framework\View\Helper\SecureHtmlRenderer;
1212

1313
/**
@@ -125,6 +125,9 @@ protected function _prepareAttributes($title, $classes, $disabled)
125125
'value' => $this->getValue(),
126126
'disabled' => $disabled,
127127
];
128+
if ($this->hasData('onclick_attribute')) {
129+
$attributes['onclick'] = $this->getData('onclick_attribute');
130+
}
128131
if ($this->hasData('backend_button_widget_hook_id')) {
129132
$attributes['backend-button-widget-hook-id'] = $this->getData('backend_button_widget_hook_id');
130133
}

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

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
namespace Magento\Backend\Controller\Adminhtml\System\Store;
88

99
use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface;
10+
use Magento\Store\Model\Group as StoreGroup;
11+
use Magento\Store\Model\Store;
12+
use Magento\Framework\Exception\LocalizedException;
1013

1114
/**
1215
* Class Save
@@ -33,6 +36,17 @@ private function processWebsiteSave($postData)
3336
$websiteModel->setId(null);
3437
}
3538

39+
$groupModel = $this->_objectManager->create(StoreGroup::class);
40+
$groupModel->load($websiteModel->getDefaultGroupId());
41+
$storeModel = $this->_objectManager->create(Store::class);
42+
$storeModel->load($groupModel->getDefaultStoreId());
43+
44+
if ($websiteModel->getIsDefault() && !$storeModel->isActive()) {
45+
throw new LocalizedException(
46+
__('Please enable your Store View before using this Web Site as Default')
47+
);
48+
}
49+
3650
$websiteModel->save();
3751
$this->messageManager->addSuccessMessage(__('You saved the website.'));
3852

@@ -43,13 +57,13 @@ private function processWebsiteSave($postData)
4357
* Process Store model save
4458
*
4559
* @param array $postData
46-
* @throws \Magento\Framework\Exception\LocalizedException
60+
* @throws LocalizedException
4761
* @return array
4862
*/
4963
private function processStoreSave($postData)
5064
{
51-
/** @var \Magento\Store\Model\Store $storeModel */
52-
$storeModel = $this->_objectManager->create(\Magento\Store\Model\Store::class);
65+
/** @var Store $storeModel */
66+
$storeModel = $this->_objectManager->create(Store::class);
5367
$postData['store']['name'] = $this->filterManager->removeTags($postData['store']['name']);
5468
if ($postData['store']['store_id']) {
5569
$storeModel->load($postData['store']['store_id']);
@@ -59,13 +73,13 @@ private function processStoreSave($postData)
5973
$storeModel->setId(null);
6074
}
6175
$groupModel = $this->_objectManager->create(
62-
\Magento\Store\Model\Group::class
76+
StoreGroup::class
6377
)->load(
6478
$storeModel->getGroupId()
6579
);
6680
$storeModel->setWebsiteId($groupModel->getWebsiteId());
6781
if (!$storeModel->isActive() && $storeModel->isDefault()) {
68-
throw new \Magento\Framework\Exception\LocalizedException(
82+
throw new LocalizedException(
6983
__('The default store cannot be disabled')
7084
);
7185
}
@@ -79,14 +93,14 @@ private function processStoreSave($postData)
7993
* Process StoreGroup model save
8094
*
8195
* @param array $postData
82-
* @throws \Magento\Framework\Exception\LocalizedException
96+
* @throws LocalizedException
8397
* @return array
8498
*/
8599
private function processGroupSave($postData)
86100
{
87101
$postData['group']['name'] = $this->filterManager->removeTags($postData['group']['name']);
88-
/** @var \Magento\Store\Model\Group $groupModel */
89-
$groupModel = $this->_objectManager->create(\Magento\Store\Model\Group::class);
102+
/** @var StoreGroup $groupModel */
103+
$groupModel = $this->_objectManager->create(StoreGroup::class);
90104
if ($postData['group']['group_id']) {
91105
$groupModel->load($postData['group']['group_id']);
92106
}
@@ -95,10 +109,11 @@ private function processGroupSave($postData)
95109
$groupModel->setId(null);
96110
}
97111
if (!$this->isSelectedDefaultStoreActive($postData, $groupModel)) {
98-
throw new \Magento\Framework\Exception\LocalizedException(
112+
throw new LocalizedException(
99113
__('An inactive store view cannot be saved as default store view')
100114
);
101115
}
116+
102117
$groupModel->save();
103118
$this->messageManager->addSuccessMessage(__('You saved the store.'));
104119

@@ -135,7 +150,7 @@ public function execute()
135150
}
136151
$redirectResult->setPath('adminhtml/*/');
137152
return $redirectResult;
138-
} catch (\Magento\Framework\Exception\LocalizedException $e) {
153+
} catch (LocalizedException $e) {
139154
$this->messageManager->addErrorMessage($e->getMessage());
140155
$this->_getSession()->setPostData($postData);
141156
} catch (\Exception $e) {
@@ -156,10 +171,10 @@ public function execute()
156171
* Verify if selected default store is active
157172
*
158173
* @param array $postData
159-
* @param \Magento\Store\Model\Group $groupModel
174+
* @param StoreGroup $groupModel
160175
* @return bool
161176
*/
162-
private function isSelectedDefaultStoreActive(array $postData, \Magento\Store\Model\Group $groupModel)
177+
private function isSelectedDefaultStoreActive(array $postData, StoreGroup $groupModel)
163178
{
164179
if (!empty($postData['group']['default_store_id'])) {
165180
$defaultStoreId = $postData['group']['default_store_id'];
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminClearGridFiltersActionGroup">
12+
<annotations>
13+
<description>Click the Clear filters on the grid.</description>
14+
</annotations>
15+
16+
<click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters"/>
17+
<waitForPageLoad stepKey="waitForPageLoaded"/>
18+
</actionGroup>
19+
</actionGroups>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertLinkActionGroup">
12+
<annotations>
13+
<description>Assert text and url of the links.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="text" type="string"/>
17+
<argument name="url" type="string"/>
18+
</arguments>
19+
20+
<seeLink userInput="{{text}}" url="{{url}}" stepKey="assertLinks"/>
21+
</actionGroup>
22+
</actionGroups>

app/code/Magento/Backend/Test/Mftf/Test/AdminPrivacyPolicyTest.xml

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,70 +23,91 @@
2323
<!-- Logging in Magento admin and checking for Privacy policy footer in dashboard -->
2424
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
2525
<closeAdminNotification stepKey="closeAdminNotification"/>
26-
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkDashboard"/>
27-
26+
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkDashboard">
27+
<argument name="text" value="Privacy Policy"/>
28+
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
29+
</actionGroup>
2830
<!-- Checking for Privacy policy footer in salesOrderPage -->
2931
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSalesOrder">
3032
<argument name="menuUiId" value="magento-sales-sales"/>
3133
<argument name="submenuUiId" value="magento-sales-sales-order"/>
3234
</actionGroup>
33-
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkSalesOrder"/>
34-
35+
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkSalesOrder">
36+
<argument name="text" value="Privacy Policy"/>
37+
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
38+
</actionGroup>
3539
<!-- Checking for Privacy policy footer in catalogProductsPage -->
3640
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToCatalogProducts">
3741
<argument name="menuUiId" value="magento-catalog-catalog"/>
3842
<argument name="submenuUiId" value="magento-catalog-catalog-products"/>
3943
</actionGroup>
40-
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkCatalogProducts"/>
41-
44+
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkCatalogProducts">
45+
<argument name="text" value="Privacy Policy"/>
46+
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
47+
</actionGroup>
4248
<!-- Checking for Privacy policy footer in customersAllCustomersPage -->
4349
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToCustomersAllCustomers">
4450
<argument name="menuUiId" value="magento-customer-customer"/>
4551
<argument name="submenuUiId" value="magento-customer-customer-manage"/>
4652
</actionGroup>
47-
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkCustomersAllCustomers"/>
48-
53+
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkCustomersAllCustomers">
54+
<argument name="text" value="Privacy Policy"/>
55+
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
56+
</actionGroup>
4957
<!-- Checking for Privacy policy footer in marketingCatalogPriceRulePage -->
5058
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToMarketingCatalogPriceRule">
5159
<argument name="menuUiId" value="magento-backend-marketing"/>
5260
<argument name="submenuUiId" value="magento-catalogrule-promo-catalog"/>
5361
</actionGroup>
54-
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkMarketingCatalogPriceRule"/>
55-
62+
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkMarketingCatalogPriceRule">
63+
<argument name="text" value="Privacy Policy"/>
64+
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
65+
</actionGroup>
5666
<!-- Checking for Privacy policy footer in contentBlocksPage -->
5767
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToContentBlocks">
5868
<argument name="menuUiId" value="magento-backend-content"/>
5969
<argument name="submenuUiId" value="magento-cms-cms-block"/>
6070
</actionGroup>
61-
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkContentBlocks"/>
62-
71+
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkContentBlocks">
72+
<argument name="text" value="Privacy Policy"/>
73+
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
74+
</actionGroup>
6375
<!-- Checking for Privacy policy footer in reportSearcbTermsPage -->
6476
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsSearchTerms">
6577
<argument name="menuUiId" value="magento-reports-report"/>
6678
<argument name="submenuUiId" value="magento-search-report-search-term"/>
6779
</actionGroup>
68-
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkReportsSearchTerms"/>
69-
80+
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkReportsSearchTerms">
81+
<argument name="text" value="Privacy Policy"/>
82+
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
83+
</actionGroup>
7084
<!-- Checking for Privacy policy footer in storesAllStoresPage -->
7185
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToStoresAllStores">
7286
<argument name="menuUiId" value="magento-backend-stores"/>
7387
<argument name="submenuUiId" value="magento-backend-system-store"/>
7488
</actionGroup>
75-
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkStoresAllStores"/>
76-
89+
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkStoresAllStores">
90+
<argument name="text" value="Privacy Policy"/>
91+
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
92+
</actionGroup>
7793
<!-- Checking for Privacy policy footer in systemImportPage -->
7894
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSystemImport">
7995
<argument name="menuUiId" value="magento-backend-system"/>
8096
<argument name="submenuUiId" value="magento-importexport-system-convert-import"/>
8197
</actionGroup>
82-
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkSystemImport"/>
83-
98+
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkSystemImport">
99+
<argument name="text" value="Privacy Policy"/>
100+
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
101+
</actionGroup>
84102
<!-- Checking for Privacy policy footer in findPartnersAndExtensionsPage -->
85103
<actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToFindPartnersAndExtensions">
86104
<argument name="menuUiId" value="magento-marketplace-partners"/>
87105
<argument name="submenuUiId" value="magento-marketplace-partners"/>
88106
</actionGroup>
89-
<seeLink userInput="Privacy Policy" url="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf" stepKey="seePrivacyPolicyLinkFindPartnersAndExtensions"/>
107+
<actionGroup ref="AssertLinkActionGroup" stepKey="seePrivacyPolicyLinkFindPartnersAndExtensions">
108+
<argument name="text" value="Privacy Policy"/>
109+
<argument name="url" value="https://magento.com/sites/default/files/REVISED-MAGENTO-PRIVACY-POLICY.pdf"/>
110+
</actionGroup>
90111
</test>
91112
</tests>
92113

app/code/Magento/Backend/Test/Unit/Block/Widget/ButtonTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,16 @@ public function getAttributesHtmlDataProvider()
9494
]
9595
];
9696
}
97+
98+
/**
99+
* Verifies ability of adding button onclick attribute
100+
*
101+
* @return void
102+
*/
103+
public function testOnClickAttribute(): void
104+
{
105+
$this->_blockMock->setData(['onclick_attribute' => 'value']);
106+
$attributes = $this->_blockMock->getAttributesHtml();
107+
$this->assertStringContainsString('onclick', $attributes);
108+
}
97109
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ System,System
198198
"All Stores","All Stores"
199199
"You saved the website.","You saved the website."
200200
"The default store cannot be disabled","The default store cannot be disabled"
201+
"Please enable your Store View before using this Web Site as Default","Please enable your Store View before using this Web Site as Default"
201202
"You saved the store view.","You saved the store view."
202203
"An inactive store view cannot be saved as default store view","An inactive store view cannot be saved as default store view"
203204
"You saved the store.","You saved the store."

app/code/Magento/Backend/view/adminhtml/templates/widget/grid/extended.phtml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
* getPagerVisibility()
1515
* getVarNamePage()
1616
*/
17-
$numColumns = count($block->getColumns());
1817

1918
/**
2019
* @var \Magento\Backend\Block\Widget\Grid\Extended $block
2120
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
2221
*/
22+
$numColumns = count($block->getColumns());
23+
2324
?>
2425
<?php if ($block->getCollection()): ?>
2526
<?php if ($block->canDisplayContainer()): ?>
@@ -285,7 +286,9 @@ $numColumns = count($block->getColumns());
285286
</table>
286287

287288
</div>
289+
<?php if ($block->canDisplayContainer()): ?>
288290
</div>
291+
<?php endif; ?>
289292
<?php
290293
/** @var \Magento\Framework\Json\Helper\Data $jsonHelper */
291294
$jsonHelper = $block->getData('jsonHelper');

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,6 @@ public function getJsonConfig()
184184
$configValue = $preConfiguredValues->getData('bundle_option/' . $optionId);
185185
if ($configValue) {
186186
$defaultValues[$optionId] = $configValue;
187-
$configQty = $preConfiguredValues->getData('bundle_option_qty/' . $optionId);
188-
if ($configQty) {
189-
$options[$optionId]['selections'][$configValue]['qty'] = $configQty;
190-
}
191187
}
192188
$options = $this->processOptions($optionId, $options, $preConfiguredValues);
193189
}

0 commit comments

Comments
 (0)