Skip to content

Commit

Permalink
🔃 [Magento Community Engineering] Community Contributions - 2.4-devel…
Browse files Browse the repository at this point in the history
…op expedited

Accepted Community Pull Requests:
 - magento#26182: Fix for footer newsletter input field length in IE/Edge (by @divyajyothi5321)
 - magento#26084: Fix  magento#26083 - problem with unsAdditionalInformation in \Magento\Payment\Model\Info (by @marcoaacoliveira)
 - magento#26130: Fix magento#25390 - UPS carrier model getting error when creating plugin in to Magento 2.3.3 compatibility (by @Bartlomiejsz)
 - magento#25479: JSON fields support (by @akaplya)
 - magento#26204: Added transaction fixes (by @yogeshsuhagiya)


Fixed GitHub Issues:
 - magento#26176: Footer Newsletter input field width is not identical in Internet Explorer/EDGE browser compared with chrome (reported by @divyajyothi5321) has been fixed in magento#26182 by @divyajyothi5321 in 2.4-develop branch
   Related commits:
     1. 63ec3e5
     2. adc7908

 - magento#26083: Problem when trying to unset additional data in payment method. (reported by @marcoaacoliveira) has been fixed in magento#26084 by @marcoaacoliveira in 2.4-develop branch
   Related commits:
     1. 13f34cd
     2. 32227d2
     3. 77390c1
     4. ad1059f
     5. 408b725

 - magento#25390: UPS carrier model getting error when create plugin in to Magento 2.3.3 compatibility (reported by @Bhavik-kumar) has been fixed in magento#26130 by @Bartlomiejsz in 2.4-develop branch
   Related commits:
     1. cfd5c22
  • Loading branch information
VladimirZaets authored Jan 3, 2020
2 parents f2aa57e + cf558ad commit 3e23510
Show file tree
Hide file tree
Showing 19 changed files with 576 additions and 90 deletions.
6 changes: 2 additions & 4 deletions app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@
<label>Create Permanent Redirect for URLs if URL Key Changed</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="generate_category_product_rewrites" translate="label" type="select" sortOrder="6" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
<field id="generate_category_product_rewrites" translate="label comment" type="select" sortOrder="6" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
<label>Generate "category/product" URL Rewrites</label>
<backend_model>Magento\CatalogUrlRewrite\Model\TableCleaner</backend_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<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>
<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>
<frontend_class>generate_category_product_rewrites</frontend_class>
</field>
</group>
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/CatalogUrlRewrite/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"Product URL Suffix","Product URL Suffix"
"Use Categories Path for Product URLs","Use Categories Path for Product URLs"
"Create Permanent Redirect for URLs if URL Key Changed","Create Permanent Redirect for URLs if URL Key Changed"
"Generate "category/product" URL Rewrites","Generate "category/product" URL Rewrites"
"Generate ""category/product"" URL Rewrites","Generate ""category/product"" URL Rewrites"
"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."
"<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."
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Magento\Customer\Model\Data\CustomerSecureFactory;
use Magento\Customer\Model\Delegation\Data\NewOperation;
use Magento\Customer\Model\Delegation\Storage as DelegatedStorage;
use Magento\Customer\Model\ResourceModel\Customer\Collection;
use Magento\Framework\Api\DataObjectHelper;
use Magento\Framework\Api\ExtensibleDataObjectConverter;
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
Expand All @@ -31,6 +32,8 @@
/**
* Customer repository.
*
* CRUD operations for customer entity
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.TooManyFields)
*/
Expand Down Expand Up @@ -187,8 +190,7 @@ public function save(CustomerInterface $customer, $passwordHash = null)
{
/** @var NewOperation|null $delegatedNewOperation */
$delegatedNewOperation = !$customer->getId() ? $this->delegatedStorage->consumeNewOperation() : null;
$prevCustomerData = null;
$prevCustomerDataArr = null;
$prevCustomerData = $prevCustomerDataArr = null;
if ($customer->getId()) {
$prevCustomerData = $this->getById($customer->getId());
$prevCustomerDataArr = $prevCustomerData->__toArray();
Expand All @@ -214,6 +216,7 @@ public function save(CustomerInterface $customer, $passwordHash = null)
$prevCustomerData ? $prevCustomerData->getStoreId() : $this->storeManager->getStore()->getId()
);
}
$this->setCustomerGroupId($customerModel, $customerArr, $prevCustomerDataArr);
// Need to use attribute set or future updates can cause data loss
if (!$customerModel->getAttributeSetId()) {
$customerModel->setAttributeSetId(CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER);
Expand Down Expand Up @@ -452,4 +455,18 @@ private function setValidationFlag($customerArray, $customerModel)
$customerModel->setData('ignore_validation_flag', true);
}
}

/**
* Set customer group id
*
* @param Customer $customerModel
* @param array $customerArr
* @param array $prevCustomerDataArr
*/
private function setCustomerGroupId($customerModel, $customerArr, $prevCustomerDataArr)
{
if (!isset($customerArr['group_id']) && $prevCustomerDataArr && isset($prevCustomerDataArr['group_id'])) {
$customerModel->setGroupId($prevCustomerDataArr['group_id']);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ public function testSave()
'setFirstFailure',
'setLockExpires',
'save',
'setGroupId'
]
);

Expand Down Expand Up @@ -245,9 +246,15 @@ public function testSave()
$this->customer->expects($this->atLeastOnce())
->method('getId')
->willReturn($customerId);
$this->customer->expects($this->atLeastOnce())
$this->customer->expects($this->at(4))
->method('__toArray')
->willReturn([]);
$this->customer->expects($this->at(3))
->method('__toArray')
->willReturn(['group_id' => 1]);
$customerModel->expects($this->once())
->method('setGroupId')
->with(1);
$this->customerRegistry->expects($this->atLeastOnce())
->method('retrieve')
->with($customerId)
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/Payment/Model/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Info extends AbstractExtensibleModel implements InfoInterface
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory
* @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory,
* @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory
* @param \Magento\Payment\Helper\Data $paymentData
* @param \Magento\Framework\Encryption\EncryptorInterface $encryptor
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
Expand Down Expand Up @@ -188,6 +188,7 @@ public function getAdditionalInformation($key = null)
*/
public function unsAdditionalInformation($key = null)
{
$this->_initAdditionalInformation();
if ($key && isset($this->_additionalInformation[$key])) {
unset($this->_additionalInformation[$key]);
return $this->setData('additional_information', $this->_additionalInformation);
Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/Sales/Model/Order/Payment/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ public function getAdditionalInformation($key = null)
*/
public function unsAdditionalInformation($key = null)
{
$this->initAdditionalInformation();
if ($key && isset($this->additionalInformation[$key])) {
unset($this->additionalInformation[$key]);
return $this->setData('additional_information', $this->additionalInformation);
Expand Down
Loading

0 comments on commit 3e23510

Please sign in to comment.