Skip to content

Commit ae95ef3

Browse files
sreichelfballiano
authored andcommitted
Backport: #2315 (#2746)
1 parent 9f1a13d commit ae95ef3

File tree

2 files changed

+1
-64
lines changed
  • app/code/core/Mage/Sales/Model/Api2/Order/Comment

2 files changed

+1
-64
lines changed

app/code/core/Mage/Sales/Model/Api2/Order/Comment/Rest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ abstract class Mage_Sales_Model_Api2_Order_Comment_Rest extends Mage_Sales_Model
3232
* Parameters in request used in model (usually specified in route mask)
3333
*/
3434
public const PARAM_ORDER_ID = 'id';
35+
public const PARAM_COMMENT_ID = 'comment_id';
3536
/**#@-*/
3637

3738
/**

app/code/core/Mage/Sales/Model/Api2/Order/Comment/Rest/Admin/V1.php

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -27,68 +27,4 @@
2727
*/
2828
class Mage_Sales_Model_Api2_Order_Comment_Rest_Admin_V1 extends Mage_Sales_Model_Api2_Order_Comment_Rest
2929
{
30-
/**
31-
* Add comment to order
32-
*
33-
* @param array $data
34-
* @return string
35-
*/
36-
protected function _create(array $data)
37-
{
38-
$orderId = $this->getRequest()->getParam(self::PARAM_ORDER_ID);
39-
$order = $this->_loadOrderById($orderId);
40-
41-
$status = $data['status'] ?? false;
42-
$comment = $data['comment'] ?? '';
43-
$visibleOnFront = $data['is_visible_on_front'] ?? 0;
44-
$notifyCustomer = array_key_exists('is_customer_notified', $data) ? $data['is_customer_notified'] : false;
45-
46-
$historyItem = $order->addStatusHistoryComment($comment, $status);
47-
$historyItem->setIsCustomerNotified($notifyCustomer)
48-
->setIsVisibleOnFront((int) $visibleOnFront)
49-
->save();
50-
51-
try {
52-
$oldStore = Mage::getDesign()->getStore();
53-
$oldArea = Mage::getDesign()->getArea();
54-
55-
if ($notifyCustomer && $comment) {
56-
Mage::getDesign()->setStore($order->getStoreId());
57-
Mage::getDesign()->setArea('frontend');
58-
}
59-
60-
$order->save();
61-
$order->sendOrderUpdateEmail((bool) $notifyCustomer, $comment);
62-
63-
if ($notifyCustomer && $comment) {
64-
Mage::getDesign()->setStore($oldStore);
65-
Mage::getDesign()->setArea($oldArea);
66-
}
67-
} catch (Mage_Core_Exception $e) {
68-
$this->_critical($e->getMessage(), self::RESOURCE_INTERNAL_ERROR);
69-
} catch (Throwable $t) {
70-
Mage::logException($t);
71-
$this->_critical($t->getMessage(), self::RESOURCE_UNKNOWN_ERROR);
72-
}
73-
74-
return $this->_getLocation($historyItem);
75-
}
76-
77-
/**
78-
* Retrieve order comment by id
79-
*
80-
* @return array
81-
*/
82-
protected function _retrieve()
83-
{
84-
$comment = Mage::getModel('sales/order_status_history')->load(
85-
$this->getRequest()->getParam(self::PARAM_COMMENT_ID)
86-
);
87-
88-
if (!$comment->getId()) {
89-
$this->_critical(self::RESOURCE_NOT_FOUND);
90-
}
91-
92-
return $comment->getData();
93-
}
9430
}

0 commit comments

Comments
 (0)