Qinvoice_Connect - Version 1.0.14

Version Notes

Compatible with v1.9.0

Download this release

Release Info

Developer Casper Mekel
Extension Qinvoice_Connect
Version 1.0.14
Comparing to
See all releases


Code changes from version 1.0.11 to 1.0.14

app/code/community/Qinvoice/CHANGELOG CHANGED
@@ -1,5 +1,8 @@
1
  CHANGELOG
2
 
 
 
 
3
  v1.0.8 - 2014/04/08
4
  - Fixed type and shipping VAT
5
 
1
  CHANGELOG
2
 
3
+ v1.1.0 - 2014/06/25
4
+ - Added attributes for display on item line
5
+
6
  v1.0.8 - 2014/04/08
7
  - Fixed type and shipping VAT
8
 
app/code/community/Qinvoice/Connect/Model/Order/Observer.Boerdereike.php ADDED
@@ -0,0 +1,619 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //class NameSpaceName_ModuleName_Model_ObserverDir_Observer
3
+ class Qinvoice_Connect_Model_Order_Observer
4
+ {
5
+ public function __construct()
6
+ {
7
+ //parent::__construct();
8
+ }
9
+
10
+ public function sendOnComplete($observer){
11
+ $order = $observer->getEvent()->getOrder();
12
+ // GETTING TRIGGER SETTING
13
+ $db = Mage::getSingleton('core/resource')->getConnection('core_write');
14
+ $varPath = 'invoice_options/invoice/invoice_trigger';
15
+ $prefix = Mage::getConfig()->getTablePrefix();
16
+ $resultTwo = $db->query("SELECT value FROM {$prefix}core_config_data WHERE path LIKE '".$varPath."'");
17
+ $rowTwo = $resultTwo->fetch(PDO::FETCH_ASSOC);
18
+ $varOnOrder = $rowTwo['value'];
19
+
20
+ if($varOnOrder == 'complete' && $order->getState() == Mage_Sales_Model_Order::STATE_COMPLETE){
21
+ $this->createInvoiceForQinvoice($order->getId(), false);
22
+ }else{
23
+ return true;
24
+ }
25
+ }
26
+
27
+ public function sendOnShip($observer){
28
+ $shipment = $observer->getEvent()->getShipment();
29
+ $order = $shipment->getOrder();
30
+
31
+ // GETTING TRIGGER SETTING
32
+ $db = Mage::getSingleton('core/resource')->getConnection('core_write');
33
+ $varPath = 'invoice_options/invoice/invoice_trigger';
34
+ $prefix = Mage::getConfig()->getTablePrefix();
35
+ $resultTwo = $db->query("SELECT value FROM {$prefix}core_config_data WHERE path LIKE '".$varPath."'");
36
+ $rowTwo = $resultTwo->fetch(PDO::FETCH_ASSOC);
37
+ $varOnOrder = $rowTwo['value'];
38
+
39
+ if($varOnOrder == 'ship'){
40
+ $this->createInvoiceForQinvoice($order->getId(), false);
41
+ }else{
42
+ return true;
43
+ }
44
+ }
45
+
46
+ public function sendOnOrder($observer){
47
+ $order = $observer->getEvent()->getOrder();
48
+
49
+
50
+
51
+ // GETTING TRIGGER SETTING
52
+ $db = Mage::getSingleton('core/resource')->getConnection('core_write');
53
+ $varPath = 'invoice_options/invoice/invoice_trigger';
54
+ $prefix = Mage::getConfig()->getTablePrefix();
55
+ $resultTwo = $db->query("SELECT value FROM {$prefix}core_config_data WHERE path LIKE '".$varPath."'");
56
+ $rowTwo = $resultTwo->fetch(PDO::FETCH_ASSOC);
57
+ $varOnOrder = $rowTwo['value'];
58
+
59
+ if($varOnOrder == 'order'){
60
+ $this->createInvoiceForQinvoice($order->getId(), false);
61
+ }else{
62
+ return true;
63
+ }
64
+ }
65
+ /**
66
+ * Exports new orders to an xml file
67
+ * @param Varien_Event_Observer $observer
68
+ * @return Feed_Sales_Model_Order_Observer
69
+ */
70
+ public function sendOnPayment($observer){
71
+ // Gets called even when other payment method is choosen.
72
+
73
+ $order_ids = $observer->getEvent()->getOrderIds();
74
+ $order = $observer->getEvent()->getOrder();
75
+
76
+ // GETTING TRIGGER SETTING
77
+ $db = Mage::getSingleton('core/resource')->getConnection('core_write');
78
+ $varPath = 'invoice_options/invoice/invoice_trigger';
79
+ $prefix = Mage::getConfig()->getTablePrefix();
80
+ $resultTwo = $db->query("SELECT value FROM {$prefix}core_config_data WHERE path LIKE '".$varPath."'");
81
+ $rowTwo = $resultTwo->fetch(PDO::FETCH_ASSOC);
82
+ $varOnOrder = $rowTwo['value'];
83
+
84
+ if($varOnOrder == 'payment'){
85
+ $this->createInvoiceForQinvoice($order_ids[0], true);
86
+ }else{
87
+ return true;
88
+ }
89
+ }
90
+ public function createInvoiceForQinvoice($varOrderID,$ifPaid = false)
91
+ {
92
+ $paid = 0;
93
+ $db = Mage::getSingleton('core/resource')->getConnection('core_write');
94
+ // GETTING ORDER ID
95
+ //$resultOne = $db->query("SELECT max(entity_id) as LastOrderID FROM sales_flat_order");
96
+ //$rowOne = $resultOne->fetch(PDO::FETCH_ASSOC);
97
+
98
+ //$varOrderID = $rowOne['LastOrderID'];
99
+
100
+ $varCurrenyCode = Mage::app()->getStore()->getCurrentCurrency()->getCode();
101
+ // GETTING ORDER STATUS
102
+ $prefix = Mage::getConfig()->getTablePrefix();
103
+ $resultOne = $db->query("SELECT entity_id, status, coupon_code, customer_email, base_currency_code, shipping_description, base_discount_amount, shipping_amount, shipping_tax_amount, increment_id, grand_total, total_paid, billing_address_id, shipping_address_id, customer_taxvat FROM {$prefix}sales_flat_order WHERE entity_id=".$varOrderID);
104
+ $rowOne = $resultOne->fetch(PDO::FETCH_ASSOC);
105
+
106
+
107
+ if($rowOne['status'] == 'processing' || $rowOne['status'] == 'complete' || $rowOne['total_paid'] == $rowOne['grand_total'])
108
+ {
109
+ $varStatus = 'Paid';
110
+ // GETTING API URL
111
+ $varURLPath = 'invoice_options/invoice/paid_remark';
112
+ $prefix = Mage::getConfig()->getTablePrefix();
113
+ $resultURL = $db->query("SELECT value FROM {$prefix}core_config_data WHERE path LIKE '".$varURLPath."'");
114
+ $rowURL = $resultURL->fetch(PDO::FETCH_ASSOC);
115
+ $paid_remark = $rowURL['value'];
116
+ $paid = 1;
117
+ }
118
+ else
119
+ {
120
+ if($ifPaid == true){
121
+ // cancel if invoice has to be paid
122
+ return;
123
+ }
124
+ $paid_remark = '';
125
+ $varStatus = 'Sent';
126
+ }
127
+
128
+ $prefix = Mage::getConfig()->getTablePrefix();
129
+ $result = $db->query("SELECT item_id, product_type, product_id, product_options, order_id, sku, name, description, qty_ordered, base_price, tax_percent, tax_amount, base_discount_amount FROM {$prefix}sales_flat_order_item WHERE order_id=".$varOrderID." AND parent_item_id IS NULL GROUP BY sku HAVING (order_id > 0) ORDER BY item_id desc");
130
+
131
+
132
+ if(!$result) {
133
+ //return false;
134
+ }
135
+ while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
136
+ $arrData[] = $row;
137
+ }
138
+ if(!$arrData) {
139
+ //return false;
140
+ }
141
+ //$comment = '';
142
+ //$comment = $data['comment_text'];
143
+ // getting po_number
144
+ $random_number = rand(0, pow(10, 7));
145
+
146
+ // GETTING API USERNAME
147
+ $varPath = 'invoice_options/invoice/api_username';
148
+ $prefix = Mage::getConfig()->getTablePrefix();
149
+ $resultTwo = $db->query("SELECT value FROM {$prefix}core_config_data WHERE path LIKE '".$varPath."'");
150
+ $rowTwo = $resultTwo->fetch(PDO::FETCH_ASSOC);
151
+ $username = $rowTwo['value'];
152
+
153
+ // GETTING API PASSWORD
154
+ $varPath = 'invoice_options/invoice/api_password';
155
+ $prefix = Mage::getConfig()->getTablePrefix();
156
+ $resultTwo = $db->query("SELECT value FROM {$prefix}core_config_data WHERE path LIKE '".$varPath."'");
157
+ $rowTwo = $resultTwo->fetch(PDO::FETCH_ASSOC);
158
+ $password = $rowTwo['value'];
159
+
160
+ // GETTING LAYOUT CODE
161
+ $varPath = 'invoice_options/invoice/layout_code';
162
+ $prefix = Mage::getConfig()->getTablePrefix();
163
+ $resultTwo = $db->query("SELECT value FROM {$prefix}core_config_data WHERE path LIKE '".$varPath."'");
164
+ $rowTwo = $resultTwo->fetch(PDO::FETCH_ASSOC);
165
+ $layout_code = $rowTwo['value'];
166
+
167
+
168
+ // GETTING CLIENT DETAILS
169
+ $prefix = Mage::getConfig()->getTablePrefix();
170
+ $resultThree = $db->query("SELECT * FROM {$prefix}sales_flat_order_address WHERE entity_id='".$rowOne['billing_address_id']."'");
171
+ $rowThree = $resultThree->fetch(PDO::FETCH_ASSOC);
172
+
173
+ $invoice = new qinvoice($username,$password);
174
+
175
+ $invoice->companyname = $rowThree['company']; // Your customers company name
176
+ $invoice->firstname = $rowThree['firstname']; // Your customers contact name
177
+ $invoice->lastname = $rowThree['lastname']; // Your customers contact name
178
+ $invoice->email = $rowOne['customer_email']; // Your customers emailaddress (invoice will be sent here)
179
+ $invoice->phone = $rowOne['telephone'];
180
+ $invoice->address = $rowThree['street']; // Self-explanatory
181
+ $invoice->zipcode = $rowThree['postcode']; // Self-explanatory
182
+ $invoice->city = $rowThree['city']; // Self-explanatory
183
+ $invoice->country = $rowThree['country_id']; // 2 character country code: NL for Netherlands, DE for Germany etc
184
+ $invoice->vatnumber = strlen($rowThree['vat_id']) > 3 ? $rowThree['vat_id'] : $rowOne['customer_taxvat'];
185
+
186
+ $prefix = Mage::getConfig()->getTablePrefix();
187
+ $resultFour = $db->query("SELECT firstname, lastname, company, email, telephone, street, city, region, postcode, country_id FROM {$prefix}sales_flat_order_address WHERE entity_id='".$rowOne['shipping_address_id']."'");
188
+ $rowFour = $resultFour->fetch(PDO::FETCH_ASSOC);
189
+
190
+ $invoice->delivery_companyname = $rowFour['delivery_company']; // Your customers company name
191
+ $invoice->delivery_firstname = $rowFour['delivery_firstname']; // Your customers contact name
192
+ $invoice->delivery_lastname = $rowFour['delivery_lastname']; // Your customers contact name
193
+ $invoice->delivery_address = $rowFour['street']; // Self-explanatory
194
+ $invoice->delivery_zipcode = $rowFour['postcode']; // Self-explanatory
195
+ $invoice->delivery_city = $rowFour['city']; // Self-explanatory
196
+ $invoice->delivery_country = $rowFour['country_id'];
197
+
198
+ $invoice->vat = ''; // Self-explanatory
199
+ $invoice->paid = $paid;
200
+
201
+ $varActionPath = 'invoice_options/invoice/save_relation';
202
+ $prefix = Mage::getConfig()->getTablePrefix();
203
+
204
+ $resultAction = $db->query("SELECT value FROM {$prefix}core_config_data WHERE path LIKE '".$varActionPath."'");
205
+ $rowAction = $resultAction->fetch(PDO::FETCH_ASSOC);
206
+ $save_relation = $rowAction['value'];
207
+
208
+ $invoice->saverelation = $save_relation;
209
+
210
+ $ddc_data = $db->query("SELECT delivery_date, customer_comment FROM sales_ddc_order WHERE order_id = '".$varOrderID."'");
211
+ $ddc_data_array = $ddc_data->fetch(PDO::FETCH_ASSOC);
212
+
213
+ $varRemarkPath = 'invoice_options/invoice/invoice_remark';
214
+ $prefix = Mage::getConfig()->getTablePrefix();
215
+ $resultRemark = $db->query("SELECT value FROM {$prefix}core_config_data WHERE path LIKE '".$varRemarkPath."'");
216
+ $rowRemark = $resultRemark->fetch(PDO::FETCH_ASSOC);
217
+
218
+ $delivery_date = strlen($_POST['delivery_date']) > 0 ? $_POST['delivery_date'] : $ddc_data_array['delivery_date'];
219
+ $delivery_date = explode(" ", $delivery_date);
220
+ $delivery_date = $delivery_date[0];
221
+ $delivery_date = explode("-",$delivery_date);
222
+
223
+ $d_date = new DateTime();
224
+ $d_date->setDate($delivery_date[0], $delivery_date[1], $delivery_date[2]);
225
+ $delivery_date = $d_date->format('l d-m-Y');
226
+
227
+ $invoice_remark = $rowRemark['value'];
228
+ $invoice_remark = str_replace('{order_id}',$rowOne['increment_id'],$invoice_remark);
229
+ $invoice_remark = str_replace('{shipping_description}',$rowOne['shipping_description'],$invoice_remark);
230
+ $invoice_remark = str_replace('{delivery_date}',$delivery_date,$invoice_remark);
231
+ $invoice_remark = str_replace('{customer_comment}',strlen($_POST['onestepcheckout_comments']) > 0 ? $_POST['onestepcheckout_comments'] : $ddc_data_array['customer_comment'],$invoice_remark);
232
+
233
+ $invoice->remark = $invoice_remark ."\n". $paid_remark;
234
+
235
+ $varActionPath = 'invoice_options/invoice/invoice_action';
236
+ $prefix = Mage::getConfig()->getTablePrefix();
237
+ $resultAction = $db->query("SELECT value FROM {$prefix}core_config_data WHERE path LIKE '".$varActionPath."'");
238
+ $rowAction = $resultAction->fetch(PDO::FETCH_ASSOC);
239
+ $invoice_action = $rowAction['value'];
240
+
241
+ $varLayoutPath = 'invoice_options/invoice/layout_code';
242
+ $prefix = Mage::getConfig()->getTablePrefix();
243
+ $resultLayout = $db->query("SELECT value FROM {$prefix}core_config_data WHERE path LIKE '".$varLayoutPath."'");
244
+ $rowLayout = $resultLayout->fetch(PDO::FETCH_ASSOC);
245
+ $invoice_layout = $rowLayout['value'];
246
+
247
+ $varCalculationmethodPath = 'invoice_options/invoice/calculation_method';
248
+ $prefix = Mage::getConfig()->getTablePrefix();
249
+ $resultCalculationmethod = $db->query("SELECT value FROM {$prefix}core_config_data WHERE path LIKE '".$varCalculationmethodPath."'");
250
+ $rowCalculationmethod = $resultCalculationmethod->fetch(PDO::FETCH_ASSOC);
251
+ $invoice_calculationmethod = $rowCalculationmethod['value'];
252
+
253
+ $invoice->calculation_method = $invoice_calculationmethod;
254
+
255
+ $invoice_layout_s = @unserialize($invoice_layout);
256
+ if ($invoice_layout_s !== false) {
257
+ // serialized
258
+ $invoice_layout = @unserialize($invoice_layout);
259
+ if(isset($invoice_layout[$rowFour['country_id']])){
260
+ $invoice_layout = @$invoice_layout[$rowFour['country_id']];
261
+ }else{
262
+ $invoice_layout = @$invoice_layout['default'];
263
+ }
264
+ } else {
265
+ // not serialized
266
+ $invoice_layout = $invoice_layout;
267
+ }
268
+
269
+ $invoice->setLayout($invoice_layout);
270
+
271
+ $varTagPath = 'invoice_options/invoice/invoice_tag';
272
+ $prefix = Mage::getConfig()->getTablePrefix();
273
+ $resultTag = $db->query("SELECT value FROM {$prefix}core_config_data WHERE path LIKE '".$varTagPath."'");
274
+ $rowTag = $resultTag->fetch(PDO::FETCH_ASSOC);
275
+ $invoice_tag = $rowTag['value'];
276
+
277
+ $varTagPath = 'invoice_options/invoice/product_attributes';
278
+ $prefix = Mage::getConfig()->getTablePrefix();
279
+ $resultTag = $db->query("SELECT value FROM {$prefix}core_config_data WHERE path LIKE '".$varTagPath."'");
280
+ $pa_array = $resultTag->fetch(PDO::FETCH_ASSOC);
281
+
282
+
283
+ $invoice->action = $invoice_action;
284
+
285
+ // OPTIONAL: Add tags
286
+ $invoice->addTag($rowOne['increment_id']);
287
+ $invoice->addTag($invoice_tag);
288
+ // $invoice->addTag('send: '. $send_mail);
289
+ // $invoice->addTag('paid: '. $paid .' '. $rowOne['total_paid']);
290
+
291
+ $attributes = Mage::getResourceModel('catalog/product_attribute_collection')->addVisibleFilter();
292
+ $attributeArray = array();
293
+
294
+ foreach($attributes as $attribute){
295
+ $attributeArray[$attribute->getData('attribute_code')] = $attribute->getData('frontend_label');
296
+ // $attributeArray[] = array(
297
+ // 'label' => $attribute->getData('frontend_label'),
298
+ // 'value' => $attribute->getData('attribute_code')
299
+ // );
300
+ }
301
+
302
+
303
+ for($i=0;$i<count($arrData);$i++)
304
+ {
305
+ $category = '';
306
+ $_productId = $arrData[$i]['product_id'];
307
+ $_product = Mage::getModel('catalog/product')->load($_productId);
308
+ $category = $_product->getData('qinvoice_category');
309
+ $productcode = $_product->getData('qinvoice_productcode');
310
+
311
+ $arrItemOptions = unserialize($arrData[$i]['product_options']);
312
+
313
+ $varDescription = '';
314
+
315
+ //print_r();
316
+
317
+ $product_attributes = explode(",",$pa_array['value']);
318
+ foreach($product_attributes as $pa){
319
+ if(isset($_product[$pa]))
320
+ {
321
+ $varDescription .= " ". $_product[$pa];
322
+ }
323
+ }
324
+
325
+
326
+ if(@$arrItemOptions['options'])
327
+ {
328
+ for($k=0; $k <count($arrItemOptions['options']); $k++)
329
+ {
330
+ $varDescription .= "\n".$arrItemOptions['options'][$k]['label'].": ".$arrItemOptions['options'][$k]['print_value']."\n";
331
+ }
332
+ }
333
+
334
+ if(@$arrItemOptions['attributes_info'])
335
+ {
336
+ for($k=0; $k <count($arrItemOptions['attributes_info']); $k++)
337
+ {
338
+ $varDescription .= "\n".$arrItemOptions['attributes_info'][$k]['label'].": ".$arrItemOptions['attributes_info'][$k]['value']."\n";
339
+ }
340
+ }
341
+
342
+
343
+ //echo $varDescription;
344
+
345
+
346
+ // else
347
+ // {
348
+ // $varDescription = ''; //"[".$arrData[$i]['sku']."] ".trim($arrData[$i]['name']);
349
+ // }
350
+ // print_r($_product);
351
+ // echo '<pre>';
352
+ // print_r( $arrItemOptions );
353
+ // echo '</pre>';
354
+
355
+
356
+
357
+ $params = array(
358
+ 'code' => $productcode,
359
+ 'description' => trim($arrData[$i]['name']) . $varDescription,
360
+ 'price' => $arrData[$i]['base_price']*100,
361
+ //'price_incl' => ((($arrData[$i]['base_price']*$arrData[$i]['qty_ordered'])+$arrData[$i]['tax_amount'])/$arrData[$i]['qty_ordered'])*100,
362
+ 'price_incl' => round(((($arrData[$i]['base_price']*$arrData[$i]['qty_ordered'])+$arrData[$i]['tax_amount'])/$arrData[$i]['qty_ordered'])*100),
363
+ 'price_vat' => ($arrData[$i]['tax_amount']/$arrData[$i]['qty_ordered'])*100,
364
+ 'vatpercentage' => trim(number_format($arrData[$i]['tax_percent'],2,'.', ''))*100,
365
+ 'discount' => trim(number_format($arrData[$i]['base_discount_amount'], 2, '.', '')/$arrData[$i]['base_price'])*100,
366
+ 'quantity' => $arrData[$i]['qty_ordered']*100,
367
+ 'categories' => $category
368
+ );
369
+ //mail('casper@expertnetwork.nl', 'vat', $arrData[$i]['tax_percent']);
370
+
371
+ // echo '<pre>';
372
+ // print_r( $params );
373
+ // echo '</pre>';
374
+ // die();
375
+ $invoice->addItem($params);
376
+
377
+ }
378
+ if($rowOne['shipping_amount'] > 0)
379
+ {
380
+ $params = array(
381
+ 'code' => '',
382
+ 'description' => trim($rowOne['shipping_description']),
383
+ 'price' => $rowOne['shipping_amount']*100,
384
+ 'price_incl' => $rowOne['shipping_incl_tax']*100,
385
+ 'price_vat' => $rowOne['shipping_tax_amount']*100,
386
+ 'vatpercentage' => round(($rowOne['shipping_tax_amount']/$rowOne['shipping_amount'])*100)*100,
387
+ 'discount' => 0,
388
+ 'quantity' => 100,
389
+ 'categories' => 'shipping'
390
+ );
391
+
392
+ $invoice->addItem($params);
393
+
394
+ }
395
+
396
+ if($rowOne['base_discount_amount'] > 0)
397
+ {
398
+ $params = array(
399
+ 'code' => '',
400
+ 'description' => trim($rowOne['coupon_code']),
401
+ 'price' => $rowOne['base_discount_amount']*100,
402
+ 'price_incl' => $rowOne['base_discount_amount']*100,
403
+ 'price_vat' => 0,
404
+ 'vatpercentage' => 0,
405
+ 'discount' => 0,
406
+ 'quantity' => 100,
407
+ 'categories' => 'discount'
408
+ );
409
+
410
+ $invoice->addItem($params);
411
+
412
+ }
413
+
414
+
415
+ $result = $invoice->sendRequest();
416
+ if($result == 1){
417
+ //notify_to_admin('Casper Mekel','casper@newday.sk','Invoice generated!');
418
+ }else{
419
+ //notify_to_admin('Casper Mekel','casper@newday.sk','Something went wrong!');
420
+ }
421
+
422
+ return true;
423
+
424
+
425
+ //$curlInvoiveResult = $this->sendCurlRequest($createInvoiceXML);
426
+ }
427
+
428
+ public function notify_to_admin($name, $email, $msg)
429
+ {
430
+ $varSubject = 'Qinvoice Notification';
431
+
432
+ //Mage::log($msg);
433
+
434
+ $mail = Mage::getModel('core/email');
435
+ $mail->setToName($name);
436
+ $mail->setToEmail($email);
437
+ $mail->setBody($msg);
438
+ $mail->setSubject($varSubject);
439
+ $mail->setFromEmail("support@qinvoice.com");
440
+ $mail->setFromName("Qinvoice Development");
441
+ $mail->setType('text');
442
+ $mail->send();
443
+ }
444
+ }
445
+
446
+ class qinvoice{
447
+
448
+ protected $gateway = '';
449
+ private $username;
450
+ private $password;
451
+
452
+ public $companyname;
453
+ public $firstname;
454
+ public $lastname;
455
+ public $email;
456
+ public $address;
457
+ public $zipcode;
458
+ public $city;
459
+ public $country;
460
+ public $delivery_companyname;
461
+ public $delivery_firstname;
462
+ public $delivery_lastname;
463
+ public $delivery_address;
464
+ public $delivery_zipcode;
465
+ public $delivery_city;
466
+ public $delivery_country;
467
+ public $vatnumber;
468
+ public $remark;
469
+ public $paid;
470
+ public $action;
471
+
472
+ public $layout;
473
+
474
+ private $tags = array();
475
+ private $items = array();
476
+ private $files = array();
477
+ private $recurring;
478
+
479
+ function __construct($username, $password){
480
+ $this->username = $username;
481
+ $this->password = $password;
482
+ $this->recurring = 'none';
483
+
484
+ $db = Mage::getSingleton('core/resource')->getConnection('core_write');
485
+
486
+ // GETTING API URL
487
+ $varURLPath = 'invoice_options/invoice/api_url';
488
+ $prefix = Mage::getConfig()->getTablePrefix();
489
+ $resultURL = $db->query("SELECT value FROM {$prefix}core_config_data WHERE path LIKE '".$varURLPath."'");
490
+ $rowURL = $resultURL->fetch(PDO::FETCH_ASSOC);
491
+ $apiURL = $rowURL['value'];
492
+
493
+ $this->gateway = $apiURL;
494
+ }
495
+
496
+ public function addTag($tag){
497
+ $this->tags[] = $tag;
498
+ }
499
+
500
+ public function setLayout($code){
501
+ $this->layout = $code;
502
+ }
503
+
504
+ public function setRecurring($recurring){
505
+ $this->recurring = strtolower($recurring);
506
+ }
507
+
508
+ public function addItem($params){
509
+ $item['code'] = (isset($params['code']) ? $params['code'] : "");
510
+ $item['description'] = $params['description'];
511
+ $item['price'] = $params['price'];
512
+ $item['price_incl'] = $params['price_incl'];
513
+ $item['price_vat'] = $params['price_vat'];
514
+ $item['vatpercentage'] = $params['vatpercentage'];
515
+ $item['discount'] = $params['discount'];
516
+ $item['quantity'] = $params['quantity'];
517
+ $item['categories'] = $params['categories'];
518
+ $this->items[] = $item;
519
+ }
520
+
521
+ public function addFile($name, $url){
522
+ $this->files[] = array('url' => $url, 'name' => $name);
523
+ }
524
+
525
+ public function sendRequest() {
526
+ $content = "<?xml version='1.0' encoding='UTF-8'?>";
527
+ $content .= $this->buildXML();
528
+
529
+ $headers = array("Content-type: application/atom+xml");
530
+ $ch = curl_init();
531
+ curl_setopt($ch, CURLOPT_URL, $this->gateway );
532
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
533
+ curl_setopt($ch, CURLOPT_TIMEOUT, 120);
534
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
535
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
536
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
537
+ $data = curl_exec($ch);
538
+ if (curl_errno($ch)) {
539
+ print curl_error($ch);
540
+ } else {
541
+ curl_close($ch);
542
+ }
543
+ if($data == 1){
544
+ return true;
545
+ }else{
546
+ return false;
547
+ }
548
+
549
+ }
550
+
551
+ private function buildXML(){
552
+ $string = '<request>
553
+ <login mode="newInvoice">
554
+ <username><![CDATA['.$this->username.']]></username>
555
+ <password><![CDATA['.$this->password.']]></password>
556
+ <identifier><![CDATA[Magento_1.0.9]]></identifier>
557
+ </login>
558
+ <invoice>
559
+ <companyname><![CDATA['. $this->companyname .']]></companyname>
560
+ <firstname><![CDATA['. $this->firstname .']]></firstname>
561
+ <lastname><![CDATA['. $this->lastname .']]></lastname>
562
+ <email><![CDATA['. $this->email .']]></email>
563
+ <phone><![CDATA['. $this->phone .']]></phone>
564
+ <address><![CDATA['. $this->address .']]></address>
565
+ <zipcode><![CDATA['. $this->zipcode .']]></zipcode>
566
+ <city><![CDATA['. $this->city .']]></city>
567
+ <country><![CDATA['. $this->country .']]></country>
568
+
569
+ <delivery_companyname><![CDATA['. $this->delivery_companyname .']]></delivery_companyname>
570
+ <delivery_firstname><![CDATA['. $this->delivery_firstname .']]></delivery_firstname>
571
+ <delivery_lastname><![CDATA['. $this->delivery_lastname .']]></delivery_lastname>
572
+ <delivery_address><![CDATA['. $this->delivery_address .']]></delivery_address>
573
+ <delivery_zipcode><![CDATA['. $this->delivery_zipcode .']]></delivery_zipcode>
574
+ <delivery_city><![CDATA['. $this->delivery_city .']]></delivery_city>
575
+ <delivery_country><![CDATA['. $this->delivery_country .']]></delivery_country>
576
+
577
+ <vat><![CDATA['. $this->vatnumber .']]></vat>
578
+ <recurring><![CDATA['. $this->recurring .']]></recurring>
579
+ <remark><![CDATA['. $this->remark .']]></remark>
580
+ <layout><![CDATA['. $this->layout .']]></layout>
581
+ <paid><![CDATA['. $this->paid .']]></paid>
582
+ <action><![CDATA['. $this->action .']]></action>
583
+ <calculation_method><![CDATA['. $this->calculation_method .']]></calculation_method>
584
+ <tags>';
585
+ foreach($this->tags as $tag){
586
+ $string .= '<tag><![CDATA['. $tag .']]></tag>';
587
+ }
588
+
589
+ $string .= '</tags>
590
+ <items>';
591
+ foreach($this->items as $i){
592
+
593
+ $string .= '<item>
594
+ <code><![CDATA['. $i['code'] .']]></code>
595
+ <quantity><![CDATA['. $i['quantity'] .']]></quantity>
596
+ <description><![CDATA['. $i['description'] .']]></description>
597
+ <price>'. $i['price'] .'</price>
598
+ <price_incl>'. $i['price_incl'] .'</price_incl>
599
+ <price_vat>'. $i['price_vat'] .'</price_vat>
600
+ <vatpercentage>'. $i['vatpercentage'] .'</vatpercentage>
601
+ <discount>'. $i['discount'] .'</discount>
602
+ <categories><![CDATA['. $i['categories'] .']]></categories>
603
+
604
+ </item>';
605
+ }
606
+
607
+ $string .= '</items>
608
+ <files>';
609
+ foreach($this->files as $f){
610
+ $string .= '<file url="'.$f['url'].'">'.$f['name'].'</file>';
611
+ }
612
+ $string .= '</files>
613
+ </invoice>
614
+ </request>';
615
+ return $string;
616
+ }
617
+ }
618
+
619
+ ?>
app/code/community/Qinvoice/Connect/Model/Order/Observer.php CHANGED
@@ -167,7 +167,7 @@ class Qinvoice_Connect_Model_Order_Observer
167
 
