Skip to content

Commit 535486f

Browse files
authored
🔃 [EngCom] Public Pull Requests - 2.3-develop
Accepted Public Pull Requests: - magento-engcom/magento2ce#1284: [EngCom Team] Batch 3. Forwardports to 2.3-develop (by @magento-engcom-team) - magento-engcom/magento2ce#1286: [EngCom Team] Batch 5. Forwardports to 2.3-develop (by @magento-engcom-team) Fixed GitHub Issues: - #6891: Add-to-cart checkbox still visible when $canItemsAddToCart = false (reported by @thdoan) has been fixed in magento-engcom/magento2ce#1284 by @magento-engcom-team in 2.3-develop branch Related commits: - #9763: When go checkout,Cart Price Rules 25%test coupon code can go wrong (reported by @michaeldyl520) has been fixed in magento-engcom/magento2ce#1284 by @magento-engcom-team in 2.3-develop branch Related commits: - #9919: Pattern Validation via UI Component Fails to Interpret String as RegEx Pattern (reported by @bap14) has been fixed in magento-engcom/magento2ce#1284 by @magento-engcom-team in 2.3-develop branch Related commits: - #9944: Name attribute shows empty when creating custom fields on product creation form (reported by @PatrickSH) has been fixed in magento-engcom/magento2ce#1284 by @magento-engcom-team in 2.3-develop branch Related commits: - #10025: Integration tests don't reset the database (reported by @dersam) has been fixed in magento-engcom/magento2ce#1284 by @magento-engcom-team in 2.3-develop branch Related commits: - #10275: Admin global search - submit by enter doesn't work (reported by @ihor-sviziev) has been fixed in magento-engcom/magento2ce#1284 by @magento-engcom-team in 2.3-develop branch Related commits: - #10856: Sync billing with shipping address on Admin Reorder and Admin Customer Create Order page does not work for Existing address selected (reported by @NoorulBhoelai) has been fixed in magento-engcom/magento2ce#1284 by @magento-engcom-team in 2.3-develop branch Related commits: - #11157: nginx.sample.conf missing heath_check.php? (reported by @craigcarnell) has been fixed in magento-engcom/magento2ce#1284 by @magento-engcom-team in 2.3-develop branch Related commits: - #4004: Newsletter Subscriber create-date not set, and change_status_at broken (reported by @fvschie) has been fixed in magento-engcom/magento2ce#1286 by @magento-engcom-team in 2.3-develop branch Related commits: - #7995: If you leave as default, shipping lines disappear (reported by @rosandrest) has been fixed in magento-engcom/magento2ce#1286 by @magento-engcom-team in 2.3-develop branch Related commits: - #8846: Attribute option value uniqueness is not checked if created via REST Api (reported by @hilrob) has been fixed in magento-engcom/magento2ce#1286 by @magento-engcom-team in 2.3-develop branch Related commits: - #8954: Error While Trying To Load Quote Item Collection Using Magento\Quote\Model\ResourceModel\QuoteItem\Collection::getItems() (reported by @rendyep) has been fixed in magento-engcom/magento2ce#1286 by @magento-engcom-team in 2.3-develop branch Related commits: - #9028: You cannot set a 303 redirect response using a result factory (reported by @jameshalsall) has been fixed in magento-engcom/magento2ce#1286 by @magento-engcom-team in 2.3-develop branch Related commits: - #10583: Checkout place order exception when using a new address (reported by @mbijnsdorp) has been fixed in magento-engcom/magento2ce#1286 by @magento-engcom-team in 2.3-develop branch Related commits: - #11700: "Something Went Wrong" error for limited access admin user (reported by @expgabe) has been fixed in magento-engcom/magento2ce#1286 by @magento-engcom-team in 2.3-develop branch Related commits: - #12017: Cross-sell product placeholder image size issue (reported by @emiprotech) has been fixed in magento-engcom/magento2ce#1286 by @magento-engcom-team in 2.3-develop branch Related commits:
2 parents eaa099c + 7412250 commit 535486f

File tree

38 files changed

+624
-135
lines changed

38 files changed

+624
-135
lines changed

