Skip to content

Commit c837cea

Browse files
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - #19678: [Backport] Fix: SalesQuoteSaveAfterObserver fails to update the checkout session quote id when applicable (by @dmytro-ch) - #19568: [Backport] [Newsletter] #19418 Cannot add additional field to system configuration at desired position (by @vasilii-b) - #19145: Add availability to leave empty config for events.xml (by @lisovyievhenii) Fixed GitHub Issues: - #19424: \Magento\Checkout\Observer\SalesQuoteSaveAfterObserver fails to update the checkout session quote id when applicable (reported by @dhayakawa) has been fixed in #19678 by @dmytro-ch in 2.2-develop branch Related commits: 1. fc56b80 - #19418: Cannot add additional field to Newsletter system configuration at desired position (reported by @vasilii-b) has been fixed in #19568 by @vasilii-b in 2.2-develop branch Related commits: 1. 1a01f4e - #15931: events.xml cant have no childrens, others can [Magento 2.2.4] (reported by @NopeNopeNope) has been fixed in #19145 by @lisovyievhenii in 2.2-develop branch Related commits: 1. 04bc0fb 2. 551a268
2 parents aa0c29d + bf34236 commit c837cea

File tree

5 files changed

+21
-18
lines changed

5 files changed

+21
-18
lines changed

app/code/Magento/Checkout/Observer/SalesQuoteSaveAfterObserver.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
use Magento\Framework\Event\ObserverInterface;
99

10+
/**
11+
* Class SalesQuoteSaveAfterObserver
12+
*/
1013
class SalesQuoteSaveAfterObserver implements ObserverInterface
1114
{
1215
/**
@@ -24,15 +27,18 @@ public function __construct(\Magento\Checkout\Model\Session $checkoutSession)
2427
}
2528

2629
/**
30+
* Assign quote to session
31+
*
2732
* @param \Magento\Framework\Event\Observer $observer
2833
* @return void
2934
*/
3035
public function execute(\Magento\Framework\Event\Observer $observer)
3136
{
37+
/* @var \Magento\Quote\Model\Quote $quote */
3238
$quote = $observer->getEvent()->getQuote();
33-
/* @var $quote \Magento\Quote\Model\Quote */
39+
3440
if ($quote->getIsCheckoutCart()) {
35-
$this->checkoutSession->getQuoteId($quote->getId());
41+
$this->checkoutSession->setQuoteId($quote->getId());
3642
}
3743
}
3844
}

app/code/Magento/Checkout/Test/Unit/Observer/SalesQuoteSaveAfterObserverTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ protected function setUp()
3030

3131
public function testSalesQuoteSaveAfter()
3232
{
33+
$quoteId = 7;
3334
$observer = $this->createMock(\Magento\Framework\Event\Observer::class);
3435
$observer->expects($this->once())->method('getEvent')->will(
3536
$this->returnValue(new \Magento\Framework\DataObject(
36-
['quote' => new \Magento\Framework\DataObject(['is_checkout_cart' => 1, 'id' => 7])]
37+
['quote' => new \Magento\Framework\DataObject(['is_checkout_cart' => 1, 'id' => $quoteId])]
3738
))
3839
);
39-
$this->checkoutSession->expects($this->once())->method('getQuoteId')->with(7);
40+
$this->checkoutSession->expects($this->once())->method('setQuoteId')->with($quoteId);
4041

4142
$this->object->execute($observer);
4243
}

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,39 @@
1111
<label>Newsletter</label>
1212
<tab>customer</tab>
1313
<resource>Magento_Newsletter::newsletter</resource>
14-
<group id="subscription" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
14+
<group id="subscription" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
1515
<label>Subscription Options</label>
16-
<field id="allow_guest_subscribe" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
16+
<field id="allow_guest_subscribe" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
1717
<label>Allow Guest Subscription</label>
1818
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
1919
</field>
20-
<field id="confirm" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
20+
<field id="confirm" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
2121
<label>Need to Confirm</label>
2222
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
2323
</field>
24-
<field id="confirm_email_identity" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
24+
<field id="confirm_email_identity" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
2525
<label>Confirmation Email Sender</label>
2626
<source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model>
2727
</field>
28-
<field id="confirm_email_template" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
28+
<field id="confirm_email_template" translate="label comment" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
2929
<label>Confirmation Email Template</label>
3030
<comment>Email template chosen based on theme fallback when "Default" option is selected.</comment>
3131
<source_model>Magento\Config\Model\Config\Source\Email\Template</source_model>
3232
</field>
33-
<field id="success_email_identity" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
33+
<field id="success_email_identity" translate="label" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
3434
<label>Success Email Sender</label>
3535
<source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model>
3636
</field>
37-
<field id="success_email_template" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
37+
<field id="success_email_template" translate="label comment" type="select" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
3838
<label>Success Email Template</label>
3939
<comment>Email template chosen based on theme fallback when "Default" option is selected.</comment>
4040
<source_model>Magento\Config\Model\Config\Source\Email\Template</source_model>
4141
</field>
42-
<field id="un_email_identity" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
42+
<field id="un_email_identity" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
4343
<label>Unsubscription Email Sender</label>
4444
<source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model>
4545
</field>
46-
<field id="un_email_template" translate="label comment" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
46+
<field id="un_email_template" translate="label comment" type="select" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
4747
<label>Unsubscription Email Template</label>
4848
<comment>Email template chosen based on theme fallback when "Default" option is selected.</comment>
4949
<source_model>Magento\Config\Model\Config\Source\Email\Template</source_model>

lib/internal/Magento/Framework/Event/Test/Unit/Config/_files/invalidEventsXmlArray.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66
return [
7-
'without_event_handle' => [
8-
'<?xml version="1.0"?><config></config>',
9-
["Element 'config': Missing child element(s). Expected is ( event ).\nLine: 1\n"],
10-
],
117
'event_without_required_name_attribute' => [
128
'<?xml version="1.0"?><config><event name="some_name"></event></config>',
139
["Element 'event': Missing child element(s). Expected is ( observer ).\nLine: 1\n"],

lib/internal/Magento/Framework/Event/etc/events.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<xs:element name="config">
1010
<xs:complexType>
1111
<xs:sequence>
12-
<xs:element name="event" type="eventDeclaration" minOccurs="1" maxOccurs="unbounded">
12+
<xs:element name="event" type="eventDeclaration" minOccurs="0" maxOccurs="unbounded">
1313
<xs:unique name="uniqueObserverName">
1414
<xs:annotation>
1515
<xs:documentation>

0 commit comments

Comments
 (0)