Skip to content

Commit 45cc4db

Browse files
Merge pull request #9461 from magento-cia/cia-2.4.8-beta2-develop-bugfix-12302024
Cia 2.4.8 beta2 develop bugfix 12302024
2 parents 2305453 + 09933c9 commit 45cc4db

17 files changed

+310
-103
lines changed

app/code/Magento/Cms/Test/Unit/Ui/Component/Listing/DataProviderTest.php

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
<?php
2-
/***
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
2+
/************************************************************************
3+
* Copyright 2024 Adobe
4+
* All Rights Reserved.
5+
*
6+
* NOTICE: All information contained herein is, and remains
7+
* the property of Adobe and its suppliers, if any. The intellectual
8+
* and technical concepts contained herein are proprietary to Adobe
9+
* and its suppliers and are protected by all applicable intellectual
10+
* property laws, including trade secret and copyright laws.
11+
* Dissemination of this information or reproduction of this material
12+
* is strictly forbidden unless prior written permission is obtained
13+
* from Adobe.
14+
* ***********************************************************************
515
*/
616
declare(strict_types=1);
717

@@ -18,6 +28,7 @@
1828
use Magento\Ui\Component\Container;
1929
use PHPUnit\Framework\MockObject\MockObject;
2030
use PHPUnit\Framework\TestCase;
31+
use Magento\Cms\Api\Data\PageInterface;
2132

2233
class DataProviderTest extends TestCase
2334
{
@@ -66,6 +77,17 @@ class DataProviderTest extends TestCase
6677
*/
6778
private $requestFieldName = 'id';
6879

80+
/**
81+
* @var array
82+
*/
83+
private array $pageLayoutColumns = [
84+
PageInterface::PAGE_LAYOUT,
85+
PageInterface::CUSTOM_THEME,
86+
PageInterface::CUSTOM_THEME_FROM,
87+
PageInterface::CUSTOM_THEME_TO,
88+
PageInterface::CUSTOM_ROOT_TEMPLATE
89+
];
90+
6991
protected function setUp(): void
7092
{
7193
$this->authorizationMock = $this->getMockBuilder(Authorization::class)
@@ -111,10 +133,15 @@ protected function setUp(): void
111133
*/
112134
public function testPrepareMetadata()
113135
{
114-
$this->authorizationMock->expects($this->once())
136+
$this->authorizationMock->expects($this->exactly(2))
115137
->method('isAllowed')
116-
->with('Magento_Cms::save')
117-
->willReturn(false);
138+
->willReturnMap(
139+
[
140+
['Magento_Cms::save', null, false],
141+
['Magento_Cms::save_design', null, false],
142+
143+
]
144+
);
118145

119146
$metadata = [
120147
'cms_page_columns' => [
@@ -131,6 +158,21 @@ public function testPrepareMetadata()
131158
]
132159
];
133160

161+
foreach ($this->pageLayoutColumns as $column) {
162+
$metadata['cms_page_columns']['children'][$column] = [
163+
'arguments' => [
164+
'data' => [
165+
'config' => [
166+
'editor' => [
167+
'editorType' => false
168+
],
169+
'componentType' => Container::NAME
170+
]
171+
]
172+
]
173+
];
174+
}
175+
134176
$this->assertEquals(
135177
$metadata,
136178
$this->dataProvider->prepareMetadata()

app/code/Magento/Cms/Ui/Component/DataProvider.php

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\Cms\Ui\Component;
77

8+
use Magento\Cms\Api\Data\PageInterface;
89
use Magento\Framework\Api\Filter;
910
use Magento\Framework\Api\FilterBuilder;
1011
use Magento\Framework\Api\Search\SearchCriteriaBuilder;
1112
use Magento\Framework\App\ObjectManager;
1213
use Magento\Framework\App\RequestInterface;
1314
use Magento\Framework\AuthorizationInterface;
1415
use Magento\Framework\View\Element\UiComponent\DataProvider\Reporting;
16+
use Magento\Ui\Component\Container;
1517

1618
/**
1719
* DataProvider for cms ui.
@@ -28,6 +30,17 @@ class DataProvider extends \Magento\Framework\View\Element\UiComponent\DataProvi
2830
*/
2931
private $additionalFilterPool;
3032

33+
/**
34+
* @var array
35+
*/
36+
private array $pageLayoutColumns = [
37+
PageInterface::PAGE_LAYOUT,
38+
PageInterface::CUSTOM_THEME,
39+
PageInterface::CUSTOM_THEME_FROM,
40+
PageInterface::CUSTOM_THEME_TO,
41+
PageInterface::CUSTOM_ROOT_TEMPLATE
42+
];
43+
3144
/**
3245
* @param string $name
3346
* @param string $primaryFieldName
@@ -73,6 +86,8 @@ public function __construct(
7386
* Get authorization info.
7487
*
7588
* @deprecated 101.0.7
89+
* @see nothing
90+
*
7691
* @return AuthorizationInterface|mixed
7792
*/
7893
private function getAuthorizationInstance()
@@ -101,21 +116,42 @@ public function prepareMetadata()
101116
'editorConfig' => [
102117
'enabled' => false
103118
],
104-
'componentType' => \Magento\Ui\Component\Container::NAME
119+
'componentType' => Container::NAME
105120
]
106121
]
107122
]
108123
]
109124
];
110125
}
111126

