Skip to content

Commit 86884b6

Browse files
committed
Merge remote-tracking branch 'upstream/2.4-develop' into B2B-1637
2 parents 0b3c5f1 + 49d4a2f commit 86884b6

File tree

102 files changed

+2831
-429
lines changed

Some content is hidden

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

102 files changed

+2831
-429
lines changed

.github/stale.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ staleLabel: "stale issue"
3939
# Comment to post when marking as stale. Set to `false` to disable
4040
markComment: >
4141
This issue has been automatically marked as stale because it has not had
42-
recent activity. It will be closed after 14 days if no further activity occurs. Thank you
43-
for your contributions.
42+
recent activity. It will be closed after 14 days if no further activity occurs.
43+
Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
44+
Thank you for your contributions!
4445
# Comment to post when removing the stale label.
4546
# unmarkComment: >
4647
# Your comment here.

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>

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/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
}

app/code/Magento/Bundle/Model/CartItemProcessor.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(
5151
}
5252

5353
/**
54-
* {@inheritdoc}
54+
* @inheritDoc
5555
*/
5656
public function convertToBuyRequest(CartItemInterface $cartItem)
5757
{
@@ -73,7 +73,7 @@ public function convertToBuyRequest(CartItemInterface $cartItem)
7373
}
7474

7575
/**
76-
* {@inheritdoc}
76+
* @inheritDoc
7777
* @SuppressWarnings(PHPMD.NPathComplexity)
7878
*/
7979
public function processOptions(CartItemInterface $cartItem)
@@ -84,19 +84,21 @@ public function processOptions(CartItemInterface $cartItem)
8484
$productOptions = [];
8585
$bundleOptions = $cartItem->getBuyRequest()->getBundleOption();
8686
$bundleOptionsQty = $cartItem->getBuyRequest()->getBundleOptionQty();
87+
$bundleOptionsQty = is_array($bundleOptionsQty) ? $bundleOptionsQty : [];
8788
if (is_array($bundleOptions)) {
8889
foreach ($bundleOptions as $optionId => $optionSelections) {
8990
if (empty($optionSelections)) {
9091
continue;
9192
}
9293
$optionSelections = is_array($optionSelections) ? $optionSelections : [$optionSelections];
93-
$optionQty = isset($bundleOptionsQty[$optionId]) ? $bundleOptionsQty[$optionId] : 1;
9494

9595
/** @var \Magento\Bundle\Api\Data\BundleOptionInterface $productOption */
9696
$productOption = $this->bundleOptionFactory->create();
9797
$productOption->setOptionId($optionId);
9898
$productOption->setOptionSelections($optionSelections);
99-
$productOption->setOptionQty($optionQty);
99+
if (isset($bundleOptionsQty[$optionId])) {
100+
$productOption->setOptionQty($bundleOptionsQty[$optionId]);
101+
}
100102
$productOptions[] = $productOption;
101103
}
102104

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ public function testGetJsonConfigFixedPriceBundleNoOption()
214214

215215
public function testGetJsonConfigFixedPriceBundle()
216216
{
217+
$optionId = 1;
218+
$optionQty = 2;
217219
$baseAmount = 123;
218220
$basePriceValue = 123123;
219221
$selections = [
@@ -230,7 +232,6 @@ public function testGetJsonConfigFixedPriceBundle()
230232
true
231233
)
232234
];
233-
234235
$bundleProductPrice = $this->getMockBuilder(Price::class)
235236
->disableOriginalConstructor()
236237
->setMethods(['getLowestPrice'])
@@ -246,10 +247,8 @@ public function testGetJsonConfigFixedPriceBundle()
246247
$this->bundleProductPriceFactory->expects($this->once())
247248
->method('create')
248249
->willReturn($bundleProductPrice);
250+
$options = [$this->createOption($optionId, 'Title `1', $selections)];
249251

250-
$options = [
251-
$this->createOption(1, 'Title `1', $selections),
252-
];
253252
$finalPriceMock = $this->getPriceMock(
254253
[
255254
'getPriceWithoutOption' => new DataObject(
@@ -289,7 +288,10 @@ public function testGetJsonConfigFixedPriceBundle()
289288
$preconfiguredValues = new DataObject(
290289
[
291290
'bundle_option' => [
292-
1 => 123123111,
291+
$optionId => [123123111],
292+
],
293+
'bundle_option_qty' => [
294+
$optionId => $optionQty,
293295
],
294296
]
295297
);
@@ -306,7 +308,8 @@ public function testGetJsonConfigFixedPriceBundle()
306308
$this->assertEquals(110, $jsonConfig['prices']['oldPrice']['amount']);
307309
$this->assertEquals(100, $jsonConfig['prices']['basePrice']['amount']);
308310
$this->assertEquals(100, $jsonConfig['prices']['finalPrice']['amount']);
309-
$this->assertEquals([1], $jsonConfig['positions']);
311+
$this->assertEquals([$optionId], $jsonConfig['positions']);
312+
$this->assertEquals($optionQty, $jsonConfig['options'][$optionId]['selections'][1123]['qty']);
310313
}
311314

312315
/**

app/code/Magento/Catalog/Test/Mftf/Test/AdminRequiredFieldsHaveRequiredFieldIndicatorTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
<!-- Verify that the CMS page have the required field name indicator next to Page Title -->
6161
<amOnPage url="{{CmsPagesPage.url}}" stepKey="amOnPagePagesGrid"/>
6262
<waitForPageLoad stepKey="waitForPageLoad1"/>
63-
<click selector="{{CmsPagesPageActionsSection.addNewPageButton}}" stepKey="clickAddNewPage"/>
63+
<actionGroup ref="AdminClickAddNewPageOnPagesGridActionGroup" stepKey="clickAddNewPage"/>
6464
<executeJS function="{{CmsNewPagePageBasicFieldsSection.RequiredFieldIndicator}}" stepKey="pageTitleRequiredFieldIndicator"/>
6565
<assertEquals message="pass" stepKey="assertRequiredFieldIndicator5">
6666
<actualResult type="variable">pageTitleRequiredFieldIndicator</actualResult>

app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateTopCategoryUrlWithNoRedirectTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@
7979
<see selector="{{AdminUrlRewriteIndexSection.gridCellByColumnRowNumber('1', 'Request Path')}}" userInput="$$createDefaultCategory.name$$/$$createTwoLevelNestedCategories.name$$/updatedurl.html" stepKey="seeTheRedirectPath"/>
8080

8181
<!-- Verify third level category's old URL path doesn't show redirect path-->
82-
<click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickOnResetButton1"/>
83-
<waitForPageLoad stepKey="waitForPageToLoad3"/>
82+
<actionGroup ref="AdminClearGridFiltersActionGroup" stepKey="clickOnResetButton1"/>
83+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageToLoad3"/>
8484

8585
<click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openUrlRewriteGridFilters1"/>
8686
<fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('request_path')}}" userInput="{{Three_nested_categories.name_lwr}}" stepKey="fillOldUrlInRedirectPathFilter"/>

app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateTopCategoryUrlWithRedirectTest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@
7777
<see selector="{{AdminUrlRewriteIndexSection.gridCellByColumnRowNumber('1', 'Request Path')}}" userInput="$$createDefaultCategory.name$$/$$createTwoLevelNestedCategories.name$$/updateredirecturl.html" stepKey="seeTheRedirectPath"/>
7878

7979
<!-- Verify third level category's Redirect path, Target Path and Redirect type for old URL -->
80-
<click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickOnResetButton1"/>
81-
<waitForPageLoad stepKey="waitForPageToLoad4"/>
80+
<actionGroup ref="AdminClearGridFiltersActionGroup" stepKey="clickOnResetButton1"/>
81+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageToLoad4"/>
8282
<click selector="{{AdminDataGridHeaderSection.filters}}" stepKey="openUrlRewriteGridFilters1"/>
8383
<fillField selector="{{AdminDataGridHeaderSection.filterFieldInput('request_path')}}" userInput="$$createThreeLevelNestedCategories.name$$" stepKey="fillOldUrlInRedirectPathFilter"/>
8484
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickOrderApplyFilters1"/>

0 commit comments

Comments
 (0)