168
  // GETTING CLIENT DETAILS
169
  $prefix = Mage::getConfig()->getTablePrefix();
170
- $resultThree = $db->query("SELECT firstname, lastname, company, email, telephone, street, city, region, postcode, country_id, vat_id FROM {$prefix}sales_flat_order_address WHERE entity_id='".$rowOne['billing_address_id']."'");
171
  $rowThree = $resultThree->fetch(PDO::FETCH_ASSOC);
172
 
173
  $invoice = new qinvoice($username,$password);
@@ -187,9 +187,9 @@ class Qinvoice_Connect_Model_Order_Observer
187
  $resultFour = $db->query("SELECT firstname, lastname, company, email, telephone, street, city, region, postcode, country_id FROM {$prefix}sales_flat_order_address WHERE entity_id='".$rowOne['shipping_address_id']."'");
188
  $rowFour = $resultFour->fetch(PDO::FETCH_ASSOC);
189
 
190
- $invoice->delivery_companyname = $rowFour['delivery_company']; // Your customers company name
191
- $invoice->delivery_firstname = $rowFour['delivery_firstname']; // Your customers contact name
192
- $invoice->delivery_lastname = $rowFour['delivery_lastname']; // Your customers contact name
193
  $invoice->delivery_address = $rowFour['street']; // Self-explanatory
