Ltc_Komfortkasse - Version 1.4.0.2

Version Notes

Improved stability for updating orders

Download this release

Release Info

Developer Komfortkasse
Extension Ltc_Komfortkasse
Version 1.4.0.2
Comparing to
See all releases


Code changes from version 1.4.0 to 1.4.0.2

app/code/community/Ltc/Komfortkasse/Helper/Komfortkasse.php CHANGED
@@ -8,7 +8,7 @@ require_once 'Komfortkasse_Order.php';
8
  */
9
  class Komfortkasse
10
  {
11
- const PLUGIN_VER = '1.4.0';
12
  const MAXLEN_SSL = 117;
13
  const LEN_MCRYPT = 16;
14
 
@@ -325,7 +325,13 @@ class Komfortkasse
325
  continue;
326
  }
327
 
328
- // Look if order is still open.
 
 
 
 
 
 
329
  if (in_array($order ['number'], $openids) === false) {
330
  continue;
331
  }
8
  */
9
  class Komfortkasse
10
  {
11
+ const PLUGIN_VER = '1.4.0.2';
12
  const MAXLEN_SSL = 117;
13
  const LEN_MCRYPT = 16;
14
 
325
  continue;
326
  }
327
 
328
+ // only update if order status update is necessary (dont update if order has been updated manually)
329
+ if ($order['status'] == $newstatus) {
330
+ $o = $o . Komfortkasse::kk_csv($id);
331
+ continue;
332
+ }
333
+
334
+ // dont update if order is no longer relevant (will be marked as DISAPPEARED later on)
335
  if (in_array($order ['number'], $openids) === false) {
336
  continue;
337
  }
app/code/community/Ltc/Komfortkasse/Helper/Komfortkasse_Config.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  * Komfortkasse
5
  * Config Class
6
- * @version 1.4.0-Magento */
7
  class Komfortkasse_Config