app/code/Magento/Catalog/Model/Product/Attribute/OptionManagement.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ public function getItems($attributeCode)
4040
*/
4141
public function add($attributeCode, $option)
4242
{
43+
/** @var \Magento\Eav\Api\Data\AttributeOptionInterface[] $currentOptions */
44+
$currentOptions = $this->getItems($attributeCode);
45+
if (is_array($currentOptions)) {
46+
array_walk($currentOptions, function (&$attributeOption) {
47+
/** @var \Magento\Eav\Api\Data\AttributeOptionInterface $attributeOption */
48+
$attributeOption = $attributeOption->getLabel();
49+
});
50+
if (in_array($option->getLabel(), $currentOptions)) {
51+
return false;
52+
}
53+
}
4354
return $this->eavOptionManagement->add(
4455
\Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE,
4556
$attributeCode,

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/js.phtml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,11 @@ function switchDefaultValueField()
196196

197197
<?php foreach ($this->helper('Magento\Catalog\Helper\Data')->getAttributeHiddenFields() as $type => $fields): ?>
198198
case '<?= /* @escapeNotVerified */ $type ?>':
199+
var isFrontTabHidden = false;
199200
<?php foreach ($fields as $one): ?>
200201
<?php if ($one == '_front_fieldset'): ?>
201202
getFrontTab().hide();
203+
isFrontTabHidden = true;
202204
<?php elseif ($one == '_default_value'): ?>
203205
defaultValueTextVisibility =
204206
defaultValueTextareaVisibility =
@@ -210,6 +212,10 @@ function switchDefaultValueField()
210212
setRowVisibility('<?= /* @escapeNotVerified */ $one ?>', false);
211213
<?php endif; ?>
212214
<?php endforeach; ?>
215+
216+
if (!isFrontTabHidden){
217+
getFrontTab().show();
218+
}
213219
break;
214220
<?php endforeach; ?>
215221

app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ switch ($type = $block->getType()) {
202202
<?= $block->getReviewsSummaryHtml($_item, $templateType) ?>
203203
<?php endif; ?>
204204

205-
<?php if (!$_item->isComposite() && $_item->isSaleable() && $type == 'related'): ?>
205+
<?php if ($canItemsAddToCart && !$_item->isComposite() && $_item->isSaleable() && $type == 'related'): ?>
206206
<?php if (!$_item->getRequiredOptions()): ?>
207207
<div class="field choice related">
208208
<input type="checkbox" class="checkbox related" id="related-checkbox<?= /* @escapeNotVerified */ $_item->getId() ?>" name="related_products[]" value="<?= /* @escapeNotVerified */ $_item->getId() ?>" />

app/code/Magento/Checkout/view/frontend/web/js/model/resource-url-manager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ define([
7575
quoteId: quoteId
7676
} : {},
7777
urls = {
78-
'guest': '/guest-carts/' + quoteId + '/coupons/' + couponCode,
79-
'customer': '/carts/mine/coupons/' + couponCode
78+
'guest': '/guest-carts/' + quoteId + '/coupons/' + encodeURIComponent(couponCode),
79+
'customer': '/carts/mine/coupons/' + encodeURIComponent(couponCode)
8080
};
8181

8282
return this.getUrl(urls, params);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@
198198
<field id="street_lines" translate="label comment" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
199199
<label>Number of Lines in a Street Address</label>
200200
<backend_model>Magento\Customer\Model\Config\Backend\Address\Street</backend_model>
201-
<comment>Leave empty for default (2). Valid range: 1-4</comment>
201+
<comment>Valid range: 1-4</comment>
202+
<validate>required-entry validate-digits validate-digits-range digits-range-1-4</validate>
202203
</field>
203204
<field id="prefix_show" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
204205
<label>Show Prefix</label>

app/code/Magento/Eav/Model/Entity/Attribute/Backend/JsonEncoded.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function afterLoad($object)
5858
{
5959
parent::afterLoad($object);
6060
$attrCode = $this->getAttribute()->getAttributeCode();
61-
$object->setData($attrCode, $this->jsonSerializer->unserialize($object->getData($attrCode)));
61+
$object->setData($attrCode, $this->jsonSerializer->unserialize($object->getData($attrCode) ?: '{}'));
6262
return $this;
6363
}
6464
}

app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Backend/JsonEncodedTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,18 @@ public function testAfterLoad()
9595
$this->model->afterLoad($product);
9696
$this->assertEquals([1, 2, 3], $product->getData('json_encoded'));
9797
}
98+
99+
/**
100+
* Test after load handler with null attribute value
101+
*/
102+
public function testAfterLoadWithNullAttributeValue()
103+
{
104+
$product = new \Magento\Framework\DataObject(
105+
[
106+
'json_encoded' => null
107+
]
108+
);
109+
$this->model->afterLoad($product);
110+
$this->assertEquals([], $product->getData('json_encoded'));
111+
}
98112
}

app/code/Magento/Newsletter/Model/Subscriber.php

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ class Subscriber extends \Magento\Framework\Model\AbstractModel
9494
*/
9595
protected $_customerSession;
9696

97+
/**
98+
* Date
99+
* @var \Magento\Framework\Stdlib\DateTime\DateTime
100+
*/
101+
private $dateTime;
102+
97103
/**
98104
* Store manager
99105
*
@@ -134,9 +140,10 @@ class Subscriber extends \Magento\Framework\Model\AbstractModel
134140
* @param CustomerRepositoryInterface $customerRepository
135141
* @param AccountManagementInterface $customerAccountManagement
136142
* @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation
137-
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
138-
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
143+
* @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource
144+
* @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection
139145
* @param array $data
146+
* @param \Magento\Framework\Stdlib\DateTime\DateTime|null $dateTime
140147
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
141148
*/
142149
public function __construct(
@@ -152,13 +159,17 @@ public function __construct(
152159
\Magento\Framework\Translate\Inline\StateInterface $inlineTranslation,
153160
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
154161
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
155-
array $data = []
162+
array $data = [],
163+
\Magento\Framework\Stdlib\DateTime\DateTime $dateTime = null
156164
) {
157165
$this->_newsletterData = $newsletterData;
158166
$this->_scopeConfig = $scopeConfig;
159167
$this->_transportBuilder = $transportBuilder;
160168
$this->_storeManager = $storeManager;
161169
$this->_customerSession = $customerSession;
170+
$this->dateTime = $dateTime ?: \Magento\Framework\App\ObjectManager::getInstance()->get(
171+
\Magento\Framework\Stdlib\DateTime\DateTime::class
172+
);
162173
$this->customerRepository = $customerRepository;
163174
$this->customerAccountManagement = $customerAccountManagement;
164175
$this->inlineTranslation = $inlineTranslation;
@@ -812,4 +823,18 @@ public function getSubscriberFullName()
812823
}
813824
return $name;
814825
}
826+
827+
/**
828+
* Set date of last changed status
829+
*
830+
* @return $this
831+
*/
832+
public function beforeSave()
833+
{
834+
parent::beforeSave();
835+
if ($this->dataHasChangedFor('subscriber_status')) {
836+
$this->setChangeStatusAt($this->dateTime->gmtDate());
837+
}
838+
return $this;
839+
}
815840
}

app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,9 @@ public function collectRates(RateRequest $request)
113113

114114
// Free shipping by qty
115115
$freeQty = 0;
116+
$freePackageValue = 0;
117+
116118
if ($request->getAllItems()) {
117-
$freePackageValue = 0;
118119
foreach ($request->getAllItems() as $item) {
119120
if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
120121
continue;

app/code/Magento/Quote/Model/Quote.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ public function addCustomerAddress(\Magento\Customer\Api\Data\AddressInterface $
10461046
public function updateCustomerData(\Magento\Customer\Api\Data\CustomerInterface $customer)
10471047
{
10481048
$quoteCustomer = $this->getCustomer();
1049-
$this->dataObjectHelper->mergeDataObjects(get_class($quoteCustomer), $quoteCustomer, $customer);
1049+
$this->dataObjectHelper->mergeDataObjects(CustomerInterface::class, $quoteCustomer, $customer);
10501050
$this->setCustomer($quoteCustomer);
10511051
return $this;
10521052
}

0 commit comments

Comments
 (0)