194
  $invoice->delivery_zipcode = $rowFour['postcode']; // Self-explanatory
195
  $invoice->delivery_city = $rowFour['city']; // Self-explanatory
@@ -200,18 +200,23 @@ class Qinvoice_Connect_Model_Order_Observer
200
 
201
  $varActionPath = 'invoice_options/invoice/save_relation';
202
  $prefix = Mage::getConfig()->getTablePrefix();
 
203
  $resultAction = $db->query("SELECT value FROM {$prefix}core_config_data WHERE path LIKE '".$varActionPath."'");
204
  $rowAction = $resultAction->fetch(PDO::FETCH_ASSOC);
205
  $save_relation = $rowAction['value'];
206
 
207
  $invoice->saverelation = $save_relation;
208
-
209
  $varRemarkPath = 'invoice_options/invoice/invoice_remark';
210
  $prefix = Mage::getConfig()->getTablePrefix();
211
  $resultRemark = $db->query("SELECT value FROM {$prefix}core_config_data WHERE path LIKE '".$varRemarkPath."'");
212
  $rowRemark = $resultRemark->fetch(PDO::FETCH_ASSOC);
 
213
  $invoice_remark = $rowRemark['value'];
214
- $invoice->remark = str_replace('{order_id}',$rowOne['increment_id'],$invoice_remark) .' '. $paid_remark; // Self-explanatory
 
 
 