8
  {
9
  const activate_export = 'payment/komfortkasse/activate_export';
@@ -57,6 +57,7 @@ class Komfortkasse_Config
57
  */
58
  public static function getConfig($constantKey, $order=null)
59
  {
 
60
  if ($order != null) {
61
  $store_id = $order['store_id'];
62
  } else {
3
  /**
4
  * Komfortkasse
5
  * Config Class
6
+ * @version 1.4.0.1-Magento */
7
  class Komfortkasse_Config
8
  {
9
  const activate_export = 'payment/komfortkasse/activate_export';
57
  */
58
  public static function getConfig($constantKey, $order=null)
59
  {
60
+ $store_id = null;
61
  if ($order != null) {
62
  $store_id = $order['store_id'];
63
  } else {
app/code/community/Ltc/Komfortkasse/Helper/Komfortkasse_Order.php CHANGED
@@ -8,7 +8,7 @@
8
  * status: data type according to the shop system
9
  * delivery_ and billing_: _firstname, _lastname, _company, _street, _postcode, _city, _countrycode
10
  * products: an Array of item numbers
11
- * @version 1.4.0-Magento
12
  */
13
  $path = Mage::getModuleDir('', 'Ltc_Komfortkasse');
14
  $order_extension = false;
@@ -19,7 +19,6 @@ if (file_exists("{$path}/Helper/Komfortkasse_Order_Extension.php") === true) {
19
  class Komfortkasse_Order
20
  {
21
 
22
-
23
  /**
24
  * Get open order IDs.
25
  *
@@ -44,66 +43,93 @@ class Komfortkasse_Order
44
 
45
  // PREPAYMENT
46
 
47
- $openOrders = explode(',', Komfortkasse_Config::getConfig(Komfortkasse_Config::status_open, $store_id_order));
48
- $paymentMethods = explode(',', Komfortkasse_Config::getConfig(Komfortkasse_Config::payment_methods, $store_id_order));
49
-
50
- $salesModel = Mage::getModel('sales/order');
51
- $salesCollection = $salesModel->getCollection()->addAttributeToFilter('status', array ('in' => $openOrders
52
- ))->addFieldToFilter('store_id', $store_id);
53
 
54
- foreach ($salesCollection as $order) {
55
- $method = $order->getPayment()->getMethodInstance()->getCode();
56
- if (in_array($method, $paymentMethods, true) === true) {
57
- $orderId = $order->getIncrementId();
58
- $ret [] = $orderId;
 
 
 
 
 
 
 
 
 
 
 
 
59
  }
60
- }
61
-
62
- // Add all orders with unpaid invoices (in case the invoice is created before shipping).
63
- $invoiceModel = Mage::getModel('sales/order_invoice');
64
- $invoiceCollection = $invoiceModel->getCollection()->addAttributeToFilter('state', Mage_Sales_Model_Order_Invoice::STATE_OPEN)->addFieldToFilter('store_id', $store_id);
65
- foreach ($invoiceCollection as $invoice) {
66
- $order = $invoice->getOrder();
67
- $method = $order->getPayment()->getMethodInstance()->getCode();
68
- if (in_array($method, $paymentMethods, true) === true) {
69
- $orderId = $order->getIncrementId();
70
- if (in_array($orderId, $ret) === false) {
71
- $ret [] = $orderId;
 
 
 
72
  }
73
  }
74
  }
75
 
76
  // INVOICE
77
 
78
- $openOrders = explode(',', Komfortkasse_Config::getConfig(Komfortkasse_Config::status_open_invoice, $store_id_order));
79
- $paymentMethods = explode(',', Komfortkasse_Config::getConfig(Komfortkasse_Config::payment_methods_invoice, $store_id_order));
80
 
81
- $salesModel = Mage::getModel('sales/order');
82
- $salesCollection = $salesModel->getCollection()->addAttributeToFilter('status', array ('in' => $openOrders
83
- ))->addFieldToFilter('store_id', $store_id);
84
-
85
- foreach ($salesCollection as $order) {
86
- $method = $order->getPayment()->getMethodInstance()->getCode();
87
- if (in_array($method, $paymentMethods, true) === true) {
88
- $orderId = $order->getIncrementId();
89
- $ret [] = $orderId;
 
 
 
 
 
 
 
 
90
  }
91
  }
92
 
93
  // COD
94
 
95
- $openOrders = explode(',', Komfortkasse_Config::getConfig(Komfortkasse_Config::status_open_cod, $store_id_order));
96
- $paymentMethods = explode(',', Komfortkasse_Config::getConfig(Komfortkasse_Config::payment_methods_cod, $store_id_order));
97
-
98
- $salesModel = Mage::getModel('sales/order');
99
- $salesCollection = $salesModel->getCollection()->addAttributeToFilter('status', array ('in' => $openOrders
100
- ))->addFieldToFilter('store_id', $store_id);
101
 
102
- foreach ($salesCollection as $order) {
103
- $method = $order->getPayment()->getMethodInstance()->getCode();
104
- if (in_array($method, $paymentMethods, true) === true) {
105
- $orderId = $order->getIncrementId();
106
- $ret [] = $orderId;
 
 
 
 
 
 
 
 
 
 
 
 
107
  }
108
  }
109
  }
@@ -368,8 +394,8 @@ class Komfortkasse_Order
368
  $creditMemo = Mage::getModel('sales/order_creditmemo')->load($id);
369
 
370
  $store_id = $creditMemo->getStoreId();
371
- $store_id_order = array();
372
- $store_id_order['store_id'] = $store_id;
373
 
374
  if (!Komfortkasse_Config::getConfig(Komfortkasse_Config::activate_update, $store_id_order)) {
375
  return;
8
  * status: data type according to the shop system
9
  * delivery_ and billing_: _firstname, _lastname, _company, _street, _postcode, _city, _countrycode
10
  * products: an Array of item numbers
11
+ * @version 1.4.0.1-Magento
12
  */
13
  $path = Mage::getModuleDir('', 'Ltc_Komfortkasse');
14
  $order_extension = false;
19
  class Komfortkasse_Order
20
  {
21
 
 
22
  /**
23
  * Get open order IDs.
24
  *
43
 
44
  // PREPAYMENT
45
 
46
+ $openOrders = Komfortkasse_Config::getConfig(Komfortkasse_Config::status_open, $store_id_order);
47
+ $paymentMethods = Komfortkasse_Config::getConfig(Komfortkasse_Config::payment_methods, $store_id_order);
 
 
 
 
48
 
49
+ if (!empty($openOrders) && !empty($paymentMethods)) {
50
+ $openOrders = explode(',', $openOrders);
51
+ $paymentMethods = explode(',', $paymentMethods);
52
+
53
+ $salesModel = Mage::getModel('sales/order');
54
+ $salesCollection = $salesModel->getCollection()->addAttributeToFilter('status', array ('in' => $openOrders
55
+ ))->addFieldToFilter('store_id', $store_id);
56
+
57
+ foreach ($salesCollection as $order) {
58
+ try {
59
+ $method = $order->getPayment()->getMethodInstance()->getCode();
60
+ if (in_array($method, $paymentMethods, true) === true) {
61
+ $orderId = $order->getIncrementId();
62
+ $ret [] = $orderId;
63
+ }
64
+ } catch ( Exception $e ) {
65
+ }
66
  }
67
+
68
+ // Add all orders with unpaid invoices (in case the invoice is created before shipping).
69
+ $invoiceModel = Mage::getModel('sales/order_invoice');
70
+ $invoiceCollection = $invoiceModel->getCollection()->addAttributeToFilter('state', Mage_Sales_Model_Order_Invoice::STATE_OPEN)->addFieldToFilter('store_id', $store_id);
71
+ foreach ($invoiceCollection as $invoice) {
72
+ try {
73
+ $order = $invoice->getOrder();
74
+ $method = $order->getPayment()->getMethodInstance()->getCode();
75
+ if (in_array($method, $paymentMethods, true) === true) {
76
+ $orderId = $order->getIncrementId();
77
+ if (in_array($orderId, $ret) === false) {
78
+ $ret [] = $orderId;
79
+ }
80
+ }
81
+ } catch ( Exception $e ) {
82
  }
83
  }
84
  }
85
 
86
  // INVOICE
87
 
88
+ $openOrders = Komfortkasse_Config::getConfig(Komfortkasse_Config::status_open_invoice, $store_id_order);
89
+ $paymentMethods = Komfortkasse_Config::getConfig(Komfortkasse_Config::payment_methods_invoice, $store_id_order);
90
 
91
+ if (!empty($openOrders) && !empty($paymentMethods)) {
92
+ $openOrders = explode(',', $openOrders);
93
+ $paymentMethods = explode(',', $paymentMethods);
94
+
95
+ $salesModel = Mage::getModel('sales/order');
96
+ $salesCollection = $salesModel->getCollection()->addAttributeToFilter('status', array ('in' => $openOrders
97
+ ))->addFieldToFilter('store_id', $store_id);
98
+
99
+ foreach ($salesCollection as $order) {
100
+ try {
101
+ $method = $order->getPayment()->getMethodInstance()->getCode();
102
+ if (in_array($method, $paymentMethods, true) === true) {
103
+ $orderId = $order->getIncrementId();
104
+ $ret [] = $orderId;
105
+ }
106
+ } catch ( Exception $e ) {
107
+ }
108
  }
109
  }
110
 
111
  // COD
112
 
113
+ $openOrders = Komfortkasse_Config::getConfig(Komfortkasse_Config::status_open_cod, $store_id_order);
114
+ $paymentMethods = Komfortkasse_Config::getConfig(Komfortkasse_Config::payment_methods_cod, $store_id_order);
 
 
 
 
115
 
116
+ if (!empty($openOrders) && !empty($paymentMethods)) {
117
+ $openOrders = explode(',', $openOrders);
118
+ $paymentMethods = explode(',', $paymentMethods);
119
+
120
+ $salesModel = Mage::getModel('sales/order');
121
+ $salesCollection = $salesModel->getCollection()->addAttributeToFilter('status', array ('in' => $openOrders
122
+ ))->addFieldToFilter('store_id', $store_id);
123
+
124
+ foreach ($salesCollection as $order) {
125
+ try {
126
+ $method = $order->getPayment()->getMethodInstance()->getCode();
127
+ if (in_array($method, $paymentMethods, true) === true) {
128
+ $orderId = $order->getIncrementId();
129
+ $ret [] = $orderId;
130
+ }
131
+ } catch ( Exception $e ) {
132
+ }
133
  }
134
  }
135
  }
394
  $creditMemo = Mage::getModel('sales/order_creditmemo')->load($id);
395
 
396
  $store_id = $creditMemo->getStoreId();
397
+ $store_id_order = array ();
398
+ $store_id_order ['store_id'] = $store_id;
399
 
400
  if (!Komfortkasse_Config::getConfig(Komfortkasse_Config::activate_update, $store_id_order)) {
401
  return;
app/code/community/Ltc/Komfortkasse/etc/config.xml CHANGED
@@ -3,7 +3,7 @@
3
  <config>
4
  <modules>
5
  <Ltc_Komfortkasse>
6
- <version>1.4.0</version>
7
  </Ltc_Komfortkasse>
8
  </modules>
9
  <global>
3
  <config>
4
  <modules>
5
  <Ltc_Komfortkasse>
6
+ <version>1.4.0.2</version>
7
  </Ltc_Komfortkasse>
8
  </modules>
9
  <global>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ltc_Komfortkasse</name>
4
- <version>1.4.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://creativecommons.org/licenses/by-nd/4.0/">CC BY-ND 4.0</license>
7
  <channel>community</channel>
@@ -13,11 +13,11 @@ Zus&#xE4;tzlich k&#xF6;nnen automatische Zahlungserinnerungen versendet werden u
13
  &#xD;
14
  Es ist eine Anmeldung auf www.komfortkasse.eu erforderlich (kostenloses Paket verf&#xFC;gbar).&#xD;
15
  </description>
16
- <notes>Improved compatibility for multi-store</notes>
17
  <authors><author><name>Komfortkasse</name><user>komfortkasse</user><email>integration@komfortkasse.eu</email></author></authors>
18
- <date>2015-05-26</date>
19
- <time>08:40:53</time>
20
- <contents><target name="magecommunity"><dir name="Ltc"><dir name="Komfortkasse"><dir name="Helper"><file name="Data.php" hash="ec7f9f8fb6ea400a740ed2c127eb71bc"/><file name="Komfortkasse.php" hash="dd7e3a1a19ca20cf0b12a82d1f0cf8a1"/><file name="Komfortkasse_Config.php" hash="8b337a9ba4583a14e1c4f40df3f9e1f5"/><file name="Komfortkasse_Order.php" hash="8f54e913c55af99b3eca65ad04a2d375"/></dir><dir name="Model"><file name="Observer.php" hash="5b616b6d3651df44f8297c732dc478bb"/></dir><dir name="controllers"><file name="MainController.php" hash="b983fe60b2bbfa3aa1d57850cc6c045b"/></dir><dir name="etc"><file name="config.xml" hash="4b933dd6c8ebb55045eab90ef4f48608"/><file name="system.xml" hash="0902280bcdd963008b48e633677c953d"/></dir></dir></dir><dir name="Mage"><dir name="Adminhtml"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="KomfortkasseEncryptionOptions.php" hash="fea880dd3e60c13ede05be53511a6d93"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ltc_Komfortkasse.xml" hash="433066ef75047d9468dcea87888283d2"/></dir></target></contents>
21
  <compatible/>
22
  <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
23
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ltc_Komfortkasse</name>
4
+ <version>1.4.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://creativecommons.org/licenses/by-nd/4.0/">CC BY-ND 4.0</license>
7
  <channel>community</channel>
13
  &#xD;
14
  Es ist eine Anmeldung auf www.komfortkasse.eu erforderlich (kostenloses Paket verf&#xFC;gbar).&#xD;
15
  </description>
16
+ <notes>Improved stability for updating orders</notes>
17
  <authors><author><name>Komfortkasse</name><user>komfortkasse</user><email>integration@komfortkasse.eu</email></author></authors>
18
+ <date>2015-07-07</date>
19
+ <time>13:32:08</time>
20
+ <contents><target name="magecommunity"><dir name="Ltc"><dir name="Komfortkasse"><dir name="Helper"><file name="Data.php" hash="ec7f9f8fb6ea400a740ed2c127eb71bc"/><file name="Komfortkasse.php" hash="7df692ad563e08ae923dba4ac0a09f1b"/><file name="Komfortkasse_Config.php" hash="44cf103f0ddef60890cd6c221262b7e5"/><file name="Komfortkasse_Order.php" hash="398246addce9c0d0283f685b71eea8d2"/></dir><dir name="Model"><file name="Observer.php" hash="5b616b6d3651df44f8297c732dc478bb"/></dir><dir name="controllers"><file name="MainController.php" hash="b983fe60b2bbfa3aa1d57850cc6c045b"/></dir><dir name="etc"><file name="config.xml" hash="c6d9356201bf1e7e920b41ec909f26ab"/><file name="system.xml" hash="0902280bcdd963008b48e633677c953d"/></dir></dir></dir><dir name="Mage"><dir name="Adminhtml"><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><file name="KomfortkasseEncryptionOptions.php" hash="fea880dd3e60c13ede05be53511a6d93"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ltc_Komfortkasse.xml" hash="433066ef75047d9468dcea87888283d2"/></dir></target></contents>
21
  <compatible/>
22
  <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
23
  </package>