Skebby_Smsnotifier - Version 1.0.0

Version Notes

First release.

Download this release

Release Info

Developer Skebby
Extension Skebby_Smsnotifier
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (35) hide show
  1. app/code/community/Skebby/Smsnotifier/Adminhtml/Model/System/Config/Source/Charset.php +19 -0
  2. app/code/community/Skebby/Smsnotifier/Adminhtml/Model/System/Config/Source/Choosesender.php +19 -0
  3. app/code/community/Skebby/Smsnotifier/Adminhtml/Model/System/Config/Source/Encodingscheme.php +19 -0
  4. app/code/community/Skebby/Smsnotifier/Adminhtml/Model/System/Config/Source/Messagetype.php +23 -0
  5. app/code/community/Skebby/Smsnotifier/Block/Adminhtml/Smsnotifier.php +15 -0
  6. app/code/community/Skebby/Smsnotifier/Block/Adminhtml/Smsnotifier/Edit.php +20 -0
  7. app/code/community/Skebby/Smsnotifier/Block/Adminhtml/Smsnotifier/Edit/Form.php +20 -0
  8. app/code/community/Skebby/Smsnotifier/Block/Adminhtml/Smsnotifier/Edit/Tab/Form.php +33 -0
  9. app/code/community/Skebby/Smsnotifier/Block/Adminhtml/Smsnotifier/Edit/Tabs.php +25 -0
  10. app/code/community/Skebby/Smsnotifier/Block/Adminhtml/Smsnotifier/Grid.php +74 -0
  11. app/code/community/Skebby/Smsnotifier/Block/Adminhtml/System/Config/Fieldset/Branding.php +21 -0
  12. app/code/community/Skebby/Smsnotifier/Block/Buttons/Contact.php +22 -0
  13. app/code/community/Skebby/Smsnotifier/Block/Buttons/NewAccount.php +19 -0
  14. app/code/community/Skebby/Smsnotifier/Helper/Data.php +54 -0
  15. app/code/community/Skebby/Smsnotifier/Model/ApiClient.php +125 -0
  16. app/code/community/Skebby/Smsnotifier/Model/Config.php +143 -0
  17. app/code/community/Skebby/Smsnotifier/Model/Cron.php +12 -0
  18. app/code/community/Skebby/Smsnotifier/Model/Observer.php +170 -0
  19. app/code/community/Skebby/Smsnotifier/Model/Resource/Smsnotifier.php +11 -0
  20. app/code/community/Skebby/Smsnotifier/Model/Resource/Smsnotifier/Collection.php +11 -0
  21. app/code/community/Skebby/Smsnotifier/Model/Smsnotifier.php +159 -0
  22. app/code/community/Skebby/Smsnotifier/controllers/Adminhtml/SmsnotifierController.php +39 -0
  23. app/code/community/Skebby/Smsnotifier/controllers/IndexController.php +41 -0
  24. app/code/community/Skebby/Smsnotifier/etc/config.xml +245 -0
  25. app/code/community/Skebby/Smsnotifier/etc/system.xml +355 -0
  26. app/code/community/Skebby/Smsnotifier/sql/smsnotifier_setup/install-1.0.0.php +39 -0
  27. app/design/adminhtml/base/default/layout/Skebby_Smsnotifier.xml +19 -0
  28. app/design/adminhtml/base/default/template/smsnotifier/system/config/fieldset/branding.phtml +1 -0
  29. app/design/frontend/base/default/layout/Skebby_Smsnotifier.xml +8 -0
  30. app/etc/modules/Skebby_Smsnotifier.xml +9 -0
  31. js/skebbySmsnotifier/smsnotifiercounter.js +81 -0
  32. package.xml +22 -0
  33. skin/adminhtml/base/default/css/smsnotifier/skin.css +1 -0
  34. skin/adminhtml/base/default/images/smsnotifier/smsnotifier_header.png +0 -0
  35. skin/frontend/base/default/js/skebby/validate.js +11 -0