215
 
216
  $varActionPath = 'invoice_options/invoice/invoice_action';
217
  $prefix = Mage::getConfig()->getTablePrefix();
@@ -255,6 +260,12 @@ class Qinvoice_Connect_Model_Order_Observer
255
  $rowTag = $resultTag->fetch(PDO::FETCH_ASSOC);
256
  $invoice_tag = $rowTag['value'];
257
 
 
 
 
 
 
 
258
  $invoice->action = $invoice_action;
259
 
260
  // OPTIONAL: Add tags
@@ -263,6 +274,17 @@ class Qinvoice_Connect_Model_Order_Observer
263
  // $invoice->addTag('send: '. $send_mail);
264
  // $invoice->addTag('paid: '. $paid .' '. $rowOne['total_paid']);
265
 
 
 
 
 
 
 
 
 
 
 
 
266
 
267
  for($i=0;$i<count($arrData);$i++)
268
  {
@@ -275,6 +297,18 @@ class Qinvoice_Connect_Model_Order_Observer
275
  $arrItemOptions = unserialize($arrData[$i]['product_options']);
276
 
277
  $varDescription = '';
 
 
 
 
 
 
 
 
 
 
 
 
278
  if(@$arrItemOptions['options'])
279
  {
280
  for($k=0; $k <count($arrItemOptions['options']); $k++)
@@ -282,7 +316,7 @@ class Qinvoice_Connect_Model_Order_Observer
282
  $varDescription .= "\n".$arrItemOptions['options'][$k]['label'].": ".$arrItemOptions['options'][$k]['print_value']."\n";
283
  }
284
  }
