File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
app/code/Magento/Sales/Controller/Adminhtml/Order/Create
dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/Create Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,12 @@ class Index extends \Magento\Sales\Controller\Adminhtml\Order\Create implements
20
20
public function execute ()
21
21
{
22
22
$ this ->_initSession ();
23
+
24
+ // Clear existing order in session when creating a new order for a customer
25
+ if ($ this ->getRequest ()->getParam ('customer_id ' )) {
26
+ $ this ->_getSession ()->setOrderId (null );
27
+ }
28
+
23
29
$ this ->_getOrderCreateModel ()->initRuleData ();
24
30
/** @var \Magento\Backend\Model\View\Result\Page $resultPage */
25
31
$ resultPage = $ this ->resultPageFactory ->create ();
Original file line number Diff line number Diff line change @@ -52,9 +52,17 @@ protected function setUp(): void
52
52
public function testExecute (): void
53
53
{
54
54
$ customerId = 1 ;
55
+ $ editingOrderId = 10 ;
56
+
55
57
$ this ->getRequest ()->setMethod (Http::METHOD_GET );
56
58
$ this ->getRequest ()->setParam ('customer_id ' , $ customerId );
59
+ $ this ->quoteSession ->setOrderId ($ editingOrderId );
60
+ $ this ->assertEquals ($ editingOrderId , $ this ->quoteSession ->getOrderId ());
57
61
$ this ->dispatch ('backend/sales/order_create/index ' );
62
+
63
+ // Check that existing order in session was cleared
64
+ $ this ->assertEquals (null , $ this ->quoteSession ->getOrderId ());
65
+
58
66
$ store = $ this ->storeManager ->getStore ();
59
67
$ this ->assertEquals ($ customerId , $ this ->quoteSession ->getCustomerId ());
60
68
$ ruleData = $ this ->registry ->registry ('rule_data ' );
You can’t perform that action at this time.
0 commit comments