Skip to content

Commit 1690aae

Browse files
committed
Merge branch '2.4-develop' of github.com:magento/magento2ce into 2.4-develop-forward-port-2
2 parents 837675c + 3e23510 commit 1690aae

File tree

19 files changed

+576
-90
lines changed

19 files changed

+576
-90
lines changed

app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,11 @@
2828
<label>Create Permanent Redirect for URLs if URL Key Changed</label>
2929
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
3030
</field>
31-
<field id="generate_category_product_rewrites" translate="label" type="select" sortOrder="6" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
31+
<field id="generate_category_product_rewrites" translate="label comment" type="select" sortOrder="6" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
3232
<label>Generate "category/product" URL Rewrites</label>
3333
<backend_model>Magento\CatalogUrlRewrite\Model\TableCleaner</backend_model>
3434
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
35-
<comment>
36-
<![CDATA[<strong style="color:red">Warning!</strong> Turning this option off will result in permanent removal of category/product URL rewrites without an ability to restore them.]]>
37-
</comment>
35+
<comment><![CDATA[<strong style="color:red">Warning!</strong> Turning this option off will result in permanent removal of category/product URL rewrites without an ability to restore them.]]></comment>
3836
<frontend_class>generate_category_product_rewrites</frontend_class>
3937
</field>
4038
</group>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
"Product URL Suffix","Product URL Suffix"
66
"Use Categories Path for Product URLs","Use Categories Path for Product URLs"
77
"Create Permanent Redirect for URLs if URL Key Changed","Create Permanent Redirect for URLs if URL Key Changed"
8-
"Generate "category/product" URL Rewrites","Generate "category/product" URL Rewrites"
8+
"Generate ""category/product"" URL Rewrites","Generate ""category/product"" URL Rewrites"
99
"URL key ""%1"" matches a reserved endpoint name (%2). Use another URL key.","URL key ""%1"" matches a reserved endpoint name (%2). Use another URL key."
10+
"<strong style=""color:red"">Warning!</strong> Turning this option off will result in permanent removal of category/product URL rewrites without an ability to restore them.","<strong style=""color:red"">Warning!</strong> Turning this option off will result in permanent removal of category/product URL rewrites without an ability to restore them."

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Magento\Customer\Model\Data\CustomerSecureFactory;
1818
use Magento\Customer\Model\Delegation\Data\NewOperation;
1919
use Magento\Customer\Model\Delegation\Storage as DelegatedStorage;
20+
use Magento\Customer\Model\ResourceModel\Customer\Collection;
2021
use Magento\Framework\Api\DataObjectHelper;
2122
use Magento\Framework\Api\ExtensibleDataObjectConverter;
2223
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
@@ -31,6 +32,8 @@
3132
/**
3233
* Customer repository.
3334
*
35+
* CRUD operations for customer entity
36+
*
3437
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
3538
* @SuppressWarnings(PHPMD.TooManyFields)
3639
*/
@@ -187,8 +190,7 @@ public function save(CustomerInterface $customer, $passwordHash = null)
187190
{
188191
/** @var NewOperation|null $delegatedNewOperation */
189192
$delegatedNewOperation = !$customer->getId() ? $this->delegatedStorage->consumeNewOperation() : null;
190-
$prevCustomerData = null;
191-
$prevCustomerDataArr = null;
193+
$prevCustomerData = $prevCustomerDataArr = null;
192194
if ($customer->getId()) {
193195
$prevCustomerData = $this->getById($customer->getId());
194196
$prevCustomerDataArr = $prevCustomerData->__toArray();
@@ -214,6 +216,7 @@ public function save(CustomerInterface $customer, $passwordHash = null)
214216
$prevCustomerData ? $prevCustomerData->getStoreId() : $this->storeManager->getStore()->getId()
215217
);
216218
}
219+
$this->setCustomerGroupId($customerModel, $customerArr, $prevCustomerDataArr);
217220
// Need to use attribute set or future updates can cause data loss
218221
if (!$customerModel->getAttributeSetId()) {
219222
$customerModel->setAttributeSetId(CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER);
@@ -452,4 +455,18 @@ private function setValidationFlag($customerArray, $customerModel)
452455
$customerModel->setData('ignore_validation_flag', true);
453456
}
454457
}
458+
459+
/**
460+
* Set customer group id
461+
*
462+
* @param Customer $customerModel
463+
* @param array $customerArr
464+
* @param array $prevCustomerDataArr
465+
*/
466+
private function setCustomerGroupId($customerModel, $customerArr, $prevCustomerDataArr)
467+
{
468+
if (!isset($customerArr['group_id']) && $prevCustomerDataArr && isset($prevCustomerDataArr['group_id'])) {
469+
$customerModel->setGroupId($prevCustomerDataArr['group_id']);
470+
}
471+
}
455472
}

app/code/Magento/Customer/Test/Unit/Model/ResourceModel/CustomerRepositoryTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ public function testSave()
211211
'setFirstFailure',
212212
'setLockExpires',
213213
'save',
214+
'setGroupId'
214215
]
215216
);
216217

@@ -245,9 +246,15 @@ public function testSave()
245246
$this->customer->expects($this->atLeastOnce())
246247
->method('getId')
247248
->willReturn($customerId);
248-
$this->customer->expects($this->atLeastOnce())
249+
$this->customer->expects($this->at(4))
249250
->method('__toArray')
250251
->willReturn([]);
252+
$this->customer->expects($this->at(3))
253+
->method('__toArray')
254+
->willReturn(['group_id' => 1]);
255+
$customerModel->expects($this->once())
256+
->method('setGroupId')
257+
->with(1);
251258
$this->customerRegistry->expects($this->atLeastOnce())
252259
->method('retrieve')
253260
->with($customerId)

app/code/Magento/Payment/Model/Info.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Info extends AbstractExtensibleModel implements InfoInterface
3838
* @param \Magento\Framework\Model\Context $context
3939
* @param \Magento\Framework\Registry $registry
4040
* @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory
41-
* @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory,
41+
* @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory
4242
* @param \Magento\Payment\Helper\Data $paymentData
4343
* @param \Magento\Framework\Encryption\EncryptorInterface $encryptor
4444
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
@@ -188,6 +188,7 @@ public function getAdditionalInformation($key = null)
188188
*/
189189
public function unsAdditionalInformation($key = null)
190190
{
191+
$this->_initAdditionalInformation();
191192
if ($key && isset($this->_additionalInformation[$key])) {
192193
unset($this->_additionalInformation[$key]);
193194
return $this->setData('additional_information', $this->_additionalInformation);

app/code/Magento/Sales/Model/Order/Payment/Info.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ public function getAdditionalInformation($key = null)
192192
*/
193193
public function unsAdditionalInformation($key = null)
194194
{
195+
$this->initAdditionalInformation();
195196
if ($key && isset($this->additionalInformation[$key])) {
196197
unset($this->additionalInformation[$key]);
197198
return $this->setData('additional_information', $this->additionalInformation);

0 commit comments

Comments
 (0)