Skip to content

Commit

Permalink
Prevented editing of a non-editable order (#2632)
Browse files Browse the repository at this point in the history
  • Loading branch information
elidrissidev authored Oct 5, 2022
1 parent 6efea4b commit 33ef17f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,19 @@ public function startAction()
$orderId = $this->getRequest()->getParam('order_id');
$order = Mage::getModel('sales/order')->load($orderId);

if (!$order->getId()) {
$this->_redirect('*/sales_order/');
return;
}

try {
if ($order->getId()) {
$this->_getSession()->setUseOldShippingMethod(true);
$this->_getOrderCreateModel()->initFromOrder($order);
$this->_redirect('*/*');
}
else {
$this->_redirect('*/sales_order/');
if (!$order->canEdit()) {
Mage::throwException(Mage::helper('sales')->__('This order cannot be edited.'));
}

$this->_getSession()->setUseOldShippingMethod(true);
$this->_getOrderCreateModel()->initFromOrder($order);
$this->_redirect('*/*');
} catch (Mage_Core_Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
$this->_redirect('*/sales_order/view', ['order_id' => $orderId]);
Expand Down
1 change: 1 addition & 0 deletions app/locale/en_US/Mage_Sales.csv
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,7 @@
"There is no update for the payment.","There is no update for the payment."
"This message will be shown in shopping cart when subtotal after discount less than minimum amount.","This message will be shown in shopping cart when subtotal after discount less than minimum amount."
"This operation requires an existing transaction object.","This operation requires an existing transaction object."
"This order cannot be edited.","This order cannot be edited."
"This order contains (%s) items and therefore cannot be edited through the admin interface at this time, if you wish to continue editing the (%s) items will be removed, the order will be canceled and a new order will be placed.","This order contains (%s) items and therefore cannot be edited through the admin interface at this time, if you wish to continue editing the (%s) items will be removed, the order will be canceled and a new order will be placed."
"This order no longer exists.","This order no longer exists."
"This product does not have any configurable options","This product does not have any configurable options"
Expand Down

0 comments on commit 33ef17f

Please sign in to comment.