Skip to content

Commit

Permalink
Merge branch '2.4-develop' into ref-AdminMassOrdersUpdateCancelPendin…
Browse files Browse the repository at this point in the history
…gOrderTest
  • Loading branch information
Gabriel da Gama authored Jan 25, 2021
2 parents 7aea8c5 + c9242e8 commit 7befff5
Show file tree
Hide file tree
Showing 389 changed files with 11,407 additions and 1,437 deletions.
5 changes: 3 additions & 2 deletions .github/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ staleLabel: "stale issue"
# Comment to post when marking as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed after 14 days if no further activity occurs. Thank you
for your contributions.
recent activity. It will be closed after 14 days if no further activity occurs.
Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
Thank you for your contributions!
# Comment to post when removing the stale label.
# unmarkComment: >
# Your comment here.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AwsS3AdminImportSimpleAndConfigurableProductsWithAssignedImagesTest" extends="AdminImportSimpleAndConfigurableProductsWithAssignedImagesTest">
<annotations>
<features value="AwsS3"/>
<stories value="Import Products"/>
<title value="S3 - Import Configurable Product With Simple Child Products With Images"/>
<description value="Imports a .csv file containing a configurable product with 3 child simple products that
have images. Verifies that products are imported successfully and that the images are attached to the
products as expected."/>
<severity value="MAJOR"/>
<group value="importExport"/>
<group value="remote_storage_aws_s3"/>
<skip>
<issueId value="MC-39280"/>
</skip>
</annotations>

<before>
<!-- Enable AWS S3 Remote Storage -->
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.enable_options}}" stepKey="enableRemoteStorage"/>
</before>

<after>
<!-- Disable AWS S3 Remote Storage -->
<magentoCLI command="setup:config:set {{RemoteStorageAwsS3ConfigData.disable_options}}" stepKey="disableRemoteStorage"/>
</after>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ protected function _redirectIfNeededAfterLogin(\Magento\Framework\App\RequestInt

// Checks, whether secret key is required for admin access or request uri is explicitly set
if ($this->_url->useSecretKey()) {
$requestUri = $this->_url->getUrl('*/*/*', ['_current' => true]);
$requestParts = explode('/', trim($request->getRequestUri(), '/'), 2);
$requestUri = $this->_url->getUrl(array_pop($requestParts));
} elseif ($request) {
$requestUri = $request->getRequestUri();
}
Expand Down
7 changes: 3 additions & 4 deletions app/code/Magento/Backend/Controller/Adminhtml/Auth/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,10 @@ public function execute()
}

$requestUrl = $this->getRequest()->getUri();
$backendUrl = $this->getUrl('*');
// redirect according to rewrite rule
if ($requestUrl != $backendUrl) {
return $this->getRedirect($backendUrl);
if (!$requestUrl->isValid()) {
return $this->getRedirect($this->getUrl('*'));
}

return $this->resultPageFactory->create();
}

Expand Down
39 changes: 27 additions & 12 deletions app/code/Magento/Backend/Controller/Adminhtml/System/Store/Save.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
namespace Magento\Backend\Controller\Adminhtml\System\Store;

use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface;
use Magento\Store\Model\Group as StoreGroup;
use Magento\Store\Model\Store;
use Magento\Framework\Exception\LocalizedException;

