Skip to content

Commit 2ad8caf

Browse files
author
Olexandr Lysenko
committed
MAGETWO-30913: Error when trying to apply coupon code in backend reorder after unchecking the discount apply checkbox
1 parent d9601ec commit 2ad8caf

File tree

1 file changed

+16
-4
lines changed
  • app/code/Magento/Sales/Controller/Adminhtml/Order

1 file changed

+16
-4
lines changed

app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,25 @@
1313
*/
1414
class Create extends \Magento\Backend\App\Action
1515
{
16+
/**
17+
* @var \Magento\Framework\Escaper
18+
*/
19+
protected $escaper;
20+
1621
/**
1722
* @param Action\Context $context
1823
* @param \Magento\Catalog\Helper\Product $productHelper
24+
* @param \Magento\Framework\Escaper $escaper
1925
*/
20-
public function __construct(Action\Context $context, \Magento\Catalog\Helper\Product $productHelper)
26+
public function __construct(
27+
Action\Context $context,
28+
\Magento\Catalog\Helper\Product $productHelper,
29+
\Magento\Framework\Escaper $escaper
30+
)
2131
{
2232
parent::__construct($context);
2333
$productHelper->setSkipSaleableCheck(true);
34+
$this->escaper = $escaper;
2435
}
2536

2637
/**
@@ -280,18 +291,19 @@ protected function _processActionData($action = null)
280291
}
281292
}
282293
if (!$isApplyDiscount) {
294+
$rr = $this->escaper->escapeHtml($couponCode);
283295
$this->messageManager->addError(
284296
__(
285-
'"%1" coupon code for item(s) selected do not apply discount',
286-
$this->_objectManager->get('Magento\Framework\Escaper')->escapeHtml($couponCode)
297+
'"%1" coupon code was not applied. Do not apply discount is selected for item(s)',
298+
$rr
287299
)
288300
);
289301
} else {
290302
if ($this->_getQuote()->getCouponCode() !== $couponCode) {
291303
$this->messageManager->addError(
292304
__(
293305
'"%1" coupon code is not valid.',
294-
$this->_objectManager->get('Magento\Framework\Escaper')->escapeHtml($couponCode)
306+
$this->escaper->escapeHtml($couponCode)
295307
)
296308
);
297309
} else {

0 commit comments

Comments
 (0)