Skip to content
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

Do not crash when creditmemo does not exist #2684

Merged
merged 2 commits into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
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 @@ -101,6 +101,10 @@ protected function _initCreditmemo($update = false)
$orderId = $this->getRequest()->getParam('order_id');
if ($creditmemoId) {
$creditmemo = Mage::getModel('sales/order_creditmemo')->load($creditmemoId);
if (!$creditmemo->getId()) {
$this->_getSession()->addError($this->__('The credit memo no longer exists.'));
return false;
}
} elseif ($orderId) {
$data = $this->getRequest()->getParam('creditmemo');
$order = Mage::getModel('sales/order')->load($orderId);
Expand Down Expand Up @@ -193,7 +197,7 @@ public function viewAction()
$this->_setActiveMenu('sales/order')
->renderLayout();
} else {
$this->_forward('noRoute');
$this->_redirect('*/*');
}
}

Expand Down
1 change: 1 addition & 0 deletions app/locale/en_US/Mage_Adminhtml.csv
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
"Cannot add tracking number.","Cannot add tracking number."
"Cannot create an invoice without products.","Cannot create an invoice without products."
"Cannot create credit memo for the order.","Cannot create credit memo for the order."
"The credit memo no longer exists.","The credit memo no longer exists."
"Cannot delete the design change.","Cannot delete the design change."
"Cannot delete tracking number.","Cannot delete tracking number."
"Cannot do shipment for the order separately from invoice.","Cannot do shipment for the order separately from invoice."
Expand Down