app/code/community/Skebby/Smsnotifier/Adminhtml/Model/System/Config/Source/Charset.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Opzione per scegliere il charset
4
+ */
5
+ class Skebby_Smsnotifier_Adminhtml_Model_System_Config_Source_Charset
6
+ {
7
+ /**
8
+ * Options getter
9
+ *
10
+ * @return array
11
+ */
12
+ public function toOptionArray()
13
+ {
14
+ return array(
15
+ array('value' => 'ISO-8859-1', 'label'=>Mage::helper('adminhtml')->__('ISO-8859-1')),
16
+ array('value' => 'UTF-8', 'label'=>Mage::helper('adminhtml')->__('UTF-8'))
17
+ );
18
+ }
19
+ }
app/code/community/Skebby/Smsnotifier/Adminhtml/Model/System/Config/Source/Choosesender.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Opzione per scegliere il mittente
4
+ */
5
+ class Skebby_Smsnotifier_Adminhtml_Model_System_Config_Source_Choosesender
6
+ {
7
+ /**
8
+ * Options getter
9
+ *
10
+ * @return array
11
+ */
12
+ public function toOptionArray()
13
+ {
14
+ return array(
15
+ array('value' => 'storename', 'label'=>Mage::helper('adminhtml')->__('Store Name')),
16
+ array('value' => 'sendernumber', 'label'=>Mage::helper('adminhtml')->__('Phone Number'))
17
+ );
18
+ }
19
+ }
app/code/community/Skebby/Smsnotifier/Adminhtml/Model/System/Config/Source/Encodingscheme.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Opzione per scegliere l'Encoding Scheme
4
+ */
5
+ class Skebby_Smsnotifier_Adminhtml_Model_System_Config_Source_Encodingscheme
6
+ {
7
+ /**
8
+ * Options getter
9
+ *
10
+ * @return array
11
+ */
12
+ public function toOptionArray()
13
+ {
14
+ return array(
15
+ array('value' => 'normal', 'label'=>Mage::helper('adminhtml')->__('Normal')),
16
+ array('value' => 'UCS2', 'label'=>Mage::helper('adminhtml')->__('UCS2'))
17
+ );
18
+ }
19
+ }
app/code/community/Skebby/Smsnotifier/Adminhtml/Model/System/Config/Source/Messagetype.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Opzione per scegliere il tipo di messaggio
4
+ */
5
+ class Skebby_Smsnotifier_Adminhtml_Model_System_Config_Source_Messagetype
6
+ {
7
+ const MESSAGE_TYPE_BASIC = 'basic';
8
+ const MESSAGE_TYPE_CLASSIC = 'classic';
9
+ const MESSAGE_TYPE_CLASSIC_PLUS = 'classic_report';
10
+ /**
11
+ * Options getter
12
+ *
13
+ * @return array
14
+ */
15
+ public function toOptionArray()
16
+ {
17
+ return array(
18
+ array('value' => self::MESSAGE_TYPE_BASIC, 'label'=>Mage::helper('adminhtml')->__('Basic')),
19
+ array('value' => self::MESSAGE_TYPE_CLASSIC, 'label'=>Mage::helper('adminhtml')->__('Classic')),
20
+ array('value' => self::MESSAGE_TYPE_CLASSIC_PLUS, 'label'=>Mage::helper('adminhtml')->__('Classic+')),
21
+ );
22
+ }
23
+ }
app/code/community/Skebby/Smsnotifier/Block/Adminhtml/Smsnotifier.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Skebby_Smsnotifier_Block_Adminhtml_Smsnotifier extends Mage_Adminhtml_Block_Widget_Grid_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ $this->_controller = 'adminhtml_smsnotifier';
8
+ $this->_blockGroup = 'smsnotifier';
9
+ $this->_headerText = Mage::helper('smsnotifier')->__('SMSNotifier');
10
+ parent::__construct();
11
+ $this->removeButton('add');
12
+
13
+ }
14
+
15
+ }
app/code/community/Skebby/Smsnotifier/Block/Adminhtml/Smsnotifier/Edit.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Skebby_Smsnotifier_Block_Adminhtml_Smsnotifier_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ $this->_objectId = 'id';
10
+ $this->_blockGroup = 'smsnotifier';
11
+ $this->_controller = 'adminhtml_smsnotifier';
12
+
13
+ $this->_updateButton('save', 'label', Mage::helper('smsnotifier')->__('Send'));
14
+ }
15
+
16
+ public function getHeaderText()
17
+ {
18
+ return Mage::helper('smsnotifier')->__('Send Bulk SMS');
19
+ }
20
+ }
app/code/community/Skebby/Smsnotifier/Block/Adminhtml/Smsnotifier/Edit/Form.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Skebby_Smsnotifier_Block_Adminhtml_Smsnotifier_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save'),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+
18
+ return parent::_prepareForm();
19
+ }
20
+ }
app/code/community/Skebby/Smsnotifier/Block/Adminhtml/Smsnotifier/Edit/Tab/Form.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Skebby_Smsnotifier_Block_Adminhtml_Smsnotifier_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+
10
+ $fieldset = $form->addFieldset('smsnotifier_form', array('legend'=>Mage::helper('smsnotifier')->__('SMS Content')));
11
+
12
+ $fieldset->addField('sms_message', 'editor', array(
13
+ 'name' => 'sms_message',
14
+ 'label' => Mage::helper('smsnotifier')->__('Message'),
15
+ 'title' => Mage::helper('smsnotifier')->__('Message'),
16
+ 'style' => 'width:500px; height:15em;',
17
+ 'after_element_html' => Mage::helper('smsnotifier')->__('Message (max. 160 characters).'),
18
+ 'wysiwyg' => false,
19
+ 'required' => true,
20
+ 'class' => 'validate-length maximum-length-160'
21
+ ));
22
+
23
+ $fieldset->addField('note2', 'note', array(
24
+ 'text' => Mage::helper('smsnotifier')->__('Bulk messaging is the process of sending a large number of SMS messages to various mobile number databases (mobile numbers). Bulk SMS is commonly used for alerts, reminders, marketing but also for providing information and communication between both staff and customers.')
25
+ ));
26
+
27
+ $fieldset->addField('note', 'note', array(
28
+ 'text' => Mage::helper('smsnotifier')->__('<br /><p><strong>Using other Skebby services with Skebby SMSNotifier</strong><br /><br /> Skebby is a global provider of mobile solutions connecting mobile network operators and enterprises through an in-house developed and operated mobile services cloud. SMS offers an ideal opportunity for business expansion because of its ubiquity, marketing effectiveness and wide reach.<br /> To find out more about SMS messaging solution visit <a href="http://www.skebby.com/" target="_blank">www.skebby.com</a><br />Magento users can go to <strong>System &gt; Import/export &gt; Dataflow Profiles &gt; Export Customers &gt; Run Profile</strong> to create a file that could later be imported to all of Skebby\'s other tools. This way, you can also use Skebby\'s Worx platform and inform your customers over SMS.</p>')
29
+ ));
30
+
31
+ return parent::_prepareForm();
32
+ }
33
+ }
app/code/community/Skebby/Smsnotifier/Block/Adminhtml/Smsnotifier/Edit/Tabs.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Skebby_Smsnotifier_Block_Adminhtml_Smsnotifier_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('smsnotifier_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('smsnotifier')->__('SMS Content'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+
17
+ $this->addTab('form_section', array(
18
+ 'label' => Mage::helper('smsnotifier')->__('SMS Content'),
19
+ 'title' => Mage::helper('smsnotifier')->__('SMS Content'),
20
+ 'content' => $this->getLayout()->createBlock('smsnotifier/adminhtml_smsnotifier_edit_tab_form')->toHtml(),
21
+ ));
22
+
23
+ return parent::_beforeToHtml();
24
+ }
25
+ }
app/code/community/Skebby/Smsnotifier/Block/Adminhtml/Smsnotifier/Grid.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Skebby_Smsnotifier_Block_Adminhtml_Smsnotifier_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('smsnotifier_grid');
9
+ $this->setDefaultSort('id');
10
+ $this->setDefaultDir('desc');
11
+ $this->setSaveParametersInSession(true);
12
+ }
13
+
14
+ protected function _prepareCollection()
15
+ {
16
+ $collection = Mage::getModel('smsnotifier/smsnotifier')->getCollection();
17
+ $this->setCollection($collection);
18
+
19
+ return parent::_prepareCollection();
20
+ }
21
+
22
+ protected function _prepareColumns()
23
+ {
24
+
25
+ $this->addColumn('id', array(
26
+ 'header' => Mage::helper('smsnotifier')->__('ID'),
27
+ 'align' =>'left',
28
+ 'width' => '40px',
29
+ 'index' => 'id',
30
+ ));
31
+ $this->addColumn('created', array(
32
+ 'header' => Mage::helper('smsnotifier')->__('Created date'),
33
+ 'align' =>'left',
34
+ 'width' => '50px',
35
+ 'index' => 'created',
36
+ 'type' => 'date'
37
+ ));
38
+ $this->addColumn('sender', array(
39
+ 'header' => Mage::helper('smsnotifier')->__('Sender'),
40
+ 'align' =>'left',
41
+ 'width' => '50px',
42
+ 'index' => 'sender',
43
+ ));
44
+ $this->addColumn('telephone', array(
45
+ 'header' => Mage::helper('smsnotifier')->__('Phone number'),
46
+ 'align' =>'left',
47
+ 'width' => '50px',
48
+ 'index' => 'telephone',
49
+ ));
50
+ $this->addColumn('message', array(
51
+ 'header' => Mage::helper('smsnotifier')->__('Message'),
52
+ 'align' =>'left',
53
+ 'width' => '250px',
54
+ 'index' => 'message',
55
+ ));
56
+ $this->addColumn('message_type', array(
57
+ 'header' => Mage::helper('smsnotifier')->__('Message Type'),
58
+ 'align' =>'left',
59
+ 'width' => '90px',
60
+ 'index' => 'message_type',
61
+ ));
62
+ $this->addColumn('delivery_status', array(
63
+ 'header' => Mage::helper('smsnotifier')->__('Delivery Status'),
64
+ 'align' =>'left',
65
+ 'width' => '50px',
66
+ 'index' => 'delivery_status',
67
+ 'type' => 'options',
68
+ 'options' => Mage::getModel('smsnotifier/config')->getMessageStatuses()
69
+ ));
70
+
71
+ return parent::_prepareColumns();
72
+ }
73
+
74
+ }
app/code/community/Skebby/Smsnotifier/Block/Adminhtml/System/Config/Fieldset/Branding.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Skebby_Smsnotifier_Block_Adminhtml_System_Config_Fieldset_Branding
4
+ extends Mage_Adminhtml_Block_Abstract
5
+ implements Varien_Data_Form_Element_Renderer_Interface
6
+ {
7
+ protected $_template = 'smsnotifier/system/config/fieldset/branding.phtml';
8
+
9
+ /**
10
+ * Render fieldset html
11
+ *
12
+ * @param Varien_Data_Form_Element_Abstract $element
13
+ * @return string
14
+ */
15
+ public function render(Varien_Data_Form_Element_Abstract $element)
16
+ {
17
+ $elementOriginalData = $element->getOriginalData();
18
+
19
+ return $this->toHtml();
20
+ }
21
+ }
app/code/community/Skebby/Smsnotifier/Block/Buttons/Contact.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Skebby_Smsnotifier_Block_Buttons_Contact extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $locale = Mage::app()->getLocale()->getLocaleCode();
8
+ $contactUrl = Mage::getModel('smsnotifier/config')->getContactUrl($locale);
9
+
10
+ $this->setElement($element);
11
+
12
+ $html = $this->getLayout()->createBlock('adminhtml/widget_button')
13
+ ->setType('button')
14
+ ->setClass('button')
15
+ ->setLabel(Mage::helper('smsnotifier')->__('Open contact form'))
16
+ ->setOnClick("window.open('{$contactUrl}','window1','width=990, height=705, scrollbars=1, resizable=1'); return false;")
17
+ ->toHtml();
18
+
19
+ return $html;
20
+
21
+ }
22
+ }
app/code/community/Skebby/Smsnotifier/Block/Buttons/NewAccount.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Skebby_Smsnotifier_Block_Buttons_NewAccount extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $this->setElement($element);
8
+
9
+ $html = $this->getLayout()->createBlock('adminhtml/widget_button')
10
+ ->setType('button')
11
+ ->setClass('button')
12
+ ->setLabel(Mage::helper('smsnotifier')->__('Open Sign Up form'))
13
+ ->setOnClick("window.open('http://www.skebby.com/sms-bulk-solutions/business-sms-sign-up/','window1','width=990, height=705, scrollbars=1, resizable=1'); return false;")
14
+ ->toHtml();
15
+
16
+ return $html;
17
+
18
+ }
19
+ }
app/code/community/Skebby/Smsnotifier/Helper/Data.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Skebby_Smsnotifier_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ public function getPhoneNumber($phoneNumber)
7
+ {
8
+ /*$config = Mage::getModel('smsnotifier/config');
9
+ $prefix = $config->getCountryPrefix();
10
+ $toStrip = '+,0';
11
+
12
+ return $prefix . ltrim($phoneNumber,$toStrip);*/
13
+ return ltrim($phoneNumber, '+,0');
14
+ }
15
+
16
+ public function isSendSuccess($response)
17
+ {
18
+ return $response['status'] == 'success';
19
+ }
20
+
21
+ public function getSendError($response)
22
+ {
23
+ $map = array(
24
+ 10 => Mage::helper('smsnotifier')->__('Generic error'),
25
+ 11 => Mage::helper('smsnotifier')->__('Unknown charset, use ISO-8859-1 or UTF-8'),
26
+ 12 => Mage::helper('smsnotifier')->__('Set all the mandatory parameters'),
27
+ 20 => Mage::helper('smsnotifier')->__('Input not valid'),
28
+ 21 => Mage::helper('smsnotifier')->__('Username or password not valid, you cannot use your email or phone number, only username is allowed on gateway'),
29
+ 22 => Mage::helper('smsnotifier')->__('Sender number not valid'),
30
+ 23 => Mage::helper('smsnotifier')->__('Sender string too long, max 11 chars'),
31
+ 24 => Mage::helper('smsnotifier')->__('Text too long'),
32
+ 25 => Mage::helper('smsnotifier')->__('Recipient not valid (must be in international format like 393401234567)'),
33
+ 26 => Mage::helper('smsnotifier')->__('Sender not allowed, please verify your number on http://www.skebby.it/user/verified-numbers/sender-id/'),
34
+ 27 => Mage::helper('smsnotifier')->__('Too many recipients, max 50.000'),
35
+ 28 => Mage::helper('smsnotifier')->__('You cannot repeate the same phone number twice or more'),
36
+ 29 => Mage::helper('smsnotifier')->__('No credit left, please buy a recharge on http://www.skebby.it/'),
37
+ 30 => Mage::helper('smsnotifier')->__('You cannot use the gateway interface with your acount, please send an email to supporto@skebby.com to enable it'),
38
+ 31 => Mage::helper('smsnotifier')->__('For this function only POST method is allowed, please send data in an HTTP POST request'),
39
+ 32 => Mage::helper('smsnotifier')->__('The delivery start date is not valid, use RFC 2822 format es: Mon, 15 Aug 2005 15:52:01 +0000'),
40
+ 33 => Mage::helper('smsnotifier')->__('The encoding scheme is not valid, allowed values: normal, ucs2 visit http://en.wikipedia.org/wiki/GSM_03.38 fo)r more information'),
41
+ 34 => Mage::helper('smsnotifier')->__('The validity period is not valid, MUST be an integer value (minutes) greater then zero and below 10080 (7 days)'),
42
+ 35 => Mage::helper('smsnotifier')->__('The user reference is not valid, MUST be max 20 chars of range [a-zA-Z0-9-_+:;]'),
43
+ 36 => Mage::helper('smsnotifier')->__('If you use a delivery start and you want the report you must also specify the user referece value'),
44
+ 37 => Mage::helper('smsnotifier')->__('Some characters in the text are not valid for the charset specified'),
45
+ 38 => Mage::helper('smsnotifier')->__('Too many alias with same vat'),
46
+ 39 => Mage::helper('smsnotifier')->__('Vat number not valid'),
47
+ 40 => Mage::helper('smsnotifier')->__('Not a business user'),
48
+ 41 => Mage::helper('smsnotifier')->__('Alias already approved'),
49
+ );
50
+
51
+ return $map[$response['code']];
52
+ }
53
+
54
+ }
app/code/community/Skebby/Smsnotifier/Model/ApiClient.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * SMS API client class
4
+ *
5
+ * @category Skebby
6
+ * @package SmsnotifierApi
7
+ * @copyright Copyright (c) 2014 Skebby (http://skebby.com/)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ * @author Skebby <supporto@skebby.com>
10
+ *
11
+ */
12
+
13
+ class Skebby_Smsnotifier_Model_ApiClient
14
+ {
15
+ private function getConfig()
16
+ {
17
+ return Mage::getModel('smsnotifier/config');
18
+
19
+ }
20
+
21
+ private function curlSend($url, $params)
22
+ {
23
+ $ch = curl_init();
24
+ curl_setopt($ch, CURLOPT_URL, $url);
25
+ curl_setopt($ch, CURLOPT_POST, 1);
26
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,10);
27
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
28
+ curl_setopt($ch, CURLOPT_TIMEOUT,60);
29
+ curl_setopt($ch, CURLOPT_USERAGENT,'Generic Client');
30
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
31
+
32
+ // response of the POST request
33
+ $response = curl_exec($ch);
34
+ curl_close($ch);
35
+
36
+ return $response;
37
+
38
+ }
39
+
40
+ public function sendByCurl(array $smsData)
41
+ {
42
+ if (empty($smsData['recipients']))
43
+ throw new Exception(Mage::helper('smsnotifier')->__('No recipients found'));
44
+
45
+ $config = $this->getConfig();
46
+ $postUrl = $config->getApiUrl();
47
+
48
+ $recipients = (!is_array($smsData['recipients'])) ? array($smsData['recipients']) : $smsData['recipients'];
49
+ $method = 'send_sms_'.$smsData['message_type'];
50
+
51
+ $params = 'method=' .$method. '&'
52
+ .'username=' .urlencode($config->getLogin()). '&'
53
+ .'password=' .urlencode($config->getPassword()).'&'
54
+ .'text=' .urlencode($smsData['message']). '&'
55
+ .'recipients[]='.implode('&recipients[]=',$recipients).'&'
56
+ .'charset=' .urlencode($config->getCharset()). '&'
57
+ .'encoding_scheme='.urlencode($config->getEncodingscheme());
58
+ if (isset($smsData['reference'])) {
59
+ $params .= '&' . 'user_reference=' .urlencode($smsData['reference']);
60
+ }
61
+
62
+ $sender = $config->getChoosesender();
63
+ if ($sender == 'storename') {
64
+ $params .= '&sender_string=' .urlencode($config->getStoreName());
65
+ } else {
66
+ $params .= '&sender_number=' .urlencode($config->getSenderNumber());
67
+ }
68
+
69
+ Skebby_Smsnotifier_Model_Smsnotifier::log('Send request: '.var_export($params,true));
70
+
71
+ // response of the POST request
72
+ $response = $this->curlSend($postUrl, $params);
73
+ //$response = 'status=success&remaining_sms=414'; // debug
74
+ //$response = 'status=failed&code=21&message=Username+or+password+not+valid%2C+you+cannot+use+your+email+or+phone+number%2C+only+username+is+allowed+on+gateway'; // debug
75
+
76
+ parse_str($response, $ret);
77
+
78
+ return $ret;
79
+
80
+ }
81
+
82
+ public function getCredits()
83
+ {
84
+ $config = $this->getConfig();
85
+ $postUrl = $config->getApiUrl();
86
+
87
+ $params = 'method=get_credit&'
88
+ .'username=' .urlencode($config->getLogin()). '&'
89
+ .'password=' .urlencode($config->getPassword());
90
+
91
+ $response = $this->curlSend($postUrl, $params);
92
+
93
+ return $response;
94
+
95
+ }
96
+
97
+ public function checkCreditLimit()
98
+ {
99
+ if (!Mage::getSingleton('admin/session')->isLoggedIn()) //checks credit limit only for logged admin
100
+ return;
101
+
102
+ $config = Mage::getModel('smsnotifier/config');
103
+ if ($config->isApiEnabled()==0) return;
104
+
105
+ $limit = $config->creditAllertLimit();
106
+ if ($limit==0) return; //If limit allert is turned off
107
+
108
+
109
+ try {
110
+
111
+ $credits = $this->getCredits();
112
+
113
+ if ($credits=='UNKNOWN_COMMAND') {
114
+ Mage::getSingleton('core/session')->addError(Mage::helper('smsnotifier')->__($config::WRONG_AUTH_DATA));
115
+ } elseif ($credits < $limit) {
116
+ Mage::getSingleton('core/session')->addError(Mage::helper('smsnotifier')->__($config::LOW_CREDITS_WARNING_MESSAGE));
117
+ }
118
+
119
+ } catch (Exception $e) {
120
+ Mage::getSingleton('core/session')->addError($e->getMessage());
121
+ }
122
+
123
+ }
124
+
125
+ }
app/code/community/Skebby/Smsnotifier/Model/Config.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Smsnotifier API config class
4
+ *
5
+ * @category Skebby
6
+ * @package SmsnotifierApi
7
+ * @copyright Copyright (c) 2014 Skebby (http://skebby.com/)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ * @author Skebby <supporto@skebby.com>
10
+ *
11
+ */
12
+
13
+ class Skebby_Smsnotifier_Model_Config
14
+ {
15
+ const LOW_CREDITS_WARNING_MESSAGE = 'Warning: Low credit level at your Skebby account. Buy credits.';
16
+ const WRONG_AUTH_DATA = 'Skebby API: Wrong Password and/or Username' ;
17
+
18
+ public $contacts = array (
19
+ 'en_US'=>'http://www.skebby.com/sms-solution-provider/contact-us', //default international
20
+ 'it_IT'=>'http://www.skebby.it/sms-business/contatti'
21
+ );
22
+
23
+ public function getApiUrl()
24
+ {
25
+ return "https://gateway.skebby.it/api/send/smseasy/advanced/http.php";
26
+ }
27
+
28
+ public function getContactUrl($localeCode)
29
+ {
30
+ return (array_key_exists($localeCode, $this->contacts)) ? $this->contacts[$localeCode] : $this->contacts['en_US'];
31
+
32
+ }
33
+
34
+ /**
35
+ * getting API login from main configuration
36
+ * @return string
37
+ */
38
+ public function getLogin()
39
+ {
40
+ return Mage::getStoreConfig('smsnotifier/main_conf/apilogin');
41
+
42
+ }
43
+
44
+ /**
45
+ * getting API password from main configuration
46
+ * @return string
47
+ */
48
+ public function getPassword()
49
+ {
50
+ $encrypted_pass = Mage::getStoreConfig('smsnotifier/main_conf/apipassword');
51
+
52
+ return Mage::helper('core')->decrypt($encrypted_pass);
53
+
54
+ }
55
+
56
+ /**
57
+ * getting API method from main configuration
58
+ * @return string
59
+ */
60
+ public function getMethod()
61
+ {
62
+ return Mage::getStoreConfig('smsnotifier/main_conf/message_type');
63
+ //return Mage::helper('core')->decrypt($encrypted_pass);
64
+ }
65
+
66
+ public function getCharset()
67
+ {
68
+ return Mage::getStoreConfig('smsnotifier/main_conf/charset');
69
+
70
+ }
71
+
72
+ public function getEncodingscheme()
73
+ {
74
+ return Mage::getStoreConfig('smsnotifier/main_conf/encodingscheme');
75
+
76
+ }
77
+
78
+ /*public function getCountryPrefix() {
79
+ return str_replace( array('00','+'), '', Mage::getStoreConfig('smsnotifier/main_conf/country_prefix') );
80
+
81
+ }*/
82
+
83
+ public function getStoreName()
84
+ {
85
+ return Mage::getStoreConfig('smsnotifier/main_conf/storename');
86
+
87
+ }
88
+
89
+ public function getSenderNumber()
90
+ {
91
+ return Mage::getStoreConfig('smsnotifier/main_conf/sendernumber');
92
+
93
+ }
94
+
95
+ public function getChoosesender()
96
+ {
97
+ return Mage::getStoreConfig('smsnotifier/main_conf/choosesender');
98
+ }
99
+ /**
100
+ * checks if Smsnotifier API module is enabled
101
+ * @return boolean
102
+ */
103
+ public function isApiEnabled()
104
+ {
105
+ return (Mage::getStoreConfig('smsnotifier/main_conf/active')==0) ? 0 : 1;
106
+
107
+ }
108
+
109
+ public function creditAllertLimit()
110
+ {
111
+ return floatval(str_replace(',','.',Mage::getStoreConfig('smsnotifier/main_conf/credit_alert_limit')));
112
+ }
113
+
114
+ /**
115
+ * getting SMS templates from config
116
+ * @return string
117
+ */
118
+ public function getMessageTemplate($template)
119
+ {
120
+ $templateContent = Mage::getStoreConfig('smsnotifier/templates/status_'.$template);
121
+
122
+ if (Mage::getStoreConfig('smsnotifier/templates/status_'. $template .'_active') && !empty($templateContent))
123
+ return $templateContent;
124
+
125
+ }
126
+
127
+ public function getMessageStatuses()
128
+ {
129
+ $statuses = array( 'DELIVERED' => Mage::helper('smsnotifier')->__('Message delivered'),
130
+ 'EXPIRED' => Mage::helper('smsnotifier')->__('Message expired (device off/not reachable)'),
131
+ 'DELETED' => Mage::helper('smsnotifier')->__('Operator network error'),
132
+ 'UNDELIVERABLE' => Mage::helper('smsnotifier')->__('Message undelivered'),
133
+ 'UNKNOWN' => Mage::helper('smsnotifier')->__('Generic error'),
134
+ 'REJECTD' => Mage::helper('smsnotifier')->__('Message rejected from operator'),
135
+ 'SENT' => Mage::helper('smsnotifier')->__('Message sent to Skebby'),
136
+ 'SENDING' => Mage::helper('smsnotifier')->__('Delivering to Skebby'),
137
+ 'ERROR' => Mage::helper('smsnotifier')->__('Unable to send to Skebby'),
138
+ );
139
+
140
+ return $statuses;
141
+ }
142
+
143
+ }
app/code/community/Skebby/Smsnotifier/Model/Cron.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Skebby_Smsnotifier_Model_Cron
4
+ {
5
+ public function getDelieveryReport()
6
+ {
7
+ $apiClient = Mage::getModel('smsnotifier/apiClient');
8
+ $apiClient->saveDeliveryReport();
9
+
10
+ }
11
+
12
+ }
app/code/community/Skebby/Smsnotifier/Model/Observer.php ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //File: app/code/community/Skebby/Smsnotifier/Model/Observer.php
3
+
4
+ /**
5
+ * @category Skebby
6
+ * @package SmsnotifierApi
7
+ * @copyright Copyright (c) 2014 Skebby (http://skebby.com/)
8
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
9
+ * @author Skebby <supporto@skebby.com>
10
+ * ...
11
+ */
12
+ class Skebby_Smsnotifier_Model_Observer
13
+ {
14
+ public static $lastExecutionTime; //to avoid multiple SMS if status was changed more than one time per 2 second
15
+
16
+
17
+ public function _construct()
18
+ {
19
+ if (!self::$lastExecutionTime)
20
+ self::$lastExecutionTime = time();
21
+ }
22
+
23
+ /**
24
+ * Generating alert notification if smsnotifierAPI account balance is low
25
+ *
26
+ * @return none
27
+ */
28
+
29
+ public function checkCreditLimit()
30
+ {
31
+ Mage::getModel('smsnotifier/apiClient')->checkCreditLimit();
32
+
33
+ }
34
+
35
+ /**
36
+ * Check if authorization data is ok
37
+ *
38
+ * @return none
39
+ */
40
+ public function checkAuthorizationData()
41
+ {
42
+ $config = Mage::getModel('smsnotifier/config');
43
+
44
+ if ($config->isApiEnabled()==0) return;
45
+
46
+ try {
47
+ $credits = Mage::getModel('smsnotifier/apiClient')->getCredits();
48
+
49
+ if ($credits=='UNKNOWN_COMMAND') {
50
+ throw new Exception(Mage::helper('smsnotifier')->__($config::WRONG_AUTH_DATA));
51
+ } else {
52
+ Mage::getSingleton('core/session')->addSuccess(Mage::helper('smsnotifier')->__('Success. Logged into Smsnotifier API.'));
53
+ }
54
+
55
+ } catch (Exception $e) {
56
+ Mage::getSingleton('core/session')->addError($e->getMessage());
57
+ }
58
+
59
+ }
60
+
61
+ public function orderStatusHistorySave($observer)
62
+ {
63
+ $config = Mage::getModel('smsnotifier/config');
64
+ if ($config->isApiEnabled()==0) return; //do nothing if api is disabled
65
+
66
+ $history = $observer->getEvent()->getStatusHistory();
67
+
68
+ //only for new status
69
+ if (!$history->getId()) {
70
+
71
+ $order = $history->getOrder();
72
+ $newStatus = $order->getData('status');
73
+ $origStatus = $order->getOrigData('status');
74
+
75
+ if (time()-self::$lastExecutionTime<=2)
76
+ return;
77
+
78
+ self::$lastExecutionTime = time();
79
+
80
+ //if status has changed run action
81
+ if ($newStatus!=$origStatus) {
82
+
83
+ $message = $config->getMessageTemplate($newStatus); //get template for new status (if active and exists)
84
+ if (!$message) //return if no active message template
85
+ return;
86
+
87
+ //getting last tracking number
88
+ $tracking = Mage::getResourceModel('sales/order_shipment_track_collection')->setOrderFilter($order)->getData();
89
+
90
+ if (!empty($tracking)) {
91
+ $last = count($tracking)-1;
92
+ $last_tracking_number = $tracking[$last]['track_number'];
93
+ } else
94
+ $last_tracking_number = 'no_tracking'; //if no tracking number set "no_tracking" message for {TRACKINGNUMBER} template
95
+
96
+
97
+ //getting order data to generate message template
98
+ $messageOrderData['{NAME}'] = $order->getShippingAddress()->getData('firstname');
99
+ $messageOrderData['{ORDERNUMBER}'] = $order->getIncrement_id();
100
+ $messageOrderData['{ORDERSTATUS}'] = $newStatus;
101
+ $messageOrderData['{TRACKINGNUMBER}'] = $last_tracking_number;
102
+ $messageOrderData['{STORENAME}'] = $config->getStoreName();
103
+
104
+ $message = strtr($message,$messageOrderData);
105
+
106
+ $model = Mage::getModel('smsnotifier/smsnotifier');
107
+
108
+ //prepare sms content
109
+ $number = $order->getShippingAddress()->getData('telephone');
110
+ $isValidNumber = $model->isValidNumber($number);
111
+ $msg['recipients'][] = Mage::helper('smsnotifier')->getPhoneNumber($number); //or getBillingAddress
112
+ $msg['message'] = $message;
113
+ $msg['message_type'] = $config->getMethod();
114
+ if ($msg['message_type'] == Skebby_Smsnotifier_Adminhtml_Model_System_Config_Source_Messagetype::MESSAGE_TYPE_CLASSIC_PLUS) {
115
+ $msg['reference'] = $model->getUserReference();
116
+ }
117
+
118
+ //sending sms and getting API response
119
+
120
+ try {
121
+
122
+ $apiClient = Mage::getModel('smsnotifier/apiClient');
123
+ $savedIds = $model->saveMessages($msg);
124
+ $msg['ids'] = $savedIds;
125
+ if ($isValidNumber) {
126
+ $response = $apiClient->sendByCurl($msg);
127
+ } else {
128
+ $response = false;
129
+ }
130
+ if ($response===false) {
131
+
132
+ //save delievery status for each message
133
+ foreach ($msg['ids'] as $messageId) {
134
+ $model->setNewDeliveryStatus($messageId,'ERROR');
135
+ $model->unsetData();
136
+ Mage::throwException('API CONNECTION ERROR.');
137
+ }
138
+
139
+ } else {
140
+
141
+ $sendSuccessFully = Mage::helper('smsnotifier')->isSendSuccess($response);
142
+ if (!$sendSuccessFully) {
143
+ foreach ($msg['ids'] as $messageId) {
144
+ $model->setNewDeliveryStatus($messageId,'ERROR');
145
+ }
146
+ Skebby_Smsnotifier_Model_Smsnotifier::log('Send error: '.var_export($response,true));
147
+ Mage::throwException(Mage::helper('smsnotifier')->__('Error sending Message:').' '.Mage::helper('smsnotifier')->getSendError($response));
148
+ }
149
+ foreach ($msg['ids'] as $messageId) {
150
+ $model->setNewDeliveryStatus($messageId,'SENT');
151
+ }
152
+ //@successs add comment to order
153
+ $newComment = Mage::helper('smsnotifier')->__('SMS notification sent (SMS id:').$msg['ids'][$msg['recipients'][0]].') ' ;
154
+ $history->setComment($newComment);
155
+ //Mage::getSingleton('core/session')->addSuccess($newComment);
156
+ $this->checkCreditLimit();
157
+ }
158
+
159
+ } catch (Exception $e) {
160
+ $newComment = Mage::helper('smsnotifier')->__('SMS notification sending error:').' "'.$e->getMessage().'"';
161
+ $history->setComment($newComment);
162
+ //Mage::getSingleton('core/session')->addError($newComment);
163
+ }
164
+
165
+ }
166
+ }
167
+
168
+ }
169
+
170
+ }
app/code/community/Skebby/Smsnotifier/Model/Resource/Smsnotifier.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Skebby_Smsnotifier_Model_Resource_Smsnotifier extends Mage_Core_Model_Resource_Db_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init("smsnotifier/skebby_smsnotifier","id");
8
+
9
+ }
10
+
11
+ }
app/code/community/Skebby/Smsnotifier/Model/Resource/Smsnotifier/Collection.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Skebby_Smsnotifier_Model_Resource_Smsnotifier_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init("smsnotifier/smsnotifier");
8
+
9
+ }
10
+
11
+ }
app/code/community/Skebby/Smsnotifier/Model/Smsnotifier.php ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Skebby_Smsnotifier_Model_Smsnotifier extends Mage_Core_Model_Abstract
4
+ {
5
+ const DEBUG_LOG_NAME = 'Skebby_SmsNotifier';
6
+
7
+ public static function log($message)
8
+ {
9
+ Mage::log(self::DEBUG_LOG_NAME.' - '.$message);
10
+ }
11
+
12
+ public function _construct()
13
+ {
14
+ $this->_init("smsnotifier/smsnotifier");
15
+ }
16
+
17
+ /** Gets list of Partners or Distributors
18
+ *
19
+ * @param type $ofWhat
20
+ * @return type
21
+ */
22
+ public function getFailedSmses()
23
+ {
24
+ $collection = $this->getCollection();
25
+ $collection->addFieldToFilter("group_id" ,array("eq"=>$ofWhat));
26
+ $items = $collection->getItems();
27
+
28
+ foreach ($items as $item) {
29
+ $listToReturn[] = $item->getData();
30
+ }
31
+
32
+ return $listToReturn;
33
+
34
+ }
35
+
36
+ public function saveMessages(array $smsData)
37
+ {
38
+ $config = Mage::getModel('smsnotifier/config');
39
+ $sender = $config->getChoosesender();
40
+ $senderName = null;
41
+ if ($smsData['message_type'] == Skebby_Smsnotifier_Adminhtml_Model_System_Config_Source_Messagetype::MESSAGE_TYPE_CLASSIC_PLUS) {
42
+ if ($sender == 'storename') {
43
+ $senderName = $config->getStoreName();
44
+ } else {
45
+ $senderName = $config->getSenderNumber();
46
+ }
47
+ }
48
+
49
+ foreach ($smsData['recipients'] as $gsmNumber) { //save sms to database and retrieve message id's
50
+ $reference = isset($smsData['reference']) ? $smsData['reference'] : null;
51
+ $this->newSms($gsmNumber,$smsData['message'],'SENDING',$smsData['message_type'],$reference,$senderName);
52
+ $smsId = $this->getData('id');
53
+ $smsIds[$gsmNumber] = $smsId;
54
+ $this->unsetData();
55
+
56
+ }
57
+
58
+ return $smsIds;
59
+ }
60
+
61
+ public function newSms($telephone,$message,$deliveryStatus,$messageType,$reference,$sender = false)
62
+ {
63
+ $this->setSender($sender);
64
+ $this->setTelephone($telephone);
65
+ $this->setDeliveryStatus($deliveryStatus);
66
+ $this->setMessage($message);
67
+ $this->setCreated(new Zend_Db_Expr('CURDATE()'));
68
+ $this->setMessageType($messageType);
69
+ if ($reference) {
70
+ // Add reference
71
+ $this->setDeliveryReference($reference);
72
+ }
73
+ $this->save();
74
+
75
+ }
76
+
77
+ public function setNewDeliveryStatus($smsId,$deliveryStatus)
78
+ {
79
+ $this->load($smsId);
80
+ $this->setDeliveryStatus($deliveryStatus)->save();
81
+
82
+ }
83
+
84
+ public function isValidNumber($number)
85
+ {
86
+ return preg_match('/^\+(9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\d{4,14}$/', $number);
87
+ }
88
+
89
+ public function getUserReference()
90
+ {
91
+ return substr(md5(rand(1,999999).'-'.microtime(true)),0,20);
92
+ }
93
+
94
+ /**
95
+ * Get all phone numbers from customer address collection
96
+ *
97
+ *
98
+ * @return type
99
+ */
100
+
101
+ public function getPhoneNumbers()
102
+ {
103
+ $col = Mage::getModel('customer/address')->getCollection()->addAttributeToSelect('telephone')->getItems();
104
+ foreach ($col as $address) {
105
+ $number = $address->getTelephone();
106
+ if ($this->isValidNumber($number)) {
107
+ $phones[] = Mage::helper('smsnotifier')->getPhoneNumber($number);
108
+ }
109
+ }
110
+ $phones = array_unique($phones);
111
+
112
+ return $phones;
113
+
114
+ }
115
+
116
+ public function sendBulkSMS($messageContent)
117
+ {
118
+ $config = Mage::getModel('smsnotifier/config');
119
+ $numbers = $this->getPhoneNumbers();
120
+
121
+ $message = array(
122
+ 'recipients' => $numbers,
123
+ 'message' => $messageContent,
124
+ 'message_type' => $config->getMethod(),
125
+ );
126
+ if ($message['message_type'] == Skebby_Smsnotifier_Adminhtml_Model_System_Config_Source_Messagetype::MESSAGE_TYPE_CLASSIC_PLUS) {
127
+ $message['reference'] = Mage::getModel('smsnotifier/smsnotifier')->getUserReference();
128
+ }
129
+
130
+ try {
131
+ $apiClient = Mage::getModel('smsnotifier/apiClient');
132
+ $savedIds = Mage::getModel('smsnotifier/smsnotifier')->saveMessages($message);
133
+ $message['ids'] = $savedIds;
134
+
135
+ $response = $apiClient->sendByCurl($message);
136
+
137
+ $sendSuccessFully = Mage::helper('smsnotifier')->isSendSuccess($response);
138
+ if (!$sendSuccessFully) {
139
+ Skebby_Smsnotifier_Model_Smsnotifier::log('Send error: '.var_export($response,true));
140
+ foreach ($savedIds as $id) {
141
+ $this->setNewDeliveryStatus($id,'ERROR');
142
+ }
143
+ Mage::throwException(Mage::helper('smsnotifier')->__('Error sending Message:').' '.Mage::helper('smsnotifier')->getSendError($response));
144
+ }
145
+ foreach ($savedIds as $id) {
146
+ $this->setNewDeliveryStatus($id,'SENT');
147
+ }
148
+
149
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('smsnotifier')->__('Message sent successfully'));
150
+
151
+ } catch (Exception $e) {
152
+
153
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
154
+
155
+ }
156
+
157
+ }
158
+
159
+ }
app/code/community/Skebby/Smsnotifier/controllers/Adminhtml/SmsnotifierController.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Skebby_Smsnotifier_Adminhtml_SmsnotifierController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+
6
+ public function indexAction()
7
+ {
8
+ $this->loadLayout()
9
+ ->_setActiveMenu('smsnotifier/items');
10
+ $this->renderLayout();
11
+
12
+ }
13
+
14
+ public function editAction()
15
+ {
16
+ $this->loadLayout()
17
+ ->_setActiveMenu('smsnotifier/items');
18
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
19
+ $this->_addContent($this->getLayout()->createBlock('smsnotifier/adminhtml_smsnotifier_edit'))
20
+ ->_addLeft($this->getLayout()->createBlock('smsnotifier/adminhtml_smsnotifier_edit_tabs'));
21
+
22
+ $this->renderLayout();
23
+
24
+ }
25
+
26
+ public function newAction()
27
+ {
28
+ $this->_forward('edit');
29
+
30
+ }
31
+
32
+ public function saveAction()
33
+ {
34
+ Mage::getModel('smsnotifier/smsnotifier')->sendBulkSMS($this->getRequest()->getParam('sms_message'));
35
+ $this->_redirect('*/*/new');
36
+
37
+ }
38
+
39
+ }
app/code/community/Skebby/Smsnotifier/controllers/IndexController.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Skebby_Smsnotifier_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ Skebby_Smsnotifier_Model_Smsnotifier::log('Got notify on wrong controller: '.var_export($_REQUEST,true));
7
+ }
8
+
9
+ public function notifyAction()
10
+ {
11
+ $recipient = Mage::app()->getRequest()->getParam('recipient');
12
+ $userReference = Mage::app()->getRequest()->getParam('user_reference');
13
+ $status = Mage::app()->getRequest()->getParam('status');
14
+ $errorCode = Mage::app()->getRequest()->getParam('error_code');
15
+
16
+ Skebby_Smsnotifier_Model_Smsnotifier::log('Got notify: '.var_export($_REQUEST,true));
17
+
18
+ if (!$recipient || !$userReference || !$status || !$errorCode) {
19
+ Skebby_Smsnotifier_Model_Smsnotifier::log('Notify missing needed parameters');
20
+
21
+ return;
22
+ }
23
+
24
+ // check if present
25
+ $collection = Mage::getModel('smsnotifier/smsnotifier')->getCollection()
26
+ ->addFieldToSelect('*')
27
+ ->addFieldToFilter('telephone', $recipient)
28
+ ->addFieldToFilter('delivery_reference',$userReference)
29
+ ->getItems();
30
+ if (count($collection) > 0) {
31
+ Skebby_Smsnotifier_Model_Smsnotifier::log('Found notify');
32
+ $item = reset($collection);
33
+ $id = $item->getId();
34
+ $item = Mage::getModel('smsnotifier/smsnotifier')->load($id);
35
+ $item->setDeliveryStatus($status)->save();
36
+ } else {
37
+ Skebby_Smsnotifier_Model_Smsnotifier::log('Not found notify');
38
+ }
39
+ }
40
+
41
+ }
app/code/community/Skebby/Smsnotifier/etc/config.xml ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ File: app/code/community/Skebby/Smsnotifier/etc/config.xml
4
+
5
+ /**
6
+ * Skebby SMSNotifier API Module
7
+ *
8
+ * NOTICE OF LICENSE
9
+ *
10
+ * This source file is subject to the Open Software License (OSL 3.0)
11
+ * that is bundled with this package in the file LICENSE.txt.
12
+ * It is also available through the world-wide-web at this URL:
13
+ * http://opensource.org/licenses/osl-3.0.php
14
+ * If you did not receive a copy of the license and are unable to
15
+ * obtain it through the world-wide-web, please send an email
16
+ * to license@magentocommerce.com so we can send you a copy immediately.
17
+ *
18
+ * DISCLAIMER
19
+ *
20
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
21
+ * versions in the future. If you wish to customize Magento for your
22
+ * needs please refer to http://www.magentocommerce.com for more information.
23
+ *
24
+ * Short Message Service (SMS) API
25
+ *
26
+ * @category Skebby
27
+ * @package SMSNotifier
28
+ * @copyright Copyright (c) 2014 Skebby (http://skebby.com/)
29
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
30
+ * @author Skebby <supporto@skebby.com>
31
+ */
32
+
33
+ -->
34
+ <config>
35
+
36
+ <modules>
37
+ <Skebby_Smsnotifier>
38
+ <version>1.0.3</version>
39
+ </Skebby_Smsnotifier>
40
+ </modules>
41
+
42
+ <admin>
43
+ <routers>
44
+ <adminhtml>
45
+ <args>
46
+ <modules>
47
+ <smsnotifier before="Mage_Adminhtml">Skebby_Smsnotifier_Adminhtml</smsnotifier>
48
+ </modules>
49
+ </args>
50
+ </adminhtml>
51
+ <smsnotifier>
52
+ <use>admin</use>
53
+ <args>
54
+ <module>Skebby_Smsnotifier</module>
55
+ <frontName>smsnotifier</frontName>
56
+ </args>
57
+ </smsnotifier>
58
+ </routers>
59
+ </admin>
60
+
61
+ <frontend>
62
+ <routers>
63
+ <smsnotifier>
64
+ <use>standard</use>
65
+ <args>
66
+ <module>Skebby_Smsnotifier</module>
67
+ <frontname>smsnotifier</frontname>
68
+ </args>
69
+ </smsnotifier>
70
+ </routers>
71
+ <layout>
72
+ <updates>
73
+ <smsnotifier>
74
+ <file>Skebby_Smsnotifier.xml</file>
75
+ </smsnotifier>
76
+ </updates>
77
+ </layout>
78
+ </frontend>
79
+
80
+ <adminhtml>
81
+ <acl>
82
+ <resources>
83
+ <admin>
84
+ <children>
85
+ <system>
86
+ <children>
87
+ <config>
88
+ <children>
89
+ <smsnotifier>
90
+ <title>Skebby SMSNotifier</title>
91
+ <sort_order>101</sort_order>
92
+ </smsnotifier>
93
+ </children>
94
+ </config>
95
+ </children>
96
+ </system>
97
+ <smsnotifier>
98
+ <title>Skebby SMSNotifier</title>
99
+ <children>
100
+ <smsnotifier translate="title" module="smsnotifier">
101
+ <title>SMSNotifier - SMS summary</title>
102
+ </smsnotifier>
103
+ <manual translate="title" module="smsnotifier">
104
+ <title>SMSNotifier - Send Bulk SMS</title>
105
+ <sort_order>10</sort_order>
106
+ </manual>
107
+ </children>
108
+ </smsnotifier>
109
+ </children>
110
+ </admin>
111
+ </resources>
112
+ </acl>
113
+
114
+ <menu>
115
+ <smsnotifier translate="title" module="smsnotifier">
116
+ <title>Skebby SMSNotifier</title>
117
+ <sort_order>500</sort_order>
118
+ <children>
119
+ <smssummary translate="title" module="smsnotifier">
120
+ <title>Summary</title>
121
+ <sort_order>5</sort_order>
122
+ <action>adminhtml/smsnotifier/index</action>
123
+ </smssummary>
124
+ <manual translate="title" module="smsnotifier">
125
+ <title>Send Bulk SMS</title>
126
+ <sort_order>10</sort_order>
127
+ <action>smsnotifier/adminhtml_smsnotifier/new</action>
128
+ </manual>
129
+ <settings translate="title" module="smsnotifier">
130
+ <title>Settings</title>
131
+ <sort_order>15</sort_order>
132
+ <action>adminhtml/system_config/edit/section/smsnotifier</action>
133
+ </settings>
134
+ </children>
135
+ </smsnotifier>
136
+ </menu>
137
+
138
+ <layout>
139
+ <updates>
140
+ <smsnotifier>
141
+ <file>Skebby_Smsnotifier.xml</file>
142
+ </smsnotifier>
143
+ </updates>
144
+ </layout>
145
+
146
+ <translate>
147
+ <modules>
148
+ <Skebby_Smsnotifier>
149
+ <files>
150
+ <default>Skebby_Smsnotifier.csv</default>
151
+ </files>
152
+ </Skebby_Smsnotifier>
153
+ </modules>
154
+ </translate>
155
+
156
+ <events>
157
+ <admin_system_config_changed_section_smsnotifier>
158
+ <observers>
159
+ <smsnotifier_check_authorization_data>
160
+ <class>Skebby_Smsnotifier_Model_Observer</class>
161
+ <method>checkAuthorizationData</method>
162
+ </smsnotifier_check_authorization_data>
163
+ </observers>
164
+ </admin_system_config_changed_section_smsnotifier>
165
+ <admin_session_user_login_success>
166
+ <observers>
167
+ <smsnotifier_check_limits>
168
+ <class>Skebby_Smsnotifier_Model_Observer</class>
169
+ <method>checkCreditLimit</method>
170
+ </smsnotifier_check_limits>
171
+ </observers>
172
+ </admin_session_user_login_success>
173
+ </events>
174
+
175
+
176
+ </adminhtml>
177
+
178
+
179
+ <global>
180
+ <models>
181
+ <smsnotifier>
182
+ <class>Skebby_Smsnotifier_Model</class>
183
+ <resourceModel>smsnotifier_resource</resourceModel>
184
+ </smsnotifier>
185
+ <smsnotifier_resource>
186
+ <class>Skebby_Smsnotifier_Model_Resource</class>
187
+ <entities>
188
+ <skebby_smsnotifier>
189
+ <table>skebby_smsnotifier</table>
190
+ </skebby_smsnotifier>
191
+ </entities>
192
+ </smsnotifier_resource>
193
+ <smsnotifier_adminhtml>
194
+ <class>Skebby_Smsnotifier_Adminhtml_Model</class>
195
+ </smsnotifier_adminhtml>
196
+ </models>
197
+ <helpers>
198
+ <smsnotifier>
199
+ <class>Skebby_Smsnotifier_Helper</class>
200
+ </smsnotifier>
201
+ </helpers>
202
+ <blocks>
203
+ <smsnotifier>
204
+ <class>Skebby_Smsnotifier_Block</class>
205
+ </smsnotifier>
206
+ </blocks>
207
+ <resources>
208
+ <smsnotifier_setup>
209
+ <setup>
210
+ <module>Skebby_Smsnotifier</module>
211
+ </setup>
212
+ </smsnotifier_setup>
213
+ </resources>
214
+ <events>
215
+ <sales_order_status_history_save_before>
216
+ <observers>
217
+ <order_new_status>
218
+ <class>Skebby_Smsnotifier_Model_Observer</class>
219
+ <method>orderStatusHistorySave</method>
220
+ </order_new_status>
221
+ </observers>
222
+ </sales_order_status_history_save_before>
223
+ </events>
224
+ </global>
225
+
226
+ <default>
227
+ <smsnotifier>
228
+ <main_conf>
229
+ <credit_alert_limit>0</credit_alert_limit>
230
+ </main_conf>
231
+ </smsnotifier>
232
+ </default>
233
+
234
+ <crontab>
235
+ <jobs>
236
+ <smsnotifier_getreports>
237
+ <schedule>
238
+ <cron_expr>0,30 * * * *</cron_expr>
239
+ </schedule>
240
+ <run><model>smsnotifier/cron::getDelieveryReport</model></run>
241
+ </smsnotifier_getreports>
242
+ </jobs>
243
+ </crontab>
244
+
245
+ </config>
app/code/community/Skebby/Smsnotifier/etc/system.xml ADDED
@@ -0,0 +1,355 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Skebby SMSNotifier API
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * Short Message Service (SMS) API
23
+ *
24
+ * @category Skebby
25
+ * @package SmsnotifierApi
26
+ * @copyright Copyright (c) 2014 Skebby (http://skebby.com/)
27
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
28
+ * @author Skebby <supporto@skebby.com>
29
+ */
30
+
31
+ -->
32
+
33
+ <config>
34
+ <tabs>
35
+ <skebby translate="label">
36
+ <label>SKEBBY</label>
37
+ <sort_order>1</sort_order>
38
+ </skebby>
39
+ </tabs>
40
+ <sections>
41
+ <smsnotifier translate="label" module="smsnotifier">
42
+ <label><![CDATA[<span class="skebbyadmin-menu">Skebby SMSNotifier</span>]]></label>
43
+ <tab>skebby</tab>
44
+ <frontend_type>text</frontend_type>
45
+ <sort_order>0</sort_order>
46
+ <show_in_default>1</show_in_default>
47
+ <show_in_website>1</show_in_website>
48
+ <show_in_store>1</show_in_store>
49
+ <groups>
50
+
51
+ <branding_header translate="label" module="smsnotifier">
52
+ <frontend_model>smsnotifier/adminhtml_system_config_fieldset_branding</frontend_model>
53
+ <sort_order>0</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
+ </branding_header>
58
+
59
+ <main_conf translate="label">
60
+ <label>Smsnotifier - Main Configuration</label>
61
+ <frontend_type>text</frontend_type>
62
+ <sort_order>1</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ <expanded>1</expanded>
67
+ <fields>
68
+ <active translate="label">
69
+ <label>Enabled</label>
70
+ <frontend_type>select</frontend_type>
71
+ <source_model>adminhtml/system_config_source_yesno</source_model>
72
+ <sort_order>1</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ </active>
77
+
78
+ <apilogin translate="label">
79
+ <label>API Login</label>
80
+ <frontend_type>text</frontend_type>
81
+ <sort_order>2</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>1</show_in_store>
85
+ </apilogin>
86
+
87
+ <apipassword translate="label">
88
+ <label>API Password</label>
89
+ <frontend_type>obscure</frontend_type>
90
+ <backend_model>adminhtml/system_config_backend_encrypted</backend_model>
91
+ <sort_order>3</sort_order>
92
+ <show_in_default>1</show_in_default>
93
+ <show_in_website>1</show_in_website>
94
+ <show_in_store>1</show_in_store>
95
+ </apipassword>
96
+
97
+ <choosesender translate="label">
98
+ <label>Choose the Sender string (Only for Classic and Classic+ SMSs)</label>
99
+ <frontend_type>select</frontend_type>
100
+ <source_model>smsnotifier_adminhtml/system_config_source_choosesender</source_model>
101
+ <sort_order>4</sort_order>
102
+ <show_in_default>1</show_in_default>
103
+ <show_in_website>1</show_in_website>
104
+ <show_in_store>1</show_in_store>
105
+ </choosesender>
106
+
107
+ <sendernumber translate="label">
108
+ <label>Sender Number</label>
109
+ <frontend_type>text</frontend_type>
110
+ <sort_order>5</sort_order>
111
+ <show_in_default>1</show_in_default>
112
+ <show_in_website>1</show_in_website>
113
+ <show_in_store>1</show_in_store>
114
+ </sendernumber>
115
+
116
+ <storename translate="label">
117
+ <label>Store name</label>
118
+ <frontend_type>text</frontend_type>
119
+ <sort_order>6</sort_order>
120
+ <show_in_default>1</show_in_default>
121
+ <show_in_website>1</show_in_website>
122
+ <show_in_store>1</show_in_store>
123
+ <validate>validate-length maximum-length-11</validate>
124
+ </storename>
125
+
126
+ <message_type translate="label">
127
+ <label>Select the type of message you want to send</label>
128
+ <frontend_type>select</frontend_type>
129
+ <source_model>smsnotifier_adminhtml/system_config_source_messagetype</source_model>
130
+ <sort_order>7</sort_order>
131
+ <show_in_default>1</show_in_default>
132
+ <show_in_website>1</show_in_website>
133
+ <show_in_store>1</show_in_store>
134
+ </message_type>
135
+
136
+ <charset translate="label">
137
+ <label>Charset</label>
138
+ <frontend_type>select</frontend_type>
139
+ <source_model>smsnotifier_adminhtml/system_config_source_charset</source_model>
140
+ <sort_order>8</sort_order>
141
+ <show_in_default>1</show_in_default>
142
+ <show_in_website>1</show_in_website>
143
+ <show_in_store>1</show_in_store>
144
+ </charset>
145
+
146
+ <encodingscheme translate="label">
147
+ <label>Encoding Scheme</label>
148
+ <frontend_type>select</frontend_type>
149
+ <source_model>smsnotifier_adminhtml/system_config_source_encodingscheme</source_model>
150
+ <sort_order>9</sort_order>
151
+ <show_in_default>1</show_in_default>
152
+ <show_in_website>1</show_in_website>
153
+ <show_in_store>1</show_in_store>
154
+ </encodingscheme>
155
+
156
+ <!--<country_prefix translate="label">
157
+ <label>Country prefix</label>
158
+ <frontend_type>text</frontend_type>
159
+ <sort_order>20</sort_order>
160
+ <show_in_default>1</show_in_default>
161
+ <show_in_website>1</show_in_website>
162
+ <show_in_store>1</show_in_store>
163
+ <validate>validate-length maximum-length-5</validate>
164
+ </country_prefix>-->
165
+
166
+ <credit_alert_limit translate="label comment">
167
+ <label>Notify if my Smsnotifier account credits is below:</label>
168
+ <comment>0 - turn off/no alert</comment>
169
+ <frontend_type>text</frontend_type>
170
+ <sort_order>30</sort_order>
171
+ <show_in_default>1</show_in_default>
172
+ <show_in_website>1</show_in_website>
173
+ <show_in_store>1</show_in_store>
174
+ <validate>validate-zero-or-greater</validate>
175
+ </credit_alert_limit>
176
+ </fields>
177
+
178
+ </main_conf>
179
+ <classicplus translate="label" module="smsnotifier">
180
+ <label>How to get Classic+ Reports</label>
181
+ <frontend_type>text</frontend_type>
182
+ <comment><![CDATA[In order to get the delivery reports from classic+ messages, you need to set a webhook page inside your Skebby profile.<br>Here's the following steps:<ul><li>Log in on your <a href="http://secure.skebby.com/user/login/business/">Skebby Profile</a></li><li>Go to Settings > Send SMS</li><li>Click on Delivery Report and set up the sending protocol (POST) and the destination URL for the reports (yourmagentosite.com/index.php/smsnotifier/index/notify).</li><li>Click on "Save" and your site is ready to receive the reports from Skebby</li></ul>]]></comment>
183
+ <sort_order>30</sort_order>
184
+ <show_in_default>1</show_in_default>
185
+ <show_in_website>1</show_in_website>
186
+ <show_in_store>1</show_in_store>
187
+ </classicplus>
188
+ <templates translate="label comment" module="smsnotifier">
189
+ <label>Message templates</label>
190
+ <frontend_type>text</frontend_type>
191
+ <comment><![CDATA[<div style="padding:10px;background-color:#fff;border:1px solid #CCC;margin-bottom:7px;">In each template you can use dynamic data. You can add <br />- {NAME} - customer name <br />- {ORDERSTATUS} - status of an order <br />- {ORDERNUMBER} - order number<br />- {TRACKINGNUMBER} - tracking number (if exists)<br />- {STORENAME} - the name of the store<br />Example: Your order #{ORDERNUMBER} waits for a fee. Regards {STORENAME}<br />SMS Content: Your order #100000012 waits for a fee. Regards skebby.com</div><div id="smsnotifierCounterContainer">Message length: <span id="smsnotifierCounter">0</span> chars.<br /> <span id="smsnotifierTooLongAlert"> Warning: The template can be to long for 1 SMS. Please shorten the message or allow to send long messages in Main Configuration.</span></div><br />]]></comment>
192
+ <sort_order>100</sort_order>
193
+ <show_in_default>1</show_in_default>
194
+ <show_in_website>1</show_in_website>
195
+ <show_in_store>1</show_in_store>
196
+ <fields>
197
+
198
+ <status_pending_active translate="label">
199
+ <label>Send SMS after status changed to "Pending Payment"</label>
200
+ <frontend_type>select</frontend_type>
201
+ <source_model>adminhtml/system_config_source_yesno</source_model>
202
+ <sort_order>3</sort_order>
203
+ <show_in_default>1</show_in_default>
204
+ <show_in_website>1</show_in_website>
205
+ <show_in_store>1</show_in_store>
206
+ </status_pending_active>
207
+ <status_pending translate="label">
208
+ <label>Template</label>
209
+ <frontend_type>textarea</frontend_type>
210
+ <sort_order>4</sort_order>
211
+ <show_in_default>1</show_in_default>
212
+ <show_in_website>1</show_in_website>
213
+ <show_in_store>1</show_in_store>
214
+ <depends><status_pending_active>1</status_pending_active></depends>
215
+ </status_pending>
216
+
217
+ <status_holded_active translate="label">
218
+ <label>Send SMS after status changed to "On Hold"</label>
219
+ <frontend_type>select</frontend_type>
220
+ <source_model>adminhtml/system_config_source_yesno</source_model>
221
+ <sort_order>5</sort_order>
222
+ <show_in_default>1</show_in_default>
223
+ <show_in_website>1</show_in_website>
224
+ <show_in_store>1</show_in_store>
225
+ </status_holded_active>
226
+ <status_holded translate="label">
227
+ <label>Template</label>
228
+ <frontend_type>textarea</frontend_type>
229
+ <sort_order>6</sort_order>
230
+ <show_in_default>1</show_in_default>
231
+ <show_in_website>1</show_in_website>
232
+ <show_in_store>1</show_in_store>
233
+ <depends><status_holded_active>1</status_holded_active></depends>
234
+ </status_holded>
235
+
236
+ <status_processing_active translate="label">
237
+ <label>Send SMS after status changed to "Processing"</label>
238
+ <frontend_type>select</frontend_type>
239
+ <source_model>adminhtml/system_config_source_yesno</source_model>
240
+ <sort_order>7</sort_order>
241
+ <show_in_default>1</show_in_default>
242
+ <show_in_website>1</show_in_website>
243
+ <show_in_store>1</show_in_store>
244
+ </status_processing_active>
245
+ <status_processing translate="label">
246
+ <label>Template</label>
247
+ <frontend_type>textarea</frontend_type>
248
+ <sort_order>8</sort_order>
249
+ <show_in_default>1</show_in_default>
250
+ <show_in_website>1</show_in_website>
251
+ <show_in_store>1</show_in_store>
252
+ <depends><status_processing_active>1</status_processing_active></depends>
253
+ </status_processing>
254
+
255
+ <status_canceled_active translate="label">
256
+ <label>Send SMS after status changed to "Canceled"</label>
257
+ <frontend_type>select</frontend_type>
258
+ <source_model>adminhtml/system_config_source_yesno</source_model>
259
+ <sort_order>9</sort_order>
260
+ <show_in_default>1</show_in_default>
261
+ <show_in_website>1</show_in_website>
262
+ <show_in_store>1</show_in_store>
263
+ </status_canceled_active>
264
+ <status_canceled translate="label">
265
+ <label>Template</label>
266
+ <frontend_type>textarea</frontend_type>
267
+ <sort_order>10</sort_order>
268
+ <show_in_default>1</show_in_default>
269
+ <show_in_website>1</show_in_website>
270
+ <show_in_store>1</show_in_store>
271
+ <depends><status_canceled_active>1</status_canceled_active></depends>
272
+ </status_canceled>
273
+
274
+ <status_complete_active translate="label">
275
+ <label>Send SMS after status changed to "Complete"</label>
276
+ <frontend_type>select</frontend_type>
277
+ <source_model>adminhtml/system_config_source_yesno</source_model>
278
+ <sort_order>11</sort_order>
279
+ <show_in_default>1</show_in_default>
280
+ <show_in_website>1</show_in_website>
281
+ <show_in_store>1</show_in_store>
282
+ </status_complete_active>
283
+ <status_complete translate="label">
284
+ <label>Template</label>
285
+ <frontend_type>textarea</frontend_type>
286
+ <sort_order>12</sort_order>
287
+ <show_in_default>1</show_in_default>
288
+ <show_in_website>1</show_in_website>
289
+ <show_in_store>1</show_in_store>
290
+ <depends><status_complete_active>1</status_complete_active></depends>
291
+ </status_complete>
292
+
293
+ <status_closed_active translate="label">
294
+ <label>Send SMS after status changed to "Closed"</label>
295
+ <frontend_type>select</frontend_type>
296
+ <source_model>adminhtml/system_config_source_yesno</source_model>
297
+ <sort_order>13</sort_order>
298
+ <show_in_default>1</show_in_default>
299
+ <show_in_website>1</show_in_website>
300
+ <show_in_store>1</show_in_store>
301
+ </status_closed_active>
302
+ <status_closed translate="label">
303
+ <label>Template</label>
304
+ <frontend_type>textarea</frontend_type>
305
+ <sort_order>14</sort_order>
306
+ <show_in_default>1</show_in_default>
307
+ <show_in_website>1</show_in_website>
308
+ <show_in_store>1</show_in_store>
309
+ <depends><status_closed_active>1</status_closed_active></depends>
310
+ </status_closed>
311
+ </fields>
312
+ </templates>
313
+
314
+ <contact translate="label" module="smsnotifier">
315
+ <label>Contact Us</label>
316
+ <frontend_type>text</frontend_type>
317
+ <sort_order>200</sort_order>
318
+ <show_in_default>1</show_in_default>
319
+ <show_in_website>1</show_in_website>
320
+ <show_in_store>1</show_in_store>
321
+ <fields>
322
+ <contactbutton translate="label">
323
+ <label>Contact Us</label>
324
+ <frontend_model>smsnotifier/buttons_contact</frontend_model>
325
+ <sort_order>101</sort_order>
326
+ <show_in_default>1</show_in_default>
327
+ <show_in_website>1</show_in_website>
328
+ <show_in_store>1</show_in_store>
329
+ </contactbutton>
330
+ </fields>
331
+ </contact>
332
+
333
+ <newaccount translate="label comment" module="smsnotifier">
334
+ <label>Sign up</label>
335
+ <comment><![CDATA[<p><strong>How to register and start using the Plugin?</strong><br /><br />In order to use Skebby SMSNotifier it's necessary to register over the Skebby platform (<a href="http://www.skebby.com/" target="_blank">www.skebby.com</a>). This allows you to get your login credentials and password for the plugin.</p>]]></comment>
336
+ <frontend_type>text</frontend_type>
337
+ <sort_order>210</sort_order>
338
+ <show_in_default>1</show_in_default>
339
+ <show_in_website>1</show_in_website>
340
+ <show_in_store>1</show_in_store>
341
+ <fields>
342
+ <newaccountbutton translate="label">
343
+ <label>Sign up</label>
344
+ <frontend_model>smsnotifier/buttons_newAccount</frontend_model>
345
+ <sort_order>101</sort_order>
346
+ <show_in_default>1</show_in_default>
347
+ <show_in_website>1</show_in_website>
348
+ <show_in_store>1</show_in_store>
349
+ </newaccountbutton>
350
+ </fields>
351
+ </newaccount>
352
+ </groups>
353
+ </smsnotifier>
354
+ </sections>
355
+ </config>
app/code/community/Skebby/Smsnotifier/sql/smsnotifier_setup/install-1.0.0.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+ $table = $installer->getConnection()->newTable($installer->getTable('skebby_smsnotifier'))
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('message', Varien_Db_Ddl_Table::TYPE_TEXT, 1000, array(
16
+ 'nullable' => false,
17
+ ), 'Message')
18
+ ->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
19
+ 'unsigned' => true,
20
+ 'nullable' => true,
21
+ ), 'Customer Entity ID')
22
+ ->addColumn('telephone', Varien_Db_Ddl_Table::TYPE_TEXT, 50, array(
23
+ 'nullable' => false,
24
+ ), 'Telephone')
25
+ ->addColumn('message_type', Varien_Db_Ddl_Table::TYPE_TEXT, 50, array(
26
+ 'nullable' => false,
27
+ ), 'Message')
28
+ ->addColumn('delivery_status', Varien_Db_Ddl_Table::TYPE_TEXT, 100, array(
29
+ 'nullable' => false,
30
+ ), 'Delivery Status')
31
+ ->addColumn('delivery_reference', Varien_Db_Ddl_Table::TYPE_TEXT, 100, array(
32
+ 'nullable' => true,
33
+ ), 'Delivery User Reference')
34
+ ->addColumn('created', Varien_Db_Ddl_Table::TYPE_DATE , null, array(
35
+ 'nullable' => false,
36
+ ), 'First send date')
37
+ ->setComment('Smsnotifier API Skebby');
38
+ $installer->getConnection()->createTable($table);
39
+ $installer->endSetup();
app/design/adminhtml/base/default/layout/Skebby_Smsnotifier.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <layout version="0.1.1">
3
+ <default>
4
+ <reference name="head">
5
+ <action method="addJs"><script>skebbySmsnotifier/smsnotifiercounter.js</script></action>
6
+ <action method="addCss"><name>css/smsnotifier/skin.css</name></action>
7
+ </reference>
8
+ </default>
9
+ <adminhtml_smsnotifier_index>
10
+ <reference name="content">
11
+ <block type="smsnotifier/adminhtml_smsnotifier" name="smsnotifier" />
12
+ </reference>
13
+ </adminhtml_smsnotifier_index>
14
+ <smsnotifier_adminhtml_smsnotifier_index>
15
+ <reference name="content">
16
+ <block type="smsnotifier/adminhtml_smsnotifier" name="smsnotifier" />
17
+ </reference>
18
+ </smsnotifier_adminhtml_smsnotifier_index>
19
+ </layout>
app/design/adminhtml/base/default/template/smsnotifier/system/config/fieldset/branding.phtml ADDED
@@ -0,0 +1 @@
 
1
+ <div style="overflow: hidden;"><img src="<?php echo $this->getSkinUrl('images/smsnotifier/smsnotifier_header.png'); ?>"></div>
app/design/frontend/base/default/layout/Skebby_Smsnotifier.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <default translate="label" module="page">
4
+ <reference name="head">
5
+ <action method="addItem"><type>skin_js</type><name>js/skebby/validate.js</name></action>
6
+ </reference>
7
+ </default>
8
+ </layout>
app/etc/modules/Skebby_Smsnotifier.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Skebby_Smsnotifier>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Skebby_Smsnotifier>
8
+ </modules>
9
+ </config>
js/skebbySmsnotifier/smsnotifiercounter.js ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Create the class
2
+ // MA FUNZIONA QUESTA CLASSE???
3
+ var mySmsnotifierCounter = Class.create({
4
+ initialize: function(eventToObserve) // Is called when the page has finished loading by the Event.observe code below
5
+ {
6
+
7
+ var smsnotifierCounter = document.getElementById('smsnotifierCounter');
8
+ var smsnotifierCounterContainer = document.getElementById('smsnotifierCounterContainer');
9
+ var maxchars = 160;
10
+ var childAdded = false;
11
+ var activeTextArea = false;
12
+ var textAreaId = false;
13
+ // var storeNameLenght = document.getElementById('smsnotifier_main_conf_storename').value.length;
14
+
15
+ $('smsnotifier_templates').observe(eventToObserve, function(event) {
16
+ var textlength = 0;
17
+ activeTextArea = event.findElement('textarea');
18
+
19
+ if (activeTextArea) {
20
+
21
+
22
+ if (textAreaId !== activeTextArea.id) {
23
+ smsnotifierCounterContainer.remove(); //remove old smsnotifierCounterContainer
24
+ activeTextArea.insert({//reinitialize conterContainer in new position
25
+ after: smsnotifierCounterContainer
26
+ });
27
+ smsnotifierCounterContainer.show(); //snow smsnotifierCounter div at starts
28
+ }
29
+
30
+ textlength = activeTextArea.value.length;
31
+
32
+
33
+
34
+ smsnotifierCounter.update(textlength);
35
+
36
+ if (textlength <= (maxchars - 50)) {
37
+
38
+ $('smsnotifierCounter').setStyle({
39
+ fontSize: '150%',
40
+ fontWeight: 'normal',
41
+ color: '#0F910F'
42
+ });
43
+ $('smsnotifierTooLongAlert').hide();
44
+
45
+ }
46
+ else if (textlength <= (maxchars - 20)) {
47
+
48
+ $('smsnotifierCounter').setStyle({
49
+ fontWeight: 'bold',
50
+ color: '#FF8400'
51
+ });
52
+ $('smsnotifierTooLongAlert').hide();
53
+
54
+ } else {
55
+
56
+ $('smsnotifierCounter').setStyle({
57
+ fontWeight: ' bold',
58
+ color: '#B80000'
59
+ });
60
+ $('smsnotifierTooLongAlert').show();
61
+
62
+ }
63
+
64
+
65
+ }
66
+
67
+
68
+
69
+
70
+ });
71
+
72
+ }
73
+
74
+ });
75
+ // Global variable for the instance of the class
76
+ // Creating an instance of the class if the page has finished loading
77
+ Event.observe(window, 'load', function() {
78
+ document.getElementById('smsnotifierCounterContainer').hide(); //hide smsnotifierCounter div at start
79
+ new mySmsnotifierCounter('click');
80
+ new mySmsnotifierCounter('keyup');
81
+ });
package.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Skebby_Smsnotifier</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Skebby SMS Notifier gives you the power of SMS to improve your commerce.</summary>
10
+ <description>SMS Notifier Module integrates the Skebby API gateway to keep the customers updated about their purchases.&#xD;
11
+ &#xD;
12
+ From payment to delivery, the customer will get an SMS that tells him about the status of the order.&#xD;
13
+ &#xD;
14
+ There's also a bulk sending feature, where you can tell about sales &amp; promotions to every number saved on the site.</description>
15
+ <notes>First release.</notes>
16
+ <authors><author><name>Skebby</name><user>skebby</user><email>support@skebby.com</email></author></authors>
17
+ <date>2014-11-12</date>
18
+ <time>17:19:36</time>
19
+ <contents><target name="magecommunity"><dir name="Skebby"><dir name="Smsnotifier"><dir name="Adminhtml"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="Charset.php" hash="013672b6a5c16c4995edc1fa6855f0b6"/><file name="Choosesender.php" hash="ecaef3298ea07e10b20472dd1aa961db"/><file name="Encodingscheme.php" hash="c56e6b6d654f6926b049c465e4a970c4"/><file name="Messagetype.php" hash="399ece001df5bcb5105501c14fe61481"/></dir></dir></dir></dir></dir><dir name="Block"><dir name="Adminhtml"><dir name="Smsnotifier"><dir name="Edit"><file name="Form.php" hash="9efe7d426565ea3560784f0d63296a14"/><dir name="Tab"><file name="Form.php" hash="6f87d4cd40eb9a7d926d2d3ecff0a99a"/></dir><file name="Tabs.php" hash="a111d7acbed91820467f983c7e1a6fa0"/></dir><file name="Edit.php" hash="b3cfb8ee706eef78686142acd621fec2"/><file name="Grid.php" hash="87ab6f707926ac2518ca2488d15727cf"/></dir><file name="Smsnotifier.php" hash="b092fb139b49e1cf047ce59f50edd3ec"/><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Branding.php" hash="463eb4f02fa6bdee7f3b1dac502601a2"/></dir></dir></dir></dir><dir name="Buttons"><file name="Contact.php" hash="2b3e4dcb72fb565791c0c6be4581c945"/><file name="NewAccount.php" hash="2f83484f4a6944f2bb88dbf225bf3b95"/></dir></dir><dir name="Helper"><file name="Data.php" hash="03de03936a81e0cf4a567f88a0a0f596"/></dir><dir name="Model"><file name="ApiClient.php" hash="5d47fb88a975d4472a12af76dd750075"/><file name="Config.php" hash="baefd13412c996652c188d3579a7ace1"/><file name="Cron.php" hash="8a919b1fb14921b295a9b3ca29aa13d8"/><file name="Observer.php" hash="8e5e153f790ea66c9e60e9a0d5b70e29"/><dir name="Resource"><dir name="Smsnotifier"><file name="Collection.php" hash="c2c3748c7b23c9fa32ab53db17d3674b"/></dir><file name="Smsnotifier.php" hash="0a2cbb25e37d50280234784eed33de84"/></dir><file name="Smsnotifier.php" hash="9dfe21967ffc3d0060e0968302d51604"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SmsnotifierController.php" hash="446fbf23dadc9cee735546630cff4bf9"/></dir><file name="IndexController.php" hash="03b3223188f4c14713f67788317565bf"/></dir><dir name="etc"><file name="config.xml" hash="001a36a105fc9cc049beb18e3e0faa24"/><file name="system.xml" hash="06f560d61f807e4bc5248eea62466dc2"/></dir><dir name="sql"><dir name="smsnotifier_setup"><file name="install-1.0.0.php" hash="0c0fd942b4d54ea996a87a8bd9deb323"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Skebby_Smsnotifier.xml" hash="30dc4ee93eac20880ba572abfb23f422"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="layout"><file name="Skebby_Smsnotifier.xml" hash="1b96152ceb4b5f4568d01816884a1013"/></dir><dir name="template"><dir name="smsnotifier"><dir name="system"><dir name="config"><dir name="fieldset"><file name="branding.phtml" hash="dd09f649287804f16e8a655a424ce3c2"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="Skebby_Smsnotifier.xml" hash="75555cb2eae96e7c27f1bb9cf9a3e0fe"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="skebbySmsnotifier"><file name="smsnotifiercounter.js" hash="a9105ea36d188f09401f7279567048a1"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="css"><dir name="smsnotifier"><file name="skin.css" hash="32310f68cacaa2f81ac19a7fe4134df4"/></dir></dir><dir name="images"><dir name="smsnotifier"><file name="smsnotifier_header.png" hash="d8efa6a9a2e2681e12bee5961bd227df"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="js"><dir name="skebby"><file name="validate.js" hash="9914c80eb48ce1a058d5490210a29239"/></dir></dir></dir></dir></dir></target></contents>
20
+ <compatible/>
21
+ <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php><extension><name>curl</name><min/><max/></extension></required></dependencies>
22
+ </package>
skin/adminhtml/base/default/css/smsnotifier/skin.css ADDED
@@ -0,0 +1 @@
 
1
+ .skebbyadmin-menu { color:#3C7FC9; padding-left:0px !important; padding-right:20px; } .entry-edit .entry-edit-head { background:#3C7FC9 !important; } .content-header { border-bottom: 2px solid #c9def3; }
skin/adminhtml/base/default/images/smsnotifier/smsnotifier_header.png ADDED
Binary file
skin/frontend/base/default/js/skebby/validate.js ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ //http://stackoverflow.com/questions/2113908/what-regular-expression-will-match-valid-international-phone-numbers
2
+ if(typeof(Validation) !== 'undefined'){
3
+ Validation.add('validate-skebby-phone', 'Please provide us with the international prefix of your country in front of the phone number e.g. +32499111111 for Belgium', function(v) {
4
+ return !v || v.match(/^\+(9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\d{1,14}$/);
5
+ });
6
+ }
7
+ document.observe('dom:loaded',function(){
8
+ if($('telephone')){ $('telephone').addClassName('validate-skebby-phone'); }
9
+ if($('billing:telephone')){ $('billing:telephone').addClassName('validate-skebby-phone'); }
10
+ if($('shipping:telephone')){ $('shipping:telephone').addClassName('validate-skebby-phone'); }
11
+ });