Version Notes
Infobip StoreSMS API module
Download this release
Release Info
| Developer | Infobip |
| Extension | Infobip_Storesms |
| Version | 2.0.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.4 to 2.0.0
- app/code/community/Infobip/Storesms/Block/Adminhtml/Adminblock.php +12 -0
- app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms.php +0 -0
- app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms/Edit.php +0 -0
- app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms/Edit/Form.php +0 -0
- app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms/Edit/Tab/Form.php +0 -0
- app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms/Edit/Tabs.php +0 -0
- app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms/Grid.php +0 -58
- app/code/community/Infobip/Storesms/Block/Adminhtml/System/Config/Fieldset/Branding.php +0 -0
- app/code/community/Infobip/Storesms/Block/Buttons/Contact.php +0 -0
- app/code/community/Infobip/Storesms/Helper/Data.php +40 -12
- app/code/community/Infobip/Storesms/Helper/Xml.php +0 -40
- app/code/community/Infobip/Storesms/Model/ApiClient.php +63 -56
- app/code/community/Infobip/Storesms/Model/Config.php +3 -42
- app/code/community/Infobip/Storesms/Model/Cron.php +0 -14
- app/code/community/Infobip/Storesms/Model/Observer.php +15 -33
- app/code/community/Infobip/Storesms/Model/Resource/Storesms.php +0 -13
- app/code/community/Infobip/Storesms/Model/Resource/Storesms/Collection.php +0 -12
- app/code/community/Infobip/Storesms/Model/Storesms.php +5 -59
- app/code/community/Infobip/Storesms/controllers/Adminhtml/StoresmsController.php +5 -3
- app/code/community/Infobip/Storesms/etc/config.xml +2 -29
- app/code/community/Infobip/Storesms/etc/system.xml +2 -22
- app/code/community/Infobip/Storesms/sql/storesms_setup/install-1.0.0.php +0 -32
- app/design/adminhtml/base/default/layout/Infobip_Storesms.xml +0 -0
- app/design/adminhtml/base/default/template/storesms/Adminblock.phtml +210 -0
- app/design/adminhtml/base/default/template/storesms/system/config/fieldset/branding.phtml +0 -0
- app/etc/modules/Infobip_Storesms.xml +0 -0
- app/locale/pl_PL/Infobip_Storesms.csv +0 -0
- js/infobipStoresms/storesmscounter.js +0 -0
- package.xml +159 -29
- skin/adminhtml/base/default/css/storesms/skin.css +0 -0
- skin/adminhtml/base/default/images/storesms/storesms_header.png +0 -0
app/code/community/Infobip/Storesms/Block/Adminhtml/Adminblock.php
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Created by IntelliJ IDEA.
|
| 4 |
+
* User: akomarica
|
| 5 |
+
* Date: 11.9.2015.
|
| 6 |
+
* Time: 11:07
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
class Infobip_Storesms_Block_Adminhtml_Adminblock extends Mage_Core_Block_Template{
|
| 10 |
+
|
| 11 |
+
//here we can put some logic if we want to call it in our adminblock.phtml
|
| 12 |
+
}
|
app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms.php
CHANGED
|
File without changes
|
app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms/Edit.php
CHANGED
|
File without changes
|
app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms/Edit/Form.php
CHANGED
|
File without changes
|
app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms/Edit/Tab/Form.php
CHANGED
|
File without changes
|
app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms/Edit/Tabs.php
CHANGED
|
File without changes
|
app/code/community/Infobip/Storesms/Block/Adminhtml/Storesms/Grid.php
CHANGED
|
@@ -5,64 +5,6 @@ class Infobip_Storesms_Block_Adminhtml_Storesms_Grid extends Mage_Adminhtml_Bloc
|
|
| 5 |
public function __construct()
|
| 6 |
{
|
| 7 |
parent::__construct();
|
| 8 |
-
$this->setId('storesms_grid');
|
| 9 |
-
$this->setDefaultSort('id');
|
| 10 |
-
$this->setDefaultDir('desc');
|
| 11 |
-
$this->setSaveParametersInSession(true);
|
| 12 |
-
}
|
| 13 |
-
|
| 14 |
-
protected function _prepareCollection()
|
| 15 |
-
{
|
| 16 |
-
$collection = Mage::getModel('storesms/storesms')->getCollection();
|
| 17 |
-
$this->setCollection($collection);
|
| 18 |
-
return parent::_prepareCollection();
|
| 19 |
-
}
|
| 20 |
-
|
| 21 |
-
protected function _prepareColumns()
|
| 22 |
-
{
|
| 23 |
-
|
| 24 |
-
$this->addColumn('id', array(
|
| 25 |
-
'header' => Mage::helper('storesms')->__('ID'),
|
| 26 |
-
'align' =>'left',
|
| 27 |
-
'width' => '40px',
|
| 28 |
-
'index' => 'id',
|
| 29 |
-
));
|
| 30 |
-
$this->addColumn('created', array(
|
| 31 |
-
'header' => Mage::helper('storesms')->__('Created date'),
|
| 32 |
-
'align' =>'left',
|
| 33 |
-
'width' => '50px',
|
| 34 |
-
'index' => 'created',
|
| 35 |
-
'type' => 'date'
|
| 36 |
-
));
|
| 37 |
-
$this->addColumn('sender', array(
|
| 38 |
-
'header' => Mage::helper('storesms')->__('Sender'),
|
| 39 |
-
'align' =>'left',
|
| 40 |
-
'width' => '50px',
|
| 41 |
-
'index' => 'sender',
|
| 42 |
-
));
|
| 43 |
-
$this->addColumn('telephone', array(
|
| 44 |
-
'header' => Mage::helper('storesms')->__('Phone number'),
|
| 45 |
-
'align' =>'left',
|
| 46 |
-
'width' => '50px',
|
| 47 |
-
'index' => 'telephone',
|
| 48 |
-
));
|
| 49 |
-
$this->addColumn('message', array(
|
| 50 |
-
'header' => Mage::helper('storesms')->__('Message'),
|
| 51 |
-
'align' =>'left',
|
| 52 |
-
'width' => '250px',
|
| 53 |
-
'index' => 'message',
|
| 54 |
-
));
|
| 55 |
-
$this->addColumn('delivery_status', array(
|
| 56 |
-
'header' => Mage::helper('storesms')->__('Delivery Status'),
|
| 57 |
-
'align' =>'left',
|
| 58 |
-
'width' => '50px',
|
| 59 |
-
'index' => 'delivery_status',
|
| 60 |
-
'type' => 'options',
|
| 61 |
-
'options' => Mage::getModel('storesms/config')->getMessageStatuses()
|
| 62 |
-
));
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
return parent::_prepareColumns();
|
| 66 |
}
|
| 67 |
|
| 68 |
}
|
| 5 |
public function __construct()
|
| 6 |
{
|
| 7 |
parent::__construct();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
}
|
| 9 |
|
| 10 |
}
|
app/code/community/Infobip/Storesms/Block/Adminhtml/System/Config/Fieldset/Branding.php
CHANGED
|
File without changes
|
app/code/community/Infobip/Storesms/Block/Buttons/Contact.php
CHANGED
|
File without changes
|
app/code/community/Infobip/Storesms/Helper/Data.php
CHANGED
|
@@ -23,21 +23,49 @@ class Infobip_Storesms_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 23 |
}
|
| 24 |
|
| 25 |
|
| 26 |
-
public function getStatusVerbally($
|
| 27 |
-
|
| 28 |
-
$
|
| 29 |
-
|
| 30 |
-
$
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
'
|
| 35 |
-
'
|
| 36 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
);
|
| 38 |
|
| 39 |
-
return $
|
| 40 |
|
| 41 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
}
|
| 23 |
}
|
| 24 |
|
| 25 |
|
| 26 |
+
public function getStatusVerbally($httpStatusCode) {
|
| 27 |
+
|
| 28 |
+
$httpStatusCode = ($httpStatusCode>=200 && $httpStatusCode<300) ? 200:$httpStatusCode;
|
| 29 |
+
$httpStatusCode = ($httpStatusCode>=300 && $httpStatusCode<400) ? 300:$httpStatusCode;
|
| 30 |
+
$httpStatusCode = ($httpStatusCode>=405 && $httpStatusCode<500) ? 402:$httpStatusCode;
|
| 31 |
+
$httpStatusCode = ($httpStatusCode>=500 && $httpStatusCode<600) ? 500:$httpStatusCode;
|
| 32 |
+
|
| 33 |
+
$httpStatusesVerbal = array(
|
| 34 |
+
'200' =>'OK',
|
| 35 |
+
'300' =>'REDIRECTION',
|
| 36 |
+
'400' =>'BAD_REQUEST',
|
| 37 |
+
'401' =>'UNAUTHORIZED',
|
| 38 |
+
'402' =>'CLIENT_ERROR',
|
| 39 |
+
'403' =>'FORBIDDEN',
|
| 40 |
+
'404' =>'NOT_FOUND',
|
| 41 |
+
'500' =>'SERVER_ERROR'
|
| 42 |
);
|
| 43 |
|
| 44 |
+
return $httpStatusesVerbal[$httpStatusCode];
|
| 45 |
|
| 46 |
}
|
| 47 |
+
|
| 48 |
+
public function getLogs() {
|
| 49 |
+
|
| 50 |
+
$responseArray = Mage::getModel('storesms/apiClient') -> getMessageLogs();
|
| 51 |
+
$result= $responseArray["responseBodyXml"] -> results -> result;
|
| 52 |
+
foreach ($result as $message) {
|
| 53 |
+
$formatedSentAt = date("M d, Y - H:i:s P T", strtotime($message -> sentAt));
|
| 54 |
+
|
| 55 |
+
$sentMessageLog = array(
|
| 56 |
+
"message_id" => $message -> messageId,
|
| 57 |
+
"to" => $message -> to,
|
| 58 |
+
"from" => $message -> from,
|
| 59 |
+
"text" => $message -> text,
|
| 60 |
+
"sent_at" => $formatedSentAt,
|
| 61 |
+
"general_status" => $message -> status -> groupName,
|
| 62 |
+
"status_description" => $message -> status -> description
|
| 63 |
+
);
|
| 64 |
+
$arrayOfMessageLogs[] = $sentMessageLog;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
return $arrayOfMessageLogs;
|
| 68 |
+
|
| 69 |
+
}
|
| 70 |
|
| 71 |
}
|
app/code/community/Infobip/Storesms/Helper/Xml.php
DELETED
|
@@ -1,40 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
class Infobip_Storesms_Helper_Xml extends Mage_Core_Helper_Abstract
|
| 5 |
-
{
|
| 6 |
-
|
| 7 |
-
public function getStatusesFromXml($xml) {
|
| 8 |
-
|
| 9 |
-
$xmlResource = xml_parser_create();
|
| 10 |
-
xml_parse_into_struct($xmlResource, $xml, $vals, $index);
|
| 11 |
-
xml_parser_free($xmlResource);
|
| 12 |
-
|
| 13 |
-
$attributes = array();
|
| 14 |
-
|
| 15 |
-
foreach ($index['MESSAGE'] as $key) {
|
| 16 |
-
$attributes[] = $vals[$key]['attributes'];
|
| 17 |
-
}
|
| 18 |
-
|
| 19 |
-
return $attributes;
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
public function getStatusCode($xml) {
|
| 27 |
-
|
| 28 |
-
$vals = $index = array();
|
| 29 |
-
$xmlResource = xml_parser_create();
|
| 30 |
-
xml_parse_into_struct($xmlResource, $xml, $vals, $index);
|
| 31 |
-
xml_parser_free($xmlResource);
|
| 32 |
-
|
| 33 |
-
return $vals[$index['STATUS'][0]]['value']; //return value of <STATUS></STATUS> node
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
}
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Infobip/Storesms/Model/ApiClient.php
CHANGED
|
@@ -21,56 +21,55 @@ class Infobip_Storesms_Model_ApiClient {
|
|
| 21 |
throw new Exception(Mage::helper('storesms')->__('No recipients found'));
|
| 22 |
|
| 23 |
$config = Mage::getModel('storesms/config');
|
| 24 |
-
$postUrl = "http://
|
| 25 |
|
| 26 |
// XML-formatted data
|
| 27 |
-
|
| 28 |
-
$xmlLongSms = ($config->isSingle()==1) ? '':'<type>longSMS</type>';
|
| 29 |
-
$dataCoding = ($config->isUnicode()==1) ? '0':'8';
|
| 30 |
$sender = $config->getSender();
|
| 31 |
-
$xmlSender = ($config->isPro() && !empty($sender)) ?
|
|
|
|
| 32 |
|
| 33 |
-
$xmlRecipients = '<recipients>'."\r\n";
|
| 34 |
foreach ($smsData['recipients'] as $recipient) {
|
| 35 |
-
$
|
| 36 |
-
$xmlRecipients .=
|
|
|
|
| 37 |
}
|
| 38 |
-
|
| 39 |
-
|
| 40 |
$xmlString =
|
| 41 |
-
'<
|
| 42 |
-
<
|
| 43 |
-
<
|
| 44 |
-
<password>'.$config->getPassword().'</password>
|
| 45 |
-
</authentification>
|
| 46 |
-
<message>
|
| 47 |
-
'.$xmlSender.'
|
| 48 |
-
'.$xmlLongSms.'
|
| 49 |
<text>'.$smsData['message'].'</text>
|
| 50 |
-
|
| 51 |
-
</message>
|
| 52 |
-
'.$xmlRecipients.'
|
| 53 |
-
</SMS>';
|
| 54 |
|
| 55 |
// previously formatted XML data becomes value of "XML" POST variable
|
| 56 |
$fields = "XML=" . urlencode($xmlString);
|
| 57 |
|
| 58 |
$ch = curl_init();
|
|
|
|
| 59 |
|
| 60 |
curl_setopt($ch, CURLOPT_URL, $postUrl);
|
|
|
|
|
|
|
|
|
|
| 61 |
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,2);
|
| 62 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
| 63 |
-
curl_setopt($ch, CURLOPT_HEADER, FALSE);
|
| 64 |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,TRUE);
|
| 65 |
curl_setopt($ch, CURLOPT_MAXREDIRS,2);
|
| 66 |
curl_setopt($ch, CURLOPT_POST, 1);
|
| 67 |
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $
|
| 68 |
|
| 69 |
|
| 70 |
// response of the POST request
|
| 71 |
$response = curl_exec($ch);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
curl_close($ch);
|
| 73 |
-
return $
|
| 74 |
}
|
| 75 |
|
| 76 |
|
|
@@ -78,15 +77,26 @@ class Infobip_Storesms_Model_ApiClient {
|
|
| 78 |
|
| 79 |
|
| 80 |
public function getCredits() {
|
| 81 |
-
|
| 82 |
-
$
|
|
|
|
| 83 |
$ch = curl_init();
|
| 84 |
curl_setopt($ch, CURLOPT_URL, $getUrl);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
| 86 |
|
| 87 |
$response = curl_exec($ch);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
curl_close($ch);
|
| 89 |
-
return $
|
| 90 |
|
| 91 |
|
| 92 |
}
|
|
@@ -109,13 +119,18 @@ class Infobip_Storesms_Model_ApiClient {
|
|
| 109 |
|
| 110 |
try {
|
| 111 |
|
| 112 |
-
$
|
|
|
|
|
|
|
| 113 |
|
| 114 |
-
if ($
|
| 115 |
Mage::getSingleton('core/session')->addError(Mage::helper('storesms')->__($config::WRONG_AUTH_DATA));
|
| 116 |
}
|
| 117 |
-
elseif($
|
| 118 |
-
|
|
|
|
|
|
|
|
|
|
| 119 |
}
|
| 120 |
|
| 121 |
}
|
|
@@ -127,41 +142,33 @@ class Infobip_Storesms_Model_ApiClient {
|
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
-
public function
|
| 131 |
|
| 132 |
$config = Mage::getModel('storesms/config');
|
| 133 |
-
$
|
|
|
|
| 134 |
$curl = curl_init();
|
| 135 |
curl_setopt($curl, CURLOPT_URL, $getUrl);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
|
|
|
| 137 |
$response = curl_exec($curl);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
curl_close($curl);
|
| 139 |
-
return $
|
| 140 |
|
| 141 |
}
|
| 142 |
|
| 143 |
|
| 144 |
-
|
| 145 |
-
public function saveDelieveryReport($report = false) {
|
| 146 |
-
|
| 147 |
-
if ($report === false)
|
| 148 |
-
$report = $this->getDelieveryReport ();
|
| 149 |
-
|
| 150 |
-
if ($report == 'NO_DATA' || !$report)
|
| 151 |
-
return;
|
| 152 |
-
|
| 153 |
-
//if delievery report exists save it to db
|
| 154 |
-
$delieveryStatuses = Mage::helper('storesms/xml')->getStatusesFromXml($report);
|
| 155 |
-
$model = Mage::getModel('storesms/storesms');
|
| 156 |
-
|
| 157 |
-
//save delievery status for each message
|
| 158 |
-
foreach ($delieveryStatuses as $message) {
|
| 159 |
-
$model->setNewDeliveryStatus($message['ID'],$message['STATUS']);
|
| 160 |
-
$model->unsetData();
|
| 161 |
-
}
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
}
|
| 165 |
|
| 166 |
|
| 167 |
}
|
| 21 |
throw new Exception(Mage::helper('storesms')->__('No recipients found'));
|
| 22 |
|
| 23 |
$config = Mage::getModel('storesms/config');
|
| 24 |
+
$postUrl = "http://api.infobip.com/sms/1/text/single";
|
| 25 |
|
| 26 |
// XML-formatted data
|
| 27 |
+
|
|
|
|
|
|
|
| 28 |
$sender = $config->getSender();
|
| 29 |
+
$xmlSender = ($config->isPro() && !empty($sender)) ? $sender:'';
|
| 30 |
+
$xmlRecipients = '';
|
| 31 |
|
|
|
|
| 32 |
foreach ($smsData['recipients'] as $recipient) {
|
| 33 |
+
$xmlRecipients .= '<to>';
|
| 34 |
+
$xmlRecipients .= $recipient;
|
| 35 |
+
$xmlRecipients .= '</to>'."\r\n";
|
| 36 |
}
|
| 37 |
+
|
|
|
|
| 38 |
$xmlString =
|
| 39 |
+
'<request>
|
| 40 |
+
<from>'.$xmlSender.'</from>
|
| 41 |
+
<to>'.$xmlRecipients.'</to>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
<text>'.$smsData['message'].'</text>
|
| 43 |
+
</request>';
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
// previously formatted XML data becomes value of "XML" POST variable
|
| 46 |
$fields = "XML=" . urlencode($xmlString);
|
| 47 |
|
| 48 |
$ch = curl_init();
|
| 49 |
+
$header = array('Content-Type:application/xml', 'Accept:application/xml');
|
| 50 |
|
| 51 |
curl_setopt($ch, CURLOPT_URL, $postUrl);
|
| 52 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER , $header);
|
| 53 |
+
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
| 54 |
+
curl_setopt($ch, CURLOPT_USERPWD , $config->getLogin() . ":" . $config->getPassword());
|
| 55 |
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,2);
|
| 56 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
|
|
| 57 |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,TRUE);
|
| 58 |
curl_setopt($ch, CURLOPT_MAXREDIRS,2);
|
| 59 |
curl_setopt($ch, CURLOPT_POST, 1);
|
| 60 |
+
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlString);
|
| 61 |
|
| 62 |
|
| 63 |
// response of the POST request
|
| 64 |
$response = curl_exec($ch);
|
| 65 |
+
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
| 66 |
+
$responseBodyXml = new SimpleXMLElement($response);
|
| 67 |
+
$responseArray = array(
|
| 68 |
+
"httpStatusCode" => $httpcode,
|
| 69 |
+
"responseBodyXml" => $responseBodyXml
|
| 70 |
+
);
|
| 71 |
curl_close($ch);
|
| 72 |
+
return $responseArray;
|
| 73 |
}
|
| 74 |
|
| 75 |
|
| 77 |
|
| 78 |
|
| 79 |
public function getCredits() {
|
| 80 |
+
|
| 81 |
+
$config = Mage::getModel('storesms/config');
|
| 82 |
+
$getUrl = 'http://api.infobip.com//account/1/balance';
|
| 83 |
$ch = curl_init();
|
| 84 |
curl_setopt($ch, CURLOPT_URL, $getUrl);
|
| 85 |
+
curl_setopt($ch, CURLOPT_HTTPHEADER , array('Accept:application/xml'));
|
| 86 |
+
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
| 87 |
+
curl_setopt($ch, CURLOPT_USERPWD , $config->getLogin() . ":" . $config->getPassword());
|
| 88 |
+
curl_setopt($ch, CURLOPT_HTTPGET , TRUE);
|
| 89 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
| 90 |
|
| 91 |
$response = curl_exec($ch);
|
| 92 |
+
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
| 93 |
+
$responseBodyXml = new SimpleXMLElement($response);
|
| 94 |
+
$responseArray = array(
|
| 95 |
+
"httpStatusCode" => $httpcode,
|
| 96 |
+
"responseBodyXml" => $responseBodyXml
|
| 97 |
+
);
|
| 98 |
curl_close($ch);
|
| 99 |
+
return $responseArray;
|
| 100 |
|
| 101 |
|
| 102 |
}
|
| 119 |
|
| 120 |
try {
|
| 121 |
|
| 122 |
+
$creditsArray = $this->getCredits();
|
| 123 |
+
$responseBodyXml = $creditsArray["responseBodyXml"];
|
| 124 |
+
$httpStatusCode = $creditsArray["httpStatusCode"];
|
| 125 |
|
| 126 |
+
if ($httpStatusCode==401) {
|
| 127 |
Mage::getSingleton('core/session')->addError(Mage::helper('storesms')->__($config::WRONG_AUTH_DATA));
|
| 128 |
}
|
| 129 |
+
elseif($httpStatusCode==200) {
|
| 130 |
+
$balance = $responseBodyXml -> balance;
|
| 131 |
+
if ($balance < $limit) {
|
| 132 |
+
Mage::getSingleton('core/session')->addError(Mage::helper('storesms')->__($config::LOW_CREDITS_WARNING_MESSAGE));
|
| 133 |
+
}
|
| 134 |
}
|
| 135 |
|
| 136 |
}
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
+
public function getMessageLogs() {
|
| 146 |
|
| 147 |
$config = Mage::getModel('storesms/config');
|
| 148 |
+
$limit = $config::DR_LIMIT;
|
| 149 |
+
$getUrl = 'http://api.infobip.com/sms/1/logs?limit='.$limit;
|
| 150 |
$curl = curl_init();
|
| 151 |
curl_setopt($curl, CURLOPT_URL, $getUrl);
|
| 152 |
+
curl_setopt($curl, CURLOPT_HTTPHEADER , array('Accept:application/xml'));
|
| 153 |
+
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
| 154 |
+
curl_setopt($curl, CURLOPT_USERPWD , $config->getLogin() . ":" . $config->getPassword());
|
| 155 |
+
curl_setopt($curl, CURLOPT_HTTPGET , TRUE);
|
| 156 |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
| 157 |
+
|
| 158 |
$response = curl_exec($curl);
|
| 159 |
+
$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
| 160 |
+
$responseBodyXml = new SimpleXMLElement($response);
|
| 161 |
+
$responseArray = array(
|
| 162 |
+
"httpStatusCode" => $httpcode,
|
| 163 |
+
"responseBodyXml" => $responseBodyXml
|
| 164 |
+
);
|
| 165 |
curl_close($curl);
|
| 166 |
+
return $responseArray;
|
| 167 |
|
| 168 |
}
|
| 169 |
|
| 170 |
|
| 171 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
|
| 173 |
|
| 174 |
}
|
app/code/community/Infobip/Storesms/Model/Config.php
CHANGED
|
@@ -17,8 +17,9 @@
|
|
| 17 |
class Infobip_Storesms_Model_Config {
|
| 18 |
|
| 19 |
const LOW_CREDITS_WARNING_MESSAGE = 'Warning: Low credit level at your Storesms account. Buy credits.';
|
| 20 |
-
const API_HOST = '
|
| 21 |
const WRONG_AUTH_DATA = 'Storesms API: Wrong Password and/or Username' ;
|
|
|
|
| 22 |
|
| 23 |
public $contacts = array (
|
| 24 |
'en_US'=>'http://www.infobip.com/contact', //default international
|
|
@@ -75,24 +76,6 @@ class Infobip_Storesms_Model_Config {
|
|
| 75 |
return Mage::getStoreConfig('storesms/main_conf/sender_active');
|
| 76 |
}
|
| 77 |
|
| 78 |
-
|
| 79 |
-
/**
|
| 80 |
-
* Checks if allowed only single message
|
| 81 |
-
* @return int
|
| 82 |
-
*/
|
| 83 |
-
public function isSingle() {
|
| 84 |
-
$confRule = Mage::getStoreConfig('storesms/main_conf/allow_long_sms');
|
| 85 |
-
|
| 86 |
-
return ($confRule == 1) ? 0:1;
|
| 87 |
-
|
| 88 |
-
}
|
| 89 |
-
|
| 90 |
-
public function isUnicode() {
|
| 91 |
-
$confRule = Mage::getStoreConfig('storesms/main_conf/allow_unicode_sms');
|
| 92 |
-
|
| 93 |
-
return ($confRule == 1) ? 0:1;
|
| 94 |
-
|
| 95 |
-
}
|
| 96 |
|
| 97 |
|
| 98 |
public function getCountryPrefix() {
|
|
@@ -140,29 +123,7 @@ class Infobip_Storesms_Model_Config {
|
|
| 140 |
|
| 141 |
}
|
| 142 |
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
public function getMessageStatuses() {
|
| 146 |
-
$statuses = array( 'SEND_OK' =>'SEND_OK',
|
| 147 |
-
'AUTH_FAILED' =>'AUTH_FAILED',
|
| 148 |
-
'XML_ERROR' =>'XML_ERROR',
|
| 149 |
-
'NOT_ENOUGH_CREDITS' =>'NOT_ENOUGH_CREDITS',
|
| 150 |
-
'NO_RECIPIENTS' =>'NO_RECIPIENTS',
|
| 151 |
-
'GENERAL_ERROR' =>'GENERAL_ERROR',
|
| 152 |
-
'WAITING_FOR_DR' =>'WAITING_FOR_DR',
|
| 153 |
-
'NOT_SENT'=>'NOT_SENT',
|
| 154 |
-
'SENT'=>'SENT',
|
| 155 |
-
'NOT_DELIVERED'=>'NOT_DELIVERED',
|
| 156 |
-
'DELIVERED'=>'DELIVERED',
|
| 157 |
-
'NOT_ALLOWED'=>'NOT_ALLOWED',
|
| 158 |
-
'INVALID_DESTINATION_ADDRESS'=>'INVALID_DESTINATION_ADDRESS',
|
| 159 |
-
'INVALID_SOURCE_ADDRESS'=>'INVALID_SOURCE_ADDRESS',
|
| 160 |
-
'ROUTE_NOT_AVAILABLE'=>'ROUTE_NOT_AVAILABLE',
|
| 161 |
-
'NOT_ENOUGH_CREDITS'=>'NOT_ENOUGH_CREDITS',
|
| 162 |
-
'INVALID_MESSAGE_FORMAT'=>'INVALID_MESSAGE_FORMAT');
|
| 163 |
-
|
| 164 |
-
return $statuses;
|
| 165 |
-
}
|
| 166 |
|
| 167 |
|
| 168 |
}
|
| 17 |
class Infobip_Storesms_Model_Config {
|
| 18 |
|
| 19 |
const LOW_CREDITS_WARNING_MESSAGE = 'Warning: Low credit level at your Storesms account. Buy credits.';
|
| 20 |
+
const API_HOST = 'api.infobip.com';
|
| 21 |
const WRONG_AUTH_DATA = 'Storesms API: Wrong Password and/or Username' ;
|
| 22 |
+
const DR_LIMIT = 7654;
|
| 23 |
|
| 24 |
public $contacts = array (
|
| 25 |
'en_US'=>'http://www.infobip.com/contact', //default international
|
| 76 |
return Mage::getStoreConfig('storesms/main_conf/sender_active');
|
| 77 |
}
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
|
| 81 |
public function getCountryPrefix() {
|
| 123 |
|
| 124 |
}
|
| 125 |
|
| 126 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
|
| 128 |
|
| 129 |
}
|
app/code/community/Infobip/Storesms/Model/Cron.php
DELETED
|
@@ -1,14 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Infobip_Storesms_Model_Cron {
|
| 4 |
-
|
| 5 |
-
public function getDelieveryReport() {
|
| 6 |
-
|
| 7 |
-
$apiClient = Mage::getModel('storesms/apiClient');
|
| 8 |
-
$apiClient->saveDelieveryReport();
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
}
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Infobip/Storesms/Model/Observer.php
CHANGED
|
@@ -45,9 +45,10 @@ class Infobip_Storesms_Model_Observer {
|
|
| 45 |
if ($config->isApiEnabled()==0) return;
|
| 46 |
|
| 47 |
try {
|
| 48 |
-
$
|
|
|
|
| 49 |
|
| 50 |
-
if ($
|
| 51 |
throw new Exception(Mage::helper('storesms')->__($config::WRONG_AUTH_DATA));
|
| 52 |
}
|
| 53 |
else {
|
|
@@ -76,7 +77,6 @@ class Infobip_Storesms_Model_Observer {
|
|
| 76 |
$newStatus = $order->getData('status');
|
| 77 |
$origStatus = $order->getOrigData('status');
|
| 78 |
|
| 79 |
-
|
| 80 |
if (time()-self::$lastExecutionTime<=2)
|
| 81 |
return;
|
| 82 |
|
|
@@ -89,7 +89,6 @@ class Infobip_Storesms_Model_Observer {
|
|
| 89 |
if (!$message) //return if no active message template
|
| 90 |
return;
|
| 91 |
|
| 92 |
-
|
| 93 |
//getting last tracking number
|
| 94 |
$tracking = Mage::getResourceModel('sales/order_shipment_track_collection')->setOrderFilter($order)->getData();
|
| 95 |
|
|
@@ -100,7 +99,6 @@ class Infobip_Storesms_Model_Observer {
|
|
| 100 |
else
|
| 101 |
$last_tracking_number = 'no_tracking'; //if no tracking number set "no_tracking" message for {TRACKINGNUMBER} template
|
| 102 |
|
| 103 |
-
|
| 104 |
//getting order data to generate message template
|
| 105 |
$messageOrderData['{NAME}'] = $order->getShippingAddress()->getData('firstname');
|
| 106 |
$messageOrderData['{ORDERNUMBER}'] = $order->getIncrement_id();
|
|
@@ -113,42 +111,26 @@ class Infobip_Storesms_Model_Observer {
|
|
| 113 |
//prepare sms content
|
| 114 |
$msg['recipients'][] = Mage::helper('storesms')->getPhoneNumber($order->getShippingAddress()->getData('telephone')); //or getBillingAddress
|
| 115 |
$msg['message'] = $message;
|
| 116 |
-
$msg['single_message'] = $config->isSingle(); //allow_long_sms
|
| 117 |
$msg['sender'] = $config->getSender();//sender
|
| 118 |
|
| 119 |
-
|
| 120 |
//sending sms and getting API response
|
| 121 |
|
| 122 |
try {
|
| 123 |
|
| 124 |
$apiClient = Mage::getModel('storesms/apiClient');
|
| 125 |
-
$model = Mage::getModel('storesms/storesms');
|
| 126 |
-
$savedIds = $model->saveMessages($msg);
|
| 127 |
-
$msg['ids'] = $savedIds;
|
| 128 |
$response = $apiClient->sendByCurl($msg);
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
$responseVerbally = Mage::helper('storesms')->getStatusVerbally(Mage::helper('storesms/xml')->getStatusCode($response));
|
| 143 |
-
if ($responseVerbally!='SEND_OK')
|
| 144 |
-
Mage::throwException(Mage::helper('storesms')->__('Error sending Message:').' '.$responseVerbally);
|
| 145 |
-
//@successs add comment to order
|
| 146 |
-
$newComment = Mage::helper('storesms')->__('SMS notification sent (SMS id:').$msg['ids'][$msg['recipients'][0]].') ' ;
|
| 147 |
-
$history->setComment($newComment);
|
| 148 |
-
//Mage::getSingleton('core/session')->addSuccess($newComment);
|
| 149 |
-
$this->checkCreditLimit();
|
| 150 |
-
}
|
| 151 |
-
|
| 152 |
|
| 153 |
} catch (Exception $e) {
|
| 154 |
$newComment = Mage::helper('storesms')->__('SMS notification sending error:').' "'.$e->getMessage().'"';
|
| 45 |
if ($config->isApiEnabled()==0) return;
|
| 46 |
|
| 47 |
try {
|
| 48 |
+
$creditsXML = Mage::getModel('storesms/apiClient')->getCredits();
|
| 49 |
+
$ExceptionMessage = $creditsXML->requestError->serviceException->messageId;
|
| 50 |
|
| 51 |
+
if ($ExceptionMessage=='UNAUTHORIZED') {
|
| 52 |
throw new Exception(Mage::helper('storesms')->__($config::WRONG_AUTH_DATA));
|
| 53 |
}
|
| 54 |
else {
|
| 77 |
$newStatus = $order->getData('status');
|
| 78 |
$origStatus = $order->getOrigData('status');
|
| 79 |
|
|
|
|
| 80 |
if (time()-self::$lastExecutionTime<=2)
|
| 81 |
return;
|
| 82 |
|
| 89 |
if (!$message) //return if no active message template
|
| 90 |
return;
|
| 91 |
|
|
|
|
| 92 |
//getting last tracking number
|
| 93 |
$tracking = Mage::getResourceModel('sales/order_shipment_track_collection')->setOrderFilter($order)->getData();
|
| 94 |
|
| 99 |
else
|
| 100 |
$last_tracking_number = 'no_tracking'; //if no tracking number set "no_tracking" message for {TRACKINGNUMBER} template
|
| 101 |
|
|
|
|
| 102 |
//getting order data to generate message template
|
| 103 |
$messageOrderData['{NAME}'] = $order->getShippingAddress()->getData('firstname');
|
| 104 |
$messageOrderData['{ORDERNUMBER}'] = $order->getIncrement_id();
|
| 111 |
//prepare sms content
|
| 112 |
$msg['recipients'][] = Mage::helper('storesms')->getPhoneNumber($order->getShippingAddress()->getData('telephone')); //or getBillingAddress
|
| 113 |
$msg['message'] = $message;
|
|
|
|
| 114 |
$msg['sender'] = $config->getSender();//sender
|
| 115 |
|
|
|
|
| 116 |
//sending sms and getting API response
|
| 117 |
|
| 118 |
try {
|
| 119 |
|
| 120 |
$apiClient = Mage::getModel('storesms/apiClient');
|
|
|
|
|
|
|
|
|
|
| 121 |
$response = $apiClient->sendByCurl($msg);
|
| 122 |
+
$responseBodyXml = $response["responseBodyXml"];
|
| 123 |
+
$httpStatusCode = $response["httpStatusCode"];
|
| 124 |
+
$msgId = $responseBodyXml -> messages -> message -> messageId;
|
| 125 |
+
|
| 126 |
+
$responseVerbally = Mage::helper('storesms')->getStatusVerbally($httpStatusCode);
|
| 127 |
+
if ($responseVerbally!='OK')
|
| 128 |
+
Mage::throwException(Mage::helper('storesms')->__('Error sending Message:').' '.$responseVerbally);
|
| 129 |
+
//@successs add comment to order
|
| 130 |
+
$newComment = Mage::helper('storesms')->__('SMS notification sent (SMS id:').$msgId.') ' ;
|
| 131 |
+
$history->setComment($newComment);
|
| 132 |
+
//Mage::getSingleton('core/session')->addSuccess($newComment);
|
| 133 |
+
$this->checkCreditLimit();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
} catch (Exception $e) {
|
| 136 |
$newComment = Mage::helper('storesms')->__('SMS notification sending error:').' "'.$e->getMessage().'"';
|
app/code/community/Infobip/Storesms/Model/Resource/Storesms.php
DELETED
|
@@ -1,13 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Infobip_Storesms_Model_Resource_Storesms extends Mage_Core_Model_Resource_Db_Abstract {
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
public function _construct() {
|
| 7 |
-
$this->_init("storesms/infobip_storesms","id");
|
| 8 |
-
|
| 9 |
-
}
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
}
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Infobip/Storesms/Model/Resource/Storesms/Collection.php
DELETED
|
@@ -1,12 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Infobip_Storesms_Model_Resource_Storesms_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
public function _construct() {
|
| 7 |
-
$this->_init("storesms/storesms");
|
| 8 |
-
|
| 9 |
-
}
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Infobip/Storesms/Model/Storesms.php
CHANGED
|
@@ -8,59 +8,7 @@ class Infobip_Storesms_Model_Storesms extends Mage_Core_Model_Abstract {
|
|
| 8 |
$this->_init("storesms/storesms");
|
| 9 |
}
|
| 10 |
|
| 11 |
-
/** Gets list of Partners or Distributors
|
| 12 |
-
*
|
| 13 |
-
* @param type $ofWhat
|
| 14 |
-
* @return type
|
| 15 |
-
*/
|
| 16 |
-
public function getFailedSmses() {
|
| 17 |
-
|
| 18 |
-
$collection = $this->getCollection();
|
| 19 |
-
$collection->addFieldToFilter("group_id" ,array("eq"=>$ofWhat));
|
| 20 |
-
$items = $collection->getItems();
|
| 21 |
-
|
| 22 |
-
foreach ($items as $item) {
|
| 23 |
-
$listToReturn[] = $item->getData();
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
return $listToReturn;
|
| 27 |
-
|
| 28 |
-
}
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
public function saveMessages(array $smsData) {
|
| 32 |
-
|
| 33 |
-
foreach ($smsData['recipients'] as $gsmNumber) { //save sms to database and retrieve message id's
|
| 34 |
-
|
| 35 |
-
$this->newSms($gsmNumber,$smsData['message'],'WAITING_FOR_DR',Mage::getModel('storesms/config')->getSender());
|
| 36 |
-
$smsId = $this->getData('id');
|
| 37 |
-
$smsIds[$gsmNumber] = $smsId;
|
| 38 |
-
$this->unsetData();
|
| 39 |
-
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
return $smsIds;
|
| 43 |
-
}
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
public function newSms($telephone,$message,$deliveryStatus,$sender = false) {
|
| 47 |
-
|
| 48 |
-
$this -> setSender($sender);
|
| 49 |
-
$this -> setTelephone($telephone);
|
| 50 |
-
$this -> setDeliveryStatus($deliveryStatus);
|
| 51 |
-
$this -> setMessage($message);
|
| 52 |
-
$this -> setAttemptsNumber(1);
|
| 53 |
-
$this -> setCreated(new Zend_Db_Expr('CURDATE()'));
|
| 54 |
-
$this -> save();
|
| 55 |
-
|
| 56 |
-
}
|
| 57 |
-
|
| 58 |
-
public function setNewDeliveryStatus($smsId,$deliveryStatus) {
|
| 59 |
-
|
| 60 |
-
$this -> load($smsId);
|
| 61 |
-
$this -> setDeliveryStatus($deliveryStatus)->save();
|
| 62 |
|
| 63 |
-
}
|
| 64 |
|
| 65 |
/**
|
| 66 |
* Get all phone numbers from customer address collection
|
|
@@ -94,17 +42,15 @@ class Infobip_Storesms_Model_Storesms extends Mage_Core_Model_Abstract {
|
|
| 94 |
|
| 95 |
try {
|
| 96 |
$apiClient = Mage::getModel('storesms/apiClient');
|
| 97 |
-
$savedIds = Mage::getModel('storesms/storesms')->saveMessages($message);
|
| 98 |
-
$message['ids'] = $savedIds;
|
| 99 |
|
| 100 |
$response = $apiClient->sendByCurl($message);
|
| 101 |
-
$
|
|
|
|
|
|
|
| 102 |
$errSendMessage = Mage::helper('storesms')->__('Error sending Message:');
|
| 103 |
-
if ($responseVerbally!='
|
| 104 |
throw new Exception ($errSendMessage.' '.$responseVerbally);
|
| 105 |
-
|
| 106 |
-
//if all is ok get delievery report from api
|
| 107 |
-
$apiClient->saveDelieveryReport();
|
| 108 |
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('storesms')->__('Message sent successfully'));
|
| 109 |
|
| 110 |
}
|
| 8 |
$this->_init("storesms/storesms");
|
| 9 |
}
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
|
|
|
| 12 |
|
| 13 |
/**
|
| 14 |
* Get all phone numbers from customer address collection
|
| 42 |
|
| 43 |
try {
|
| 44 |
$apiClient = Mage::getModel('storesms/apiClient');
|
|
|
|
|
|
|
| 45 |
|
| 46 |
$response = $apiClient->sendByCurl($message);
|
| 47 |
+
$httpStatusCode = $response["httpStatusCode"];
|
| 48 |
+
|
| 49 |
+
$responseVerbally = Mage::helper('storesms')->getStatusVerbally($httpStatusCode);
|
| 50 |
$errSendMessage = Mage::helper('storesms')->__('Error sending Message:');
|
| 51 |
+
if ($responseVerbally!='OK')
|
| 52 |
throw new Exception ($errSendMessage.' '.$responseVerbally);
|
| 53 |
+
|
|
|
|
|
|
|
| 54 |
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('storesms')->__('Message sent successfully'));
|
| 55 |
|
| 56 |
}
|
app/code/community/Infobip/Storesms/controllers/Adminhtml/StoresmsController.php
CHANGED
|
@@ -5,9 +5,11 @@ class Infobip_Storesms_Adminhtml_StoresmsController extends Mage_Adminhtml_Contr
|
|
| 5 |
|
| 6 |
public function indexAction() {
|
| 7 |
$this->loadLayout()
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
| 11 |
}
|
| 12 |
|
| 13 |
|
| 5 |
|
| 6 |
public function indexAction() {
|
| 7 |
$this->loadLayout()
|
| 8 |
+
->_addContent(
|
| 9 |
+
$this->getLayout()
|
| 10 |
+
->createBlock('storesms/adminhtml_adminblock')
|
| 11 |
+
->setTemplate('storesms/Adminblock.phtml'))
|
| 12 |
+
->renderLayout();
|
| 13 |
}
|
| 14 |
|
| 15 |
|
app/code/community/Infobip/Storesms/etc/config.xml
CHANGED
|
@@ -35,7 +35,7 @@
|
|
| 35 |
|
| 36 |
<modules>
|
| 37 |
<Infobip_Storesms>
|
| 38 |
-
<version>
|
| 39 |
</Infobip_Storesms>
|
| 40 |
</modules>
|
| 41 |
|
|
@@ -164,14 +164,6 @@
|
|
| 164 |
<class>Infobip_Storesms_Model</class>
|
| 165 |
<resourceModel>storesms_resource</resourceModel>
|
| 166 |
</storesms>
|
| 167 |
-
<storesms_resource>
|
| 168 |
-
<class>Infobip_Storesms_Model_Resource</class>
|
| 169 |
-
<entities>
|
| 170 |
-
<infobip_storesms>
|
| 171 |
-
<table>infobip_storesms</table>
|
| 172 |
-
</infobip_storesms>
|
| 173 |
-
</entities>
|
| 174 |
-
</storesms_resource>
|
| 175 |
</models>
|
| 176 |
<helpers>
|
| 177 |
<storesms>
|
|
@@ -183,13 +175,6 @@
|
|
| 183 |
<class>Infobip_Storesms_Block</class>
|
| 184 |
</storesms>
|
| 185 |
</blocks>
|
| 186 |
-
<resources>
|
| 187 |
-
<storesms_setup>
|
| 188 |
-
<setup>
|
| 189 |
-
<module>Infobip_Storesms</module>
|
| 190 |
-
</setup>
|
| 191 |
-
</storesms_setup>
|
| 192 |
-
</resources>
|
| 193 |
<events>
|
| 194 |
<sales_order_status_history_save_before>
|
| 195 |
<observers>
|
|
@@ -200,7 +185,7 @@
|
|
| 200 |
</observers>
|
| 201 |
</sales_order_status_history_save_before>
|
| 202 |
</events>
|
| 203 |
-
</global>
|
| 204 |
|
| 205 |
<default>
|
| 206 |
<storesms>
|
|
@@ -210,16 +195,4 @@
|
|
| 210 |
</storesms>
|
| 211 |
</default>
|
| 212 |
|
| 213 |
-
<crontab>
|
| 214 |
-
<jobs>
|
| 215 |
-
<storesms_getreports>
|
| 216 |
-
<schedule>
|
| 217 |
-
<cron_expr>0,30 * * * *</cron_expr>
|
| 218 |
-
</schedule>
|
| 219 |
-
<run><model>storesms/cron::getDelieveryReport</model></run>
|
| 220 |
-
</storesms_getreports>
|
| 221 |
-
</jobs>
|
| 222 |
-
</crontab>
|
| 223 |
-
|
| 224 |
-
|
| 225 |
</config>
|
| 35 |
|
| 36 |
<modules>
|
| 37 |
<Infobip_Storesms>
|
| 38 |
+
<version>2.0.0</version>
|
| 39 |
</Infobip_Storesms>
|
| 40 |
</modules>
|
| 41 |
|
| 164 |
<class>Infobip_Storesms_Model</class>
|
| 165 |
<resourceModel>storesms_resource</resourceModel>
|
| 166 |
</storesms>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
</models>
|
| 168 |
<helpers>
|
| 169 |
<storesms>
|
| 175 |
<class>Infobip_Storesms_Block</class>
|
| 176 |
</storesms>
|
| 177 |
</blocks>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
<events>
|
| 179 |
<sales_order_status_history_save_before>
|
| 180 |
<observers>
|
| 185 |
</observers>
|
| 186 |
</sales_order_status_history_save_before>
|
| 187 |
</events>
|
| 188 |
+
</global>
|
| 189 |
|
| 190 |
<default>
|
| 191 |
<storesms>
|
| 195 |
</storesms>
|
| 196 |
</default>
|
| 197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
</config>
|
app/code/community/Infobip/Storesms/etc/system.xml
CHANGED
|
@@ -74,7 +74,7 @@
|
|
| 74 |
</active>
|
| 75 |
|
| 76 |
<apilogin translate="label">
|
| 77 |
-
<label>
|
| 78 |
<frontend_type>text</frontend_type>
|
| 79 |
<sort_order>2</sort_order>
|
| 80 |
<show_in_default>1</show_in_default>
|
|
@@ -83,7 +83,7 @@
|
|
| 83 |
</apilogin>
|
| 84 |
|
| 85 |
<apipassword translate="label">
|
| 86 |
-
<label>
|
| 87 |
<frontend_type>obscure</frontend_type>
|
| 88 |
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
| 89 |
<sort_order>3</sort_order>
|
|
@@ -132,26 +132,6 @@
|
|
| 132 |
<validate>validate-length maximum-length-5</validate>
|
| 133 |
</country_prefix>
|
| 134 |
|
| 135 |
-
<allow_long_sms translate="label">
|
| 136 |
-
<label>Allow long messages (more than 160 chars or 70 for unicode)</label>
|
| 137 |
-
<frontend_type>select</frontend_type>
|
| 138 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 139 |
-
<sort_order>25</sort_order>
|
| 140 |
-
<show_in_default>1</show_in_default>
|
| 141 |
-
<show_in_website>1</show_in_website>
|
| 142 |
-
<show_in_store>1</show_in_store>
|
| 143 |
-
</allow_long_sms>
|
| 144 |
-
|
| 145 |
-
<allow_unicode_sms translate="label">
|
| 146 |
-
<label>Send as unicode message (70 characters)</label>
|
| 147 |
-
<frontend_type>select</frontend_type>
|
| 148 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 149 |
-
<sort_order>27</sort_order>
|
| 150 |
-
<show_in_default>1</show_in_default>
|
| 151 |
-
<show_in_website>1</show_in_website>
|
| 152 |
-
<show_in_store>1</show_in_store>
|
| 153 |
-
</allow_unicode_sms>
|
| 154 |
-
|
| 155 |
<credit_alert_limit translate="label comment">
|
| 156 |
<label>Notify if my Storesms account credits is below:</label>
|
| 157 |
<comment>0 - turn off/no alert</comment>
|
| 74 |
</active>
|
| 75 |
|
| 76 |
<apilogin translate="label">
|
| 77 |
+
<label>Username</label>
|
| 78 |
<frontend_type>text</frontend_type>
|
| 79 |
<sort_order>2</sort_order>
|
| 80 |
<show_in_default>1</show_in_default>
|
| 83 |
</apilogin>
|
| 84 |
|
| 85 |
<apipassword translate="label">
|
| 86 |
+
<label>Password</label>
|
| 87 |
<frontend_type>obscure</frontend_type>
|
| 88 |
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
| 89 |
<sort_order>3</sort_order>
|
| 132 |
<validate>validate-length maximum-length-5</validate>
|
| 133 |
</country_prefix>
|
| 134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
<credit_alert_limit translate="label comment">
|
| 136 |
<label>Notify if my Storesms account credits is below:</label>
|
| 137 |
<comment>0 - turn off/no alert</comment>
|
app/code/community/Infobip/Storesms/sql/storesms_setup/install-1.0.0.php
DELETED
|
@@ -1,32 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
$installer = $this;
|
| 4 |
-
$installer->startSetup();
|
| 5 |
-
$table = $installer->getConnection()->newTable($installer->getTable('infobip_storesms'))
|
| 6 |
-
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
| 7 |
-
'identity' => true,
|
| 8 |
-
'unsigned' => true,
|
| 9 |
-
'nullable' => false,
|
| 10 |
-
'primary' => true
|
| 11 |
-
), 'SMS ID')
|
| 12 |
-
->addColumn('sender', Varien_Db_Ddl_Table::TYPE_TEXT, 100, array(
|
| 13 |
-
'nullable' => false,
|
| 14 |
-
), 'Sender')
|
| 15 |
-
->addColumn('telephone', Varien_Db_Ddl_Table::TYPE_TEXT, 50, array(
|
| 16 |
-
'nullable' => false,
|
| 17 |
-
), 'Telephone')
|
| 18 |
-
->addColumn('message', Varien_Db_Ddl_Table::TYPE_TEXT, 1000, array(
|
| 19 |
-
'nullable' => false,
|
| 20 |
-
), 'Message')
|
| 21 |
-
->addColumn('attempts_number', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
|
| 22 |
-
'nullable' => false,
|
| 23 |
-
), 'Send Attempts')
|
| 24 |
-
->addColumn('delivery_status', Varien_Db_Ddl_Table::TYPE_TEXT, 100, array(
|
| 25 |
-
'nullable' => false,
|
| 26 |
-
), 'Delivery Status')
|
| 27 |
-
->addColumn('created', Varien_Db_Ddl_Table::TYPE_DATE , null, array(
|
| 28 |
-
'nullable' => false,
|
| 29 |
-
), 'First send date')
|
| 30 |
-
->setComment('Storesms API SMSes');
|
| 31 |
-
$installer->getConnection()->createTable($table);
|
| 32 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/base/default/layout/Infobip_Storesms.xml
CHANGED
|
File without changes
|
app/design/adminhtml/base/default/template/storesms/Adminblock.phtml
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
| 2 |
+
"http://www.w3.org/TR/html4/strict.dtd">
|
| 3 |
+
<html>
|
| 4 |
+
<head>
|
| 5 |
+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
|
| 6 |
+
<script type="text/javascript">
|
| 7 |
+
|
| 8 |
+
var $j = jQuery.noConflict();
|
| 9 |
+
|
| 10 |
+
function ClearFields() {
|
| 11 |
+
document.getElementById("storesms_grid_filter_message_id").value = "";
|
| 12 |
+
document.getElementById("storesms_grid_filter_to").value = "";
|
| 13 |
+
document.getElementById("storesms_grid_filter_from").value = "";
|
| 14 |
+
document.getElementById("storesms_grid_filter_text").value = "";
|
| 15 |
+
document.getElementById("storesms_grid_filter_status").value = "";
|
| 16 |
+
|
| 17 |
+
var $rows = $j('#storesms_grid_table tbody tr');
|
| 18 |
+
$rows.show();
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
window.onload = function FilterSearch() {
|
| 22 |
+
|
| 23 |
+
(function($j) {
|
| 24 |
+
$j.fn.multiFilter = function(filters) {
|
| 25 |
+
var $table = $j(this);
|
| 26 |
+
return $table.find('tbody > tr').each(function() {
|
| 27 |
+
var tr = $j(this);
|
| 28 |
+
|
| 29 |
+
// Make it an array to avoid special cases later.
|
| 30 |
+
if(!$j.isArray(filters))
|
| 31 |
+
filters = [ filters ];
|
| 32 |
+
|
| 33 |
+
howMany = 0;
|
| 34 |
+
for(i = 0, f = filters[0]; i < filters.length; f = filters[++i]) {
|
| 35 |
+
var index = 0;
|
| 36 |
+
$table.find('thead > tr > th').each(function(i) {
|
| 37 |
+
if($j(this).text() == f.column) {
|
| 38 |
+
index = i;
|
| 39 |
+
return false;
|
| 40 |
+
}
|
| 41 |
+
});
|
| 42 |
+
var text = tr.find('td:eq(' + index + ')').text();
|
| 43 |
+
if(text.toLowerCase().indexOf(f.word.toLowerCase()) != -1)
|
| 44 |
+
++howMany;
|
| 45 |
+
}
|
| 46 |
+
if(howMany == filters.length)
|
| 47 |
+
tr.show();
|
| 48 |
+
else
|
| 49 |
+
tr.hide();
|
| 50 |
+
});
|
| 51 |
+
};
|
| 52 |
+
})(jQuery);
|
| 53 |
+
|
| 54 |
+
$j('#storesms_grid_filter_message_id').keyup(function() {
|
| 55 |
+
var t = $j('table');
|
| 56 |
+
$j('#storesms_grid_table').multiFilter([
|
| 57 |
+
{ column: 'Message ID', word: this.value },
|
| 58 |
+
{ column: 'To', word: $j('#storesms_grid_filter_to').val() },
|
| 59 |
+
{ column: 'From', word: $j('#storesms_grid_filter_from').val() },
|
| 60 |
+
{ column: 'Text', word: $j('#storesms_grid_filter_text').val() },
|
| 61 |
+
{ column: 'General Status',word: $j('#storesms_grid_filter_status').val() }
|
| 62 |
+
]);
|
| 63 |
+
});
|
| 64 |
+
|
| 65 |
+
$j('#storesms_grid_filter_to').keyup(function() {
|
| 66 |
+
var t = $j('table');
|
| 67 |
+
$j('#storesms_grid_table').multiFilter([
|
| 68 |
+
{ column: 'Message ID', word: $j('#storesms_grid_filter_message_id').val() },
|
| 69 |
+
{ column: 'To', word: this.value },
|
| 70 |
+
{ column: 'From', word: $j('#storesms_grid_filter_from').val() },
|
| 71 |
+
{ column: 'Text', word: $j('#storesms_grid_filter_text').val() },
|
| 72 |
+
{ column: 'General Status',word: $j('#storesms_grid_filter_status').val() }
|
| 73 |
+
]);
|
| 74 |
+
});
|
| 75 |
+
|
| 76 |
+
$j('#storesms_grid_filter_from').keyup(function() {
|
| 77 |
+
var t = $j('table');
|
| 78 |
+
$j('#storesms_grid_table').multiFilter([
|
| 79 |
+
{ column: 'Message ID', word: $j('#storesms_grid_filter_message_id').val() },
|
| 80 |
+
{ column: 'To', word: $j('#storesms_grid_filter_to').val() },
|
| 81 |
+
{ column: 'From', word: this.value },
|
| 82 |
+
{ column: 'Text', word: $j('#storesms_grid_filter_text').val() },
|
| 83 |
+
{ column: 'General Status',word: $j('#storesms_grid_filter_status').val() }
|
| 84 |
+
]);
|
| 85 |
+
});
|
| 86 |
+
|
| 87 |
+
$j('#storesms_grid_filter_text').keyup(function() {
|
| 88 |
+
var t = $j('table');
|
| 89 |
+
$j('#storesms_grid_table').multiFilter([
|
| 90 |
+
{ column: 'Message ID', word: $j('#storesms_grid_filter_message_id').val() },
|
| 91 |
+
{ column: 'To', word: $j('#storesms_grid_filter_to').val() },
|
| 92 |
+
{ column: 'From', word: $j('#storesms_grid_filter_from').val() },
|
| 93 |
+
{ column: 'Text', word: this.value },
|
| 94 |
+
{ column: 'General Status',word: $j('#storesms_grid_filter_status').val() }
|
| 95 |
+
]);
|
| 96 |
+
});
|
| 97 |
+
|
| 98 |
+
$j('#storesms_grid_filter_status').change(function() {
|
| 99 |
+
var t = $j('table');
|
| 100 |
+
$j('#storesms_grid_table').multiFilter([
|
| 101 |
+
{ column: 'Message ID', word: $j('#storesms_grid_filter_message_id').val() },
|
| 102 |
+
{ column: 'To', word: $j('#storesms_grid_filter_to').val() },
|
| 103 |
+
{ column: 'From', word: $j('#storesms_grid_filter_from').val() },
|
| 104 |
+
{ column: 'Text', word: $j('#storesms_grid_filter_text').val() },
|
| 105 |
+
{ column: 'General Status',word: this.value }
|
| 106 |
+
]);
|
| 107 |
+
});
|
| 108 |
+
|
| 109 |
+
}
|
| 110 |
+
</script>
|
| 111 |
+
</head>
|
| 112 |
+
<body>
|
| 113 |
+
<div id="storesms_grid">
|
| 114 |
+
<table cellspacing="0" class="actions">
|
| 115 |
+
<tbody>
|
| 116 |
+
<tr>
|
| 117 |
+
<td class="filter-actions a-right">
|
| 118 |
+
<button id="id_reset" title="Reset Filter" type="button" class="scalable " onclick="ClearFields()" style=""><span>Reset Filter</span></button>
|
| 119 |
+
</td>
|
| 120 |
+
</tr>
|
| 121 |
+
</tbody>
|
| 122 |
+
</table>
|
| 123 |
+
<div class="grid">
|
| 124 |
+
<div class="hor-scroll">
|
| 125 |
+
<table cellspacing="0" class="data" id="storesms_grid_table">
|
| 126 |
+
<colgroup><col width="50">
|
| 127 |
+
<col width="50">
|
| 128 |
+
<col width="50">
|
| 129 |
+
<col width="250">
|
| 130 |
+
<col width="50">
|
| 131 |
+
<col width="50">
|
| 132 |
+
<col width="150">
|
| 133 |
+
</colgroup><thead>
|
| 134 |
+
<tr class="headings">
|
| 135 |
+
<th>Message ID</th>
|
| 136 |
+
<th>To</th>
|
| 137 |
+
<th>From</th>
|
| 138 |
+
<th>Text</th>
|
| 139 |
+
<th>General Status</th>
|
| 140 |
+
<th>Status Description</th>
|
| 141 |
+
<th>Sent At</th>
|
| 142 |
+
</tr>
|
| 143 |
+
<tr class="filter">
|
| 144 |
+
<th><div class="field-100"><input type="text" name="message_id" id="storesms_grid_filter_message_id" value="" class="input-text no-changes"></div></th>
|
| 145 |
+
<th><div class="field-100"><input type="text" name="to" id="storesms_grid_filter_to" value="" class="input-text no-changes"></div></th>
|
| 146 |
+
<th><div class="field-100"><input type="text" name="from" id="storesms_grid_filter_from" value="" class="input-text no-changes"></div></th>
|
| 147 |
+
<th><div class="field-100"><input type="text" name="text" id="storesms_grid_filter_text" value="" class="input-text no-changes"></div></th>
|
| 148 |
+
<th><select id="storesms_grid_filter_status" name="general status">
|
| 149 |
+
<option value=""></option>
|
| 150 |
+
<?php
|
| 151 |
+
// distinct result
|
| 152 |
+
$arrayOfMessageLogs = Mage::helper('storesms')->getLogs();
|
| 153 |
+
foreach ($arrayOfMessageLogs as $sentMessageLog) {
|
| 154 |
+
$generalStatuses[] = $sentMessageLog["general_status"];
|
| 155 |
+
|
| 156 |
+
}
|
| 157 |
+
$uniqueGeneralStatuses = array_unique($generalStatuses);
|
| 158 |
+
foreach ($uniqueGeneralStatuses as $genStat) {
|
| 159 |
+
echo "<option value=\"". $genStat ."\">". $genStat ."</option>";
|
| 160 |
+
}
|
| 161 |
+
?>
|
| 162 |
+
</select></th>
|
| 163 |
+
<th></th>
|
| 164 |
+
<th></th>
|
| 165 |
+
</tr>
|
| 166 |
+
</thead>
|
| 167 |
+
|
| 168 |
+
<tbody>
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
<?php
|
| 172 |
+
|
| 173 |
+
foreach ($arrayOfMessageLogs as $sentMessageLog) {
|
| 174 |
+
?>
|
| 175 |
+
<tr title="#" class="pointer">
|
| 176 |
+
<td class="a-left ">
|
| 177 |
+
<?php echo $sentMessageLog["message_id"]; ?>
|
| 178 |
+
</td>
|
| 179 |
+
<td id="col_to" class="a-left ">
|
| 180 |
+
<?php echo $sentMessageLog["to"]; ?>
|
| 181 |
+
</td>
|
| 182 |
+
<td id="col_from" class="a-left ">
|
| 183 |
+
<?php echo $sentMessageLog["from"]; ?>
|
| 184 |
+
</td>
|
| 185 |
+
<td class="a-left ">
|
| 186 |
+
<?php echo $sentMessageLog["text"]; ?>
|
| 187 |
+
</td>
|
| 188 |
+
<td class="a-left ">
|
| 189 |
+
<?php echo $sentMessageLog["general_status"]; ?>
|
| 190 |
+
</td>
|
| 191 |
+
<td class="a-left last ">
|
| 192 |
+
<?php echo $sentMessageLog["status_description"]; ?>
|
| 193 |
+
</td>
|
| 194 |
+
<td class="a-left ">
|
| 195 |
+
<?php echo $sentMessageLog["sent_at"]; ?>
|
| 196 |
+
</td>
|
| 197 |
+
</tr>
|
| 198 |
+
<?php
|
| 199 |
+
|
| 200 |
+
} ?>
|
| 201 |
+
|
| 202 |
+
</tbody>
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
</table>
|
| 206 |
+
</div>
|
| 207 |
+
</div>
|
| 208 |
+
</div>
|
| 209 |
+
</body>
|
| 210 |
+
</html>
|
app/design/adminhtml/base/default/template/storesms/system/config/fieldset/branding.phtml
CHANGED
|
File without changes
|
app/etc/modules/Infobip_Storesms.xml
CHANGED
|
File without changes
|
app/locale/pl_PL/Infobip_Storesms.csv
CHANGED
|
File without changes
|
js/infobipStoresms/storesmscounter.js
CHANGED
|
File without changes
|
package.xml
CHANGED
|
@@ -1,29 +1,159 @@
|
|
| 1 |
-
<?xml version="1.0"?>
|
| 2 |
-
<package>
|
| 3 |
-
<name>Infobip_Storesms</name>
|
| 4 |
-
<version>
|
| 5 |
-
<stability>stable</stability>
|
| 6 |
-
<license>Infobip StoreSMS licence</license>
|
| 7 |
-
<channel>community</channel>
|
| 8 |
-
<extends/>
|
| 9 |
-
<summary>By using Infobip StoreSMS you can easily keep your customers informed about the status of their shipments.
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
Infobip StoreSMS
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-

|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
<
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>Infobip_Storesms</name>
|
| 4 |
+
<version>2.0.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license>Infobip StoreSMS licence</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>By using Infobip StoreSMS you can easily keep your customers informed about the status of their shipments.
|
| 10 |
+
If your business sells or makes products that need shipping, Infobip StoreSMS is the right solution for you.
|
| 11 |
+
</summary>
|
| 12 |
+
<description>By using Infobip StoreSMS you can easily keep your customers informed about the status of their
|
| 13 |
+
shipments. If your business sells or makes products that need shipping, Infobip StoreSMS is the right solution
|
| 14 |
+
for you.
|
| 15 |
+

|
| 16 |
+
Infobip StoreSMS is a plugin based on SMS API technology.
|
| 17 |
+
Features
|
| 18 |
+

|
| 19 |
+
Keep customers happy - providing the right information at the right time adds value to your business and
|
| 20 |
+
increases customer loyalty.
|
| 21 |
+

|
| 22 |
+
Easy integration - a quick and esy way to provide your business with its own personal SMS service.
|
| 23 |
+

|
| 24 |
+
Bulk SMS - send out coupons or promotional offers and promote your business.
|
| 25 |
+

|
| 26 |
+
Sending speed - send up to 20 SMS messages per second over a highly reliable platform.
|
| 27 |
+
</description>
|
| 28 |
+
<notes>Infobip StoreSMS API module</notes>
|
| 29 |
+
<authors>
|
| 30 |
+
<author>
|
| 31 |
+
<name>Infobip</name>
|
| 32 |
+
<user>Infobip</user>
|
| 33 |
+
<email>magento@infobip.com</email>
|
| 34 |
+
</author>
|
| 35 |
+
</authors>
|
| 36 |
+
<date>2015-09-17</date>
|
| 37 |
+
<time>15:11:49</time>
|
| 38 |
+
<contents>
|
| 39 |
+
<target name="magecommunity">
|
| 40 |
+
<dir name="Infobip">
|
| 41 |
+
<dir name="Storesms">
|
| 42 |
+
<dir name="Block">
|
| 43 |
+
<dir name="Adminhtml">
|
| 44 |
+
<file name="Adminblock.php" hash="202015864597f1009051ecb6428004bc"/>
|
| 45 |
+
<dir name="Storesms">
|
| 46 |
+
<dir name="Edit">
|
| 47 |
+
<file name="Form.php" hash="1b369dae5e437d2dcf17b30275fcd489"/>
|
| 48 |
+
<dir name="Tab">
|
| 49 |
+
<file name="Form.php" hash="96d0f24063b0a7af61d55a728e13ad0e"/>
|
| 50 |
+
</dir>
|
| 51 |
+
<file name="Tabs.php" hash="188c99c05a103090fb0d3c65a30529a5"/>
|
| 52 |
+
</dir>
|
| 53 |
+
<file name="Edit.php" hash="d2095dd15d30a7ee0bb50f12c9d91c8d"/>
|
| 54 |
+
<file name="Grid.php" hash="53bae5db8d43a1c0635d33d4dc0e6b24"/>
|
| 55 |
+
</dir>
|
| 56 |
+
<file name="Storesms.php" hash="7bb4da25d3b5bc3e7363cf8b9a86bfd2"/>
|
| 57 |
+
<dir name="System">
|
| 58 |
+
<dir name="Config">
|
| 59 |
+
<dir name="Fieldset">
|
| 60 |
+
<file name="Branding.php" hash="eebc4a367ad619b8fe105dfd2fe42394"/>
|
| 61 |
+
</dir>
|
| 62 |
+
</dir>
|
| 63 |
+
</dir>
|
| 64 |
+
</dir>
|
| 65 |
+
<dir name="Buttons">
|
| 66 |
+
<file name="Contact.php" hash="a9ea799fe52cac5ce9eced905173a69d"/>
|
| 67 |
+
<file name="NewAccount.php" hash="03f0f45768a8dccb275c6e343cb86664"/>
|
| 68 |
+
</dir>
|
| 69 |
+
</dir>
|
| 70 |
+
<dir name="Helper">
|
| 71 |
+
<file name="Data.php" hash="974435258dcd08cb4ed793cee02f1788"/>
|
| 72 |
+
</dir>
|
| 73 |
+
<dir name="Model">
|
| 74 |
+
<file name="ApiClient.php" hash="1fdd7b2aa0cfdcdb5b44a52d269fe645"/>
|
| 75 |
+
<file name="Config.php" hash="ee2f15bd0e7b9a2cf400b926b0e9ffaa"/>
|
| 76 |
+
<file name="Observer.php" hash="349cb0e104daee12d14175c1c9072eeb"/>
|
| 77 |
+
<file name="Storesms.php" hash="70f8c280a744eb613cacabc65ddf2365"/>
|
| 78 |
+
</dir>
|
| 79 |
+
<dir name="controllers">
|
| 80 |
+
<dir name="Adminhtml">
|
| 81 |
+
<file name="StoresmsController.php" hash="4d8bcbeae354ec75750a2db09ad056e8"/>
|
| 82 |
+
</dir>
|
| 83 |
+
</dir>
|
| 84 |
+
<dir name="etc">
|
| 85 |
+
<file name="config.xml" hash="8e03f00ace819c36402311e36edb424f"/>
|
| 86 |
+
<file name="system.xml" hash="408a282448b07035a433250dbbbea988"/>
|
| 87 |
+
</dir>
|
| 88 |
+
</dir>
|
| 89 |
+
</dir>
|
| 90 |
+
</target>
|
| 91 |
+
<target name="magedesign">
|
| 92 |
+
<dir name="adminhtml">
|
| 93 |
+
<dir name="base">
|
| 94 |
+
<dir name="default">
|
| 95 |
+
<dir name="layout">
|
| 96 |
+
<file name="Infobip_Storesms.xml" hash="adb7f697c159b49cc17313bf8d5426a8"/>
|
| 97 |
+
</dir>
|
| 98 |
+
<dir name="template">
|
| 99 |
+
<dir name="storesms">
|
| 100 |
+
<file name="Adminblock.phtml" hash="e4607b58eeca875391aab04720555f35"/>
|
| 101 |
+
<dir name="system">
|
| 102 |
+
<dir name="config">
|
| 103 |
+
<dir name="fieldset">
|
| 104 |
+
<file name="branding.phtml" hash="97fd7bad4030f34f3869363786cc46c8"/>
|
| 105 |
+
</dir>
|
| 106 |
+
</dir>
|
| 107 |
+
</dir>
|
| 108 |
+
</dir>
|
| 109 |
+
</dir>
|
| 110 |
+
</dir>
|
| 111 |
+
</dir>
|
| 112 |
+
</dir>
|
| 113 |
+
</target>
|
| 114 |
+
<target name="mageskin">
|
| 115 |
+
<dir name="adminhtml">
|
| 116 |
+
<dir name="base">
|
| 117 |
+
<dir name="default">
|
| 118 |
+
<dir name="images">
|
| 119 |
+
<dir name="storesms">
|
| 120 |
+
<file name="storesms_header.png" hash="ca8dce29b3bbe56ae222587b103f27ac"/>
|
| 121 |
+
</dir>
|
| 122 |
+
</dir>
|
| 123 |
+
<dir name="css">
|
| 124 |
+
<dir name="storesms">
|
| 125 |
+
<file name="skin.css" hash="2f6c219956ed5ac0bd28256279cdc0cf"/>
|
| 126 |
+
</dir>
|
| 127 |
+
</dir>
|
| 128 |
+
</dir>
|
| 129 |
+
</dir>
|
| 130 |
+
</dir>
|
| 131 |
+
</target>
|
| 132 |
+
<target name="mageetc">
|
| 133 |
+
<dir name="modules">
|
| 134 |
+
<file name="Infobip_Storesms.xml" hash="ea5ef63fd7a211500bdaefaf6e56809e"/>
|
| 135 |
+
</dir>
|
| 136 |
+
</target>
|
| 137 |
+
<target name="mage">
|
| 138 |
+
<dir name="js">
|
| 139 |
+
<dir name="infobipStoresms">
|
| 140 |
+
<file name="storesmscounter.js" hash="172592c438b41b35d5b3bec9ad8afc0d"/>
|
| 141 |
+
</dir>
|
| 142 |
+
</dir>
|
| 143 |
+
</target>
|
| 144 |
+
<target name="magelocale">
|
| 145 |
+
<dir name="pl_PL">
|
| 146 |
+
<file name="Infobip_Storesms.csv" hash="00700b577d39d3c4f9e0553301cdead7"/>
|
| 147 |
+
</dir>
|
| 148 |
+
</target>
|
| 149 |
+
</contents>
|
| 150 |
+
<compatible/>
|
| 151 |
+
<dependencies>
|
| 152 |
+
<required>
|
| 153 |
+
<php>
|
| 154 |
+
<min>5.2.0</min>
|
| 155 |
+
<max>6.0.0</max>
|
| 156 |
+
</php>
|
| 157 |
+
</required>
|
| 158 |
+
</dependencies>
|
| 159 |
+
</package>
|
skin/adminhtml/base/default/css/storesms/skin.css
CHANGED
|
File without changes
|
skin/adminhtml/base/default/images/storesms/storesms_header.png
CHANGED
|
File without changes
|