127+
if (!$this->getAuthorizationInstance()->isAllowed('Magento_Cms::save_design')) {
128+
129+
foreach ($this->pageLayoutColumns as $column) {
130+
$metadata['cms_page_columns']['children'][$column] = [
131+
'arguments' => [
132+
'data' => [
133+
'config' => [
134+
'editor' => [
135+
'editorType' => false
136+
],
137+
'componentType' => Container::NAME
138+
]
139+
]
140+
]
141+
];
142+
}
143+
}
144+
112145
return $metadata;
113146
}
114147

115148
/**
116-
* @inheritdoc
149+
* Add Filter
150+
*
151+
* @param Filter $filter
152+
* @return void
117153
*/
118-
public function addFilter(Filter $filter)
154+
public function addFilter(Filter $filter): void
119155
{
120156
if (!empty($this->additionalFilterPool[$filter->getField()])) {
121157
$this->additionalFilterPool[$filter->getField()]->addFilter($this->searchCriteriaBuilder, $filter);

app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
3+
* Copyright 2025 Adobe.
4+
* All rights reserved.
45
* See COPYING.txt for license details.
56
*/
67

@@ -190,8 +191,6 @@ protected function _extractCustomerData()
190191
$customerData = [];
191192
if ($this->getRequest()->getPost('customer')) {
192193
$additionalAttributes = [
193-
CustomerInterface::DEFAULT_BILLING,
194-
CustomerInterface::DEFAULT_SHIPPING,
195194
'confirmation',
196195
'sendemail_store_id',
197196
'extension_attributes',

app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
55
*/
66

77
declare(strict_types=1);
@@ -206,17 +206,17 @@ public function save(CustomerInterface $customer, $passwordHash = null)
206206
/** @var NewOperation|null $delegatedNewOperation */
207207
$delegatedNewOperation = !$customer->getId() ? $this->delegatedStorage->consumeNewOperation() : null;
208208
$prevCustomerData = $prevCustomerDataArr = null;
209-
if ($customer->getDefaultBilling()) {
210-
$this->validateDefaultAddress($customer, CustomerInterface::DEFAULT_BILLING);
211-
}
212-
if ($customer->getDefaultShipping()) {
213-
$this->validateDefaultAddress($customer, CustomerInterface::DEFAULT_SHIPPING);
214-
}
215209
if ($customer->getId()) {
216210
$prevCustomerData = $this->getById($customer->getId());
217211
$prevCustomerDataArr = $this->prepareCustomerData($prevCustomerData->__toArray());
218212
$customer->setCreatedAt($prevCustomerData->getCreatedAt());
219213
}
214+
if ($customer->getDefaultBilling()) {
215+
$this->validateDefaultAddress($customer, $prevCustomerData, CustomerInterface::DEFAULT_BILLING);
216+
}
217+
if ($customer->getDefaultShipping()) {
218+
$this->validateDefaultAddress($customer, $prevCustomerData, CustomerInterface::DEFAULT_SHIPPING);
219+
}
220220
/** @var $customer \Magento\Customer\Model\Data\Customer */
221221
$customerArr = $customer->__toArray();
222222
$customer = $this->imageProcessor->save(
@@ -569,28 +569,24 @@ private function prepareCustomerData(array $customerData): array
569569
* To validate default address
570570
*
571571
* @param CustomerInterface $customer
572+
* @param CustomerInterface|null $prevCustomerData
572573
* @param string $defaultAddressType
573574
* @return void
574575
* @throws InputException
575576
*/
576577
private function validateDefaultAddress(
577578
CustomerInterface $customer,
579+
?CustomerInterface $prevCustomerData,
578580
string $defaultAddressType
579581
): void {
580582
$defaultAddressId = $defaultAddressType === CustomerInterface::DEFAULT_BILLING ?
581583
(int) $customer->getDefaultBilling() : (int) $customer->getDefaultShipping();
582-
583-
if ($customer->getAddresses()) {
584-
foreach ($customer->getAddresses() as $address) {
585-
$addressArray = $address->__toArray();
586-
$addressId = (int) $address->getId();
587-
if (!empty($addressArray[$defaultAddressType])
588-
|| empty($addressId)
589-
|| $defaultAddressId === $addressId) {
584+
if ($prevCustomerData && $prevCustomerData->getAddresses()) {
585+
foreach ($prevCustomerData->getAddresses() as $address) {
586+
if ($defaultAddressId === (int) $address->getId()) {
590587
return;
591588
}
592589
}
593-
594590
throw new InputException(
595591
__(
596592
'The %fieldName value is invalid. Set the correct value and try again.',

app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_index.xml

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?xml version="1.0"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
4+
* Copyright 2025 Adobe.
5+
* All rights reserved.
56
* See COPYING.txt for license details.
67
*/
78
-->
@@ -39,13 +40,41 @@
3940
<arguments>
4041
<argument name="sideBarPermissionCheck" xsi:type="object">Magento\Sales\ViewModel\Order\Create\SidebarPermissionCheck</argument>
4142
</arguments>
42-
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Cart" template="Magento_Sales::order/create/sidebar/items.phtml" name="cart"/>
43-
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Wishlist" template="Magento_Sales::order/create/sidebar/items.phtml" name="wishlist"/>
44-
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Reorder" template="Magento_Sales::order/create/sidebar/items.phtml" name="reorder"/>
45-
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Viewed" template="Magento_Sales::order/create/sidebar/items.phtml" name="viewed"/>
46-
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Compared" template="Magento_Sales::order/create/sidebar/items.phtml" name="compared"/>
47-
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Pcompared" template="Magento_Sales::order/create/sidebar/items.phtml" name="pcompared"/>
48-
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Pviewed" template="Magento_Sales::order/create/sidebar/items.phtml" name="pviewed"/>
43+
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Cart" template="Magento_Sales::order/create/sidebar/items.phtml" name="cart">
44+
<arguments>
45+
<argument name="sideBarPermissionCheck" xsi:type="object">Magento\Sales\ViewModel\Order\Create\SidebarPermissionCheck</argument>
46+
</arguments>
47+
</block>
48+
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Wishlist" template="Magento_Sales::order/create/sidebar/items.phtml" name="wishlist">
49+
<arguments>
50+
<argument name="sideBarPermissionCheck" xsi:type="object">Magento\Sales\ViewModel\Order\Create\SidebarPermissionCheck</argument>
51+
</arguments>
52+
</block>
53+
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Reorder" template="Magento_Sales::order/create/sidebar/items.phtml" name="reorder">
54+
<arguments>
55+
<argument name="sideBarPermissionCheck" xsi:type="object">Magento\Sales\ViewModel\Order\Create\SidebarPermissionCheck</argument>
56+
</arguments>
57+
</block>
58+
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Viewed" template="Magento_Sales::order/create/sidebar/items.phtml" name="viewed">
59+
<arguments>
60+
<argument name="sideBarPermissionCheck" xsi:type="object">Magento\Sales\ViewModel\Order\Create\SidebarPermissionCheck</argument>
61+
</arguments>
62+
</block>
63+
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Compared" template="Magento_Sales::order/create/sidebar/items.phtml" name="compared">
64+
<arguments>
65+
<argument name="sideBarPermissionCheck" xsi:type="object">Magento\Sales\ViewModel\Order\Create\SidebarPermissionCheck</argument>
66+
</arguments>
67+
</block>
68+
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Pcompared" template="Magento_Sales::order/create/sidebar/items.phtml" name="pcompared">
69+
<arguments>
70+
<argument name="sideBarPermissionCheck" xsi:type="object">Magento\Sales\ViewModel\Order\Create\SidebarPermissionCheck</argument>
71+
</arguments>
72+
</block>
73+
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Pviewed" template="Magento_Sales::order/create/sidebar/items.phtml" name="pviewed">
74+
<arguments>
75+
<argument name="sideBarPermissionCheck" xsi:type="object">Magento\Sales\ViewModel\Order\Create\SidebarPermissionCheck</argument>
76+
</arguments>
77+
</block>
4978
</block>
5079
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Form\Account" template="Magento_Sales::order/create/form/account.phtml" name="form_account"/>
5180
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Address" template="Magento_Sales::order/create/form/address.phtml" name="shipping_address">

app/code/Magento/Sales/view/adminhtml/layout/sales_order_create_load_block_data.xml

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?xml version="1.0"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
4+
* Copyright 2025 Adobe.
5+
* All rights reserved.
56
* See COPYING.txt for license details.
67
*/
78
-->
@@ -14,13 +15,41 @@
1415
<arguments>
1516
<argument name="sideBarPermissionCheck" xsi:type="object">Magento\Sales\ViewModel\Order\Create\SidebarPermissionCheck</argument>
1617
</arguments>
17-
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Cart" template="Magento_Sales::order/create/sidebar/items.phtml" name="cart"/>
18-
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Wishlist" template="Magento_Sales::order/create/sidebar/items.phtml" name="wishlist"/>
19-
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Reorder" template="Magento_Sales::order/create/sidebar/items.phtml" name="reorder"/>
20-
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Viewed" template="Magento_Sales::order/create/sidebar/items.phtml" name="viewed"/>
21-
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Compared" template="Magento_Sales::order/create/sidebar/items.phtml" name="compared"/>
22-
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Pcompared" template="Magento_Sales::order/create/sidebar/items.phtml" name="pcompared"/>
23-
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Pviewed" template="Magento_Sales::order/create/sidebar/items.phtml" name="pviewed"/>
18+
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Cart" template="Magento_Sales::order/create/sidebar/items.phtml" name="cart">
19+
<arguments>
20+
<argument name="sideBarPermissionCheck" xsi:type="object">Magento\Sales\ViewModel\Order\Create\SidebarPermissionCheck</argument>
21+
</arguments>
22+
</block>
23+
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Wishlist" template="Magento_Sales::order/create/sidebar/items.phtml" name="wishlist">
24+
<arguments>
25+
<argument name="sideBarPermissionCheck" xsi:type="object">Magento\Sales\ViewModel\Order\Create\SidebarPermissionCheck</argument>
26+
</arguments>
27+
</block>
28+
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Reorder" template="Magento_Sales::order/create/sidebar/items.phtml" name="reorder">
29+
<arguments>
30+
<argument name="sideBarPermissionCheck" xsi:type="object">Magento\Sales\ViewModel\Order\Create\SidebarPermissionCheck</argument>
31+
</arguments>
32+
</block>
33+
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Viewed" template="Magento_Sales::order/create/sidebar/items.phtml" name="viewed">
34+
<arguments>
35+
<argument name="sideBarPermissionCheck" xsi:type="object">Magento\Sales\ViewModel\Order\Create\SidebarPermissionCheck</argument>
36+
</arguments>
37+
</block>
38+
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Compared" template="Magento_Sales::order/create/sidebar/items.phtml" name="compared">
39+
<arguments>
40+
<argument name="sideBarPermissionCheck" xsi:type="object">Magento\Sales\ViewModel\Order\Create\SidebarPermissionCheck</argument>
41+
</arguments>
42+
</block>
43+
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Pcompared" template="Magento_Sales::order/create/sidebar/items.phtml" name="pcompared">
44+
<arguments>
45+
<argument name="sideBarPermissionCheck" xsi:type="object">Magento\Sales\ViewModel\Order\Create\SidebarPermissionCheck</argument>
46+
</arguments>
47+
</block>
48+
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Sidebar\Pviewed" template="Magento_Sales::order/create/sidebar/items.phtml" name="pviewed">
49+
<arguments>
50+
<argument name="sideBarPermissionCheck" xsi:type="object">Magento\Sales\ViewModel\Order\Create\SidebarPermissionCheck</argument>
51+
</arguments>
52+
</block>
2453
</block>
2554
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Form\Account" template="Magento_Sales::order/create/form/account.phtml" name="form_account"/>
2655
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Shipping\Address" template="Magento_Sales::order/create/form/address.phtml" name="shipping_address">

0 commit comments

Comments
 (0)