Skip to content

Commit 5bc151b

Browse files
authored
Merge branch '2.4-develop' into feature/wishlist-graphql-258
2 parents f1d13b7 + dc14e50 commit 5bc151b

File tree

34 files changed

+1327
-624
lines changed

34 files changed

+1327
-624
lines changed

app/code/Magento/Catalog/Model/Product/SalabilityChecker.php

Lines changed: 0 additions & 57 deletions
This file was deleted.

app/code/Magento/Catalog/Model/ResourceModel/Product/CategoryLink.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ private function processCategoryLinks($newCategoryPositions, &$oldCategoryPositi
147147
* @param bool $insert
148148
* @return array
149149
*/
150-
private function updateCategoryLinks(ProductInterface $product, array $insertLinks, $insert = false)
150+
public function updateCategoryLinks(ProductInterface $product, array $insertLinks, $insert = false)
151151
{
152152
if (empty($insertLinks)) {
153153
return [];

app/code/Magento/CatalogImportExport/Model/Import/Product/LinkProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ public function saveLinks(
8989
$resource = $this->linkFactory->create();
9090
$mainTable = $resource->getMainTable();
9191
$positionAttrId = [];
92-
$nextLinkId = $this->resourceHelper->getNextAutoincrement($mainTable);
9392

9493
// pre-load 'position' attributes ID for each link type once
9594
foreach ($this->linkNameToId as $linkId) {
@@ -103,6 +102,7 @@ public function saveLinks(
103102
$positionAttrId[$linkId] = $importEntity->getConnection()->fetchOne($select, $bind);
104103
}
105104
while ($bunch = $dataSourceModel->getNextBunch()) {
105+
$nextLinkId = $this->resourceHelper->getNextAutoincrement($mainTable);
106106
$this->processLinkBunches($importEntity, $linkField, $bunch, $resource, $nextLinkId, $positionAttrId);
107107
}
108108
}

app/code/Magento/Cms/Test/Mftf/Section/TinyMCESection/WidgetSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
<element name="PageSize" type="input" selector="input[name='parameters[page_size]']"/>
3939
<element name="ProductAttribute" type="multiselect" selector="select[name='parameters[show_attributes][]']"/>
4040
<element name="ButtonToShow" type="multiselect" selector="select[name='parameters[show_buttons][]']"/>
41+
<element name="InputAnchorCustomText" type="input" selector="input[name='parameters[anchor_text]']"/>
42+
<element name="InputAnchorCustomTitle" type="input" selector="input[name='parameters[title]']"/>
4143
<!--Compare on Storefront-->
4244
<element name="ProductName" type="text" selector=".product.name.product-item-name"/>
4345
<element name="CompareBtn" type="button" selector=".action.tocompare"/>

app/code/Magento/Config/Model/Config.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ public function save()
208208
);
209209

210210
$groupChangedPaths = $this->getChangedPaths($sectionId, $groupId, $groupData, $oldConfig, $extraOldGroups);
211+
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
211212
$changedPaths = \array_merge($changedPaths, $groupChangedPaths);
212213
}
213214

@@ -370,6 +371,7 @@ private function getChangedPaths(
370371
$oldConfig,
371372
$extraOldGroups
372373
);
374+
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
373375
$changedPaths = \array_merge($changedPaths, $subGroupChangedPaths);
374376
}
375377
}
@@ -435,11 +437,11 @@ protected function _processGroup(
435437
if (!isset($fieldData['value'])) {
436438
$fieldData['value'] = null;
437439
}
438-
440+
439441
if ($field->getType() == 'multiline' && is_array($fieldData['value'])) {
440442
$fieldData['value'] = trim(implode(PHP_EOL, $fieldData['value']));
441443
}
442-
444+
443445
$data = [
444446
'field' => $fieldId,
445447
'groups' => $groups,
@@ -453,7 +455,7 @@ protected function _processGroup(
453455
$backendModel->addData($data);
454456
$this->_checkSingleStoreMode($field, $backendModel);
455457

456-
$path = $this->getFieldPath($field, $fieldId, $extraOldGroups, $oldConfig);
458+
$path = $this->getFieldPath($field, $fieldId, $oldConfig, $extraOldGroups);
457459
$backendModel->setPath($path)->setValue($fieldData['value']);
458460

459461
$inherit = !empty($fieldData['inherit']);
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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\ConfigurableProduct\Block\DataProviders;
9+
10+
use Magento\Framework\AuthorizationInterface;
11+
use Magento\Framework\View\Element\Block\ArgumentInterface;
12+
13+
/**
14+
* Provides permissions data into template.
15+
*/
16+
class PermissionsData implements ArgumentInterface
17+
{
18+
/**
19+
* @var AuthorizationInterface
20+
*/
21+
private $authorization;
22+
23+
/**
24+
* Constructor
25+
*
26+
* @param AuthorizationInterface $authorization
27+
*/
28+
public function __construct(AuthorizationInterface $authorization)
29+
{
30+
$this->authorization = $authorization;
31+
}
32+
33+
/**
34+
* Check that user is allowed to manage attributes
35+
*
36+
* @return bool
37+
*/
38+
public function isAllowedToManageAttributes(): bool
39+
{
40+
return $this->authorization->isAllowed('Magento_Catalog::attributes_attributes');
41+
}
42+
}

app/code/Magento/ConfigurableProduct/view/adminhtml/layout/catalog_product_wizard.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
<item name="modal" xsi:type="string">configurableModal</item>
4949
<item name="dataScope" xsi:type="string">productFormConfigurable</item>
5050
</argument>
51+
<argument name="permissions" xsi:type="object">Magento\ConfigurableProduct\Block\DataProviders\PermissionsData</argument>
5152
</arguments>
5253
</block>
5354
<block class="Magento\ConfigurableProduct\Block\Adminhtml\Product\Steps\Bulk" name="step3" template="Magento_ConfigurableProduct::catalog/product/edit/attribute/steps/bulk.phtml">

app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/attribute/steps/attributes_values.phtml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@
55
*/
66

77
/* @var $block \Magento\ConfigurableProduct\Block\Adminhtml\Product\Steps\AttributeValues */
8+
$isAllowedToManageAttributes = $block->getPermissions()->isAllowedToManageAttributes();
9+
$attributesUrl = $block->getUrl('catalog/product_attribute/getAttributes');
10+
$optionsUrl = $block->getUrl('catalog/product_attribute/createOptions');
811
?>
912
<div data-bind="scope: '<?= /* @noEscape */ $block->getComponentName() ?>'">
1013
<h2 class="steps-wizard-title"><?= $block->escapeHtml(
1114
__('Step 2: Attribute Values')
1215
); ?></h2>
1316
<div class="steps-wizard-info">
1417
<span><?= $block->escapeHtml(
15-
__('Select values from each attribute to include in this product. Each unique combination of values creates a unique product SKU.')
18+
__('Select values from each attribute to include in this product. ' .
19+
'Each unique combination of values creates a unique product SKU.')
1620
);?></span>
1721
</div>
1822
<div data-bind="foreach: attributes, sortableList: attributes">
@@ -72,7 +76,8 @@
7276
<label data-bind="text: label, visible: label, attr:{for:id}"
7377
class="admin__field-label"></label>
7478
</div>
75-
<div class="admin__field admin__field-create-new" data-bind="attr:{'data-role':id}, visible: !label">
79+
<div class="admin__field admin__field-create-new"
80+
data-bind="attr:{'data-role':id}, visible: !label">
7681
<div class="admin__field-control">
7782
<input class="admin__control-text"
7883
name="label"
@@ -101,14 +106,14 @@
101106
</li>
102107
</ul>
103108
</fieldset>
104-
<button class="action-create-new action-tertiary"
105-
type="button"
106-
data-action="addOption"
107-
data-bind="click: $parent.createOption, visible: canCreateOption">
108-
<span><?= $block->escapeHtml(
109-
__('Create New Value')
110-
); ?></span>
111-
</button>
109+
<?php if ($isAllowedToManageAttributes): ?>
110+
<button class="action-create-new action-tertiary"
111+
type="button"
112+
data-action="addOption"
113+
data-bind="click: $parent.createOption, visible: canCreateOption">
114+
<span><?= $block->escapeHtml(__('Create New Value')); ?></span>
115+
</button>
116+
<?php endif; ?>
112117
</div>
113118
</div>
114119
</div>
@@ -120,8 +125,8 @@
120125
"<?= /* @noEscape */ $block->getComponentName() ?>": {
121126
"component": "Magento_ConfigurableProduct/js/variations/steps/attributes_values",
122127
"appendTo": "<?= /* @noEscape */ $block->getParentComponentName() ?>",
123-
"optionsUrl": "<?= /* @noEscape */ $block->getUrl('catalog/product_attribute/getAttributes') ?>",
124-
"createOptionsUrl": "<?= /* @noEscape */ $block->getUrl('catalog/product_attribute/createOptions') ?>"
128+
"optionsUrl": "<?= /* @noEscape */ $attributesUrl ?>",
129+
"createOptionsUrl": "<?= /* @noEscape */ $optionsUrl ?>"
125130
}
126131
}
127132
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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\Customer\Observer;
9+
10+
use Magento\Framework\Api\SearchCriteriaBuilder;
11+
use Magento\Framework\Event\Observer;
12+
use Magento\Framework\Event\ObserverInterface;
13+
use Magento\Sales\Api\Data\OrderInterface;
14+
use Magento\Sales\Api\OrderRepositoryInterface;
15+
use Magento\Sales\Model\ResourceModel\Order\Collection;
16+
use Magento\Customer\Model\Data\Customer;
17+
18+
/**
19+
* Class observer UpgradeOrderCustomerEmailObserver
20+
* Update orders customer email after corresponding customer email changed
21+
*/
22+
class UpgradeOrderCustomerEmailObserver implements ObserverInterface
23+
{
24+
/**
25+
* @var OrderRepositoryInterface
26+
*/
27+
private $orderRepository;
28+
29+
/**
30+
* @var SearchCriteriaBuilder
31+
*/
32+
private $searchCriteriaBuilder;
33+
34+
/**
35+
* @param OrderRepositoryInterface $orderRepository
36+
* @param SearchCriteriaBuilder $searchCriteriaBuilder
37+
*/
38+
public function __construct(
39+
OrderRepositoryInterface $orderRepository,
40+
SearchCriteriaBuilder $searchCriteriaBuilder
41+
) {
42+
$this->orderRepository = $orderRepository;
43+
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
44+
}
45+
46+
/**
47+
* Upgrade order customer email when customer has changed email
48+
*
49+
* @param Observer $observer
50+
* @return void
51+
*/
52+
public function execute(Observer $observer): void
53+
{
54+
/** @var Customer $originalCustomer */
55+
$originalCustomer = $observer->getEvent()->getOrigCustomerDataObject();
56+
if (!$originalCustomer) {
57+
return;
58+
}
59+
60+
/** @var Customer $customer */
61+
$customer = $observer->getEvent()->getCustomerDataObject();
62+
$customerEmail = $customer->getEmail();
63+
64+
if ($customerEmail === $originalCustomer->getEmail()) {
65+
return;
66+
}
67+
$searchCriteria = $this->searchCriteriaBuilder
68+
->addFilter(OrderInterface::CUSTOMER_ID, $customer->getId())
69+
->create();
70+
71+
/**
72+
* @var Collection $orders
73+
*/
74+
$orders = $this->orderRepository->getList($searchCriteria);
75+
$orders->setDataToAll(OrderInterface::CUSTOMER_EMAIL, $customerEmail);
76+
$orders->save();
77+
}
78+
}

0 commit comments

Comments
 (0)