Skip to content

Commit

Permalink
ENGCOM-3828: Fixed issue #19942 Success message is not showing when c…
Browse files Browse the repository at this point in the history
…reating invoice & shipment simultaniously #20142
  • Loading branch information
sivaschenko authored Jan 27, 2019
2 parents fdc163f + 28d6d93 commit 153eef7
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
use Magento\Sales\Model\Service\InvoiceService;

/**
* Save invoice controller.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Save extends \Magento\Backend\App\Action implements HttpPostActionInterface
Expand Down Expand Up @@ -103,6 +105,7 @@ protected function _prepareShipment($invoice)

/**
* Save invoice
*
* We can save only new invoice. Existing invoices are not editable
*
* @return \Magento\Framework\Controller\ResultInterface
Expand Down Expand Up @@ -194,12 +197,6 @@ public function execute()
}
$transactionSave->save();

if (!empty($data['do_shipment'])) {
$this->messageManager->addSuccessMessage(__('You created the invoice and shipment.'));
} else {
$this->messageManager->addSuccessMessage(__('The invoice has been created.'));
}

// send invoice/shipment emails
try {
if (!empty($data['send_email'])) {
Expand All @@ -219,6 +216,11 @@ public function execute()
$this->messageManager->addErrorMessage(__('We can\'t send the shipment right now.'));
}
}
if (!empty($data['do_shipment'])) {
$this->messageManager->addSuccessMessage(__('You created the invoice and shipment.'));
} else {
$this->messageManager->addSuccessMessage(__('The invoice has been created.'));
}
$this->_objectManager->get(\Magento\Backend\Model\Session::class)->getCommentText(true);
return $resultRedirect->setPath('sales/order/view', ['order_id' => $orderId]);
} catch (LocalizedException $e) {
Expand Down

0 comments on commit 153eef7

Please sign in to comment.