Skip to content

Commit a3f6b53

Browse files
luigifabfballiano
authored andcommitted
Redirect to grid when creditmemo does not exist (#2684)
1 parent 96c14d4 commit a3f6b53

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ protected function _initCreditmemo($update = false)
101101
$orderId = $this->getRequest()->getParam('order_id');
102102
if ($creditmemoId) {
103103
$creditmemo = Mage::getModel('sales/order_creditmemo')->load($creditmemoId);
104+
if (!$creditmemo->getId()) {
105+
$this->_getSession()->addError($this->__('The credit memo no longer exists.'));
106+
return false;
107+
}
104108
} elseif ($orderId) {
105109
$data = $this->getRequest()->getParam('creditmemo');
106110
$order = Mage::getModel('sales/order')->load($orderId);
@@ -193,7 +197,7 @@ public function viewAction()
193197
$this->_setActiveMenu('sales/order')
194198
->renderLayout();
195199
} else {
196-
$this->_forward('noRoute');
200+
$this->_redirect('*/*');
197201
}
198202
}
199203

app/locale/en_US/Mage_Adminhtml.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@
205205
"Cannot add tracking number.","Cannot add tracking number."
206206
"Cannot create an invoice without products.","Cannot create an invoice without products."
207207
"Cannot create credit memo for the order.","Cannot create credit memo for the order."
208+
"The credit memo no longer exists.","The credit memo no longer exists."
208209
"Cannot delete the design change.","Cannot delete the design change."
209210
"Cannot delete tracking number.","Cannot delete tracking number."
210211
"Cannot do shipment for the order separately from invoice.","Cannot do shipment for the order separately from invoice."

0 commit comments

Comments
 (0)