Version Notes
Full compatibility up to Magento 1.7.0.2. Includes support for using Clockwork SMS "API keys" instead of old Mediaburst usernames and passwords.
Download this release
Release Info
Developer | Mediaburst |
Extension | Mediaburst_SMS |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.4 to 1.2.0
- app/code/community/Mediaburst/Sms/Block/AbstractMessageGrid.php +57 -37
- app/code/community/Mediaburst/Sms/Block/CreditReportGrid.php +38 -27
- app/code/community/Mediaburst/Sms/Block/FailedGrid.php +28 -21
- app/code/community/Mediaburst/Sms/Block/GridContainer.php +0 -0
- app/code/community/Mediaburst/Sms/Block/PendingGrid.php +19 -16
- app/code/community/Mediaburst/Sms/Block/SentGrid.php +28 -21
- app/code/community/Mediaburst/Sms/Exception.php +0 -0
- app/code/community/Mediaburst/Sms/Helper/Data.php +19 -22
- app/code/community/Mediaburst/Sms/Model/Api.php +18 -14
- app/code/community/Mediaburst/Sms/Model/ApiConfig.php +4 -11
- app/code/community/Mediaburst/Sms/Model/Message.php +5 -4
- app/code/community/Mediaburst/Sms/Model/Mysql4/Message.php +0 -1
- app/code/community/Mediaburst/Sms/Model/Mysql4/Message/Collection.php +0 -1
- app/code/community/Mediaburst/Sms/Model/Observer.php +14 -14
- app/code/community/Mediaburst/Sms/controllers/Mediaburst/SmsController.php +10 -9
- app/code/community/Mediaburst/Sms/etc/adminhtml.xml +4 -4
- app/code/community/Mediaburst/Sms/etc/config.xml +13 -13
- app/code/community/Mediaburst/Sms/etc/system.xml +6 -13
- app/code/community/Mediaburst/Sms/sql/{MediaBurst_Sms → Mediaburst_Sms}/mysql4-install-1.0.0.php +0 -0
- app/code/community/Mediaburst/Sms/sql/{MediaBurst_Sms → Mediaburst_Sms}/mysql4-upgrade-1.0.0-1.1.2.php +0 -0
- app/design/adminhtml/default/default/layout/mediaburst/sms.xml +16 -16
- app/etc/modules/{Mediaburst_Sms.xml → MediaBurst_Sms.xml} +4 -4
- package.xml +17 -10
app/code/community/Mediaburst/Sms/Block/AbstractMessageGrid.php
CHANGED
@@ -61,50 +61,70 @@ abstract class Mediaburst_Sms_Block_AbstractMessageGrid extends Mage_Adminhtml_B
|
|
61 |
|
62 |
protected function _prepareColumns()
|
63 |
{
|
64 |
-
$this->addColumn(
|
65 |
-
'
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
70 |
|
71 |
-
$this->addColumn(
|
72 |
-
'
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
78 |
|
79 |
-
$this->addColumn(
|
80 |
-
'
|
81 |
-
|
82 |
-
|
83 |
-
|
|
|
|
|
|
|
84 |
|
85 |
-
$this->addColumn(
|
86 |
-
'
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
|
|
|
|
90 |
|
91 |
-
$this->addColumn(
|
92 |
-
'
|
93 |
-
|
94 |
-
|
|
|
|
|
|
|
95 |
|
96 |
-
$this->addColumn(
|
97 |
-
'
|
98 |
-
|
99 |
-
|
|
|
|
|
|
|
100 |
|
101 |
-
$this->addColumn(
|
102 |
-
'
|
103 |
-
|
104 |
-
|
105 |
-
|
|
|
|
|
|
|
106 |
|
107 |
return parent::_prepareColumns();
|
108 |
}
|
109 |
-
|
110 |
}
|
61 |
|
62 |
protected function _prepareColumns()
|
63 |
{
|
64 |
+
$this->addColumn(
|
65 |
+
'id',
|
66 |
+
array(
|
67 |
+
'header' => $this->__('Message #'),
|
68 |
+
'width' => '80px',
|
69 |
+
'type' => 'number',
|
70 |
+
'index' => 'id',
|
71 |
+
)
|
72 |
+
);
|
73 |
|
74 |
+
$this->addColumn(
|
75 |
+
'store_id',
|
76 |
+
array(
|
77 |
+
'header' => $this->__('Store'),
|
78 |
+
'index' => 'store_id',
|
79 |
+
'type' => 'store',
|
80 |
+
'store_view' => true,
|
81 |
+
'display_deleted' => true,
|
82 |
+
)
|
83 |
+
);
|
84 |
|
85 |
+
$this->addColumn(
|
86 |
+
'created_at',
|
87 |
+
array(
|
88 |
+
'header' => $this->__('Created'),
|
89 |
+
'index' => 'created_at',
|
90 |
+
'type' => 'datetime',
|
91 |
+
)
|
92 |
+
);
|
93 |
|
94 |
+
$this->addColumn(
|
95 |
+
'updated_at',
|
96 |
+
array(
|
97 |
+
'header' => $this->__('Updated'),
|
98 |
+
'index' => 'updated_at',
|
99 |
+
'type' => 'datetime',
|
100 |
+
)
|
101 |
+
);
|
102 |
|
103 |
+
$this->addColumn(
|
104 |
+
'to',
|
105 |
+
array(
|
106 |
+
'header' => $this->__('To'),
|
107 |
+
'index' => 'to',
|
108 |
+
)
|
109 |
+
);
|
110 |
|
111 |
+
$this->addColumn(
|
112 |
+
'from',
|
113 |
+
array(
|
114 |
+
'header' => $this->__('From'),
|
115 |
+
'index' => 'from',
|
116 |
+
)
|
117 |
+
);
|
118 |
|
119 |
+
$this->addColumn(
|
120 |
+
'content',
|
121 |
+
array(
|
122 |
+
'header' => $this->__('Content'),
|
123 |
+
'index' => 'content',
|
124 |
+
'filter' => false,
|
125 |
+
)
|
126 |
+
);
|
127 |
|
128 |
return parent::_prepareColumns();
|
129 |
}
|
|
|
130 |
}
|
app/code/community/Mediaburst/Sms/Block/CreditReportGrid.php
CHANGED
@@ -52,14 +52,14 @@ class Mediaburst_Sms_Block_CreditReportGrid extends Mage_Adminhtml_Block_Widget_
|
|
52 |
if ($helper->isActive($store)) {
|
53 |
$username = $helper->getUsername($store);
|
54 |
$password = $helper->getPassword($store);
|
55 |
-
$url
|
56 |
-
$hash
|
57 |
|
58 |
if (!isset($runs[$hash])) {
|
59 |
$runs[$hash] = array(
|
60 |
'username' => $username,
|
61 |
-
'url'
|
62 |
-
'stores'
|
63 |
);
|
64 |
}
|
65 |
|
@@ -90,23 +90,32 @@ class Mediaburst_Sms_Block_CreditReportGrid extends Mage_Adminhtml_Block_Widget_
|
|
90 |
|
91 |
protected function _prepareColumns()
|
92 |
{
|
93 |
-
$this->addColumn(
|
94 |
-
'
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
return parent::_prepareColumns();
|
112 |
}
|
@@ -116,12 +125,14 @@ class Mediaburst_Sms_Block_CreditReportGrid extends Mage_Adminhtml_Block_Widget_
|
|
116 |
$container = $this->getParentBlock();
|
117 |
if ($container instanceof Mage_Adminhtml_Block_Widget_Grid_Container) {
|
118 |
$helper = Mage::helper('Mediaburst_Sms/Data');
|
119 |
-
$container->addButton(
|
120 |
-
'
|
121 |
-
|
122 |
-
|
123 |
-
|
|
|
|
|
|
|
124 |
}
|
125 |
}
|
126 |
-
|
127 |
}
|
52 |
if ($helper->isActive($store)) {
|
53 |
$username = $helper->getUsername($store);
|
54 |
$password = $helper->getPassword($store);
|
55 |
+
$url = $helper->getCheckUrl($store);
|
56 |
+
$hash = md5($username . ':' . $password . ':' . $url);
|
57 |
|
58 |
if (!isset($runs[$hash])) {
|
59 |
$runs[$hash] = array(
|
60 |
'username' => $username,
|
61 |
+
'url' => $url,
|
62 |
+
'stores' => array()
|
63 |
);
|
64 |
}
|
65 |
|
90 |
|
91 |
protected function _prepareColumns()
|
92 |
{
|
93 |
+
$this->addColumn(
|
94 |
+
'username',
|
95 |
+
array(
|
96 |
+
'header' => $this->__('Username'),
|
97 |
+
'index' => 'username',
|
98 |
+
'filter' => false,
|
99 |
+
)
|
100 |
+
);
|
101 |
+
|
102 |
+
$this->addColumn(
|
103 |
+
'url',
|
104 |
+
array(
|
105 |
+
'header' => $this->__('Service URL'),
|
106 |
+
'index' => 'url',
|
107 |
+
'filter' => false,
|
108 |
+
)
|
109 |
+
);
|
110 |
+
|
111 |
+
$this->addColumn(
|
112 |
+
'credits',
|
113 |
+
array(
|
114 |
+
'header' => $this->__('Credits'),
|
115 |
+
'index' => 'credits',
|
116 |
+
'filter' => false,
|
117 |
+
)
|
118 |
+
);
|
119 |
|
120 |
return parent::_prepareColumns();
|
121 |
}
|
125 |
$container = $this->getParentBlock();
|
126 |
if ($container instanceof Mage_Adminhtml_Block_Widget_Grid_Container) {
|
127 |
$helper = Mage::helper('Mediaburst_Sms/Data');
|
128 |
+
$container->addButton(
|
129 |
+
'buy',
|
130 |
+
array(
|
131 |
+
'label' => $this->__('Buy'),
|
132 |
+
'onclick' => 'setLocation(\'' . $helper->getBuyUrl(0) . '\')',
|
133 |
+
'class' => 'add',
|
134 |
+
)
|
135 |
+
);
|
136 |
}
|
137 |
}
|
|
|
138 |
}
|
app/code/community/Mediaburst/Sms/Block/FailedGrid.php
CHANGED
@@ -37,32 +37,39 @@ class Mediaburst_Sms_Block_FailedGrid extends Mediaburst_Sms_Block_AbstractMessa
|
|
37 |
|
38 |
protected function _prepareColumns()
|
39 |
{
|
40 |
-
$this->addColumnAfter(
|
41 |
-
'
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
45 |
|
46 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/mediaburst_sms/retry')) {
|
47 |
-
$this->addColumnAfter(
|
48 |
-
'
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
),
|
59 |
-
'
|
60 |
-
|
61 |
-
'is_system' => true,
|
62 |
-
), 'error');
|
63 |
}
|
64 |
|
65 |
return parent::_prepareColumns();
|
66 |
}
|
67 |
-
|
68 |
}
|
37 |
|
38 |
protected function _prepareColumns()
|
39 |
{
|
40 |
+
$this->addColumnAfter(
|
41 |
+
'error',
|
42 |
+
array(
|
43 |
+
'header' => $this->__('Error'),
|
44 |
+
'index' => 'error_description',
|
45 |
+
'filter' => false,
|
46 |
+
),
|
47 |
+
'content'
|
48 |
+
);
|
49 |
|
50 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/mediaburst_sms/retry')) {
|
51 |
+
$this->addColumnAfter(
|
52 |
+
'action',
|
53 |
+
array(
|
54 |
+
'header' => $this->__('Action'),
|
55 |
+
'width' => '50px',
|
56 |
+
'type' => 'action',
|
57 |
+
'getter' => 'getId',
|
58 |
+
'filter' => false,
|
59 |
+
'sortable' => false,
|
60 |
+
'is_system' => true,
|
61 |
+
'actions' => array(
|
62 |
+
array(
|
63 |
+
'caption' => $this->__('Retry'),
|
64 |
+
'url' => array('base' => '*/*/retry'),
|
65 |
+
'field' => 'id'
|
66 |
+
)
|
67 |
+
)
|
68 |
),
|
69 |
+
'error'
|
70 |
+
);
|
|
|
|
|
71 |
}
|
72 |
|
73 |
return parent::_prepareColumns();
|
74 |
}
|
|
|
75 |
}
|
app/code/community/Mediaburst/Sms/Block/GridContainer.php
CHANGED
File without changes
|
app/code/community/Mediaburst/Sms/Block/PendingGrid.php
CHANGED
@@ -38,25 +38,28 @@ class Mediaburst_Sms_Block_PendingGrid extends Mediaburst_Sms_Block_AbstractMess
|
|
38 |
protected function _prepareColumns()
|
39 |
{
|
40 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/mediaburst_sms/send')) {
|
41 |
-
$this->addColumnAfter(
|
42 |
-
'
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
),
|
53 |
-
'
|
54 |
-
|
55 |
-
'is_system' => true,
|
56 |
-
), 'content');
|
57 |
}
|
58 |
|
59 |
return parent::_prepareColumns();
|
60 |
}
|
61 |
-
|
62 |
}
|
38 |
protected function _prepareColumns()
|
39 |
{
|
40 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/mediaburst_sms/send')) {
|
41 |
+
$this->addColumnAfter(
|
42 |
+
'action',
|
43 |
+
array(
|
44 |
+
'header' => $this->__('Action'),
|
45 |
+
'width' => '50px',
|
46 |
+
'type' => 'action',
|
47 |
+
'getter' => 'getId',
|
48 |
+
'filter' => false,
|
49 |
+
'sortable' => false,
|
50 |
+
'is_system' => true,
|
51 |
+
'actions' => array(
|
52 |
+
array(
|
53 |
+
'caption' => $this->__('Send'),
|
54 |
+
'url' => array('base' => '*/*/send'),
|
55 |
+
'field' => 'id'
|
56 |
+
)
|
57 |
+
)
|
58 |
),
|
59 |
+
'content'
|
60 |
+
);
|
|
|
|
|
61 |
}
|
62 |
|
63 |
return parent::_prepareColumns();
|
64 |
}
|
|
|
65 |
}
|
app/code/community/Mediaburst/Sms/Block/SentGrid.php
CHANGED
@@ -37,32 +37,39 @@ class Mediaburst_Sms_Block_SentGrid extends Mediaburst_Sms_Block_AbstractMessage
|
|
37 |
|
38 |
protected function _prepareColumns()
|
39 |
{
|
40 |
-
$this->addColumnAfter(
|
41 |
-
'
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
45 |
|
46 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/mediaburst_sms/requeue')) {
|
47 |
-
$this->addColumnAfter(
|
48 |
-
'
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
),
|
59 |
-
'
|
60 |
-
|
61 |
-
'is_system' => true,
|
62 |
-
), 'message_id');
|
63 |
}
|
64 |
|
65 |
return parent::_prepareColumns();
|
66 |
}
|
67 |
-
|
68 |
}
|
37 |
|
38 |
protected function _prepareColumns()
|
39 |
{
|
40 |
+
$this->addColumnAfter(
|
41 |
+
'message_id',
|
42 |
+
array(
|
43 |
+
'header' => $this->__('MessageID'),
|
44 |
+
'index' => 'message_id',
|
45 |
+
'filter' => false,
|
46 |
+
),
|
47 |
+
'content'
|
48 |
+
);
|
49 |
|
50 |
if (Mage::getSingleton('admin/session')->isAllowed('sales/mediaburst_sms/requeue')) {
|
51 |
+
$this->addColumnAfter(
|
52 |
+
'action',
|
53 |
+
array(
|
54 |
+
'header' => $this->__('Action'),
|
55 |
+
'width' => '50px',
|
56 |
+
'type' => 'action',
|
57 |
+
'getter' => 'getId',
|
58 |
+
'filter' => false,
|
59 |
+
'sortable' => false,
|
60 |
+
'is_system' => true,
|
61 |
+
'actions' => array(
|
62 |
+
array(
|
63 |
+
'caption' => $this->__('Requeue'),
|
64 |
+
'url' => array('base' => '*/*/requeue'),
|
65 |
+
'field' => 'id'
|
66 |
+
)
|
67 |
+
)
|
68 |
),
|
69 |
+
'message_id'
|
70 |
+
);
|
|
|
|
|
71 |
}
|
72 |
|
73 |
return parent::_prepareColumns();
|
74 |
}
|
|
|
75 |
}
|
app/code/community/Mediaburst/Sms/Exception.php
CHANGED
File without changes
|
app/code/community/Mediaburst/Sms/Helper/Data.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
* Copyright © 2011 by Mediaburst Limited
|
6 |
*
|
@@ -17,7 +17,7 @@
|
|
17 |
* OF THIS SOFTWARE.
|
18 |
*
|
19 |
* @category Mage
|
20 |
-
* @package
|
21 |
* @license http://opensource.org/licenses/isc-license.txt
|
22 |
* @copyright Copyright © 2011 by Mediaburst Limited
|
23 |
* @author Lee Saferite <lee.saferite@lokeycoding.com>
|
@@ -26,7 +26,7 @@
|
|
26 |
/**
|
27 |
* Helper
|
28 |
*/
|
29 |
-
class
|
30 |
{
|
31 |
const XML_CONFIG_BASE_PATH = 'mediaburst_sms/';
|
32 |
|
@@ -73,24 +73,15 @@ class MediaBurst_Sms_Helper_Data extends Mage_Core_Helper_Abstract implements Me
|
|
73 |
return Mage::getStoreConfig(self::XML_CONFIG_BASE_PATH . 'general/send_url', $store);
|
74 |
}
|
75 |
|
76 |
-
public function
|
77 |
{
|
78 |
if ($store === null) {
|
79 |
$store = $this->_defaultStore;
|
80 |
}
|
81 |
|
82 |
-
return Mage::getStoreConfig(self::XML_CONFIG_BASE_PATH . 'general/
|
83 |
}
|
84 |
-
|
85 |
-
public function getPassword($store = null)
|
86 |
-
{
|
87 |
-
if ($store === null) {
|
88 |
-
$store = $this->_defaultStore;
|
89 |
-
}
|
90 |
-
|
91 |
-
return Mage::getStoreConfig(self::XML_CONFIG_BASE_PATH . 'general/password', $store);
|
92 |
-
}
|
93 |
-
|
94 |
public function isDebug($store = null)
|
95 |
{
|
96 |
if ($store === null) {
|
@@ -108,8 +99,8 @@ class MediaBurst_Sms_Helper_Data extends Mage_Core_Helper_Abstract implements Me
|
|
108 |
|
109 |
if ($message instanceof Exception) {
|
110 |
$message = "\n" . $message->__toString();
|
111 |
-
$level
|
112 |
-
$file
|
113 |
} else {
|
114 |
if (is_array($message) || is_object($message)) {
|
115 |
$message = print_r($message, true);
|
@@ -254,7 +245,12 @@ class MediaBurst_Sms_Helper_Data extends Mage_Core_Helper_Abstract implements Me
|
|
254 |
$filter = Mage::getModel('core/email_template_filter');
|
255 |
$filter->setPlainTemplateMode(true);
|
256 |
$filter->setStoreId($order->getStoreId());
|
257 |
-
$filter->setVariables(
|
|
|
|
|
|
|
|
|
|
|
258 |
return $filter->filter($this->getOrderShippedContent($order->getStoreId()));
|
259 |
}
|
260 |
|
@@ -280,7 +276,8 @@ class MediaBurst_Sms_Helper_Data extends Mage_Core_Helper_Abstract implements Me
|
|
280 |
* Convert a result array into a series of session messages
|
281 |
*
|
282 |
* @param Mage_Core_Model_Session_Abstract $session
|
283 |
-
*
|
|
|
284 |
*/
|
285 |
public function reportResults(Mage_Core_Model_Session_Abstract $session, array $result)
|
286 |
{
|
@@ -340,8 +337,9 @@ class MediaBurst_Sms_Helper_Data extends Mage_Core_Helper_Abstract implements Me
|
|
340 |
/**
|
341 |
*
|
342 |
* @param Mage_Sales_Model_Order $order
|
343 |
-
* @param string
|
344 |
-
*
|
|
|
345 |
*/
|
346 |
public function addOrderComment(Mage_Sales_Model_Order $order, $comment)
|
347 |
{
|
@@ -354,5 +352,4 @@ class MediaBurst_Sms_Helper_Data extends Mage_Core_Helper_Abstract implements Me
|
|
354 |
|
355 |
return $this;
|
356 |
}
|
357 |
-
|
358 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Mediaburst SMS Magento Integration
|
4 |
*
|
5 |
* Copyright © 2011 by Mediaburst Limited
|
6 |
*
|
17 |
* OF THIS SOFTWARE.
|
18 |
*
|
19 |
* @category Mage
|
20 |
+
* @package Mediaburst_Sms
|
21 |
* @license http://opensource.org/licenses/isc-license.txt
|
22 |
* @copyright Copyright © 2011 by Mediaburst Limited
|
23 |
* @author Lee Saferite <lee.saferite@lokeycoding.com>
|
26 |
/**
|
27 |
* Helper
|
28 |
*/
|
29 |
+
class Mediaburst_Sms_Helper_Data extends Mage_Core_Helper_Abstract implements Mediaburst_Sms_Model_ApiConfig
|
30 |
{
|
31 |
const XML_CONFIG_BASE_PATH = 'mediaburst_sms/';
|
32 |
|
73 |
return Mage::getStoreConfig(self::XML_CONFIG_BASE_PATH . 'general/send_url', $store);
|
74 |
}
|
75 |
|
76 |
+
public function getKey($store = null)
|
77 |
{
|
78 |
if ($store === null) {
|
79 |
$store = $this->_defaultStore;
|
80 |
}
|
81 |
|
82 |
+
return Mage::getStoreConfig(self::XML_CONFIG_BASE_PATH . 'general/key', $store);
|
83 |
}
|
84 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
public function isDebug($store = null)
|
86 |
{
|
87 |
if ($store === null) {
|
99 |
|
100 |
if ($message instanceof Exception) {
|
101 |
$message = "\n" . $message->__toString();
|
102 |
+
$level = Zend_Log::ERR;
|
103 |
+
$file = Mage::getStoreConfig('dev/log/exception_file', $store);
|
104 |
} else {
|
105 |
if (is_array($message) || is_object($message)) {
|
106 |
$message = print_r($message, true);
|
245 |
$filter = Mage::getModel('core/email_template_filter');
|
246 |
$filter->setPlainTemplateMode(true);
|
247 |
$filter->setStoreId($order->getStoreId());
|
248 |
+
$filter->setVariables(
|
249 |
+
array(
|
250 |
+
'order' => $order,
|
251 |
+
'shipment' => $shipment
|
252 |
+
)
|
253 |
+
);
|
254 |
return $filter->filter($this->getOrderShippedContent($order->getStoreId()));
|
255 |
}
|
256 |
|
276 |
* Convert a result array into a series of session messages
|
277 |
*
|
278 |
* @param Mage_Core_Model_Session_Abstract $session
|
279 |
+
*
|
280 |
+
* @return Mediaburst_Sms_Helper_Data
|
281 |
*/
|
282 |
public function reportResults(Mage_Core_Model_Session_Abstract $session, array $result)
|
283 |
{
|
337 |
/**
|
338 |
*
|
339 |
* @param Mage_Sales_Model_Order $order
|
340 |
+
* @param string $comment
|
341 |
+
*
|
342 |
+
* @return Mediaburst_Sms_Helper_Data
|
343 |
*/
|
344 |
public function addOrderComment(Mage_Sales_Model_Order $order, $comment)
|
345 |
{
|
352 |
|
353 |
return $this;
|
354 |
}
|
|
|
355 |
}
|
app/code/community/Mediaburst/Sms/Model/Api.php
CHANGED
@@ -75,14 +75,18 @@ class Mediaburst_Sms_Model_Api extends Zend_Service_Abstract
|
|
75 |
throw new Mediaburst_Sms_Exception('Too many messages. Limit is ' . self::SMS_PER_REQUEST_LIMIT . ' per request');
|
76 |
}
|
77 |
|
78 |
-
$result = array(
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
$indexedMessages = array();
|
81 |
|
82 |
-
$xml
|
83 |
$root = $xml->appendChild($xml->createElement('Message'));
|
84 |
-
$root->appendChild($xml->createElement('
|
85 |
-
$root->appendChild($xml->createElement('Password', $this->_config->getPassword()));
|
86 |
foreach ($messages as $message) {
|
87 |
if (!$message instanceof Mediaburst_Sms_Model_Message) {
|
88 |
$this->_config->log('Message object not expected type', Zend_Log::WARN);
|
@@ -142,9 +146,9 @@ class Mediaburst_Sms_Model_Api extends Zend_Service_Abstract
|
|
142 |
$message = $result['pending'][$clientId];
|
143 |
unset($result['pending'][$clientId]);
|
144 |
|
145 |
-
$to
|
146 |
-
$messageId
|
147 |
-
$errorNumber
|
148 |
$errorDescription = $xpath->evaluate('string(./ErrDesc)', $responseNode);
|
149 |
|
150 |
if (!empty($errorNumber)) {
|
@@ -155,7 +159,8 @@ class Mediaburst_Sms_Model_Api extends Zend_Service_Abstract
|
|
155 |
$message->setStatus(Mediaburst_Sms_Model_Message::STATUS_FAILED);
|
156 |
$message->save();
|
157 |
$result['failed'][$clientId] = $message;
|
158 |
-
}
|
|
|
159 |
$result['errors'][] = array($e->getMessage(), $to, $errorNumber, $errorDescription);
|
160 |
}
|
161 |
} elseif (!empty($messageId)) {
|
@@ -166,7 +171,8 @@ class Mediaburst_Sms_Model_Api extends Zend_Service_Abstract
|
|
166 |
$message->setStatus(Mediaburst_Sms_Model_Message::STATUS_SENT);
|
167 |
$message->save();
|
168 |
$result['sent'][$clientId] = $message;
|
169 |
-
}
|
|
|
170 |
$result['errors'][] = array($e->getMessage(), $to, $messageId);
|
171 |
}
|
172 |
} else {
|
@@ -176,8 +182,8 @@ class Mediaburst_Sms_Model_Api extends Zend_Service_Abstract
|
|
176 |
|
177 |
$messageNodes = $xpath->query('//Message_Resp[ErrNo]');
|
178 |
foreach ($messageNodes as $messageNode) {
|
179 |
-
$errorNumber
|
180 |
-
$errorDescription
|
181 |
$result['errors'][] = array($errorNumber, $errorDescription);
|
182 |
}
|
183 |
|
@@ -196,8 +202,7 @@ class Mediaburst_Sms_Model_Api extends Zend_Service_Abstract
|
|
196 |
$client = $this->getHttpClient();
|
197 |
$client->resetParameters(true);
|
198 |
$client->setUri($this->_config->getCheckUrl());
|
199 |
-
$client->setParameterPost('
|
200 |
-
$client->setParameterPost('password', $this->_config->getPassword());
|
201 |
|
202 |
$response = $client->request(Zend_Http_Client::POST);
|
203 |
|
@@ -217,5 +222,4 @@ class Mediaburst_Sms_Model_Api extends Zend_Service_Abstract
|
|
217 |
{
|
218 |
return preg_replace('#[^\d]#', '', trim($number));
|
219 |
}
|
220 |
-
|
221 |
}
|
75 |
throw new Mediaburst_Sms_Exception('Too many messages. Limit is ' . self::SMS_PER_REQUEST_LIMIT . ' per request');
|
76 |
}
|
77 |
|
78 |
+
$result = array(
|
79 |
+
'pending' => array(),
|
80 |
+
'sent' => array(),
|
81 |
+
'failed' => array(),
|
82 |
+
'errors' => array()
|
83 |
+
);
|
84 |
|
85 |
$indexedMessages = array();
|
86 |
|
87 |
+
$xml = new DOMDocument('1.0', 'UTF-8');
|
88 |
$root = $xml->appendChild($xml->createElement('Message'));
|
89 |
+
$root->appendChild($xml->createElement('Key', $this->_config->getKey()));
|
|
|
90 |
foreach ($messages as $message) {
|
91 |
if (!$message instanceof Mediaburst_Sms_Model_Message) {
|
92 |
$this->_config->log('Message object not expected type', Zend_Log::WARN);
|
146 |
$message = $result['pending'][$clientId];
|
147 |
unset($result['pending'][$clientId]);
|
148 |
|
149 |
+
$to = $xpath->evaluate('string(./To)', $responseNode);
|
150 |
+
$messageId = $xpath->evaluate('string(./MessageID)', $responseNode);
|
151 |
+
$errorNumber = $xpath->evaluate('string(./ErrNo)', $responseNode);
|
152 |
$errorDescription = $xpath->evaluate('string(./ErrDesc)', $responseNode);
|
153 |
|
154 |
if (!empty($errorNumber)) {
|
159 |
$message->setStatus(Mediaburst_Sms_Model_Message::STATUS_FAILED);
|
160 |
$message->save();
|
161 |
$result['failed'][$clientId] = $message;
|
162 |
+
}
|
163 |
+
catch (Exception $e) {
|
164 |
$result['errors'][] = array($e->getMessage(), $to, $errorNumber, $errorDescription);
|
165 |
}
|
166 |
} elseif (!empty($messageId)) {
|
171 |
$message->setStatus(Mediaburst_Sms_Model_Message::STATUS_SENT);
|
172 |
$message->save();
|
173 |
$result['sent'][$clientId] = $message;
|
174 |
+
}
|
175 |
+
catch (Exception $e) {
|
176 |
$result['errors'][] = array($e->getMessage(), $to, $messageId);
|
177 |
}
|
178 |
} else {
|
182 |
|
183 |
$messageNodes = $xpath->query('//Message_Resp[ErrNo]');
|
184 |
foreach ($messageNodes as $messageNode) {
|
185 |
+
$errorNumber = $xpath->evaluate('string(./ErrNo)', $messageNode);
|
186 |
+
$errorDescription = $xpath->evaluate('string(./ErrDesc)', $messageNode);
|
187 |
$result['errors'][] = array($errorNumber, $errorDescription);
|
188 |
}
|
189 |
|
202 |
$client = $this->getHttpClient();
|
203 |
$client->resetParameters(true);
|
204 |
$client->setUri($this->_config->getCheckUrl());
|
205 |
+
$client->setParameterPost('key', $this->_config->getKey());
|
|
|
206 |
|
207 |
$response = $client->request(Zend_Http_Client::POST);
|
208 |
|
222 |
{
|
223 |
return preg_replace('#[^\d]#', '', trim($number));
|
224 |
}
|
|
|
225 |
}
|
app/code/community/Mediaburst/Sms/Model/ApiConfig.php
CHANGED
@@ -42,18 +42,11 @@ interface Mediaburst_Sms_Model_ApiConfig
|
|
42 |
public function getCheckUrl();
|
43 |
|
44 |
/**
|
45 |
-
* Return the API
|
46 |
*
|
47 |
* @return string
|
48 |
*/
|
49 |
-
public function
|
50 |
-
|
51 |
-
/**
|
52 |
-
* Return the API password
|
53 |
-
*
|
54 |
-
* @return string
|
55 |
-
*/
|
56 |
-
public function getPassword();
|
57 |
|
58 |
/**
|
59 |
* Check is debugging is enabled
|
@@ -66,8 +59,8 @@ interface Mediaburst_Sms_Model_ApiConfig
|
|
66 |
* Log a message
|
67 |
*
|
68 |
* @param mixed $message
|
69 |
-
* @param int
|
70 |
* @param mixed $store
|
71 |
*/
|
72 |
-
public function log($message, $level, $store);
|
73 |
}
|
42 |
public function getCheckUrl();
|
43 |
|
44 |
/**
|
45 |
+
* Return the API key
|
46 |
*
|
47 |
* @return string
|
48 |
*/
|
49 |
+
public function getKey();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
/**
|
52 |
* Check is debugging is enabled
|
59 |
* Log a message
|
60 |
*
|
61 |
* @param mixed $message
|
62 |
+
* @param int $level
|
63 |
* @param mixed $store
|
64 |
*/
|
65 |
+
public function log($message, $level = Zend_Log::DEBUG, $store = null);
|
66 |
}
|
app/code/community/Mediaburst/Sms/Model/Message.php
CHANGED
@@ -28,9 +28,9 @@
|
|
28 |
*/
|
29 |
class Mediaburst_Sms_Model_Message extends Mage_Core_Model_Abstract
|
30 |
{
|
31 |
-
const STATUS_PENDING
|
32 |
-
const STATUS_SENT
|
33 |
-
const STATUS_FAILED
|
34 |
const DATETIME_FORMAT = 'yyyy-MM-dd HH:mm:ss';
|
35 |
|
36 |
protected function _construct()
|
@@ -87,6 +87,7 @@ class Mediaburst_Sms_Model_Message extends Mage_Core_Model_Abstract
|
|
87 |
* Convert a date string or object into a MySQL formatted date-time string
|
88 |
*
|
89 |
* @param Zend_Date|string|null $date
|
|
|
90 |
* @return string
|
91 |
*/
|
92 |
protected function _toDbDate($date = null)
|
@@ -106,6 +107,7 @@ class Mediaburst_Sms_Model_Message extends Mage_Core_Model_Abstract
|
|
106 |
* Convert a MySQL Formatted DateTime string into a Zend_Date object
|
107 |
*
|
108 |
* @param string $date
|
|
|
109 |
* @return Zend_Date
|
110 |
*/
|
111 |
protected function _fromDbDate($date)
|
@@ -122,5 +124,4 @@ class Mediaburst_Sms_Model_Message extends Mage_Core_Model_Abstract
|
|
122 |
|
123 |
return $date;
|
124 |
}
|
125 |
-
|
126 |
}
|
28 |
*/
|
29 |
class Mediaburst_Sms_Model_Message extends Mage_Core_Model_Abstract
|
30 |
{
|
31 |
+
const STATUS_PENDING = 0;
|
32 |
+
const STATUS_SENT = 1;
|
33 |
+
const STATUS_FAILED = 2;
|
34 |
const DATETIME_FORMAT = 'yyyy-MM-dd HH:mm:ss';
|
35 |
|
36 |
protected function _construct()
|
87 |
* Convert a date string or object into a MySQL formatted date-time string
|
88 |
*
|
89 |
* @param Zend_Date|string|null $date
|
90 |
+
*
|
91 |
* @return string
|
92 |
*/
|
93 |
protected function _toDbDate($date = null)
|
107 |
* Convert a MySQL Formatted DateTime string into a Zend_Date object
|
108 |
*
|
109 |
* @param string $date
|
110 |
+
*
|
111 |
* @return Zend_Date
|
112 |
*/
|
113 |
protected function _fromDbDate($date)
|
124 |
|
125 |
return $date;
|
126 |
}
|
|
|
127 |
}
|
app/code/community/Mediaburst/Sms/Model/Mysql4/Message.php
CHANGED
@@ -33,5 +33,4 @@ class Mediaburst_Sms_Model_Mysql4_Message extends Mage_Core_Model_Mysql4_Abstrac
|
|
33 |
{
|
34 |
$this->_init('Mediaburst_Sms/Message', 'id');
|
35 |
}
|
36 |
-
|
37 |
}
|
33 |
{
|
34 |
$this->_init('Mediaburst_Sms/Message', 'id');
|
35 |
}
|
|
|
36 |
}
|
app/code/community/Mediaburst/Sms/Model/Mysql4/Message/Collection.php
CHANGED
@@ -33,5 +33,4 @@ class Mediaburst_Sms_Model_Mysql4_Message_Collection extends Mage_Core_Model_Mys
|
|
33 |
{
|
34 |
$this->_init('Mediaburst_Sms/Message');
|
35 |
}
|
36 |
-
|
37 |
}
|
33 |
{
|
34 |
$this->_init('Mediaburst_Sms/Message');
|
35 |
}
|
|
|
36 |
}
|
app/code/community/Mediaburst/Sms/Model/Observer.php
CHANGED
@@ -44,7 +44,8 @@ class Mediaburst_Sms_Model_Observer
|
|
44 |
$message->setFrom($this->getHelper()->getOrderCreatedFrom());
|
45 |
$message->setContent($this->getHelper()->generateOrderCreatedContent($order));
|
46 |
$message->save();
|
47 |
-
}
|
|
|
48 |
$this->getHelper()->log('Error creating Order Created SMS Message Record for Order ' . $order->getIncrementId(), Zend_Log::ERR);
|
49 |
}
|
50 |
}
|
@@ -67,7 +68,8 @@ class Mediaburst_Sms_Model_Observer
|
|
67 |
$message->setContent($this->getHelper()->generateOrderShippedContent($order, $shipment));
|
68 |
$message->save();
|
69 |
$this->getHelper()->addOrderComment($order, 'SMS message generated (' . $message->getId() . ')');
|
70 |
-
}
|
|
|
71 |
$this->getHelper()->log('Error creating Order Shipped SMS Message Record for Order ' . $order->getIncrementId(), Zend_Log::ERR);
|
72 |
}
|
73 |
}
|
@@ -90,7 +92,8 @@ class Mediaburst_Sms_Model_Observer
|
|
90 |
$message->setContent($this->getHelper()->generateOrderHeldContent($order));
|
91 |
$message->save();
|
92 |
$this->getHelper()->addOrderComment($order, 'SMS message generated (' . $message->getId() . ')');
|
93 |
-
}
|
|
|
94 |
$this->getHelper()->log('Error creating Order Held SMS Message Record for Order ' . $order->getIncrementId(), Zend_Log::ERR);
|
95 |
}
|
96 |
}
|
@@ -114,7 +117,8 @@ class Mediaburst_Sms_Model_Observer
|
|
114 |
$message->setContent($this->getHelper()->generateOrderUnheldContent($order));
|
115 |
$message->save();
|
116 |
$this->getHelper()->addOrderComment($order, 'SMS message generated (' . $message->getId() . ')');
|
117 |
-
}
|
|
|
118 |
$this->getHelper()->log('Error creating Order Held SMS Message Record for Order ' . $order->getIncrementId(), Zend_Log::ERR);
|
119 |
}
|
120 |
}
|
@@ -131,17 +135,15 @@ class Mediaburst_Sms_Model_Observer
|
|
131 |
$stores = Mage::app()->getStores();
|
132 |
foreach ($stores as $store) {
|
133 |
if ($this->getHelper()->isActive($store)) {
|
134 |
-
$
|
135 |
-
$
|
136 |
-
$
|
137 |
-
$hash = md5($username . ':' . $password . ':' . $url);
|
138 |
|
139 |
if (!isset($runs[$hash])) {
|
140 |
$runs[$hash] = array(
|
141 |
-
'
|
142 |
-
'
|
143 |
-
'
|
144 |
-
'stores' => array()
|
145 |
);
|
146 |
}
|
147 |
|
@@ -150,7 +152,6 @@ class Mediaburst_Sms_Model_Observer
|
|
150 |
}
|
151 |
|
152 |
$api = Mage::getModel('Mediaburst_Sms/Api', $this->getHelper());
|
153 |
-
/* @var $api Mediaburst_Sms_Model_Api */
|
154 |
|
155 |
foreach ($runs as $run) {
|
156 |
$collection = Mage::getModel('Mediaburst_Sms/Message')->getCollection()
|
@@ -181,5 +182,4 @@ class Mediaburst_Sms_Model_Observer
|
|
181 |
{
|
182 |
return Mage::helper('Mediaburst_Sms/Data');
|
183 |
}
|
184 |
-
|
185 |
}
|
44 |
$message->setFrom($this->getHelper()->getOrderCreatedFrom());
|
45 |
$message->setContent($this->getHelper()->generateOrderCreatedContent($order));
|
46 |
$message->save();
|
47 |
+
}
|
48 |
+
catch (Exception $e) {
|
49 |
$this->getHelper()->log('Error creating Order Created SMS Message Record for Order ' . $order->getIncrementId(), Zend_Log::ERR);
|
50 |
}
|
51 |
}
|
68 |
$message->setContent($this->getHelper()->generateOrderShippedContent($order, $shipment));
|
69 |
$message->save();
|
70 |
$this->getHelper()->addOrderComment($order, 'SMS message generated (' . $message->getId() . ')');
|
71 |
+
}
|
72 |
+
catch (Exception $e) {
|
73 |
$this->getHelper()->log('Error creating Order Shipped SMS Message Record for Order ' . $order->getIncrementId(), Zend_Log::ERR);
|
74 |
}
|
75 |
}
|
92 |
$message->setContent($this->getHelper()->generateOrderHeldContent($order));
|
93 |
$message->save();
|
94 |
$this->getHelper()->addOrderComment($order, 'SMS message generated (' . $message->getId() . ')');
|
95 |
+
}
|
96 |
+
catch (Exception $e) {
|
97 |
$this->getHelper()->log('Error creating Order Held SMS Message Record for Order ' . $order->getIncrementId(), Zend_Log::ERR);
|
98 |
}
|
99 |
}
|
117 |
$message->setContent($this->getHelper()->generateOrderUnheldContent($order));
|
118 |
$message->save();
|
119 |
$this->getHelper()->addOrderComment($order, 'SMS message generated (' . $message->getId() . ')');
|
120 |
+
}
|
121 |
+
catch (Exception $e) {
|
122 |
$this->getHelper()->log('Error creating Order Held SMS Message Record for Order ' . $order->getIncrementId(), Zend_Log::ERR);
|
123 |
}
|
124 |
}
|
135 |
$stores = Mage::app()->getStores();
|
136 |
foreach ($stores as $store) {
|
137 |
if ($this->getHelper()->isActive($store)) {
|
138 |
+
$key = $this->getHelper()->getKey($store);
|
139 |
+
$url = $this->getHelper()->getSendUrl($store);
|
140 |
+
$hash = md5($username . ':' . $password . ':' . $url);
|
|
|
141 |
|
142 |
if (!isset($runs[$hash])) {
|
143 |
$runs[$hash] = array(
|
144 |
+
'key' => $key,
|
145 |
+
'url' => $url,
|
146 |
+
'stores' => array()
|
|
|
147 |
);
|
148 |
}
|
149 |
|
152 |
}
|
153 |
|
154 |
$api = Mage::getModel('Mediaburst_Sms/Api', $this->getHelper());
|
|
|
155 |
|
156 |
foreach ($runs as $run) {
|
157 |
$collection = Mage::getModel('Mediaburst_Sms/Message')->getCollection()
|
182 |
{
|
183 |
return Mage::helper('Mediaburst_Sms/Data');
|
184 |
}
|
|
|
185 |
}
|
app/code/community/Mediaburst/Sms/controllers/Mediaburst/SmsController.php
CHANGED
@@ -68,13 +68,13 @@ class Mediaburst_Sms_Mediaburst_SmsController extends Mage_Adminhtml_Controller_
|
|
68 |
|
69 |
public function sendAction()
|
70 |
{
|
71 |
-
$id
|
72 |
$message = Mage::getModel('Mediaburst_Sms/Message')->load($id);
|
73 |
if ($message->getId() > 0 && $message->getId() == $id) {
|
74 |
if ($message->getStatus() == Mediaburst_Sms_Model_Message::STATUS_PENDING) {
|
75 |
$helper = Mage::helper('Mediaburst_Sms/Data');
|
76 |
$helper->setDefaultStore($message->getStoreId());
|
77 |
-
$api
|
78 |
$result = $api->sendMessage($message);
|
79 |
$helper->setDefaultStore(null);
|
80 |
$helper->reportResults($this->_getSession(), $result);
|
@@ -90,7 +90,7 @@ class Mediaburst_Sms_Mediaburst_SmsController extends Mage_Adminhtml_Controller_
|
|
90 |
|
91 |
public function requeueAction()
|
92 |
{
|
93 |
-
$id
|
94 |
$message = Mage::getModel('Mediaburst_Sms/Message')->load($id);
|
95 |
if ($message->getId() > 0 && $message->getId() == $id) {
|
96 |
if ($message->getStatus() == Mediaburst_Sms_Model_Message::STATUS_SENT) {
|
@@ -101,8 +101,9 @@ class Mediaburst_Sms_Mediaburst_SmsController extends Mage_Adminhtml_Controller_
|
|
101 |
$message->setErrorDescription(null);
|
102 |
$message->save();
|
103 |
$this->_getSession()->addSuccess($this->__('Requeued message %s to %s', $message->getId(), $message->getTo()));
|
104 |
-
}
|
105 |
-
|
|
|
106 |
}
|
107 |
} else {
|
108 |
$this->_getSession()->addError($this->__('Invalid Message Status'));
|
@@ -116,7 +117,7 @@ class Mediaburst_Sms_Mediaburst_SmsController extends Mage_Adminhtml_Controller_
|
|
116 |
|
117 |
public function retryAction()
|
118 |
{
|
119 |
-
$id
|
120 |
$message = Mage::getModel('Mediaburst_Sms/Message')->load($id);
|
121 |
if ($message->getId() > 0 && $message->getId() == $id) {
|
122 |
if ($message->getStatus() == Mediaburst_Sms_Model_Message::STATUS_FAILED) {
|
@@ -127,8 +128,9 @@ class Mediaburst_Sms_Mediaburst_SmsController extends Mage_Adminhtml_Controller_
|
|
127 |
$message->setErrorDescription(null);
|
128 |
$message->save();
|
129 |
$this->_getSession()->addSuccess($this->__('Retrying message %s to %s', $message->getId(), $message->getTo()));
|
130 |
-
}
|
131 |
-
|
|
|
132 |
}
|
133 |
} else {
|
134 |
$this->_getSession()->addError($this->__('Invalid Message Status'));
|
@@ -174,5 +176,4 @@ class Mediaburst_Sms_Mediaburst_SmsController extends Mage_Adminhtml_Controller_
|
|
174 |
{
|
175 |
return Mage::getSingleton('admin/session')->isAllowed('sales/mediaburst_sms/' . $permission);
|
176 |
}
|
177 |
-
|
178 |
}
|
68 |
|
69 |
public function sendAction()
|
70 |
{
|
71 |
+
$id = (int)$this->getRequest()->getParam('id');
|
72 |
$message = Mage::getModel('Mediaburst_Sms/Message')->load($id);
|
73 |
if ($message->getId() > 0 && $message->getId() == $id) {
|
74 |
if ($message->getStatus() == Mediaburst_Sms_Model_Message::STATUS_PENDING) {
|
75 |
$helper = Mage::helper('Mediaburst_Sms/Data');
|
76 |
$helper->setDefaultStore($message->getStoreId());
|
77 |
+
$api = Mage::getModel('Mediaburst_Sms/Api', $helper);
|
78 |
$result = $api->sendMessage($message);
|
79 |
$helper->setDefaultStore(null);
|
80 |
$helper->reportResults($this->_getSession(), $result);
|
90 |
|
91 |
public function requeueAction()
|
92 |
{
|
93 |
+
$id = (int)$this->getRequest()->getParam('id');
|
94 |
$message = Mage::getModel('Mediaburst_Sms/Message')->load($id);
|
95 |
if ($message->getId() > 0 && $message->getId() == $id) {
|
96 |
if ($message->getStatus() == Mediaburst_Sms_Model_Message::STATUS_SENT) {
|
101 |
$message->setErrorDescription(null);
|
102 |
$message->save();
|
103 |
$this->_getSession()->addSuccess($this->__('Requeued message %s to %s', $message->getId(), $message->getTo()));
|
104 |
+
}
|
105 |
+
catch (Exception $e) {
|
106 |
+
$this->_getSession()->addException($e, $e->getMessage());
|
107 |
}
|
108 |
} else {
|
109 |
$this->_getSession()->addError($this->__('Invalid Message Status'));
|
117 |
|
118 |
public function retryAction()
|
119 |
{
|
120 |
+
$id = (int)$this->getRequest()->getParam('id');
|
121 |
$message = Mage::getModel('Mediaburst_Sms/Message')->load($id);
|
122 |
if ($message->getId() > 0 && $message->getId() == $id) {
|
123 |
if ($message->getStatus() == Mediaburst_Sms_Model_Message::STATUS_FAILED) {
|
128 |
$message->setErrorDescription(null);
|
129 |
$message->save();
|
130 |
$this->_getSession()->addSuccess($this->__('Retrying message %s to %s', $message->getId(), $message->getTo()));
|
131 |
+
}
|
132 |
+
catch (Exception $e) {
|
133 |
+
$this->_getSession()->addException($e, $e->getMessage());
|
134 |
}
|
135 |
} else {
|
136 |
$this->_getSession()->addError($this->__('Invalid Message Status'));
|
176 |
{
|
177 |
return Mage::getSingleton('admin/session')->isAllowed('sales/mediaburst_sms/' . $permission);
|
178 |
}
|
|
|
179 |
}
|
app/code/community/Mediaburst/Sms/etc/adminhtml.xml
CHANGED
@@ -9,22 +9,22 @@
|
|
9 |
<children>
|
10 |
<pending translate="title">
|
11 |
<title>Pending</title>
|
12 |
-
<action>adminhtml/
|
13 |
<sort_order>100</sort_order>
|
14 |
</pending>
|
15 |
<sent translate="title">
|
16 |
<title>Sent</title>
|
17 |
-
<action>adminhtml/
|
18 |
<sort_order>200</sort_order>
|
19 |
</sent>
|
20 |
<failed translate="title">
|
21 |
<title>Failed</title>
|
22 |
-
<action>adminhtml/
|
23 |
<sort_order>300</sort_order>
|
24 |
</failed>
|
25 |
<check translate="title">
|
26 |
<title>View/Buy Credits</title>
|
27 |
-
<action>adminhtml/
|
28 |
<sort_order>400</sort_order>
|
29 |
</check>
|
30 |
</children>
|
9 |
<children>
|
10 |
<pending translate="title">
|
11 |
<title>Pending</title>
|
12 |
+
<action>adminhtml/mediaburst_sms/pending</action>
|
13 |
<sort_order>100</sort_order>
|
14 |
</pending>
|
15 |
<sent translate="title">
|
16 |
<title>Sent</title>
|
17 |
+
<action>adminhtml/mediaburst_sms/sent</action>
|
18 |
<sort_order>200</sort_order>
|
19 |
</sent>
|
20 |
<failed translate="title">
|
21 |
<title>Failed</title>
|
22 |
+
<action>adminhtml/mediaburst_sms/failed</action>
|
23 |
<sort_order>300</sort_order>
|
24 |
</failed>
|
25 |
<check translate="title">
|
26 |
<title>View/Buy Credits</title>
|
27 |
+
<action>adminhtml/mediaburst_sms/check</action>
|
28 |
<sort_order>400</sort_order>
|
29 |
</check>
|
30 |
</children>
|
app/code/community/Mediaburst/Sms/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Mediaburst_Sms>
|
5 |
-
<version>1.1.
|
6 |
</Mediaburst_Sms>
|
7 |
</modules>
|
8 |
<global>
|
@@ -91,33 +91,33 @@
|
|
91 |
<default>
|
92 |
<mediaburst_sms>
|
93 |
<general>
|
94 |
-
<active>
|
95 |
-
<username
|
96 |
-
<password
|
97 |
-
<send_url>
|
98 |
-
<check_url>
|
99 |
-
<buy_url>https://
|
100 |
-
<schedule
|
101 |
-
<debug>
|
102 |
</general>
|
103 |
<order_created>
|
104 |
-
<active
|
105 |
<from></from>
|
106 |
<to></to>
|
107 |
<content>Order {{var order.increment_id}} placed for {{var order.base_grand_total}}</content>
|
108 |
</order_created>
|
109 |
<order_held>
|
110 |
-
<active>
|
111 |
<from></from>
|
112 |
<content>{{var order.getCustomerName()}}, your order {{var order.increment_id}} has been placed on hold.</content>
|
113 |
</order_held>
|
114 |
<order_unheld>
|
115 |
-
<active>
|
116 |
<from></from>
|
117 |
<content>{{var order.getCustomerName()}}, your order {{var order.increment_id}} has been released from hold.</content>
|
118 |
</order_unheld>
|
119 |
<order_shipped>
|
120 |
-
<active>
|
121 |
<from></from>
|
122 |
<content>{{var order.getCustomerName()}}, your order {{var order.increment_id}} has shipped. Shipment {{var shipment.increment_id}}</content>
|
123 |
</order_shipped>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Mediaburst_Sms>
|
5 |
+
<version>1.1.6</version>
|
6 |
</Mediaburst_Sms>
|
7 |
</modules>
|
8 |
<global>
|
91 |
<default>
|
92 |
<mediaburst_sms>
|
93 |
<general>
|
94 |
+
<active>1</active>
|
95 |
+
<username>james@mediaburst.co.uk</username>
|
96 |
+
<password>CastingLines11:11</password>
|
97 |
+
<send_url>https://api.clockworksms.com/xml/send.aspx</send_url>
|
98 |
+
<check_url>https://api.clockworksms.com/http/credit.aspx</check_url>
|
99 |
+
<buy_url>https://smsapi.mediaburst.co.uk/Login.aspx?ReturnUrl=https://smsapi.mediaburst.co.uk/shop/</buy_url>
|
100 |
+
<schedule>* * * * *</schedule>
|
101 |
+
<debug>1</debug>
|
102 |
</general>
|
103 |
<order_created>
|
104 |
+
<active>1</active>
|
105 |
<from></from>
|
106 |
<to></to>
|
107 |
<content>Order {{var order.increment_id}} placed for {{var order.base_grand_total}}</content>
|
108 |
</order_created>
|
109 |
<order_held>
|
110 |
+
<active>1</active>
|
111 |
<from></from>
|
112 |
<content>{{var order.getCustomerName()}}, your order {{var order.increment_id}} has been placed on hold.</content>
|
113 |
</order_held>
|
114 |
<order_unheld>
|
115 |
+
<active>1</active>
|
116 |
<from></from>
|
117 |
<content>{{var order.getCustomerName()}}, your order {{var order.increment_id}} has been released from hold.</content>
|
118 |
</order_unheld>
|
119 |
<order_shipped>
|
120 |
+
<active>1</active>
|
121 |
<from></from>
|
122 |
<content>{{var order.getCustomerName()}}, your order {{var order.increment_id}} has shipped. Shipment {{var shipment.increment_id}}</content>
|
123 |
</order_shipped>
|
app/code/community/Mediaburst/Sms/etc/system.xml
CHANGED
@@ -25,37 +25,30 @@
|
|
25 |
<show_in_default>1</show_in_default>
|
26 |
<show_in_website>1</show_in_website>
|
27 |
</active>
|
28 |
-
<
|
29 |
-
<label>
|
30 |
<frontend_type>text</frontend_type>
|
31 |
<sort_order>20</sort_order>
|
32 |
<show_in_default>1</show_in_default>
|
33 |
<show_in_website>1</show_in_website>
|
34 |
-
</
|
35 |
-
<password translate="label">
|
36 |
-
<label>Password</label>
|
37 |
-
<frontend_type>password</frontend_type>
|
38 |
-
<sort_order>30</sort_order>
|
39 |
-
<show_in_default>1</show_in_default>
|
40 |
-
<show_in_website>1</show_in_website>
|
41 |
-
</password>
|
42 |
<send_url translate="label">
|
43 |
<label>Send Message URL</label>
|
44 |
<frontend_type>text</frontend_type>
|
45 |
<sort_order>40</sort_order>
|
46 |
-
<show_in_default>
|
47 |
</send_url>
|
48 |
<check_url translate="label">
|
49 |
<label>Check Credits URL</label>
|
50 |
<frontend_type>text</frontend_type>
|
51 |
<sort_order>50</sort_order>
|
52 |
-
<show_in_default>
|
53 |
</check_url>
|
54 |
<buy_url translate="label">
|
55 |
<label>Buy Credits URL</label>
|
56 |
<frontend_type>text</frontend_type>
|
57 |
<sort_order>60</sort_order>
|
58 |
-
<show_in_default>
|
59 |
</buy_url>
|
60 |
<failsafe_prefix translate="label">
|
61 |
<label>Failsafe Country Prefix</label>
|
25 |
<show_in_default>1</show_in_default>
|
26 |
<show_in_website>1</show_in_website>
|
27 |
</active>
|
28 |
+
<key translate="label">
|
29 |
+
<label>API Key</label>
|
30 |
<frontend_type>text</frontend_type>
|
31 |
<sort_order>20</sort_order>
|
32 |
<show_in_default>1</show_in_default>
|
33 |
<show_in_website>1</show_in_website>
|
34 |
+
</key>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
<send_url translate="label">
|
36 |
<label>Send Message URL</label>
|
37 |
<frontend_type>text</frontend_type>
|
38 |
<sort_order>40</sort_order>
|
39 |
+
<show_in_default>0</show_in_default>
|
40 |
</send_url>
|
41 |
<check_url translate="label">
|
42 |
<label>Check Credits URL</label>
|
43 |
<frontend_type>text</frontend_type>
|
44 |
<sort_order>50</sort_order>
|
45 |
+
<show_in_default>0</show_in_default>
|
46 |
</check_url>
|
47 |
<buy_url translate="label">
|
48 |
<label>Buy Credits URL</label>
|
49 |
<frontend_type>text</frontend_type>
|
50 |
<sort_order>60</sort_order>
|
51 |
+
<show_in_default>0</show_in_default>
|
52 |
</buy_url>
|
53 |
<failsafe_prefix translate="label">
|
54 |
<label>Failsafe Country Prefix</label>
|
app/code/community/Mediaburst/Sms/sql/{MediaBurst_Sms → Mediaburst_Sms}/mysql4-install-1.0.0.php
RENAMED
File without changes
|
app/code/community/Mediaburst/Sms/sql/{MediaBurst_Sms → Mediaburst_Sms}/mysql4-upgrade-1.0.0-1.1.2.php
RENAMED
File without changes
|
app/design/adminhtml/default/default/layout/mediaburst/sms.xml
CHANGED
@@ -2,16 +2,16 @@
|
|
2 |
<layout>
|
3 |
<adminhtml_mediaburst_sms_pending>
|
4 |
<reference name="content">
|
5 |
-
<block type="
|
6 |
-
<action method="setHeaderText">
|
7 |
<param>Pending SMS Messages</param>
|
8 |
</action>
|
9 |
<action method="removeButton">
|
10 |
<param>add</param>
|
11 |
</action>
|
12 |
-
<block type="
|
13 |
<action method="setCollectionResourceModel">
|
14 |
-
<param>
|
15 |
</action>
|
16 |
<action method="setDefaultDir">
|
17 |
<param>DESC</param>
|
@@ -22,16 +22,16 @@
|
|
22 |
</adminhtml_mediaburst_sms_pending>
|
23 |
<adminhtml_mediaburst_sms_sent>
|
24 |
<reference name="content">
|
25 |
-
<block type="
|
26 |
-
<action method="setHeaderText">
|
27 |
<param>Sent SMS Messages</param>
|
28 |
</action>
|
29 |
<action method="removeButton">
|
30 |
<param>add</param>
|
31 |
</action>
|
32 |
-
<block type="
|
33 |
<action method="setCollectionResourceModel">
|
34 |
-
<param>
|
35 |
</action>
|
36 |
<action method="setDefaultDir">
|
37 |
<param>DESC</param>
|
@@ -42,16 +42,16 @@
|
|
42 |
</adminhtml_mediaburst_sms_sent>
|
43 |
<adminhtml_mediaburst_sms_failed>
|
44 |
<reference name="content">
|
45 |
-
<block type="
|
46 |
-
<action method="setHeaderText">
|
47 |
<param>Failed SMS Messages</param>
|
48 |
</action>
|
49 |
<action method="removeButton">
|
50 |
<param>add</param>
|
51 |
</action>
|
52 |
-
<block type="
|
53 |
<action method="setCollectionResourceModel">
|
54 |
-
<param>
|
55 |
</action>
|
56 |
<action method="setDefaultDir">
|
57 |
<param>DESC</param>
|
@@ -62,15 +62,15 @@
|
|
62 |
</adminhtml_mediaburst_sms_failed>
|
63 |
<adminhtml_mediaburst_sms_check>
|
64 |
<reference name="content">
|
65 |
-
<block type="
|
66 |
-
<action method="setHeaderText">
|
67 |
<param>Remaining Credits</param>
|
68 |
</action>
|
69 |
<action method="removeButton">
|
70 |
<param>add</param>
|
71 |
</action>
|
72 |
-
<block type="
|
73 |
-
<action method="registerBuyButton"
|
74 |
</block>
|
75 |
</block>
|
76 |
</reference>
|
2 |
<layout>
|
3 |
<adminhtml_mediaburst_sms_pending>
|
4 |
<reference name="content">
|
5 |
+
<block type="Mediaburst_Sms/GridContainer" name="mediaburst_sms.gridcontainer">
|
6 |
+
<action method="setHeaderText" translate="param">
|
7 |
<param>Pending SMS Messages</param>
|
8 |
</action>
|
9 |
<action method="removeButton">
|
10 |
<param>add</param>
|
11 |
</action>
|
12 |
+
<block type="Mediaburst_Sms/PendingGrid" name="mediaburst_sms.grid" as="grid">
|
13 |
<action method="setCollectionResourceModel">
|
14 |
+
<param>Mediaburst_Sms/Message_Collection</param>
|
15 |
</action>
|
16 |
<action method="setDefaultDir">
|
17 |
<param>DESC</param>
|
22 |
</adminhtml_mediaburst_sms_pending>
|
23 |
<adminhtml_mediaburst_sms_sent>
|
24 |
<reference name="content">
|
25 |
+
<block type="Mediaburst_Sms/GridContainer" name="mediaburst_sms.gridcontainer">
|
26 |
+
<action method="setHeaderText" translate="param">
|
27 |
<param>Sent SMS Messages</param>
|
28 |
</action>
|
29 |
<action method="removeButton">
|
30 |
<param>add</param>
|
31 |
</action>
|
32 |
+
<block type="Mediaburst_Sms/SentGrid" name="mediaburst_sms.grid" as="grid">
|
33 |
<action method="setCollectionResourceModel">
|
34 |
+
<param>Mediaburst_Sms/Message_Collection</param>
|
35 |
</action>
|
36 |
<action method="setDefaultDir">
|
37 |
<param>DESC</param>
|
42 |
</adminhtml_mediaburst_sms_sent>
|
43 |
<adminhtml_mediaburst_sms_failed>
|
44 |
<reference name="content">
|
45 |
+
<block type="Mediaburst_Sms/GridContainer" name="mediaburst_sms.gridcontainer">
|
46 |
+
<action method="setHeaderText" translate="param">
|
47 |
<param>Failed SMS Messages</param>
|
48 |
</action>
|
49 |
<action method="removeButton">
|
50 |
<param>add</param>
|
51 |
</action>
|
52 |
+
<block type="Mediaburst_Sms/FailedGrid" name="mediaburst_sms.grid" as="grid">
|
53 |
<action method="setCollectionResourceModel">
|
54 |
+
<param>Mediaburst_Sms/Message_Collection</param>
|
55 |
</action>
|
56 |
<action method="setDefaultDir">
|
57 |
<param>DESC</param>
|
62 |
</adminhtml_mediaburst_sms_failed>
|
63 |
<adminhtml_mediaburst_sms_check>
|
64 |
<reference name="content">
|
65 |
+
<block type="Mediaburst_Sms/GridContainer" name="mediaburst_sms.gridcontainer">
|
66 |
+
<action method="setHeaderText" translate="param">
|
67 |
<param>Remaining Credits</param>
|
68 |
</action>
|
69 |
<action method="removeButton">
|
70 |
<param>add</param>
|
71 |
</action>
|
72 |
+
<block type="Mediaburst_Sms/CreditReportGrid" name="mediaburst_sms.grid" as="grid">
|
73 |
+
<action method="registerBuyButton"/>
|
74 |
</block>
|
75 |
</block>
|
76 |
</reference>
|
app/etc/modules/{Mediaburst_Sms.xml → MediaBurst_Sms.xml}
RENAMED
@@ -5,10 +5,10 @@
|
|
5 |
<active>true</active>
|
6 |
<codePool>community</codePool>
|
7 |
<depends>
|
8 |
-
<Mage_Core
|
9 |
-
<Mage_Adminhtml
|
10 |
-
<Mage_Sales
|
11 |
-
<Mage_Checkout
|
12 |
</depends>
|
13 |
</Mediaburst_Sms>
|
14 |
</modules>
|
5 |
<active>true</active>
|
6 |
<codePool>community</codePool>
|
7 |
<depends>
|
8 |
+
<Mage_Core/>
|
9 |
+
<Mage_Adminhtml/>
|
10 |
+
<Mage_Sales/>
|
11 |
+
<Mage_Checkout/>
|
12 |
</depends>
|
13 |
</Mediaburst_Sms>
|
14 |
</modules>
|
package.xml
CHANGED
@@ -1,18 +1,25 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Mediaburst_SMS</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
-
<license uri="http://opensource.org/licenses/
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>
|
10 |
-
<description
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
<compatible/>
|
17 |
-
<dependencies><required><php><min>5.
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Mediaburst_SMS</name>
|
4 |
+
<version>1.2.0</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/bsd-license.php">BSD License</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Send order status and shipping text messages automatically.</summary>
|
10 |
+
<description><p>The Mediaburst SMS add-on enables Magento to send text messages to you and your customers whenever an order status changes.</p>
|
11 |
+
<ul>
|
12 |
+
<li>Your website can send you a text when somebody places an order.</li>
|
13 |
+
<li>Send you customer a text when you ship their order</li>
|
14 |
+
<li>Notify your customer if shipping is delayed.</li>
|
15 |
+
</ul>
|
16 |
+
<p>To use the plugin you need to sign up for a <a href="http://www.mediaburst.co.uk/api/?utm_source=plugin&utm_medium=magento&utm_campaign=mediaburst-sms">Mediaburst SMS API</a> account. Mediaburst SMS API is a premium service using network connected SMS routes (it doesnt use the free email to SMS routes). This means you can deliver text messages to over 400 networks in over 150 countries around the world with high throughput and super fast delivery.</p>
|
17 |
+
<p>The price for a Mediaburst API account is 5p per text message irrespective of which country you are sending to.</p></description>
|
18 |
+
<notes>Full compatibility up to Magento 1.7.0.2. Includes support for using Clockwork SMS "API keys" instead of old Mediaburst usernames and passwords.</notes>
|
19 |
+
<authors><author><name>Mediaburst</name><user>mediaburst</user><email>hello@mediaburst.co.uk</email></author></authors>
|
20 |
+
<date>2012-07-31</date>
|
21 |
+
<time>15:50:16</time>
|
22 |
+
<contents><target name="magecommunity"><dir name="Mediaburst"><dir name="Sms"><dir name="Block"><file name="AbstractMessageGrid.php" hash="3dda9946cab8411c8d208ff3256fad6f"/><file name="CreditReportGrid.php" hash="368fee227195e826c4904b7bd0bf7059"/><file name="FailedGrid.php" hash="0f8a829ebe78fc126c119ec62f0f113a"/><file name="GridContainer.php" hash="e9db6ad67f86c00f27cf4fada82ab548"/><file name="PendingGrid.php" hash="2b9e917935b90368a1d63177e2cd4144"/><file name="SentGrid.php" hash="6f90c105b11bcfbd994a694f1a6b9ff7"/></dir><file name="Exception.php" hash="a61b41609348442384c156505bbf04bd"/><dir name="Helper"><file name="Data.php" hash="baca1d6b02854389aeace4649bdd4c88"/></dir><dir name="Model"><file name="Api.php" hash="01743920ea9fba6ef64fafbd0dff34bc"/><file name="ApiConfig.php" hash="ae879ffad94b23440e680bddd6a32c90"/><file name="Message.php" hash="7cba80e49c7540dfbdcf23db29c52f59"/><dir name="Mysql4"><dir name="Message"><file name="Collection.php" hash="58de36b5fde44f9a8497f2f791c45108"/></dir><file name="Message.php" hash="0798cc84eca49393941451e30ab018f8"/></dir><file name="Observer.php" hash="b00fd33176b8e0699a9c46275325d18f"/></dir><dir name="controllers"><dir name="Mediaburst"><file name="SmsController.php" hash="c40d0f548ddcae0cbe7c9c5a93f4f970"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="67fe2c04b60cfa6266a17d9a0525127b"/><file name="config.xml" hash="97aeca64c798b671be71ec6249e9aa75"/><file name="system.xml" hash="270cf0510fe6c0631a82b0d6d542190f"/></dir><dir name="sql"><dir name="Mediaburst_Sms"><file name="mysql4-install-1.0.0.php" hash="4d2862d3ab72dd8db342f126f27502b3"/><file name="mysql4-upgrade-1.0.0-1.1.2.php" hash="f82c128da5ea76c7f7a058d54cdb29b5"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="mediaburst"><file name="sms.xml" hash="f4b1cc340f2ae675615a73d33be7cc46"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="MediaBurst_Sms.xml" hash="10128b20049e52b96613d7f54148e54b"/></dir></target></contents>
|
23 |
<compatible/>
|
24 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
25 |
</package>
|