285
- else
286
  if(@$arrItemOptions['attributes_info'])
287
  {
288
  for($k=0; $k <count($arrItemOptions['attributes_info']); $k++)
@@ -290,17 +324,28 @@ class Qinvoice_Connect_Model_Order_Observer
290
  $varDescription .= "\n".$arrItemOptions['attributes_info'][$k]['label'].": ".$arrItemOptions['attributes_info'][$k]['value']."\n";
291
  }
292
  }
293
- else
294
- {
295
- $varDescription = ''; //"[".$arrData[$i]['sku']."] ".trim($arrData[$i]['name']);
296
- }
 
 
 
 
 
 
 
 
 
 
 
297
 
298
  $params = array(
299
  'code' => $productcode,
300
  'description' => "[".$arrData[$i]['sku']."] ".trim($arrData[$i]['name']) . $varDescription,
301
  'price' => $arrData[$i]['base_price']*100,
302
  //'price_incl' => ((($arrData[$i]['base_price']*$arrData[$i]['qty_ordered'])+$arrData[$i]['tax_amount'])/$arrData[$i]['qty_ordered'])*100,
303
- 'price_incl' => round((($arrData[$i]['base_price']*$arrData[$i]['qty_ordered'])+$arrData[$i]['tax_amount'])/$arrData[$i]['qty_ordered'])*100,
304
  'price_vat' => ($arrData[$i]['tax_amount']/$arrData[$i]['qty_ordered'])*100,
305
  'vatpercentage' => trim(number_format($arrData[$i]['tax_percent'],2,'.', ''))*100,
306
  'discount' => trim(number_format($arrData[$i]['base_discount_amount'], 2, '.', '')/$arrData[$i]['base_price'])*100,
@@ -308,6 +353,11 @@ class Qinvoice_Connect_Model_Order_Observer
308
  'categories' => $category
309
  );
