File tree Expand file tree Collapse file tree 2 files changed +37
-4
lines changed
app/code/Magento/Sales/Model/AdminOrder
dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/Create Expand file tree Collapse file tree 2 files changed +37
-4
lines changed Original file line number Diff line number Diff line change @@ -1716,10 +1716,9 @@ public function importPostData($data)
1716
1716
1717
1717
if (isset ($ data ['comment ' ])) {
1718
1718
$ this ->getQuote ()->addData ($ data ['comment ' ]);
1719
- if (empty ($ data ['comment ' ]['customer_note_notify ' ])) {
1720
- $ this ->getQuote ()->setCustomerNoteNotify (false );
1721
- } else {
1722
- $ this ->getQuote ()->setCustomerNoteNotify (true );
1719
+ if ($ this ->getIsValidate ()) {
1720
+ $ notify = !empty ($ data ['comment ' ]['customer_note_notify ' ]);
1721
+ $ this ->getQuote ()->setCustomerNoteNotify ($ notify );
1723
1722
}
1724
1723
}
1725
1724
Original file line number Diff line number Diff line change @@ -231,6 +231,40 @@ public function testAddProductToOrderFromWishList(): void
231
231
$ this ->assertCount (1 , $ quoteItems );
232
232
}
233
233
234
+ /**
235
+ * Check that customer notification is NOT disabled after comment is updated.
236
+ *
237
+ * @return void
238
+ * @magentoDataFixture Magento/Checkout/_files/quote_with_customer_without_address.php
239
+ */
240
+ public function testUpdateCustomerNote (): void
241
+ {
242
+ $ customerNote = 'Example Comment ' ;
243
+ $ quoteId = $ this ->getQuoteByReservedOrderId ->execute ('test_order_with_customer_without_address ' )->getId ();
244
+ $ this ->session ->setQuoteId ($ quoteId );
245
+ $ params = [
246
+ 'json ' => false ,
247
+ 'block ' => 'totals ' ,
248
+ 'as_js_varname ' => false ,
249
+ ];
250
+ $ post = $ this ->hydratePost ([
251
+ 'order ' => [
252
+ 'comment ' => [
253
+ CartInterface::KEY_CUSTOMER_NOTE => $ customerNote
254
+ ],
255
+ ],
256
+ ]);
257
+ $ this ->dispatchWitParams ($ params , $ post );
258
+
259
+ $ quote = $ this ->session ->getQuote ();
260
+ $ this ->assertEquals ($ customerNote , $ quote ->getCustomerNote ());
261
+ $ this ->assertTrue ((bool )$ quote ->getCustomerNoteNotify ());
262
+
263
+ preg_match ('/id="notify_customer"(?<attributes>.*?)\/>/s ' , $ this ->getResponse ()->getBody (), $ matches );
264
+ $ this ->assertArrayHasKey ('attributes ' , $ matches );
265
+ $ this ->assertStringContainsString ('checked="checked" ' , $ matches ['attributes ' ]);
266
+ }
267
+
234
268
/**
235
269
* Check customer quotes
236
270
*
You can’t perform that action at this time.
0 commit comments