Skip to content

Commit e555920

Browse files
authored
Merge branch '20.0' into remove_pagecache_module
2 parents ce435d1 + d91170b commit e555920

File tree

10 files changed

+87
-972
lines changed

10 files changed

+87
-972
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ Do not use 20.x.x if you need IE support.
9494
- reduce needless saves by avoiding setting `_hasDataChanges` flag #2066
9595
- removed support for `global/sales/old_fields_map` defined in XML #921
9696
- removed Mage_PageCache module #2258
97+
- removed lib/flex containing unused ActionScript "file uploader" files #2271
9798

9899
For full list of changes, you can [compare tags](https://github.com/OpenMage/magento-lts/compare/1.9.4.x...20.0).
99100

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
@@ -37,6 +37,7 @@ abstract class Mage_Sales_Model_Api2_Order_Comment_Rest extends Mage_Sales_Model
3737
* Parameters in request used in model (usually specified in route mask)
3838
*/
3939
const PARAM_ORDER_ID = 'id';
40+
const PARAM_COMMENT_ID = 'comment_id';
4041
/**#@-*/
4142

4243
/**

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

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

app/code/core/Mage/Sales/etc/api2.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@
308308
<title>Order Comments</title>
309309
<privileges>
310310
<admin>
311+
<create>1</create>
311312
<retrieve>1</retrieve>
312313
</admin>
313314
<customer>
@@ -328,6 +329,10 @@
328329
</customer>
329330
</force_attributes>
330331
<routes>
332+
<route_entity>
333+
<route>/orders/comments/:comment_id</route>
334+
<action_type>entity</action_type>
335+
</route_entity>
331336
<route_collection>
332337
<route>/orders/:id/comments</route>
333338
<action_type>collection</action_type>

js/.htaccess

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
############################################
2+
## Disable PHP code execution
3+
4+
<IfModule mod_php7.c>
5+
php_flag engine 0
6+
</IfModule>
7+
8+
<IfModule mod_php8.c>
9+
php_flag engine 0
10+
</IfModule>
11+
12+
############################################
13+
## Don't permit execution of CGI scripts
14+
15+
AddHandler cgi-script .php .pl .py .jsp .asp .sh .cgi
16+
Options -ExecCGI

lib/flex/uploader/uploader.mxml

Lines changed: 0 additions & 76 deletions
This file was deleted.

lib/flex/uploader/uploaderSingle.mxml

Lines changed: 0 additions & 91 deletions
This file was deleted.

0 commit comments

Comments
 (0)