310
  //mail('casper@expertnetwork.nl', 'vat', $arrData[$i]['tax_percent']);
 
 
 
 
 
311
  $invoice->addItem($params);
312
 
313
  }
@@ -328,6 +378,8 @@ class Qinvoice_Connect_Model_Order_Observer
328
  $invoice->addItem($params);
329
 
330
  }
 
 
331
 
332
 
333
  $result = $invoice->sendRequest();
@@ -336,6 +388,7 @@ class Qinvoice_Connect_Model_Order_Observer
336
  }else{
337
  //notify_to_admin('Casper Mekel','casper@newday.sk','Something went wrong!');
338
  }
 
339
  return true;
340
 
341
 
167
 
168
  // GETTING CLIENT DETAILS
169
  $prefix = Mage::getConfig()->getTablePrefix();
170
+ $resultThree = $db->query("SELECT * FROM {$prefix}sales_flat_order_address WHERE entity_id='".$rowOne['billing_address_id']."'");
171
  $rowThree = $resultThree->fetch(PDO::FETCH_ASSOC);
172
 
173
  $invoice = new qinvoice($username,$password);
187
  $resultFour = $db->query("SELECT firstname, lastname, company, email, telephone, street, city, region, postcode, country_id FROM {$prefix}sales_flat_order_address WHERE entity_id='".$rowOne['shipping_address_id']."'");
188
  $rowFour = $resultFour->fetch(PDO::FETCH_ASSOC);
189
 