/**
* Class Save
Expand All @@ -33,6 +36,17 @@ private function processWebsiteSave($postData)
$websiteModel->setId(null);
}

$groupModel = $this->_objectManager->create(StoreGroup::class);
$groupModel->load($websiteModel->getDefaultGroupId());
$storeModel = $this->_objectManager->create(Store::class);
$storeModel->load($groupModel->getDefaultStoreId());

if ($websiteModel->getIsDefault() && !$storeModel->isActive()) {
throw new LocalizedException(
__('Please enable your Store View before using this Web Site as Default')
);
}

$websiteModel->save();
$this->messageManager->addSuccessMessage(__('You saved the website.'));

Expand All @@ -43,13 +57,13 @@ private function processWebsiteSave($postData)
* Process Store model save
*
* @param array $postData
* @throws \Magento\Framework\Exception\LocalizedException
* @throws LocalizedException
* @return array
*/
private function processStoreSave($postData)
{
/** @var \Magento\Store\Model\Store $storeModel */
$storeModel = $this->_objectManager->create(\Magento\Store\Model\Store::class);
/** @var Store $storeModel */
$storeModel = $this->_objectManager->create(Store::class);
$postData['store']['name'] = $this->filterManager->removeTags($postData['store']['name']);
if ($postData['store']['store_id']) {
$storeModel->load($postData['store']['store_id']);
Expand All @@ -59,13 +73,13 @@ private function processStoreSave($postData)
$storeModel->setId(null);
}
$groupModel = $this->_objectManager->create(
\Magento\Store\Model\Group::class
StoreGroup::class
)->load(
$storeModel->getGroupId()
);
$storeModel->setWebsiteId($groupModel->getWebsiteId());
if (!$storeModel->isActive() && $storeModel->isDefault()) {
throw new \Magento\Framework\Exception\LocalizedException(
throw new LocalizedException(
__('The default store cannot be disabled')
);
}
Expand All @@ -79,14 +93,14 @@ private function processStoreSave($postData)
* Process StoreGroup model save
*
* @param array $postData
* @throws \Magento\Framework\Exception\LocalizedException
* @throws LocalizedException
* @return array
*/
private function processGroupSave($postData)
{
$postData['group']['name'] = $this->filterManager->removeTags($postData['group']['name']);
/** @var \Magento\Store\Model\Group $groupModel */
$groupModel = $this->_objectManager->create(\Magento\Store\Model\Group::class);
/** @var StoreGroup $groupModel */
$groupModel = $this->_objectManager->create(StoreGroup::class);
if ($postData['group']['group_id']) {
$groupModel->load($postData['group']['group_id']);
}
Expand All @@ -95,10 +109,11 @@ private function processGroupSave($postData)
$groupModel->setId(null);
}
if (!$this->isSelectedDefaultStoreActive($postData, $groupModel)) {
throw new \Magento\Framework\Exception\LocalizedException(
throw new LocalizedException(
__('An inactive store view cannot be saved as default store view')
);
}

$groupModel->save();
$this->messageManager->addSuccessMessage(__('You saved the store.'));

Expand Down Expand Up @@ -135,7 +150,7 @@ public function execute()
}
$redirectResult->setPath('adminhtml/*/');
return $redirectResult;
} catch (\Magento\Framework\Exception\LocalizedException $e) {
} catch (LocalizedException $e) {
$this->messageManager->addErrorMessage($e->getMessage());
$this->_getSession()->setPostData($postData);
} catch (\Exception $e) {
Expand All @@ -156,10 +171,10 @@ public function execute()
* Verify if selected default store is active
*
* @param array $postData
* @param \Magento\Store\Model\Group $groupModel
* @param StoreGroup $groupModel
* @return bool
*/
private function isSelectedDefaultStoreActive(array $postData, \Magento\Store\Model\Group $groupModel)
private function isSelectedDefaultStoreActive(array $postData, StoreGroup $groupModel)
{
if (!empty($postData['group']['default_store_id'])) {
$defaultStoreId = $postData['group']['default_store_id'];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminClearGridFiltersActionGroup">
<annotations>
<description>Click the Clear filters on the grid.</description>
</annotations>

<click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clickClearFilters"/>
<waitForPageLoad stepKey="waitForPageLoaded"/>
</actionGroup>
</actionGroups>
1 change: 1 addition & 0 deletions app/code/Magento/Backend/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ System,System
"All Stores","All Stores"
"You saved the website.","You saved the website."
"The default store cannot be disabled","The default store cannot be disabled"
"Please enable your Store View before using this Web Site as Default","Please enable your Store View before using this Web Site as Default"
"You saved the store view.","You saved the store view."
"An inactive store view cannot be saved as default store view","An inactive store view cannot be saved as default store view"
"You saved the store.","You saved the store."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,6 @@ public function getJsonConfig()
$configValue = $preConfiguredValues->getData('bundle_option/' . $optionId);
if ($configValue) {
$defaultValues[$optionId] = $configValue;
$configQty = $preConfiguredValues->getData('bundle_option_qty/' . $optionId);
if ($configQty) {
$options[$optionId]['selections'][$configValue]['qty'] = $configQty;
}
}
$options = $this->processOptions($optionId, $options, $preConfiguredValues);
}
Expand Down
10 changes: 6 additions & 4 deletions app/code/Magento/Bundle/Model/CartItemProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritDoc
*/
public function convertToBuyRequest(CartItemInterface $cartItem)
{
Expand All @@ -73,7 +73,7 @@ public function convertToBuyRequest(CartItemInterface $cartItem)
}

/**
* {@inheritdoc}
* @inheritDoc
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function processOptions(CartItemInterface $cartItem)
Expand All @@ -84,19 +84,21 @@ public function processOptions(CartItemInterface $cartItem)
$productOptions = [];
$bundleOptions = $cartItem->getBuyRequest()->getBundleOption();
$bundleOptionsQty = $cartItem->getBuyRequest()->getBundleOptionQty();
$bundleOptionsQty = is_array($bundleOptionsQty) ? $bundleOptionsQty : [];
if (is_array($bundleOptions)) {
foreach ($bundleOptions as $optionId => $optionSelections) {
if (empty($optionSelections)) {
continue;
}
$optionSelections = is_array($optionSelections) ? $optionSelections : [$optionSelections];
$optionQty = isset($bundleOptionsQty[$optionId]) ? $bundleOptionsQty[$optionId] : 1;

/** @var \Magento\Bundle\Api\Data\BundleOptionInterface $productOption */
$productOption = $this->bundleOptionFactory->create();
$productOption->setOptionId($optionId);
$productOption->setOptionSelections($optionSelections);
$productOption->setOptionQty($optionQty);
if (isset($bundleOptionsQty[$optionId])) {
$productOption->setOptionQty($bundleOptionsQty[$optionId]);
}
$productOptions[] = $productOption;
}

Expand Down
Loading

0 comments on commit 7befff5

Please sign in to comment.