Skip to content

Fixed issue #19942 Success message is not showing when creating invoice & shipment simultaniously #20142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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