190
+ $invoice->delivery_companyname = $rowFour['company']; // Your customers company name
191
+ $invoice->delivery_firstname = $rowFour['firstname']; // Your customers contact name
192
+ $invoice->delivery_lastname = $rowFour['lastname']; // Your customers contact name
193
  $invoice->delivery_address = $rowFour['street']; // Self-explanatory
194
  $invoice->delivery_zipcode = $rowFour['postcode']; // Self-explanatory
195
  $invoice->delivery_city = $rowFour['city']; // Self-explanatory
200
 
201
  $varActionPath = 'invoice_options/invoice/save_relation';
202
  $prefix = Mage::getConfig()->getTablePrefix();
203
+
204
  $resultAction = $db->query("SELECT value FROM {$prefix}core_config_data WHERE path LIKE '".$varActionPath."'");
205
  $rowAction = $resultAction->fetch(PDO::FETCH_ASSOC);
206
  $save_relation = $rowAction['value'];
207
 
208
  $invoice->saverelation = $save_relation;
209
+
210
  $varRemarkPath = 'invoice_options/invoice/invoice_remark';
211
  $prefix = Mage::getConfig()->getTablePrefix();
212
  $resultRemark = $db->query("SELECT value FROM {$prefix}core_config_data WHERE path LIKE '".$varRemarkPath."'");
213
  $rowRemark = $resultRemark->fetch(PDO::FETCH_ASSOC);
214
+
215
  $invoice_remark = $rowRemark['value'];
216
+ $invoice_remark = str_replace('{order_id}',$rowOne['increment_id'],$invoice_remark);
217
+ $invoice_remark = str_replace('{shipping_description}',$rowOne['shipping_description'],$invoice_remark);
218
+
219
+ $invoice->remark = $invoice_remark ."\n". $paid_remark;
220
 
221
  $varActionPath = 'invoice_options/invoice/invoice_action';
222
  $prefix = Mage::getConfig()->getTablePrefix();
260
  $rowTag = $resultTag->fetch(PDO::FETCH_ASSOC);
261
  $invoice_tag = $rowTag['value'];
262
 
263
+ $varTagPath = 'invoice_options/invoice/product_attributes';
264
+ $prefix = Mage::getConfig()->getTablePrefix();
265
+ $resultTag = $db->query("SELECT value FROM {$prefix}core_config_data WHERE path LIKE '".$varTagPath."'");
266
+ $pa_array = $resultTag->fetch(PDO::FETCH_ASSOC);
267
+
268
+
269
  $invoice->action = $invoice_action;
270
 
271
  // OPTIONAL: Add tags
274
  // $invoice->addTag('send: '. $send_mail);
275
  // $invoice->addTag('paid: '. $paid .' '. $rowOne['total_paid']);
276
 
277
+ $attributes = Mage::getResourceModel('catalog/product_attribute_collection')->addVisibleFilter();
278
+ $attributeArray = array();
279
+
280
+ foreach($attributes as $attribute){
281
+ $attributeArray[$attribute->getData('attribute_code')] = $attribute->getData('frontend_label');
282
+ // $attributeArray[] = array(
283
+ // 'label' => $attribute->getData('frontend_label'),
284
+ // 'value' => $attribute->getData('attribute_code')
285
+ // );
286
+ }
287
+
288
 
289
  for($i=0;$i<count($arrData);$i++)
290
  {
297
  $arrItemOptions = unserialize($arrData[$i]['product_options']);
298
 
299
  $varDescription = '';
300
+
301
+ //print_r();
302
+
303
+ $product_attributes = explode(",",$pa_array['value']);
304
+ foreach($product_attributes as $pa){
305
+ if(isset($_product[$pa]))
306
+ {
307
+ $varDescription .= "\n". $attributeArray[$pa] .': '. $_product[$pa];
308
+ }
309
+ }
310
+
311
+
312
  if(@$arrItemOptions['options'])
313
  {
314
  for($k=0; $k <count($arrItemOptions['options']); $k++)
316
  $varDescription .= "\n".$arrItemOptions['options'][$k]['label'].": ".$arrItemOptions['options'][$k]['print_value']."\n";
317
  }
318
  }
319
+
320
  if(@$arrItemOptions['attributes_info'])
321
  {
322
  for($k=0; $k <count($arrItemOptions['attributes_info']); $k++)
324
  $varDescription .= "\n".$arrItemOptions['attributes_info'][$k]['label'].": ".$arrItemOptions['attributes_info'][$k]['value']."\n";
325
  }
326
  }
327
+
328
+
329
+ //echo $varDescription;
330
+
331
+
332
+ // else
333
+ // {
334
+ // $varDescription = ''; //"[".$arrData[$i]['sku']."] ".trim($arrData[$i]['name']);
335
+ // }
336
+ // print_r($_product);
337
+ // echo '<pre>';
338
+ // print_r( $arrItemOptions );
339
+ // echo '</pre>';
340
+
341
+
342
 
343
  $params = array(
344
  'code' => $productcode,
345
  'description' => "[".$arrData[$i]['sku']."] ".trim($arrData[$i]['name']) . $varDescription,
346
  'price' => $arrData[$i]['base_price']*100,
347
  //'price_incl' => ((($arrData[$i]['base_price']*$arrData[$i]['qty_ordered'])+$arrData[$i]['tax_amount'])/$arrData[$i]['qty_ordered'])*100,
348
+ 'price_incl' => round(((($arrData[$i]['base_price']*$arrData[$i]['qty_ordered'])+$arrData[$i]['tax_amount'])/$arrData[$i]['qty_ordered'])*100),
349
  'price_vat' => ($arrData[$i]['tax_amount']/$arrData[$i]['qty_ordered'])*100,
350
  'vatpercentage' => trim(number_format($arrData[$i]['tax_percent'],2,'.', ''))*100,
351
  'discount' => trim(number_format($arrData[$i]['base_discount_amount'], 2, '.', '')/$arrData[$i]['base_price'])*100,
353
  'categories' => $category
354
  );
355
  //mail('casper@expertnetwork.nl', 'vat', $arrData[$i]['tax_percent']);
356
+
357
+ // echo '<pre>';
358
+ // print_r( $params );
359
+ // echo '</pre>';
360
+ // die();
361
  $invoice->addItem($params);
362
 
363
  }
378
  $invoice->addItem($params);
379
 
380
  }
381
+
382
+
383
 
384
 
385
  $result = $invoice->sendRequest();
388
  }else{
389
  //notify_to_admin('Casper Mekel','casper@newday.sk','Something went wrong!');
390
  }
391
+
392
  return true;
393
 
394
 
