Version Notes
Additional notifications of status.
Download this release
Release Info
Developer | SerwerSMS.pl |
Extension | SerwerSMSpl |
Version | 1.0.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.0.2
- app/code/community/SerwerSMS/Sms/Block/Danekonta.php +7 -7
- app/code/community/SerwerSMS/Sms/Block/Wyslijsms.php +15 -9
- app/code/community/SerwerSMS/Sms/Helper/SerwerSMS.php +28 -9
- app/code/community/SerwerSMS/Sms/Model/Nadawcy.php +3 -3
- app/code/community/SerwerSMS/Sms/Model/Observer.php +37 -2
- app/code/community/SerwerSMS/Sms/etc/config.xml +7 -2
- app/code/community/SerwerSMS/Sms/etc/system.xml +26 -7
- app/design/adminhtml/default/default/template/serwersms/danekonta.phtml +9 -7
- app/design/adminhtml/default/default/template/serwersms/faktury.phtml +10 -8
- app/design/adminhtml/default/default/template/serwersms/formularzsms.phtml +12 -8
- package.xml +10 -10
app/code/community/SerwerSMS/Sms/Block/Danekonta.php
CHANGED
@@ -15,23 +15,23 @@ class SerwerSMS_Sms_Block_Danekonta extends Mage_Core_Block_Template{
|
|
15 |
$api['login'] = $helper->getApiLogin();
|
16 |
$api['haslo'] = $helper->getApiPassword();
|
17 |
|
18 |
-
$xml = $helper->ilosc_sms(array(login => $api['login'], haslo => $api['haslo'], pokaz_typ_konta => 1));
|
19 |
$dane = $helper->PrzetworzXML("ilosc_sms",$xml);
|
20 |
|
21 |
if(is_array($dane)){
|
22 |
|
23 |
-
$xml2 = $helper->nazwa_nadawcy(array(login => $api['login'], haslo => $api['haslo'], operacja => 'lista'));
|
24 |
$nazwy_nadawcy = $helper->PrzetworzXML("nazwa_nadawcy",$xml2);
|
25 |
-
$xml3 = $helper->pomoc(array(login => $api['login'], haslo => $api['haslo']));
|
26 |
$pomoc = $helper->PrzetworzXML("pomoc",$xml3);
|
27 |
|
28 |
foreach($dane as $key => $value){
|
29 |
-
if($value['konto']){
|
30 |
$result['konto'] = $value['konto'];
|
31 |
-
} elseif($value['typ_sms'] == 'ECO'){
|
32 |
$result['ECO'] = $value['stan'];
|
33 |
$result['ECOlimit'] = $value['limit'];
|
34 |
-
} elseif($value['typ_sms'] == 'FULL'){
|
35 |
$result['FULL'] = $value['stan'];
|
36 |
$result['FULLlimit'] = $value['limit'];
|
37 |
}
|
@@ -52,7 +52,7 @@ class SerwerSMS_Sms_Block_Danekonta extends Mage_Core_Block_Template{
|
|
52 |
$api['login'] = $helper->getApiLogin();
|
53 |
$api['haslo'] = $helper->getApiPassword();
|
54 |
|
55 |
-
$xml = $helper->faktury(array(login => $api['login'], haslo => $api['haslo'], operacja => "lista"));
|
56 |
$dane = $helper->PrzetworzXML("faktury",$xml);
|
57 |
|
58 |
// for($i=0;$i<15;$i++){
|
15 |
$api['login'] = $helper->getApiLogin();
|
16 |
$api['haslo'] = $helper->getApiPassword();
|
17 |
|
18 |
+
$xml = $helper->ilosc_sms(array('login' => $api['login'], 'haslo' => $api['haslo'], 'pokaz_typ_konta' => 1));
|
19 |
$dane = $helper->PrzetworzXML("ilosc_sms",$xml);
|
20 |
|
21 |
if(is_array($dane)){
|
22 |
|
23 |
+
$xml2 = $helper->nazwa_nadawcy(array('login' => $api['login'], 'haslo' => $api['haslo'], 'operacja' => 'lista'));
|
24 |
$nazwy_nadawcy = $helper->PrzetworzXML("nazwa_nadawcy",$xml2);
|
25 |
+
$xml3 = $helper->pomoc(array('login' => $api['login'], 'haslo' => $api['haslo']));
|
26 |
$pomoc = $helper->PrzetworzXML("pomoc",$xml3);
|
27 |
|
28 |
foreach($dane as $key => $value){
|
29 |
+
if(isset($value['konto'])){
|
30 |
$result['konto'] = $value['konto'];
|
31 |
+
} elseif(isset($value['typ_sms']) and $value['typ_sms'] == 'ECO'){
|
32 |
$result['ECO'] = $value['stan'];
|
33 |
$result['ECOlimit'] = $value['limit'];
|
34 |
+
} elseif(isset($value['typ_sms']) and $value['typ_sms'] == 'FULL'){
|
35 |
$result['FULL'] = $value['stan'];
|
36 |
$result['FULLlimit'] = $value['limit'];
|
37 |
}
|
52 |
$api['login'] = $helper->getApiLogin();
|
53 |
$api['haslo'] = $helper->getApiPassword();
|
54 |
|
55 |
+
$xml = $helper->faktury(array('login' => $api['login'], 'haslo' => $api['haslo'], 'operacja' => "lista"));
|
56 |
$dane = $helper->PrzetworzXML("faktury",$xml);
|
57 |
|
58 |
// for($i=0;$i<15;$i++){
|
app/code/community/SerwerSMS/Sms/Block/Wyslijsms.php
CHANGED
@@ -9,34 +9,38 @@
|
|
9 |
class SerwerSMS_Sms_Block_Wyslijsms extends Mage_Core_Block_Template{
|
10 |
|
11 |
public function nadawcyLista(){
|
12 |
-
|
13 |
$result = '';
|
14 |
|
15 |
$helper = Mage::helper('sms_helper/SerwerSMS');
|
16 |
$api['login'] = $helper->getApiLogin();
|
17 |
$api['haslo'] = $helper->getApiPassword();
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
21 |
|
22 |
if(is_array($dane)){
|
23 |
|
24 |
-
$xml2 = $helper->nazwa_nadawcy(array(login => $api['login'], haslo => $api['haslo'], operacja => 'lista'));
|
25 |
$nazwy_nadawcy = $helper->PrzetworzXML("nazwa_nadawcy",$xml2);
|
26 |
-
$xml3 = $helper->nazwa_nadawcy(array(login => $api['login'], haslo => $api['haslo'], operacja => 'lista', predefiniowane => 1));
|
27 |
$predefiniowane = $helper->PrzetworzXML("nazwa_nadawcy",$xml3);
|
28 |
|
29 |
$result['wlasne'] = $nazwy_nadawcy;
|
30 |
$result['predefiniowane'] = $predefiniowane;
|
31 |
-
} else {
|
32 |
-
$result = $dane;
|
33 |
}
|
34 |
|
35 |
return $result;
|
36 |
}
|
37 |
|
38 |
public function kontaktyLista(){
|
|
|
39 |
|
|
|
|
|
40 |
$collection = Mage::getModel('customer/customer')
|
41 |
->getCollection()
|
42 |
->addAttributeToSelect('*')
|
@@ -49,13 +53,15 @@ class SerwerSMS_Sms_Block_Wyslijsms extends Mage_Core_Block_Template{
|
|
49 |
$result[$i]['telefon'] = $customer->getPrimaryBillingAddress()->getTelephone();
|
50 |
$i++;
|
51 |
}
|
52 |
-
}
|
53 |
|
54 |
return $result;
|
55 |
}
|
56 |
|
57 |
public function grupyLista(){
|
58 |
|
|
|
|
|
59 |
$collection = Mage::getModel('customer/group')
|
60 |
->getCollection()->getData();
|
61 |
|
9 |
class SerwerSMS_Sms_Block_Wyslijsms extends Mage_Core_Block_Template{
|
10 |
|
11 |
public function nadawcyLista(){
|
|
|
12 |
$result = '';
|
13 |
|
14 |
$helper = Mage::helper('sms_helper/SerwerSMS');
|
15 |
$api['login'] = $helper->getApiLogin();
|
16 |
$api['haslo'] = $helper->getApiPassword();
|
17 |
+
|
18 |
+
if(!empty($api['login']) and !empty($api['haslo'])){
|
19 |
+
$xml = $helper->ilosc_sms(array('login' => $api['login'], 'haslo' => $api['haslo']));
|
20 |
+
$dane = $helper->PrzetworzXML("ilosc_sms",$xml);
|
21 |
+
} else {
|
22 |
+
$dane = false;
|
23 |
+
}
|
24 |
|
25 |
if(is_array($dane)){
|
26 |
|
27 |
+
$xml2 = $helper->nazwa_nadawcy(array('login' => $api['login'], 'haslo' => $api['haslo'], 'operacja' => 'lista'));
|
28 |
$nazwy_nadawcy = $helper->PrzetworzXML("nazwa_nadawcy",$xml2);
|
29 |
+
$xml3 = $helper->nazwa_nadawcy(array('login' => $api['login'], 'haslo' => $api['haslo'], 'operacja' => 'lista', 'predefiniowane' => 1));
|
30 |
$predefiniowane = $helper->PrzetworzXML("nazwa_nadawcy",$xml3);
|
31 |
|
32 |
$result['wlasne'] = $nazwy_nadawcy;
|
33 |
$result['predefiniowane'] = $predefiniowane;
|
|
|
|
|
34 |
}
|
35 |
|
36 |
return $result;
|
37 |
}
|
38 |
|
39 |
public function kontaktyLista(){
|
40 |
+
|
41 |
|
42 |
+
$result = array();
|
43 |
+
/*
|
44 |
$collection = Mage::getModel('customer/customer')
|
45 |
->getCollection()
|
46 |
->addAttributeToSelect('*')
|
53 |
$result[$i]['telefon'] = $customer->getPrimaryBillingAddress()->getTelephone();
|
54 |
$i++;
|
55 |
}
|
56 |
+
}*/
|
57 |
|
58 |
return $result;
|
59 |
}
|
60 |
|
61 |
public function grupyLista(){
|
62 |
|
63 |
+
$result = array();
|
64 |
+
|
65 |
$collection = Mage::getModel('customer/group')
|
66 |
->getCollection()->getData();
|
67 |
|
app/code/community/SerwerSMS/Sms/Helper/SerwerSMS.php
CHANGED
@@ -39,12 +39,14 @@ class SerwerSMS_Sms_Helper_SerwerSMS {
|
|
39 |
curl_setopt($curl, CURLOPT_POST, 1);
|
40 |
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($postParams));
|
41 |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
42 |
-
|
|
|
|
|
43 |
$answer = curl_exec($curl);
|
44 |
|
45 |
if (curl_errno($curl)) {
|
46 |
}
|
47 |
-
|
48 |
curl_close($curl);
|
49 |
|
50 |
return $answer;
|
@@ -58,18 +60,24 @@ class SerwerSMS_Sms_Helper_SerwerSMS {
|
|
58 |
|
59 |
|
60 |
public function PrzetworzXML($akcja,$xml_file) {
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
64 |
|
65 |
if (isset($xml->Blad)) {
|
66 |
|
67 |
-
$numer = $_POST['numer'];
|
68 |
$przyczyna = $xml->Blad;
|
69 |
return $przyczyna;
|
70 |
|
71 |
} elseif ($akcja=="wyslij_sms") {
|
72 |
-
|
|
|
|
|
|
|
73 |
if(isset($xml->Odbiorcy->Skolejkowane)){
|
74 |
$i = 0;
|
75 |
foreach($xml->Odbiorcy->Skolejkowane->SMS as $sms) {
|
@@ -94,6 +102,7 @@ class SerwerSMS_Sms_Helper_SerwerSMS {
|
|
94 |
return $wynik;
|
95 |
|
96 |
} elseif ($akcja=="ilosc_sms") {
|
|
|
97 |
if(isset($xml->SMS)){
|
98 |
$i = 0;
|
99 |
foreach($xml->SMS as $sms) {
|
@@ -109,6 +118,7 @@ class SerwerSMS_Sms_Helper_SerwerSMS {
|
|
109 |
return $limity;
|
110 |
|
111 |
} elseif ($akcja=="nazwa_nadawcy") {
|
|
|
112 |
if(isset($xml->NADAWCA)){
|
113 |
foreach($xml->NADAWCA as $nadawca){
|
114 |
$lista[self::xml_attribute($nadawca,'nazwa')] = $nadawca;
|
@@ -142,6 +152,7 @@ class SerwerSMS_Sms_Helper_SerwerSMS {
|
|
142 |
}
|
143 |
|
144 |
public function korektaNumerow($numery){
|
|
|
145 |
if(is_array($numery)){
|
146 |
foreach($numery as $numer){
|
147 |
$numer = str_replace(" ","",$numer);
|
@@ -204,6 +215,10 @@ class SerwerSMS_Sms_Helper_SerwerSMS {
|
|
204 |
return Mage::getStoreConfig('smsconfig_section/powiadomienia/wstrzymanie');
|
205 |
}
|
206 |
|
|
|
|
|
|
|
|
|
207 |
public function szablonWstrzymanie(){
|
208 |
return Mage::getStoreConfig('smsconfig_section/tekstysms/tekst_wstrzymanie');
|
209 |
}
|
@@ -212,6 +227,10 @@ class SerwerSMS_Sms_Helper_SerwerSMS {
|
|
212 |
return Mage::getStoreConfig('smsconfig_section/tekstysms/tekst_odblokowanie');
|
213 |
}
|
214 |
|
|
|
|
|
|
|
|
|
215 |
public function powiadomienieStanKonta(){
|
216 |
return Mage::getStoreConfig('smsconfig_section/powiadomienia/stan_konta');
|
217 |
}
|
@@ -223,7 +242,7 @@ class SerwerSMS_Sms_Helper_SerwerSMS {
|
|
223 |
$parametry['login'] = $this->getApiLogin();
|
224 |
$parametry['haslo'] = $this->getApiPassword();
|
225 |
|
226 |
-
$xml = $this->wyslij_sms(array(login => $parametry['login'], haslo => $parametry['haslo'], numer => $parametry['odbiorcy'], wiadomosc => $parametry['tresc'], nadawca => $parametry['nadawca']));
|
227 |
$dane = $this->PrzetworzXML("wyslij_sms",$xml);
|
228 |
|
229 |
if($stanKonta){
|
@@ -302,7 +321,7 @@ class SerwerSMS_Sms_Helper_SerwerSMS {
|
|
302 |
$parametry['haslo'] = $this->getApiPassword();
|
303 |
$parametry['odbiorcy'] = $this->numeryAdministratora();
|
304 |
|
305 |
-
$xml = $this->ilosc_sms(array(login => $parametry['login'], haslo => $parametry['haslo']));
|
306 |
$dane = $this->PrzetworzXML("ilosc_sms",$xml);
|
307 |
|
308 |
foreach($dane as $sms){
|
39 |
curl_setopt($curl, CURLOPT_POST, 1);
|
40 |
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($postParams));
|
41 |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
42 |
+
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
|
43 |
+
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
|
44 |
+
curl_setopt($curl, CURLOPT_TIMEOUT,60);
|
45 |
$answer = curl_exec($curl);
|
46 |
|
47 |
if (curl_errno($curl)) {
|
48 |
}
|
49 |
+
|
50 |
curl_close($curl);
|
51 |
|
52 |
return $answer;
|
60 |
|
61 |
|
62 |
public function PrzetworzXML($akcja,$xml_file) {
|
63 |
+
|
64 |
+
if(!empty($xml_file)){
|
65 |
+
$dom = new domDocument;
|
66 |
+
$dom->loadXML($xml_file);
|
67 |
+
$xml = simplexml_import_dom($dom);
|
68 |
+
}
|
69 |
|
70 |
if (isset($xml->Blad)) {
|
71 |
|
72 |
+
$numer = (isset($_POST['numer']) and !empty($_POST['numer'])) ? addslashes(htmlspecialchars($_POST['numer'])) : '';
|
73 |
$przyczyna = $xml->Blad;
|
74 |
return $przyczyna;
|
75 |
|
76 |
} elseif ($akcja=="wyslij_sms") {
|
77 |
+
$wynik = array();
|
78 |
+
$wyslane = array();
|
79 |
+
$niewyslane = array();
|
80 |
+
|
81 |
if(isset($xml->Odbiorcy->Skolejkowane)){
|
82 |
$i = 0;
|
83 |
foreach($xml->Odbiorcy->Skolejkowane->SMS as $sms) {
|
102 |
return $wynik;
|
103 |
|
104 |
} elseif ($akcja=="ilosc_sms") {
|
105 |
+
$limity = array();
|
106 |
if(isset($xml->SMS)){
|
107 |
$i = 0;
|
108 |
foreach($xml->SMS as $sms) {
|
118 |
return $limity;
|
119 |
|
120 |
} elseif ($akcja=="nazwa_nadawcy") {
|
121 |
+
$lista = array();
|
122 |
if(isset($xml->NADAWCA)){
|
123 |
foreach($xml->NADAWCA as $nadawca){
|
124 |
$lista[self::xml_attribute($nadawca,'nazwa')] = $nadawca;
|
152 |
}
|
153 |
|
154 |
public function korektaNumerow($numery){
|
155 |
+
$result = array();
|
156 |
if(is_array($numery)){
|
157 |
foreach($numery as $numer){
|
158 |
$numer = str_replace(" ","",$numer);
|
215 |
return Mage::getStoreConfig('smsconfig_section/powiadomienia/wstrzymanie');
|
216 |
}
|
217 |
|
218 |
+
public function powiadomienieStatus(){
|
219 |
+
return Mage::getStoreConfig('smsconfig_section/powiadomienia/status');
|
220 |
+
}
|
221 |
+
|
222 |
public function szablonWstrzymanie(){
|
223 |
return Mage::getStoreConfig('smsconfig_section/tekstysms/tekst_wstrzymanie');
|
224 |
}
|
227 |
return Mage::getStoreConfig('smsconfig_section/tekstysms/tekst_odblokowanie');
|
228 |
}
|
229 |
|
230 |
+
public function szablonStatus(){
|
231 |
+
return Mage::getStoreConfig('smsconfig_section/tekstysms/tekst_status');
|
232 |
+
}
|
233 |
+
|
234 |
public function powiadomienieStanKonta(){
|
235 |
return Mage::getStoreConfig('smsconfig_section/powiadomienia/stan_konta');
|
236 |
}
|
242 |
$parametry['login'] = $this->getApiLogin();
|
243 |
$parametry['haslo'] = $this->getApiPassword();
|
244 |
|
245 |
+
$xml = $this->wyslij_sms(array('login' => $parametry['login'], 'haslo' => $parametry['haslo'], 'numer' => $parametry['odbiorcy'], 'wiadomosc' => $parametry['tresc'], 'nadawca' => $parametry['nadawca']));
|
246 |
$dane = $this->PrzetworzXML("wyslij_sms",$xml);
|
247 |
|
248 |
if($stanKonta){
|
321 |
$parametry['haslo'] = $this->getApiPassword();
|
322 |
$parametry['odbiorcy'] = $this->numeryAdministratora();
|
323 |
|
324 |
+
$xml = $this->ilosc_sms(array('login' => $parametry['login'], 'haslo' => $parametry['haslo']));
|
325 |
$dane = $this->PrzetworzXML("ilosc_sms",$xml);
|
326 |
|
327 |
foreach($dane as $sms){
|
app/code/community/SerwerSMS/Sms/Model/Nadawcy.php
CHANGED
@@ -13,14 +13,14 @@ class SerwerSMS_Sms_Model_Nadawcy extends Mage_Core_Model_Abstract {
|
|
13 |
$api['login'] = $helper->getApiLogin();
|
14 |
$api['haslo'] = $helper->getApiPassword();
|
15 |
|
16 |
-
$xml = $helper->ilosc_sms(array(login => $api['login'], haslo => $api['haslo']));
|
17 |
$dane = $helper->PrzetworzXML("ilosc_sms",$xml);
|
18 |
|
19 |
if(is_array($dane)){
|
20 |
|
21 |
-
$xml2 = $helper->nazwa_nadawcy(array(login => $api['login'], haslo => $api['haslo'], operacja => 'lista'));
|
22 |
$nazwy_nadawcy = $helper->PrzetworzXML("nazwa_nadawcy",$xml2);
|
23 |
-
$xml3 = $helper->nazwa_nadawcy(array(login => $api['login'], haslo => $api['haslo'], operacja => 'lista', predefiniowane => 1));
|
24 |
$predefiniowane = $helper->PrzetworzXML("nazwa_nadawcy",$xml3);
|
25 |
|
26 |
$nadawcy['wlasne'] = $nazwy_nadawcy;
|
13 |
$api['login'] = $helper->getApiLogin();
|
14 |
$api['haslo'] = $helper->getApiPassword();
|
15 |
|
16 |
+
$xml = $helper->ilosc_sms(array('login' => $api['login'], 'haslo' => $api['haslo']));
|
17 |
$dane = $helper->PrzetworzXML("ilosc_sms",$xml);
|
18 |
|
19 |
if(is_array($dane)){
|
20 |
|
21 |
+
$xml2 = $helper->nazwa_nadawcy(array('login' => $api['login'], 'haslo' => $api['haslo'], 'operacja' => 'lista'));
|
22 |
$nazwy_nadawcy = $helper->PrzetworzXML("nazwa_nadawcy",$xml2);
|
23 |
+
$xml3 = $helper->nazwa_nadawcy(array('login' => $api['login'], 'haslo' => $api['haslo'], 'operacja' => 'lista', 'predefiniowane' => 1));
|
24 |
$predefiniowane = $helper->PrzetworzXML("nazwa_nadawcy",$xml3);
|
25 |
|
26 |
$nadawcy['wlasne'] = $nazwy_nadawcy;
|
app/code/community/SerwerSMS/Sms/Model/Observer.php
CHANGED
@@ -74,7 +74,7 @@ class SerwerSMS_Sms_Model_Observer{
|
|
74 |
|
75 |
public function wyslijsmsWstrzymanie(Varien_Event_Observer $observer){
|
76 |
|
77 |
-
$order = $observer->getOrder();
|
78 |
|
79 |
if ($order->getState() !== $order->getOrigData('state') && $order->getState() === Mage_Sales_Model_Order::STATE_HOLDED) {
|
80 |
|
@@ -107,7 +107,7 @@ class SerwerSMS_Sms_Model_Observer{
|
|
107 |
|
108 |
public function wyslijsmsOdblokowanie(Varien_Event_Observer $observer){
|
109 |
|
110 |
-
$order = $observer->getOrder();
|
111 |
|
112 |
if ($order->getState() !== $order->getOrigData('state') && $order->getOrigData('state') === Mage_Sales_Model_Order::STATE_HOLDED) {
|
113 |
|
@@ -138,6 +138,41 @@ class SerwerSMS_Sms_Model_Observer{
|
|
138 |
}
|
139 |
}
|
140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
public function getHelper()
|
142 |
{
|
143 |
return Mage::helper('sms_helper/SerwerSMS');
|
74 |
|
75 |
public function wyslijsmsWstrzymanie(Varien_Event_Observer $observer){
|
76 |
|
77 |
+
$order = $observer->getEvent()->getOrder();
|
78 |
|
79 |
if ($order->getState() !== $order->getOrigData('state') && $order->getState() === Mage_Sales_Model_Order::STATE_HOLDED) {
|
80 |
|
107 |
|
108 |
public function wyslijsmsOdblokowanie(Varien_Event_Observer $observer){
|
109 |
|
110 |
+
$order = $observer->getEvent()->getOrder();
|
111 |
|
112 |
if ($order->getState() !== $order->getOrigData('state') && $order->getOrigData('state') === Mage_Sales_Model_Order::STATE_HOLDED) {
|
113 |
|
138 |
}
|
139 |
}
|
140 |
|
141 |
+
public function wyslijsmsStatus(Varien_Event_Observer $observer){
|
142 |
+
|
143 |
+
$order = $observer->getEvent()->getOrder();
|
144 |
+
|
145 |
+
if($order->getStatus() !== $order->getOrigData('status')){
|
146 |
+
|
147 |
+
$orderId = $order->getId();
|
148 |
+
$numer_zamowienia = $order->getIncrementId();
|
149 |
+
$shipping = $order->getShippingAddress();
|
150 |
+
$kwota = number_format($order->getData('grand_total'),2,',','');
|
151 |
+
$name = $shipping->getFirstname();
|
152 |
+
$lastname = $shipping->getLastname();
|
153 |
+
$status = $order->getStatusLabel();
|
154 |
+
|
155 |
+
$szablon = $this->getHelper()->szablonStatus();
|
156 |
+
$billingAddress = $order->getBillingAddress();
|
157 |
+
$numer = $billingAddress->getTelephone();
|
158 |
+
$numer = $this->getHelper()->korektaNumerow($numer);
|
159 |
+
$wysylka['odbiorcy'] = implode(",",$numer);
|
160 |
+
|
161 |
+
if($this->getHelper()->wlaczonySerwerSMS() and $this->getHelper()->powiadomienieStatus()){
|
162 |
+
|
163 |
+
$szablon = str_replace("#IMIE#",$name,$szablon);
|
164 |
+
$szablon = str_replace("#NAZWISKO#",$lastname, $szablon);
|
165 |
+
$szablon = str_replace("#NUMER#",$numer_zamowienia,$szablon);
|
166 |
+
$szablon = str_replace("#KWOTA#",$kwota,$szablon);
|
167 |
+
$szablon = str_replace("#STATUS#",$status,$szablon);
|
168 |
+
|
169 |
+
$wysylka['tresc'] = $szablon;
|
170 |
+
|
171 |
+
$this->getHelper()->wyslijSms($wysylka);
|
172 |
+
}
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
public function getHelper()
|
177 |
{
|
178 |
return Mage::helper('sms_helper/SerwerSMS');
|
app/code/community/SerwerSMS/Sms/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<SerwerSMS_Sms>
|
5 |
-
<version>1.0.
|
6 |
</SerwerSMS_Sms>
|
7 |
</modules>
|
8 |
|
@@ -42,7 +42,7 @@
|
|
42 |
</layout>
|
43 |
<menu>
|
44 |
<serwersms translate="title" module="adminhtml">
|
45 |
-
<title>SerwerSMS</title>
|
46 |
<sort_order>100</sort_order>
|
47 |
<children>
|
48 |
<wyslane>
|
@@ -158,6 +158,10 @@
|
|
158 |
<class>serwersms_model/Observer</class>
|
159 |
<method>wyslijsmsOdblokowanie</method>
|
160 |
</serwersms_model>
|
|
|
|
|
|
|
|
|
161 |
</observers>
|
162 |
</sales_order_save_after>
|
163 |
<sales_order_shipment_save_after>
|
@@ -186,6 +190,7 @@
|
|
186 |
<tekst_realizacja>#IMIE#, Twoje zamówienie nr: #NUMER# zostało zrealizowne i wysłane na adres: #IMIE# #NAZWISKO#, #ADRES#</tekst_realizacja>
|
187 |
<tekst_wstrzymanie>#IMIE#, Twoje zamówienie nr: #NUMER#, na kwotę: #KWOTA# PLN zostało wstrzymane</tekst_wstrzymanie>
|
188 |
<tekst_odblokowanie>#IMIE#, Twoje zamówienie nr: #NUMER#, na kwotę: #KWOTA# PLN zostało odblokowane</tekst_odblokowanie>
|
|
|
189 |
</tekstysms>
|
190 |
</smsconfig_section>
|
191 |
</default>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<SerwerSMS_Sms>
|
5 |
+
<version>1.0.2</version>
|
6 |
</SerwerSMS_Sms>
|
7 |
</modules>
|
8 |
|
42 |
</layout>
|
43 |
<menu>
|
44 |
<serwersms translate="title" module="adminhtml">
|
45 |
+
<title>SerwerSMS.pl</title>
|
46 |
<sort_order>100</sort_order>
|
47 |
<children>
|
48 |
<wyslane>
|
158 |
<class>serwersms_model/Observer</class>
|
159 |
<method>wyslijsmsOdblokowanie</method>
|
160 |
</serwersms_model>
|
161 |
+
<serwersms_model_status>
|
162 |
+
<class>serwersms_model/Observer</class>
|
163 |
+
<method>wyslijsmsStatus</method>
|
164 |
+
</serwersms_model_status>
|
165 |
</observers>
|
166 |
</sales_order_save_after>
|
167 |
<sales_order_shipment_save_after>
|
190 |
<tekst_realizacja>#IMIE#, Twoje zamówienie nr: #NUMER# zostało zrealizowne i wysłane na adres: #IMIE# #NAZWISKO#, #ADRES#</tekst_realizacja>
|
191 |
<tekst_wstrzymanie>#IMIE#, Twoje zamówienie nr: #NUMER#, na kwotę: #KWOTA# PLN zostało wstrzymane</tekst_wstrzymanie>
|
192 |
<tekst_odblokowanie>#IMIE#, Twoje zamówienie nr: #NUMER#, na kwotę: #KWOTA# PLN zostało odblokowane</tekst_odblokowanie>
|
193 |
+
<tekst_status>#IMIE#, Twoje zamówienie nr: #NUMER#, na kwotę: #KWOTA# PLN zmieniło status na: #STATUS#</tekst_status>
|
194 |
</tekstysms>
|
195 |
</smsconfig_section>
|
196 |
</default>
|
app/code/community/SerwerSMS/Sms/etc/system.xml
CHANGED
@@ -7,8 +7,8 @@
|
|
7 |
</smsconfig_tab>
|
8 |
</tabs>
|
9 |
<sections>
|
10 |
-
<smsconfig_section translate="label">
|
11 |
-
<label>
|
12 |
<sort_order>200</sort_order>
|
13 |
<show_in_default>1</show_in_default>
|
14 |
<show_in_website>1</show_in_website>
|
@@ -18,7 +18,7 @@
|
|
18 |
<konfiguracjasms translate="label">
|
19 |
<label>Konfiguracja modułu</label>
|
20 |
<comment>
|
21 |
-
|
22 |
</comment>
|
23 |
<sort_order>10</sort_order>
|
24 |
<show_in_default>1</show_in_default>
|
@@ -67,7 +67,7 @@
|
|
67 |
<ustawieniawiadomosci>
|
68 |
<label>Ustawienia wiadomości</label>
|
69 |
<comment>
|
70 |
-
|
71 |
Jeśli chcesz dodać nową nazwę przejdź do zakładki Dane konta w menu SerwerSMS.
|
72 |
</comment>
|
73 |
<sort_order>10</sort_order>
|
@@ -115,7 +115,7 @@
|
|
115 |
<sort_order>10</sort_order>
|
116 |
</zamowienie>
|
117 |
<realizacja translate="label comment">
|
118 |
-
<label>
|
119 |
<comment></comment>
|
120 |
<show_in_default>1</show_in_default>
|
121 |
<show_in_website>1</show_in_website>
|
@@ -134,6 +134,16 @@
|
|
134 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
135 |
<sort_order>30</sort_order>
|
136 |
</wstrzymanie>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
<stan_konta translate="label comment">
|
138 |
<label>Niski stan konta SMS</label>
|
139 |
<comment></comment>
|
@@ -142,7 +152,7 @@
|
|
142 |
<show_in_store>1</show_in_store>
|
143 |
<frontend_type>select</frontend_type>
|
144 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
145 |
-
<sort_order>
|
146 |
</stan_konta>
|
147 |
</fields>
|
148 |
</powiadomienia>
|
@@ -163,7 +173,7 @@
|
|
163 |
<comment>Szablon do 160 znaków.</comment>
|
164 |
</tekst_zamowienie>
|
165 |
<tekst_realizacja translate="label comment">
|
166 |
-
<label>
|
167 |
<frontend_type>textarea</frontend_type>
|
168 |
<sort_order>20</sort_order>
|
169 |
<show_in_default>1</show_in_default>
|
@@ -189,6 +199,15 @@
|
|
189 |
<show_in_store>1</show_in_store>
|
190 |
<comment>Szablon do 160 znaków.</comment>
|
191 |
</tekst_odblokowanie>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
</fields>
|
193 |
</tekstysms>
|
194 |
</groups>
|
7 |
</smsconfig_tab>
|
8 |
</tabs>
|
9 |
<sections>
|
10 |
+
<smsconfig_section translate="label" module="adminhtml">
|
11 |
+
<label>SerwerSMS.pl</label>
|
12 |
<sort_order>200</sort_order>
|
13 |
<show_in_default>1</show_in_default>
|
14 |
<show_in_website>1</show_in_website>
|
18 |
<konfiguracjasms translate="label">
|
19 |
<label>Konfiguracja modułu</label>
|
20 |
<comment>
|
21 |
+
W celu sprawdzenia czy podany login i hasło są właściwe, zapisz konfigurację i przejdź do zakładki Dane konta w menu SerwerSMS.
|
22 |
</comment>
|
23 |
<sort_order>10</sort_order>
|
24 |
<show_in_default>1</show_in_default>
|
67 |
<ustawieniawiadomosci>
|
68 |
<label>Ustawienia wiadomości</label>
|
69 |
<comment>
|
70 |
+
W celu ustawienia nazwy nadawcy należy wcześniej zapisać konfigurację z prawidłowym loginem oraz hasłem do serwisu www.serwersms.pl.
|
71 |
Jeśli chcesz dodać nową nazwę przejdź do zakładki Dane konta w menu SerwerSMS.
|
72 |
</comment>
|
73 |
<sort_order>10</sort_order>
|
115 |
<sort_order>10</sort_order>
|
116 |
</zamowienie>
|
117 |
<realizacja translate="label comment">
|
118 |
+
<label>Wysyłka towaru</label>
|
119 |
<comment></comment>
|
120 |
<show_in_default>1</show_in_default>
|
121 |
<show_in_website>1</show_in_website>
|
134 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
135 |
<sort_order>30</sort_order>
|
136 |
</wstrzymanie>
|
137 |
+
<status translate="label comment">
|
138 |
+
<label>Zmiana statusu zamówienia</label>
|
139 |
+
<comment></comment>
|
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 |
+
<frontend_type>select</frontend_type>
|
144 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
145 |
+
<sort_order>40</sort_order>
|
146 |
+
</status>
|
147 |
<stan_konta translate="label comment">
|
148 |
<label>Niski stan konta SMS</label>
|
149 |
<comment></comment>
|
152 |
<show_in_store>1</show_in_store>
|
153 |
<frontend_type>select</frontend_type>
|
154 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
155 |
+
<sort_order>50</sort_order>
|
156 |
</stan_konta>
|
157 |
</fields>
|
158 |
</powiadomienia>
|
173 |
<comment>Szablon do 160 znaków.</comment>
|
174 |
</tekst_zamowienie>
|
175 |
<tekst_realizacja translate="label comment">
|
176 |
+
<label>Wysyłka towaru</label>
|
177 |
<frontend_type>textarea</frontend_type>
|
178 |
<sort_order>20</sort_order>
|
179 |
<show_in_default>1</show_in_default>
|
199 |
<show_in_store>1</show_in_store>
|
200 |
<comment>Szablon do 160 znaków.</comment>
|
201 |
</tekst_odblokowanie>
|
202 |
+
<tekst_status translate="label comment">
|
203 |
+
<label>Zmiana statusu zamówienia</label>
|
204 |
+
<frontend_type>textarea</frontend_type>
|
205 |
+
<sort_order>50</sort_order>
|
206 |
+
<show_in_default>1</show_in_default>
|
207 |
+
<show_in_website>1</show_in_website>
|
208 |
+
<show_in_store>1</show_in_store>
|
209 |
+
<comment>Szablon do 160 znaków.</comment>
|
210 |
+
</tekst_status>
|
211 |
</fields>
|
212 |
</tekstysms>
|
213 |
</groups>
|
app/design/adminhtml/default/default/template/serwersms/danekonta.phtml
CHANGED
@@ -66,13 +66,15 @@ $dane = $this->pokazDaneKonta();
|
|
66 |
<td></td><td></td>
|
67 |
</tr>
|
68 |
<?php
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
|
|
|
|
76 |
?>
|
77 |
<tr>
|
78 |
<td colspan="3" class="naglowek_serwersms">
|
66 |
<td></td><td></td>
|
67 |
</tr>
|
68 |
<?php
|
69 |
+
if(is_array($dane['nadawcy']) and !empty($dane['nadawcy'])){
|
70 |
+
foreach($dane['nadawcy'] as $nazwa => $status){
|
71 |
+
echo '
|
72 |
+
<tr>
|
73 |
+
<td></td><td>'.$nazwa.'</td><td>'.$status.'</td>
|
74 |
+
</tr>
|
75 |
+
';
|
76 |
+
}
|
77 |
+
}
|
78 |
?>
|
79 |
<tr>
|
80 |
<td colspan="3" class="naglowek_serwersms">
|
app/design/adminhtml/default/default/template/serwersms/faktury.phtml
CHANGED
@@ -109,14 +109,16 @@ $dane = $this->pokazFaktury();
|
|
109 |
*/
|
110 |
|
111 |
$key = Mage::getSingleton('adminhtml/url')->getSecretKey("adminhtml_index","podgladfaktury");
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
|
|
|
|
120 |
echo '<tr><td colspan="5" align="center" class="naglowek_serwersms">'.$paginator.'</td></tr>';
|
121 |
} else {
|
122 |
echo '<tr><td colspan="5">';
|
109 |
*/
|
110 |
|
111 |
$key = Mage::getSingleton('adminhtml/url')->getSecretKey("adminhtml_index","podgladfaktury");
|
112 |
+
if(is_array($tablica) and !empty($tablica)){
|
113 |
+
foreach($tablica as $pole){
|
114 |
+
$link = Mage::helper("adminhtml")->getUrl("serwersms/adminhtml_index/podgladfaktury/",array("faktura" => $pole['id'], "key" => $key));
|
115 |
+
echo '
|
116 |
+
<tr>
|
117 |
+
<td>'.$pole['numer'].'</td><td>'.$pole['rozliczono'].'</td><td>'.$pole['kwota'].'</td><td>'.$pole['termin'].'</td><td><a href="'.$link.'">podgląd</a></td>
|
118 |
+
</tr>
|
119 |
+
';
|
120 |
+
}
|
121 |
+
}
|
122 |
echo '<tr><td colspan="5" align="center" class="naglowek_serwersms">'.$paginator.'</td></tr>';
|
123 |
} else {
|
124 |
echo '<tr><td colspan="5">';
|
app/design/adminhtml/default/default/template/serwersms/formularzsms.phtml
CHANGED
@@ -105,9 +105,11 @@ $nadawcy = $this->nadawcyLista();
|
|
105 |
<select name="numer_lista">
|
106 |
<?php
|
107 |
$kontakty = $this->kontaktyLista();
|
108 |
-
|
109 |
-
|
110 |
-
|
|
|
|
|
111 |
?>
|
112 |
</select>
|
113 |
</td>
|
@@ -116,11 +118,13 @@ $nadawcy = $this->nadawcyLista();
|
|
116 |
<select name="numer_grupa">
|
117 |
<?php
|
118 |
$grupy = $this->grupyLista();
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
|
|
|
|
124 |
?>
|
125 |
</select>
|
126 |
</td>
|
105 |
<select name="numer_lista">
|
106 |
<?php
|
107 |
$kontakty = $this->kontaktyLista();
|
108 |
+
if(is_array($kontakty) and !empty($kontakty)){
|
109 |
+
foreach($kontakty as $kontakt){
|
110 |
+
echo '<option value="'.$kontakt['telefon'].'">'.$kontakt['name'].' ('.$kontakt['telefon'].')</option>';
|
111 |
+
}
|
112 |
+
}
|
113 |
?>
|
114 |
</select>
|
115 |
</td>
|
118 |
<select name="numer_grupa">
|
119 |
<?php
|
120 |
$grupy = $this->grupyLista();
|
121 |
+
if(is_array($grupy) and !empty($grupy)){
|
122 |
+
foreach($grupy as $grupa){
|
123 |
+
if($grupa['id'] != 0){
|
124 |
+
echo '<option value="'.$grupa['id'].'">'.$grupa['name'].'</option>';
|
125 |
+
}
|
126 |
+
}
|
127 |
+
}
|
128 |
?>
|
129 |
</select>
|
130 |
</td>
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>SerwerSMSpl</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
-
<license
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>SMS notification module
|
10 |
-
<description>
|
11 |
-
<notes>
|
12 |
-
<authors><author><name>SerwerSMS.pl</name><user>
|
13 |
-
<date>
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="SerwerSMS"><dir name="Sms"><dir name="Block"><dir name="Adminhtml"><dir name="Niewyslane"><file name="Grid.php" hash="317d7967039ed5b8447999d259fa9353"/></dir><file name="NiewyslaneGrid.php" hash="0671b1bd063eea416f327ec1946e1c96"/><dir name="Odpowiedzi"><file name="Grid.php" hash="84f63c3ad25ee5d50b0ec1b84439e4f1"/></dir><file name="OdpowiedziGrid.php" hash="141b7dcf19b94db6837308a0540ee995"/><dir name="Wyslane"><file name="Grid.php" hash="eacbbb4da57a549a9eab9f6c78d222df"/></dir><file name="WyslaneGrid.php" hash="2245fde11523a62523dca935750ca08f"/></dir><file name="Danekonta.php" hash="
|
16 |
<compatible/>
|
17 |
-
<dependencies><required><php><min>5.
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>SerwerSMSpl</name>
|
4 |
+
<version>1.0.2</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license>OSL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>SMS notification module</summary>
|
10 |
+
<description>SMS notification module integrated with the platform SerwerSMS.pl </description>
|
11 |
+
<notes>Additional notifications of status.</notes>
|
12 |
+
<authors><author><name>SerwerSMS.pl</name><user>serwersms</user><email>biuro@serwersms.pl</email></author></authors>
|
13 |
+
<date>2016-01-28</date>
|
14 |
+
<time>13:30:01</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="SerwerSMS"><dir name="Sms"><dir name="Block"><dir name="Adminhtml"><dir name="Niewyslane"><file name="Grid.php" hash="317d7967039ed5b8447999d259fa9353"/></dir><file name="NiewyslaneGrid.php" hash="0671b1bd063eea416f327ec1946e1c96"/><dir name="Odpowiedzi"><file name="Grid.php" hash="84f63c3ad25ee5d50b0ec1b84439e4f1"/></dir><file name="OdpowiedziGrid.php" hash="141b7dcf19b94db6837308a0540ee995"/><dir name="Wyslane"><file name="Grid.php" hash="eacbbb4da57a549a9eab9f6c78d222df"/></dir><file name="WyslaneGrid.php" hash="2245fde11523a62523dca935750ca08f"/></dir><file name="Danekonta.php" hash="78c35c76c0255e56294508a69cebb177"/><file name="Wyslijsms.php" hash="4e5f650b134bbc9d77768937ac15c7fd"/></dir><dir name="Helper"><file name="SerwerSMS.php" hash="859dc3ab39fc5480d15c317a5d7087c1"/></dir><dir name="Model"><dir name="Mysql4"><dir name="OdpowiedziModel"><file name="Collection.php" hash="dbfa2e96c3f088b42a4e2a8a6cc2b4c0"/></dir><file name="OdpowiedziModel.php" hash="1a04631d3aa451c1713f020e2d17e6cf"/><dir name="SmsModel"><file name="Collection.php" hash="6735ae51dc06d5f2725f526987715ca8"/></dir><file name="SmsModel.php" hash="0d599d22592ea6d52e2b1172065ccea1"/></dir><file name="Nadawcy.php" hash="c4f1f4340a9f91789fee92ddc8760839"/><file name="Observer.php" hash="23b3a29d7c7302e8566178296139ea43"/><file name="OdpowiedziModel.php" hash="3d6cb078b3042a2d22a4f9493656ce84"/><file name="SmsModel.php" hash="c0efeebdbc12b2c7580dc535affa9ca9"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="e302357841d00e5b289cd828f58bc7f3"/></dir><file name="OdpowiedziController.php" hash="bd2fa7d16609e58b9c621c85bfd9de7c"/><file name="RaportController.php" hash="8eefa4bbcf432c1841167c9d26436511"/></dir><dir name="etc"><file name="config.xml" hash="dafe410594af0b7a8cd44f67ddf5aea6"/><file name="system.xml" hash="864917b42753d70ed453a3356c59027f"/></dir><dir name="sql"><dir name="sms_setup"><file name="mysql4-install-1.0.0.php" hash="f415a5cf53d5353190e87d3141311acc"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="serwersms"><file name="sms.xml" hash="db99af44a18f7e4f58be1f5ee091a897"/></dir></dir><dir name="template"><dir name="serwersms"><file name="danekonta.phtml" hash="dd459047191a2daad0223e8b22b187c9"/><file name="dodajnazwe.phtml" hash="0dc2f52bb0c1c9959c2741bd21574138"/><file name="faktury.phtml" hash="e014d551213974dc3e33162043014aeb"/><file name="formularzsms.phtml" hash="61eb45c949f54be096781902f667f6bb"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SerwerSMS_Sms.xml" hash="60b8a59f621ae8222504fd95dae8545b"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="serwersms"><file name="serwersms.png" hash="e686cbffb9e6d14eff216b382780ca05"/></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php><extension><name>curl</name><min/><max/></extension><extension><name>SimpleXML</name><min/><max/></extension><extension><name>dom</name><min/><max/></extension></required></dependencies>
|
18 |
</package>
|