Version Notes
Enhanced credit memo handling
Download this release
Release Info
Developer | Komfortkasse |
Extension | Ltc_Komfortkasse |
Version | 1.4.4.15 |
Comparing to | |
See all releases |
Code changes from version 1.4.4.13 to 1.4.4.15
- app/code/community/Ltc/Komfortkasse/Helper/Komfortkasse.php +1 -1
- app/code/community/Ltc/Komfortkasse/Helper/Komfortkasse_Config.php +3 -1
- app/code/community/Ltc/Komfortkasse/Helper/Komfortkasse_Order.php +562 -481
- app/code/community/Ltc/Komfortkasse/etc/config.xml +3 -1
- app/code/community/Ltc/Komfortkasse/etc/system.xml +24 -0
- package.xml +5 -5
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.4.
|
12 |
const MAXLEN_SSL = 117;
|
13 |
const LEN_MCRYPT = 16;
|
14 |
|
8 |
*/
|
9 |
class Komfortkasse
|
10 |
{
|
11 |
+
const PLUGIN_VER = '1.4.4.15';
|
12 |
const MAXLEN_SSL = 117;
|
13 |
const LEN_MCRYPT = 16;
|
14 |
|
app/code/community/Ltc/Komfortkasse/Helper/Komfortkasse_Config.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/**
|
4 |
* Komfortkasse
|
5 |
* Config Class
|
6 |
-
* @version 1.4.4.
|
7 |
class Komfortkasse_Config
|
8 |
{
|
9 |
const activate_export = 'payment/komfortkasse/activate_export';
|
@@ -27,6 +27,8 @@ class Komfortkasse_Config
|
|
27 |
const privatekey = 'payment/komfortkasse/privatekey';
|
28 |
const use_invoice_total = 'payment/komfortkasse/use_invoice_total';
|
29 |
const consider_creditnotes = 'payment/komfortkasse/consider_creditnotes';
|
|
|
|
|
30 |
|
31 |
|
32 |
/**
|
3 |
/**
|
4 |
* Komfortkasse
|
5 |
* Config Class
|
6 |
+
* @version 1.4.4.15-Magento */
|
7 |
class Komfortkasse_Config
|
8 |
{
|
9 |
const activate_export = 'payment/komfortkasse/activate_export';
|
27 |
const privatekey = 'payment/komfortkasse/privatekey';
|
28 |
const use_invoice_total = 'payment/komfortkasse/use_invoice_total';
|
29 |
const consider_creditnotes = 'payment/komfortkasse/consider_creditnotes';
|
30 |
+
const creditnotes_as_invoices = 'payment/komfortkasse/creditnotes_as_invoices';
|
31 |
+
const last_receipt_only = 'payment/komfortkasse/last_receipt_only';
|
32 |
|
33 |
|
34 |
/**
|
app/code/community/Ltc/Komfortkasse/Helper/Komfortkasse_Order.php
CHANGED
@@ -1,482 +1,563 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Komfortkasse Order Class
|
6 |
-
* in KK, an Order is an Array providing the following members:
|
7 |
-
* number, date, email, customer_number, payment_method, amount, currency_code, exchange_rate, language_code, invoice_number, store_id
|
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.4.
|
12 |
-
*/
|
13 |
-
$path = Mage::getModuleDir('', 'Ltc_Komfortkasse');
|
14 |
-
global $komfortkasse_order_extension;
|
15 |
-
$komfortkasse_order_extension = false;
|
16 |
-
if (file_exists("{$path}/Helper/Komfortkasse_Order_Extension.php") === true) {
|
17 |
-
$komfortkasse_order_extension = true;
|
18 |
-
include_once "{$path}/Helper/Komfortkasse_Order_Extension.php";
|
19 |
-
}
|
20 |
-
class Komfortkasse_Order
|
21 |
-
{
|
22 |
-
|
23 |
-
|
24 |
-
private static function createInClause($arr)
|
25 |
-
{
|
26 |
-
if (!is_array($arr)) {
|
27 |
-
$arr = explode(',', $arr);
|
28 |
-
}
|
29 |
-
$tmp = array ();
|
30 |
-
foreach ($arr as $item) {
|
31 |
-
$tmp [] = str_replace('\'', '', $item);
|
32 |
-
}
|
33 |
-
return '(\'' . implode('\', \'', $tmp) . '\')';
|
34 |
-
|
35 |
-
}
|
36 |
-
|
37 |
-
|
38 |
-
/**
|
39 |
-
* Get open order IDs.
|
40 |
-
*
|
41 |
-
* @return string all order IDs that are "open" and relevant for transfer to kk
|
42 |
-
*/
|
43 |
-
public static function getOpenIDs()
|
44 |
-
{
|
45 |
-
$ret = array ();
|
46 |
-
|
47 |
-
$resource = Mage::getSingleton('core/resource');
|
48 |
-
$readConnection = $resource->getConnection('core_read');
|
49 |
-
$tableOrder = $resource->getTableName('sales/order');
|
50 |
-
$tablePayment = $resource->getTableName('sales/order_payment');
|
51 |
-
|
52 |
-
$minDate = date('Y-m-d', time() - 31536000); // 1 Jahr
|
53 |
-
|
54 |
-
foreach (Mage::app()->getWebsites() as $website) {
|
55 |
-
foreach ($website->getGroups() as $group) {
|
56 |
-
$stores = $group->getStores();
|
57 |
-
foreach ($stores as $store) {
|
58 |
-
$store_id = $store->getId();
|
59 |
-
$store_id_order = array ();
|
60 |
-
$store_id_order ['store_id'] = $store_id;
|
61 |
-
|
62 |
-
if (Komfortkasse_Config::getConfig(Komfortkasse_Config::activate_export, $store_id_order)) {
|
63 |
-
|
64 |
-
$query = 'SELECT o.increment_id FROM ' . $tableOrder . ' o join ' . $tablePayment . ' p on p.parent_id = o.entity_id where o.store_id=' . $store_id . ' and created_at > ' . $minDate . ' and (';
|
65 |
-
$first = true;
|
66 |
-
|
67 |
-
// PREPAYMENT
|
68 |
-
$openOrders = Komfortkasse_Config::getConfig(Komfortkasse_Config::status_open, $store_id_order);
|
69 |
-
$paymentMethods = Komfortkasse_Config::getConfig(Komfortkasse_Config::payment_methods, $store_id_order);
|
70 |
-
if ($openOrders && $paymentMethods) {
|
71 |
-
if (!$first)
|
72 |
-
$query .= ' or ';
|
73 |
-
$query .= '(o.status in ' . self::createInClause($openOrders) . ' and p.method in ' . self::createInClause($paymentMethods) . ')';
|
74 |
-
$first = false;
|
75 |
-
}
|
76 |
-
|
77 |
-
// COD
|
78 |
-
$openOrders = Komfortkasse_Config::getConfig(Komfortkasse_Config::status_open_cod, $store_id_order);
|
79 |
-
$paymentMethods = Komfortkasse_Config::getConfig(Komfortkasse_Config::payment_methods_cod, $store_id_order);
|
80 |
-
if ($openOrders && $paymentMethods) {
|
81 |
-
if (!$first)
|
82 |
-
$query .= ' or ';
|
83 |
-
$query .= '(o.status in ' . self::createInClause($openOrders) . ' and p.method in ' . self::createInClause($paymentMethods) . ')';
|
84 |
-
$first = false;
|
85 |
-
}
|
86 |
-
|
87 |
-
// INVOICE
|
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 |
-
if ($openOrders && $paymentMethods) {
|
91 |
-
if (!$first)
|
92 |
-
$query .= ' or ';
|
93 |
-
$query .= '(o.status in ' . self::createInClause($openOrders) . ' and p.method in ' . self::createInClause($paymentMethods) . ')';
|
94 |
-
$first = false;
|
95 |
-
}
|
96 |
-
|
97 |
-
$query .= ')';
|
98 |
-
|
99 |
-
$results = $readConnection->fetchAll($query);
|
100 |
-
foreach ($results as $result) {
|
101 |
-
$ret [] = $result ['increment_id'];
|
102 |
-
}
|
103 |
-
}
|
104 |
-
}
|
105 |
-
}
|
106 |
-
}
|
107 |
-
|
108 |
-
return $ret;
|
109 |
-
|
110 |
-
}
|
111 |
-
|
112 |
-
// end getOpenIDs()
|
113 |
-
|
114 |
-
|
115 |
-
/**
|
116 |
-
* Get refund IDS.
|
117 |
-
*
|
118 |
-
* @return string all refund IDs that are "open" and relevant for transfer to kk
|
119 |
-
*/
|
120 |
-
public static function getRefundIDs()
|
121 |
-
{
|
122 |
-
$ret = array ();
|
123 |
-
|
124 |
-
foreach (Mage::app()->getWebsites() as $website) {
|
125 |
-
foreach ($website->getGroups() as $group) {
|
126 |
-
$stores = $group->getStores();
|
127 |
-
foreach ($stores as $store) {
|
128 |
-
|
129 |
-
$store_id = $store->getId();
|
130 |
-
$store_id_order = array ();
|
131 |
-
$store_id_order ['store_id'] = $store_id;
|
132 |
-
|
133 |
-
if (!Komfortkasse_Config::getConfig(Komfortkasse_Config::activate_export, $store_id_order)) {
|
134 |
-
continue;
|
135 |
-
}
|
136 |
-
|
137 |
-
$paymentMethods = explode(',', Komfortkasse_Config::getConfig(Komfortkasse_Config::payment_methods, $store_id_order));
|
138 |
-
$paymentMethodsInvoice = explode(',', Komfortkasse_Config::getConfig(Komfortkasse_Config::payment_methods_invoice, $store_id_order));
|
139 |
-
|
140 |
-
$cmModel = Mage::getModel("sales/order_creditmemo");
|
141 |
-
$cmCollection = $cmModel->getCollection()->addFieldToFilter('store_id', $store_id);
|
142 |
-
|
143 |
-
foreach ($cmCollection as $creditMemo) {
|
144 |
-
if ($creditMemo->getTransactionId() == null) {
|
145 |
-
$order = $creditMemo->getOrder();
|
146 |
-
try {
|
147 |
-
$method = $order->getPayment()->getMethodInstance()->getCode();
|
148 |
-
} catch ( Exception $e ) {
|
149 |
-
// payment method has been deleted
|
150 |
-
$method = null;
|
151 |
-
}
|
152 |
-
if ($method && (in_array($method, $paymentMethods, true) === true || in_array($method, $paymentMethodsInvoice, true) === true)) {
|
153 |
-
$cmId = $creditMemo->getIncrementId();
|
154 |
-
$ret [] = $cmId;
|
155 |
-
}
|
156 |
-
}
|
157 |
-
}
|
158 |
-
}
|
159 |
-
}
|
160 |
-
}
|
161 |
-
|
162 |
-
return $ret;
|
163 |
-
|
164 |
-
}
|
165 |
-
|
166 |
-
// end getRefundIDs()
|
167 |
-
|
168 |
-
|
169 |
-
/**
|
170 |
-
* Get order.
|
171 |
-
*
|
172 |
-
* @param string $number order number
|
173 |
-
*
|
174 |
-
* @return array order
|
175 |
-
*/
|
176 |
-
public static function getOrder($number)
|
177 |
-
{
|
178 |
-
$order = Mage::getModel('sales/order')->loadByIncrementId($number);
|
179 |
-
if (empty($number) === true || empty($order) === true || $number != $order->getIncrementId()) {
|
180 |
-
return null;
|
181 |
-
}
|
182 |
-
|
183 |
-
$conf_general = Mage::getStoreConfig('general', $order->getStoreId());
|
184 |
-
|
185 |
-
$ret = array ();
|
186 |
-
$ret ['
|
187 |
-
$ret ['
|
188 |
-
$ret ['
|
189 |
-
$ret ['
|
190 |
-
$ret ['
|
191 |
-
$ret ['
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
}
|
196 |
-
|
197 |
-
$ret ['
|
198 |
-
$ret ['
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
$
|
203 |
-
$
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
$
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
$
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
$
|
329 |
-
|
330 |
-
));
|
331 |
-
$
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
$
|
380 |
-
$
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
$
|
419 |
-
}
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
482 |
}//end class
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Komfortkasse Order Class
|
6 |
+
* in KK, an Order is an Array providing the following members:
|
7 |
+
* number, date, email, customer_number, payment_method, amount, currency_code, exchange_rate, language_code, invoice_number, store_id
|
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.4.15-Magento1
|
12 |
+
*/
|
13 |
+
$path = Mage::getModuleDir('', 'Ltc_Komfortkasse');
|
14 |
+
global $komfortkasse_order_extension;
|
15 |
+
$komfortkasse_order_extension = false;
|
16 |
+
if (file_exists("{$path}/Helper/Komfortkasse_Order_Extension.php") === true) {
|
17 |
+
$komfortkasse_order_extension = true;
|
18 |
+
include_once "{$path}/Helper/Komfortkasse_Order_Extension.php";
|
19 |
+
}
|
20 |
+
class Komfortkasse_Order
|
21 |
+
{
|
22 |
+
|
23 |
+
|
24 |
+
private static function createInClause($arr)
|
25 |
+
{
|
26 |
+
if (!is_array($arr)) {
|
27 |
+
$arr = explode(',', $arr);
|
28 |
+
}
|
29 |
+
$tmp = array ();
|
30 |
+
foreach ($arr as $item) {
|
31 |
+
$tmp [] = str_replace('\'', '', $item);
|
32 |
+
}
|
33 |
+
return '(\'' . implode('\', \'', $tmp) . '\')';
|
34 |
+
|
35 |
+
}
|
36 |
+
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Get open order IDs.
|
40 |
+
*
|
41 |
+
* @return string all order IDs that are "open" and relevant for transfer to kk
|
42 |
+
*/
|
43 |
+
public static function getOpenIDs()
|
44 |
+
{
|
45 |
+
$ret = array ();
|
46 |
+
|
47 |
+
$resource = Mage::getSingleton('core/resource');
|
48 |
+
$readConnection = $resource->getConnection('core_read');
|
49 |
+
$tableOrder = $resource->getTableName('sales/order');
|
50 |
+
$tablePayment = $resource->getTableName('sales/order_payment');
|
51 |
+
|
52 |
+
$minDate = date('Y-m-d', time() - 31536000); // 1 Jahr
|
53 |
+
|
54 |
+
foreach (Mage::app()->getWebsites() as $website) {
|
55 |
+
foreach ($website->getGroups() as $group) {
|
56 |
+
$stores = $group->getStores();
|
57 |
+
foreach ($stores as $store) {
|
58 |
+
$store_id = $store->getId();
|
59 |
+
$store_id_order = array ();
|
60 |
+
$store_id_order ['store_id'] = $store_id;
|
61 |
+
|
62 |
+
if (Komfortkasse_Config::getConfig(Komfortkasse_Config::activate_export, $store_id_order)) {
|
63 |
+
|
64 |
+
$query = 'SELECT o.increment_id FROM ' . $tableOrder . ' o join ' . $tablePayment . ' p on p.parent_id = o.entity_id where o.store_id=' . $store_id . ' and created_at > ' . $minDate . ' and (';
|
65 |
+
$first = true;
|
66 |
+
|
67 |
+
// PREPAYMENT
|
68 |
+
$openOrders = Komfortkasse_Config::getConfig(Komfortkasse_Config::status_open, $store_id_order);
|
69 |
+
$paymentMethods = Komfortkasse_Config::getConfig(Komfortkasse_Config::payment_methods, $store_id_order);
|
70 |
+
if ($openOrders && $paymentMethods) {
|
71 |
+
if (!$first)
|
72 |
+
$query .= ' or ';
|
73 |
+
$query .= '(o.status in ' . self::createInClause($openOrders) . ' and p.method in ' . self::createInClause($paymentMethods) . ')';
|
74 |
+
$first = false;
|
75 |
+
}
|
76 |
+
|
77 |
+
// COD
|
78 |
+
$openOrders = Komfortkasse_Config::getConfig(Komfortkasse_Config::status_open_cod, $store_id_order);
|
79 |
+
$paymentMethods = Komfortkasse_Config::getConfig(Komfortkasse_Config::payment_methods_cod, $store_id_order);
|
80 |
+
if ($openOrders && $paymentMethods) {
|
81 |
+
if (!$first)
|
82 |
+
$query .= ' or ';
|
83 |
+
$query .= '(o.status in ' . self::createInClause($openOrders) . ' and p.method in ' . self::createInClause($paymentMethods) . ')';
|
84 |
+
$first = false;
|
85 |
+
}
|
86 |
+
|
87 |
+
// INVOICE
|
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 |
+
if ($openOrders && $paymentMethods) {
|
91 |
+
if (!$first)
|
92 |
+
$query .= ' or ';
|
93 |
+
$query .= '(o.status in ' . self::createInClause($openOrders) . ' and p.method in ' . self::createInClause($paymentMethods) . ')';
|
94 |
+
$first = false;
|
95 |
+
}
|
96 |
+
|
97 |
+
$query .= ')';
|
98 |
+
|
99 |
+
$results = $readConnection->fetchAll($query);
|
100 |
+
foreach ($results as $result) {
|
101 |
+
$ret [] = $result ['increment_id'];
|
102 |
+
}
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
return $ret;
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
// end getOpenIDs()
|
113 |
+
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Get refund IDS.
|
117 |
+
*
|
118 |
+
* @return string all refund IDs that are "open" and relevant for transfer to kk
|
119 |
+
*/
|
120 |
+
public static function getRefundIDs()
|
121 |
+
{
|
122 |
+
$ret = array ();
|
123 |
+
|
124 |
+
foreach (Mage::app()->getWebsites() as $website) {
|
125 |
+
foreach ($website->getGroups() as $group) {
|
126 |
+
$stores = $group->getStores();
|
127 |
+
foreach ($stores as $store) {
|
128 |
+
|
129 |
+
$store_id = $store->getId();
|
130 |
+
$store_id_order = array ();
|
131 |
+
$store_id_order ['store_id'] = $store_id;
|
132 |
+
|
133 |
+
if (!Komfortkasse_Config::getConfig(Komfortkasse_Config::activate_export, $store_id_order)) {
|
134 |
+
continue;
|
135 |
+
}
|
136 |
+
|
137 |
+
$paymentMethods = explode(',', Komfortkasse_Config::getConfig(Komfortkasse_Config::payment_methods, $store_id_order));
|
138 |
+
$paymentMethodsInvoice = explode(',', Komfortkasse_Config::getConfig(Komfortkasse_Config::payment_methods_invoice, $store_id_order));
|
139 |
+
|
140 |
+
$cmModel = Mage::getModel("sales/order_creditmemo");
|
141 |
+
$cmCollection = $cmModel->getCollection()->addFieldToFilter('store_id', $store_id);
|
142 |
+
|
143 |
+
foreach ($cmCollection as $creditMemo) {
|
144 |
+
if ($creditMemo->getTransactionId() == null) {
|
145 |
+
$order = $creditMemo->getOrder();
|
146 |
+
try {
|
147 |
+
$method = $order->getPayment()->getMethodInstance()->getCode();
|
148 |
+
} catch ( Exception $e ) {
|
149 |
+
// payment method has been deleted
|
150 |
+
$method = null;
|
151 |
+
}
|
152 |
+
if ($method && (in_array($method, $paymentMethods, true) === true || in_array($method, $paymentMethodsInvoice, true) === true)) {
|
153 |
+
$cmId = $creditMemo->getIncrementId();
|
154 |
+
$ret [] = $cmId;
|
155 |
+
}
|
156 |
+
}
|
157 |
+
}
|
158 |
+
}
|
159 |
+
}
|
160 |
+
}
|
161 |
+
|
162 |
+
return $ret;
|
163 |
+
|
164 |
+
}
|
165 |
+
|
166 |
+
// end getRefundIDs()
|
167 |
+
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Get order.
|
171 |
+
*
|
172 |
+
* @param string $number order number
|
173 |
+
*
|
174 |
+
* @return array order
|
175 |
+
*/
|
176 |
+
public static function getOrder($number)
|
177 |
+
{
|
178 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($number);
|
179 |
+
if (empty($number) === true || empty($order) === true || $number != $order->getIncrementId()) {
|
180 |
+
return null;
|
181 |
+
}
|
182 |
+
|
183 |
+
$conf_general = Mage::getStoreConfig('general', $order->getStoreId());
|
184 |
+
|
185 |
+
$ret = array ();
|
186 |
+
$ret ['store_id'] = $order->getStoreId();
|
187 |
+
$ret ['invoice_date'] = null;
|
188 |
+
$ret ['number'] = $order->getIncrementId();
|
189 |
+
$ret ['status'] = $order->getStatus();
|
190 |
+
$ret ['date'] = date('d.m.Y', strtotime($order->getCreatedAtStoreDate()->get(Zend_Date::DATE_MEDIUM)));
|
191 |
+
$ret ['email'] = $order->getCustomerEmail();
|
192 |
+
$ret ['customer_number'] = $order->getCustomerId();
|
193 |
+
try {
|
194 |
+
$ret ['payment_method'] = $order->getPayment()->getMethodInstance()->getCode();
|
195 |
+
} catch ( Exception $e ) {
|
196 |
+
}
|
197 |
+
$ret ['amount'] = $order->getGrandTotal();
|
198 |
+
$ret ['currency_code'] = $order->getOrderCurrencyCode();
|
199 |
+
$ret ['exchange_rate'] = $order->getBaseToOrderRate();
|
200 |
+
|
201 |
+
// Rechnungsnummer und -datum, evtl. Rechnungsbetrag
|
202 |
+
$useInvoiceAmount = Komfortkasse::getOrderType($ret) == 'INVOICE' && Komfortkasse_Config::getConfig(Komfortkasse_Config::use_invoice_total, $ret);
|
203 |
+
$considerCreditnotes = $useInvoiceAmount && Komfortkasse_Config::getConfig(Komfortkasse_Config::consider_creditnotes, $ret);
|
204 |
+
$creditnotesAsInvoices = Komfortkasse_Config::getConfig(Komfortkasse_Config::creditnotes_as_invoices, $ret);
|
205 |
+
$lastOnly = Komfortkasse_Config::getConfig(Komfortkasse_Config::last_receipt_only, $ret);
|
206 |
+
$invoiceColl = $order->getInvoiceCollection();
|
207 |
+
$creditColl = $order->getCreditmemosCollection();
|
208 |
+
$invAmount = 0.0;
|
209 |
+
|
210 |
+
if ($lastOnly) {
|
211 |
+
// nur der letzte Beleg wird übertragen
|
212 |
+
$newestInvoice = null;
|
213 |
+
foreach ($invoiceColl as $invoice) {
|
214 |
+
if (!$invoice->isCanceled()) {
|
215 |
+
if ($newestInvoice == null || $newestInvoice->getCreatedAt() < $invoice->getCreatedAt()) {
|
216 |
+
$newestInvoice = $invoice;
|
217 |
+
}
|
218 |
+
}
|
219 |
+
}
|
220 |
+
$newestCredit = null;
|
221 |
+
if ($creditnotesAsInvoices) {
|
222 |
+
foreach ($creditColl as $credit) {
|
223 |
+
if ($newestCredit == null || $newestCredit->getCreatedAt() < $credit->getCreatedAt()) {
|
224 |
+
$newestCredit = $credit;
|
225 |
+
}
|
226 |
+
}
|
227 |
+
}
|
228 |
+
if ($newestCredit != null || $newestInvoice != null) {
|
229 |
+
if ($newestCredit == null || ($newestInvoice != null && $newestInvoice->getCreatedAt() > $newestCredit->getCreatedAt())) {
|
230 |
+
$ret ['invoice_number'] [] = $newestInvoice->getIncrementId();
|
231 |
+
$ret ['invoice_date'] = date('d.m.Y', strtotime($newestInvoice->getCreatedAt()));
|
232 |
+
$invAmount = $newestInvoice->getGrandTotal();
|
233 |
+
} else if ($newestCredit != null) {
|
234 |
+
$ret ['invoice_number'] [] = $newestCredit->getIncrementId();
|
235 |
+
$ret ['invoice_date'] = date('d.m.Y', strtotime($newestCredit->getCreatedAt()));
|
236 |
+
$invAmount = $newestCredit->getGrandTotal();
|
237 |
+
}
|
238 |
+
}
|
239 |
+
} else {
|
240 |
+
// alle Belege werden übertragen
|
241 |
+
if ($invoiceColl->getSize() > 0 || ($creditnotesAsInvoices && $creditColl->getSize() > 0)) {
|
242 |
+
foreach ($invoiceColl as $invoice) {
|
243 |
+
if (!$invoice->isCanceled()) {
|
244 |
+
$ret ['invoice_number'] [] = $invoice->getIncrementId();
|
245 |
+
$invoiceDate = date('d.m.Y', strtotime($invoice->getCreatedAt()));
|
246 |
+
if ($ret ['invoice_date'] == null || strtotime($ret ['invoice_date']) < strtotime($invoiceDate)) {
|
247 |
+
$ret ['invoice_date'] = $invoiceDate;
|
248 |
+
}
|
249 |
+
$invAmount = $invAmount + $invoice->getGrandTotal();
|
250 |
+
}
|
251 |
+
}
|
252 |
+
if (!$creditnotesAsInvoices && $considerCreditnotes) {
|
253 |
+
foreach ($creditColl as $credit) {
|
254 |
+
$invAmount = $invAmount - $credit->getGrandTotal();
|
255 |
+
}
|
256 |
+
}
|
257 |
+
if ($creditnotesAsInvoices) {
|
258 |
+
foreach ($creditColl as $credit) {
|
259 |
+
$ret ['invoice_number'] [] = $credit->getIncrementId();
|
260 |
+
$invoiceDate = date('d.m.Y', strtotime($credit->getCreatedAt()));
|
261 |
+
if ($ret ['invoice_date'] == null || strtotime($ret ['invoice_date']) < strtotime($invoiceDate)) {
|
262 |
+
$ret ['invoice_date'] = $invoiceDate;
|
263 |
+
}
|
264 |
+
$invAmount = $invAmount + $credit->getGrandTotal();
|
265 |
+
}
|
266 |
+
}
|
267 |
+
}
|
268 |
+
}
|
269 |
+
if ($useInvoiceAmount && $invAmount > 0)
|
270 |
+
$ret ['amount'] = $invAmount;
|
271 |
+
|
272 |
+
$shippingAddress = $order->getShippingAddress();
|
273 |
+
if ($shippingAddress) {
|
274 |
+
$ret ['delivery_firstname'] = utf8_encode($shippingAddress->getFirstname());
|
275 |
+
$ret ['delivery_lastname'] = utf8_encode($shippingAddress->getLastname());
|
276 |
+
$ret ['delivery_company'] = utf8_encode($shippingAddress->getCompany());
|
277 |
+
$ret ['delivery_street'] = utf8_encode($shippingAddress->getStreetFull());
|
278 |
+
$ret ['delivery_postcode'] = utf8_encode($shippingAddress->getPostcode());
|
279 |
+
$ret ['delivery_city'] = utf8_encode($shippingAddress->getCity());
|
280 |
+
$ret ['delivery_countrycode'] = utf8_encode($shippingAddress->getCountryId());
|
281 |
+
}
|
282 |
+
|
283 |
+
$billingAddress = $order->getBillingAddress();
|
284 |
+
if ($billingAddress) {
|
285 |
+
$ret ['language_code'] = substr($conf_general ['locale'] ['code'], 0, 2) . '-' . $billingAddress->getCountryId();
|
286 |
+
$ret ['billing_firstname'] = utf8_encode($billingAddress->getFirstname());
|
287 |
+
$ret ['billing_lastname'] = utf8_encode($billingAddress->getLastname());
|
288 |
+
$ret ['billing_company'] = utf8_encode($billingAddress->getCompany());
|
289 |
+
$ret ['billing_street'] = utf8_encode($billingAddress->getStreetFull());
|
290 |
+
$ret ['billing_postcode'] = utf8_encode($billingAddress->getPostcode());
|
291 |
+
$ret ['billing_city'] = utf8_encode($billingAddress->getCity());
|
292 |
+
$ret ['billing_countrycode'] = utf8_encode($billingAddress->getCountryId());
|
293 |
+
} else {
|
294 |
+
$ret ['language_code'] = substr($conf_general ['locale'] ['code'], 0, 2);
|
295 |
+
}
|
296 |
+
|
297 |
+
foreach ($order->getAllItems() as $itemId => $item) {
|
298 |
+
$sku = $item->getSku();
|
299 |
+
if ($sku) {
|
300 |
+
$ret ['products'] [] = $sku;
|
301 |
+
} else {
|
302 |
+
$ret ['products'] [] = $item->getName();
|
303 |
+
}
|
304 |
+
}
|
305 |
+
|
306 |
+
global $komfortkasse_order_extension;
|
307 |
+
if ($komfortkasse_order_extension && method_exists('Komfortkasse_Order_Extension', 'extendOrder') === true) {
|
308 |
+
$ret = Komfortkasse_Order_Extension::extendOrder($order, $ret);
|
309 |
+
}
|
310 |
+
|
311 |
+
return $ret;
|
312 |
+
|
313 |
+
}
|
314 |
+
|
315 |
+
// end getOrder()
|
316 |
+
|
317 |
+
|
318 |
+
/**
|
319 |
+
* Get refund.
|
320 |
+
*
|
321 |
+
* @param string $number refund number
|
322 |
+
*
|
323 |
+
* @return array refund
|
324 |
+
*/
|
325 |
+
public static function getRefund($number)
|
326 |
+
{
|
327 |
+
$resource = Mage::getSingleton('core/resource');
|
328 |
+
$id = $resource->getConnection('core_read')->fetchOne('SELECT `entity_id` FROM `' . $resource->getTableName('sales/creditmemo') . "` WHERE `increment_id` = '" . $number . "'");
|
329 |
+
|
330 |
+
$creditMemo = Mage::getModel('sales/order_creditmemo')->load($id);
|
331 |
+
if (empty($number) === true || empty($creditMemo) === true || $number != $creditMemo->getIncrementId()) {
|
332 |
+
return null;
|
333 |
+
}
|
334 |
+
|
335 |
+
$ret = array ();
|
336 |
+
$ret ['number'] = $creditMemo->getOrder()->getIncrementId();
|
337 |
+
// Number of the Creditmemo.
|
338 |
+
$ret ['customer_number'] = $creditMemo->getIncrementId();
|
339 |
+
$ret ['date'] = date('d.m.Y', strtotime($creditMemo->getCreatedAt()));
|
340 |
+
$ret ['amount'] = $creditMemo->getGrandTotal();
|
341 |
+
|
342 |
+
return $ret;
|
343 |
+
|
344 |
+
}
|
345 |
+
|
346 |
+
// end getRefund()
|
347 |
+
|
348 |
+
|
349 |
+
/**
|
350 |
+
* Update order.
|
351 |
+
*
|
352 |
+
* @param array $order order
|
353 |
+
* @param string $status status
|
354 |
+
* @param string $callbackid callback ID
|
355 |
+
*
|
356 |
+
* @return void
|
357 |
+
*/
|
358 |
+
public static function updateOrder($order, $status, $callbackid)
|
359 |
+
{
|
360 |
+
if (!Komfortkasse_Config::getConfig(Komfortkasse_Config::activate_update, $order)) {
|
361 |
+
return;
|
362 |
+
}
|
363 |
+
|
364 |
+
// Hint: PAID and CANCELLED are supported as of now.
|
365 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($order ['number']);
|
366 |
+
|
367 |
+
Mage::log('Komfortkasse: update order ' . $order->getIncrementId() . ' START', null, 'komfortkasse.log');
|
368 |
+
Mage::dispatchEvent('komfortkasse_change_order_status_before', array ('order' => $order,'status' => $status,'callbackid' => $callbackid
|
369 |
+
));
|
370 |
+
|
371 |
+
$stateCollection = Mage::getModel('sales/order_status')->getCollection()->joinStates();
|
372 |
+
$stateCollection->addFieldToFilter('main_table.status', array ('like' => $status
|
373 |
+
));
|
374 |
+
$state = $stateCollection->getFirstItem()->getState();
|
375 |
+
|
376 |
+
if ($state == 'processing' || $state == 'closed' || $state == 'complete') {
|
377 |
+
|
378 |
+
// If there is already an invoice, update the invoice, not the order.
|
379 |
+
$invoiceColl = $order->getInvoiceCollection();
|
380 |
+
if ($invoiceColl->getSize() > 0) {
|
381 |
+
foreach ($order->getInvoiceCollection() as $invoice) {
|
382 |
+
Mage::log('Komfortkasse: update order ' . $order->getIncrementId() . ' invoice ' . $invoice->getIncrementId() . ' pay', null, 'komfortkasse.log');
|
383 |
+
$invoice->pay();
|
384 |
+
Mage::log('Komfortkasse: update order ' . $order->getIncrementId() . ' invoice ' . $invoice->getIncrementId() . ' addComment ' . $callbackid, null, 'komfortkasse.log');
|
385 |
+
$invoice->addComment($callbackid, false, false);
|
386 |
+
self::mysave($invoice);
|
387 |
+
}
|
388 |
+
} else {
|
389 |
+
$payment = $order->getPayment();
|
390 |
+
Mage::log('Komfortkasse: update order ' . $order->getIncrementId() . ' payment capture', null, 'komfortkasse.log');
|
391 |
+
$payment->capture(null);
|
392 |
+
|
393 |
+
if ($callbackid) {
|
394 |
+
$payment->setTransactionId($callbackid);
|
395 |
+
Mage::log('Komfortkasse: update order ' . $order->getIncrementId() . ' addTransaction', null, 'komfortkasse.log');
|
396 |
+
$transaction = $payment->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE);
|
397 |
+
}
|
398 |
+
}
|
399 |
+
$order->save();
|
400 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($order->getIncrementId());
|
401 |
+
|
402 |
+
Mage::log('Komfortkasse: update order ' . $order->getIncrementId() . ' add status history ' . $status . ' / ' . $callbackid, null, 'komfortkasse.log');
|
403 |
+
$history = $order->addStatusHistoryComment('' . $callbackid, $status);
|
404 |
+
$order->setStatus($status);
|
405 |
+
$order->save();
|
406 |
+
} else if ($state == 'canceled') {
|
407 |
+
|
408 |
+
if ($callbackid) {
|
409 |
+
Mage::log('Komfortkasse: update order ' . $order->getIncrementId() . ' add status history ' . $status . ' / ' . $callbackid, null, 'komfortkasse.log');
|
410 |
+
$history = $order->addStatusHistoryComment('' . $callbackid, $status);
|
411 |
+
}
|
412 |
+
if ($order->canCancel()) {
|
413 |
+
Mage::log('Komfortkasse: update order ' . $order->getIncrementId() . ' cancel', null, 'komfortkasse.log');
|
414 |
+
$order->cancel();
|
415 |
+
}
|
416 |
+
Mage::log('Komfortkasse: update order ' . $order->getIncrementId() . ' set status ' . $status, null, 'komfortkasse.log');
|
417 |
+
$order->setStatus($status);
|
418 |
+
$order->save();
|
419 |
+
} else {
|
420 |
+
|
421 |
+
Mage::log('Komfortkasse: update order ' . $order->getIncrementId() . ' add status history ' . $status . ' / ' . $callbackid, null, 'komfortkasse.log');
|
422 |
+
$history = $order->addStatusHistoryComment('' . $callbackid, $status);
|
423 |
+
$order->save();
|
424 |
+
}
|
425 |
+
|
426 |
+
Mage::dispatchEvent('komfortkasse_change_order_status_after', array ('order' => $order,'status' => $status,'callbackid' => $callbackid
|
427 |
+
));
|
428 |
+
|
429 |
+
Mage::log('Komfortkasse: update order ' . $order->getIncrementId() . ' END. Status: ' . $order->getStatus, null, 'komfortkasse.log');
|
430 |
+
|
431 |
+
}
|
432 |
+
|
433 |
+
// end updateOrder()
|
434 |
+
|
435 |
+
|
436 |
+
/**
|
437 |
+
* Update order.
|
438 |
+
*
|
439 |
+
* @param string $refundIncrementId Increment ID of refund
|
440 |
+
* @param string $status status
|
441 |
+
* @param string $callbackid callback ID
|
442 |
+
*
|
443 |
+
* @return void
|
444 |
+
*/
|
445 |
+
public static function updateRefund($refundIncrementId, $status, $callbackid)
|
446 |
+
{
|
447 |
+
$resource = Mage::getSingleton('core/resource');
|
448 |
+
$id = $resource->getConnection('core_read')->fetchOne('SELECT `entity_id` FROM `' . $resource->getTableName('sales/creditmemo') . "` WHERE `increment_id` = '" . $refundIncrementId . "'");
|
449 |
+
|
450 |
+
$creditMemo = Mage::getModel('sales/order_creditmemo')->load($id);
|
451 |
+
|
452 |
+
$store_id = $creditMemo->getStoreId();
|
453 |
+
$store_id_order = array ();
|
454 |
+
$store_id_order ['store_id'] = $store_id;
|
455 |
+
|
456 |
+
if (!Komfortkasse_Config::getConfig(Komfortkasse_Config::activate_update, $store_id_order)) {
|
457 |
+
return;
|
458 |
+
}
|
459 |
+
|
460 |
+
if ($creditMemo->getTransactionId() == null) {
|
461 |
+
$creditMemo->setTransactionId($callbackid);
|
462 |
+
}
|
463 |
+
|
464 |
+
$history = $creditMemo->addComment($status . ' [' . $callbackid . ']', false, false);
|
465 |
+
|
466 |
+
$creditMemo->save();
|
467 |
+
|
468 |
+
}
|
469 |
+
|
470 |
+
// end updateRefund()
|
471 |
+
|
472 |
+
|
473 |
+
/**
|
474 |
+
* Call an object's save method
|
475 |
+
*
|
476 |
+
* @param unknown $object
|
477 |
+
*
|
478 |
+
* @return void
|
479 |
+
*/
|
480 |
+
private static function mysave($object)
|
481 |
+
{
|
482 |
+
$object->save();
|
483 |
+
|
484 |
+
}
|
485 |
+
|
486 |
+
|
487 |
+
public static function getInvoicePdfPrepare()
|
488 |
+
{
|
489 |
+
|
490 |
+
}
|
491 |
+
|
492 |
+
|
493 |
+
public static function getInvoicePdf($invoiceNumber, $orderNumber)
|
494 |
+
{
|
495 |
+
if ($invoiceNumber) {
|
496 |
+
|
497 |
+
$invoice = Mage::getModel('sales/order_invoice')->loadByIncrementId($invoiceNumber);
|
498 |
+
$fileName = $invoiceNumber . '.pdf';
|
499 |
+
|
500 |
+
if ($invoice && (!$orderNumber || $invoice->getOrderIncrementId() == $orderNumber)) {
|
501 |
+
|
502 |
+
$pdfGenerated = false;
|
503 |
+
|
504 |
+
// try easy pdf (www.easypdfinvoice.com)
|
505 |
+
if (!$pdfGenerated) {
|
506 |
+
$pdfProModel = Mage::getModel('pdfpro/order_invoice');
|
507 |
+
if ($pdfProModel !== false) {
|
508 |
+
$invoiceData = $pdfProModel->initInvoiceData($invoice);
|
509 |
+
$result = Mage::helper('pdfpro')->initPdf(array ($invoiceData
|
510 |
+
));
|
511 |
+
if ($result ['success']) {
|
512 |
+
$content = $result ['content'];
|
513 |
+
$pdfGenerated = true;
|
514 |
+
}
|
515 |
+
}
|
516 |
+
}
|
517 |
+
|
518 |
+
// try Magento Standard
|
519 |
+
if (!$pdfGenerated) {
|
520 |
+
$pdf = Mage::getModel('sales/order_pdf_invoice')->getPdf(array ($invoice
|
521 |
+
));
|
522 |
+
$content = $pdf->render();
|
523 |
+
}
|
524 |
+
} else if (Komfortkasse_Config::getConfig(Komfortkasse_Config::creditnotes_as_invoices, self::getOrder($orderNumber))) {
|
525 |
+
|
526 |
+
// try credit note
|
527 |
+
$collection = Mage::getResourceModel('sales/order_creditmemo_collection')->addFieldToFilter('increment_id', $invoiceNumber);
|
528 |
+
$credit = $collection->count() == 1 ? $collection->getFirstItem() : null;
|
529 |
+
|
530 |
+
if ($credit && (!$orderNumber || $credit->getOrder()->getIncrementId() == $orderNumber)) {
|
531 |
+
|
532 |
+
$pdfGenerated = false;
|
533 |
+
|
534 |
+
// try easy pdf (www.easypdfinvoice.com)
|
535 |
+
if (!$pdfGenerated) {
|
536 |
+
$pdfProModel = Mage::getModel('pdfpro/order_creditmemo');
|
537 |
+
if ($pdfProModel !== false) {
|
538 |
+
$creditData = $pdfProModel->initCreditmemoData($credit);
|
539 |
+
$result = Mage::helper('pdfpro')->initPdf(array ($creditData
|
540 |
+
));
|
541 |
+
if ($result ['success']) {
|
542 |
+
$content = $result ['content'];
|
543 |
+
// $pdfGenerated = true;
|
544 |
+
}
|
545 |
+
}
|
546 |
+
}
|
547 |
+
|
548 |
+
// try Magento Standard
|
549 |
+
if (!$pdfGenerated) {
|
550 |
+
$pdf = Mage::getModel('sales/order_pdf_creditmemo')->getPdf(array ($credit
|
551 |
+
));
|
552 |
+
$content = $pdf->render();
|
553 |
+
}
|
554 |
+
}
|
555 |
+
|
556 |
+
}
|
557 |
+
|
558 |
+
|
559 |
+
return $content;
|
560 |
+
}
|
561 |
+
|
562 |
+
}
|
563 |
}//end class
|
app/code/community/Ltc/Komfortkasse/etc/config.xml
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
<config>
|
4 |
<modules>
|
5 |
<Ltc_Komfortkasse>
|
6 |
-
<version>1.4.4.
|
7 |
</Ltc_Komfortkasse>
|
8 |
</modules>
|
9 |
<global>
|
@@ -60,6 +60,8 @@
|
|
60 |
<status_open_invoice>complete</status_open_invoice>
|
61 |
<use_invoice_total>0</use_invoice_total>
|
62 |
<consider_creditnotes>0</consider_creditnotes>
|
|
|
|
|
63 |
<status_open_cod>processing</status_open_cod>
|
64 |
</komfortkasse>
|
65 |
</payment>
|
3 |
<config>
|
4 |
<modules>
|
5 |
<Ltc_Komfortkasse>
|
6 |
+
<version>1.4.4.15</version>
|
7 |
</Ltc_Komfortkasse>
|
8 |
</modules>
|
9 |
<global>
|
60 |
<status_open_invoice>complete</status_open_invoice>
|
61 |
<use_invoice_total>0</use_invoice_total>
|
62 |
<consider_creditnotes>0</consider_creditnotes>
|
63 |
+
<creditnotes_as_invoices>0</creditnotes_as_invoices>
|
64 |
+
<last_receipt_only>0</last_receipt_only>
|
65 |
<status_open_cod>processing</status_open_cod>
|
66 |
</komfortkasse>
|
67 |
</payment>
|
app/code/community/Ltc/Komfortkasse/etc/system.xml
CHANGED
@@ -155,6 +155,30 @@
|
|
155 |
<show_in_store>1</show_in_store>
|
156 |
<comment>If using invoice amount: subtract credit notes from total</comment>
|
157 |
</consider_creditnotes>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
|
159 |
|
160 |
|
155 |
<show_in_store>1</show_in_store>
|
156 |
<comment>If using invoice amount: subtract credit notes from total</comment>
|
157 |
</consider_creditnotes>
|
158 |
+
<creditnotes_as_invoices translate="label">
|
159 |
+
<label>Invoice: treat credit notes as invoices</label>
|
160 |
+
<frontend_type>select</frontend_type>
|
161 |
+
<source_model>adminhtml/system_config_source_enabledisable
|
162 |
+
</source_model>
|
163 |
+
<sort_order>98</sort_order>
|
164 |
+
<show_in_default>1</show_in_default>
|
165 |
+
<show_in_website>1</show_in_website>
|
166 |
+
<show_in_store>1</show_in_store>
|
167 |
+
<comment>Treat credit notes as corrected invoices</comment>
|
168 |
+
</creditnotes_as_invoices>
|
169 |
+
<last_receipt_only translate="label">
|
170 |
+
<label>Invoice: use last receipt only</label>
|
171 |
+
<frontend_type>select</frontend_type>
|
172 |
+
<source_model>adminhtml/system_config_source_enabledisable
|
173 |
+
</source_model>
|
174 |
+
<sort_order>99</sort_order>
|
175 |
+
<show_in_default>1</show_in_default>
|
176 |
+
<show_in_website>1</show_in_website>
|
177 |
+
<show_in_store>1</show_in_store>
|
178 |
+
<comment>Do not sum up amounts, only export last receipt (invoice or credit note)</comment>
|
179 |
+
</last_receipt_only>
|
180 |
+
|
181 |
+
|
182 |
|
183 |
|
184 |
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Ltc_Komfortkasse</name>
|
4 |
-
<version>1.4.4.
|
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ätzlich können automatische Zahlungserinnerungen versendet werden u
|
|
13 |

|
14 |
Es ist eine Anmeldung auf www.komfortkasse.eu erforderlich (kostenloses Paket verfügbar).
|
15 |
</description>
|
16 |
-
<notes>
|
17 |
<authors><author><name>Komfortkasse</name><user>komfortkasse</user><email>integration@komfortkasse.eu</email></author></authors>
|
18 |
-
<date>2016-04-
|
19 |
-
<time>14:
|
20 |
-
<contents><target name="magecommunity"><dir name="Ltc"><dir name="Komfortkasse"><dir name="Helper"><file name="Data.php" hash="42f1d168bb70725128e15daf305802ba"/><file name="Komfortkasse.php" hash="
|
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.4.15</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 |

|
14 |
Es ist eine Anmeldung auf www.komfortkasse.eu erforderlich (kostenloses Paket verfügbar).
|
15 |
</description>
|
16 |
+
<notes>Enhanced credit memo handling</notes>
|
17 |
<authors><author><name>Komfortkasse</name><user>komfortkasse</user><email>integration@komfortkasse.eu</email></author></authors>
|
18 |
+
<date>2016-04-27</date>
|
19 |
+
<time>14:20:10</time>
|
20 |
+
<contents><target name="magecommunity"><dir name="Ltc"><dir name="Komfortkasse"><dir name="Helper"><file name="Data.php" hash="42f1d168bb70725128e15daf305802ba"/><file name="Komfortkasse.php" hash="6928d27cd510ef6432a514864c359df5"/><file name="Komfortkasse_Config.php" hash="991250ec3cdbc9b7b79ab38888e3a022"/><file name="Komfortkasse_Order.php" hash="ec56d463cf663646bab504ed60698226"/></dir><dir name="Model"><file name="Encryptionoptions.php" hash="1fbe2ffc43cc3c1489688d20f4c8af11"/><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="6d041151102ad71e584cabaee5ae8065"/><file name="system.xml" hash="4477e69044c79edab2b70691b0236bd8"/></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>
|