app/code/community/Qinvoice/Connect/Model/Source/Attribute.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qinvoice_Connect_Model_Source_Attribute
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ $attributes = Mage::getResourceModel('catalog/product_attribute_collection')->addVisibleFilter();
7
+ $attributeArray = array();
8
+
9
+ foreach($attributes as $attribute){
10
+ $attributeArray[] = array(
11
+ 'label' => $attribute->getData('frontend_label'),
12
+ 'value' => $attribute->getData('attribute_code')
13
+ );
14
+ }
15
+ return $attributeArray;
16
+ }
17
+ }
18
+ ?>
app/code/community/Qinvoice/Connect/etc/config.xml CHANGED
@@ -3,7 +3,7 @@
3
  <config>
4
  <modules>
5
  <Qinvoice_Connect>
6
- <version>1.0.8</version>
7
  </Qinvoice_Connect>
8
  </modules>
9
  <global>
3
  <config>
4
  <modules>
5
  <Qinvoice_Connect>
6
+ <version>1.1.0</version>
7
  </Qinvoice_Connect>
8
  </modules>
9
  <global>
app/code/community/Qinvoice/Connect/etc/system.xml CHANGED
@@ -60,7 +60,7 @@
60
  </layout_code>
61
  <invoice_remark translate="label">
62
  <label>Invoice remark</label>
63
- <frontend_type>text</frontend_type>
64
  <sort_order>5</sort_order>
65
  <show_in_default>1</show_in_default>
66
  <show_in_website>1</show_in_website>
@@ -125,6 +125,16 @@
125
  <show_in_store>1</show_in_store>
126
  <comment><![CDATA[Select leading price type]]></comment>
127
  </calculation_method>
 
 
 
 
 
 
 
 
 
 
128
  </fields>
129
  </invoice>
130
  </groups>
60
  </layout_code>
61
  <invoice_remark translate="label">
62
  <label>Invoice remark</label>
63
+ <frontend_type>textarea</frontend_type>
64
  <sort_order>5</sort_order>
65
  <show_in_default>1</show_in_default>
66
  <show_in_website>1</show_in_website>
125
  <show_in_store>1</show_in_store>
126
  <comment><![CDATA[Select leading price type]]></comment>
127
  </calculation_method>
128
+ <product_attributes translate="label">
129
+ <label>Products attributes</label>
130
+ <frontend_type>multiselect</frontend_type>
131
+ <source_model>invoice/source_attribute</source_model>
132
+ <sort_order>11</sort_order>
133
+ <show_in_default>1</show_in_default>
134
+ <show_in_website>1</show_in_website>
135
+ <show_in_store>1</show_in_store>
136
+ <comment><![CDATA[Select one or more attributes to show on product line]]></comment>
137
+ </product_attributes>
138
  </fields>
139
  </invoice>
140
  </groups>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Qinvoice_Connect</name>
4
- <version>1.0.11</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Connects to q-invoice for sending invoices.</summary>
10
  <description>Manage your financial adminstration with q-invoice. All orders are invoiced through q-invoice and automatically added to your administration.</description>
11
- <notes>Updated dependencies</notes>
12
  <authors><author><name>Casper Mekel</name><user>caspermekel</user><email>info@q-invoice.com</email></author></authors>
13
- <date>2014-05-08</date>
14
- <time>10:15:57</time>
15
- <contents><target name="magecommunity"><dir name="Qinvoice"><file name="CHANGELOG" hash="0d74bdf10f2ba282635d709c28e1f236"/><dir name="Connect"><dir name="etc"><file name="config.xml" hash="7d3b9ce125aebb532dc6bd6fb1453665"/><file name="system.xml" hash="83e6dd86e5488715edb32c180cfbf35c"/></dir><dir name="Helper"><file name="Data.php" hash="ccb4b09674319e8b20e9c06a94adfa38"/></dir><dir name="Model"><dir name="Order"><file name="Observer.php" hash="d06521f2a8b374f7f71f8e1b7e37c4e6"/></dir><dir name="Source"><file name="Invoice.php" hash="4661f369f7e116fd761e5fffac9efeaf"/><file name="Method.php" hash="ac6891fc7e403250b24f5b0f2d6199bc"/><file name="Relation.php" hash="89ab031937b846ab5f0bcac7ccaa31b7"/><file name="Trigger.php" hash="e65427cc9773baaedae2b3897c7bf28a"/></dir></dir><file name="readme.txt" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Qinvoice_Connect.xml" hash="fbedefa4e926092705c6941ad28f51f8"/></dir></target></contents>
16
  <compatible/>
17
- <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6.0.0</min><max>1.8.1.0</max></package><extension><name>curl</name><min>5.1</min><max>6.0</max></extension></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Qinvoice_Connect</name>
4
+ <version>1.0.14</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Connects to q-invoice for sending invoices.</summary>
10
  <description>Manage your financial adminstration with q-invoice. All orders are invoiced through q-invoice and automatically added to your administration.</description>
11
+ <notes>Compatible with v1.9.0</notes>
12
  <authors><author><name>Casper Mekel</name><user>caspermekel</user><email>info@q-invoice.com</email></author></authors>
13
+ <date>2014-11-04</date>
14
+ <time>13:07:46</time>
15
+ <contents><target name="magecommunity"><dir name="Qinvoice"><file name="CHANGELOG" hash="fe63e41117f38a39736c3354a7b1d11d"/><dir name="Connect"><dir name="etc"><file name="config.xml" hash="eaf8853232705f786452282ca065d53d"/><file name="system.xml" hash="0f7c10edfb8942199b277a0170babe30"/></dir><dir name="Helper"><file name="Data.php" hash="ccb4b09674319e8b20e9c06a94adfa38"/></dir><dir name="Model"><dir name="Order"><file name="Observer.Boerdereike.php" hash="8ecdeaa4e9a41de7d5debfaf22967761"/><file name="Observer.php" hash="beaa2c78539e48b6a3204138737d2418"/></dir><dir name="Source"><file name="Attribute.php" hash="72f35ffb8cd873d2c5e1e448ff4bf4e2"/><file name="Invoice.php" hash="4661f369f7e116fd761e5fffac9efeaf"/><file name="Method.php" hash="ac6891fc7e403250b24f5b0f2d6199bc"/><file name="Relation.php" hash="89ab031937b846ab5f0bcac7ccaa31b7"/><file name="Trigger.php" hash="e65427cc9773baaedae2b3897c7bf28a"/></dir></dir><file name="readme.txt" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Qinvoice_Connect.xml" hash="fbedefa4e926092705c6941ad28f51f8"/></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><extension><name>curl</name><min>5.1</min><max>6.0</max></extension></required></dependencies>
18
  </package>