Qinvoice_Connect - Version 1.0.2

Version Notes

Added options for invoice action after trigger.
0) Generate concept
1) Finalize invoice
2) Finalize and send

Added support for product code
- Add attribute qinvoice_productcode
- If the product code matches a product in q-invoice, stock will be updated.

Added support for delivery address
- The delivery address is now sent printed on the invoices and packaging slips

*IMPORTANT*
Use API version 1.1 with this plugin

Download this release

Release Info

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


Code changes from version 1.0.1 to 1.0.2

app/code/community/Qinvoice/Connect/Model/Order/Observer.php CHANGED
@@ -10,14 +10,16 @@ class Qinvoice_Connect_Model_Order_Observer
10
  public function sendOnOrder($observer){
11
  $order = $observer->getEvent()->getOrder();
12
 
 
 
13
  // GETTING TRIGGER SETTING
14
  $db = Mage::getSingleton('core/resource')->getConnection('core_write');
15
- $varPath = 'invoice_options/invoice/invoice_on_order';
16
  $resultTwo = $db->query("SELECT value FROM core_config_data WHERE path LIKE '".$varPath."'");
17
  $rowTwo = $resultTwo->fetch(PDO::FETCH_ASSOC);
18
  $varOnOrder = $rowTwo['value'];
19
 
20
- if($varOnOrder == 1){
21
  $this->createInvoiceForQinvoice($order->getId(), false);
22
  }else{
23
  return true;
@@ -36,12 +38,12 @@ class Qinvoice_Connect_Model_Order_Observer
36
 
37
  // GETTING TRIGGER SETTING
38
  $db = Mage::getSingleton('core/resource')->getConnection('core_write');
39
- $varPath = 'invoice_options/invoice/invoice_on_order';
40
  $resultTwo = $db->query("SELECT value FROM core_config_data WHERE path LIKE '".$varPath."'");
41
  $rowTwo = $resultTwo->fetch(PDO::FETCH_ASSOC);
42
  $varOnOrder = $rowTwo['value'];
43
 
44
- if($varOnOrder == 0){
45
  $this->createInvoiceForQinvoice($order_ids[0], true);
46
  }else{
47
  return true;
@@ -59,7 +61,7 @@ class Qinvoice_Connect_Model_Order_Observer
59
 
60
  $varCurrenyCode = Mage::app()->getStore()->getCurrentCurrency()->getCode();
61
  // GETTING ORDER STATUS
62
- $resultOne = $db->query("SELECT entity_id, status, customer_email, base_currency_code, shipping_description, shipping_amount, shipping_tax_amount, increment_id, grand_total, total_paid FROM sales_flat_order WHERE entity_id=".$varOrderID);
63
  $rowOne = $resultOne->fetch(PDO::FETCH_ASSOC);
64
 
65
 
@@ -120,18 +122,28 @@ class Qinvoice_Connect_Model_Order_Observer
120
 
121
 
122
  // GETTING CLIENT DETAILS
123
- $resultThree = $db->query("SELECT firstname, lastname, company, email, telephone, street, city, region, postcode FROM sales_flat_order_address WHERE email='".$rowOne['customer_email']."'");
124
  $rowThree = $resultThree->fetch(PDO::FETCH_ASSOC);
125
 
126
  $invoice = new qinvoice($username,$password);
127
 
128
- $invoice->companyname = $rowThree['firstname'].' '.$rowThree['lastname']; // Your customers company name
129
- $invoice->contactname = $rowThree['firstname'].' '.$rowThree['lastname']; // Your customers contact name
 
130
  $invoice->email = $rowOne['customer_email']; // Your customers emailaddress (invoice will be sent here)
131
  $invoice->address = $rowThree['street']; // Self-explanatory
132
  $invoice->zipcode = $rowThree['postcode']; // Self-explanatory
133
  $invoice->city = $rowThree['city']; // Self-explanatory
134
  $invoice->country = ''; // 2 character country code: NL for Netherlands, DE for Germany etc
 
 
 
 
 
 
 
 
 
135
  $invoice->vat = ''; // Self-explanatory
136
  $invoice->paid = $paid;
137
 
@@ -141,10 +153,10 @@ class Qinvoice_Connect_Model_Order_Observer
141
  $invoice_remark = $rowRemark['value'];
142
  $invoice->remark = str_replace('{order_id}',$rowOne['increment_id'],$invoice_remark) .' '. $paid_remark; // Self-explanatory
143
 
144
- $varSendPath = 'invoice_options/invoice/send_mail';
145
- $resultSend = $db->query("SELECT value FROM core_config_data WHERE path LIKE '".$varSendPath."'");
146
- $rowSend = $resultSend->fetch(PDO::FETCH_ASSOC);
147
- $send_mail = $rowSend['value'];
148
 
149
  $varLayoutPath = 'invoice_options/invoice/layout_code';
150
  $resultLayout = $db->query("SELECT value FROM core_config_data WHERE path LIKE '".$varLayoutPath."'");
@@ -158,7 +170,7 @@ class Qinvoice_Connect_Model_Order_Observer
158
  $rowTag = $resultTag->fetch(PDO::FETCH_ASSOC);
159
  $invoice_tag = $rowTag['value'];
160
 
161
- $invoice->send = $send_mail;
162
 
163
  // OPTIONAL: Add tags
164
  $invoice->addTag($rowOne['increment_id']);
@@ -173,6 +185,7 @@ class Qinvoice_Connect_Model_Order_Observer
173
  $_productId = $arrData[$i]['product_id'];
174
  $_product = Mage::getModel('catalog/product')->load($_productId);
175
  $category = $_product->getData('qinvoice_category');
 
176
 
177
  $arrItemOptions = unserialize($arrData[$i]['product_options']);
178
 
@@ -197,6 +210,7 @@ class Qinvoice_Connect_Model_Order_Observer
197
  $varDescription = "[".$arrData[$i]['sku']."] ".trim($arrData[$i]['name']);
198
  }
199
  $params = array(
 
200
  'description' => $arrData[$i]['name'] ."\n". $varDescription,
201
  'price' => $arrData[$i]['base_price']*100,
202
  'vatpercentage' => trim(number_format($arrData[$i]['tax_percent'],2,'.', ''))*100,
@@ -234,33 +248,6 @@ class Qinvoice_Connect_Model_Order_Observer
234
 
235
 
236
  //$curlInvoiveResult = $this->sendCurlRequest($createInvoiceXML);
237
-
238
- // GETTING SEND MAIL SETTING
239
- $db = Mage::getSingleton('core/resource')->getConnection('core_write');
240
- $varPath = 'invoice_options/invoice/send_mail';
241
- $resultTwo = $db->query("SELECT value FROM core_config_data WHERE path LIKE '".$varPath."'");
242
- $rowTwo = $resultTwo->fetch(PDO::FETCH_ASSOC);
243
- $varSendMailFlag = $rowTwo['value'];
244
-
245
- if($varSendMailFlag && 1==2)
246
- {
247
- $xml = stripslashes($curlInvoiveResult);
248
- $objXml = new SimpleXMLElement($xml);
249
- $arrParamList = $this->objectsIntoArray($objXml);
250
-
251
- if($arrParamList['@attributes']['status'] == '200')
252
- {
253
- $varInvoiceID = $arrParamList['invoice_id'];
254
-
255
- $varSendInvoiceXml = '<?xml version="1.0" encoding="utf-8"?>
256
- <request method="sendInvoiceMail">
257
- <invoice_id>'.$varInvoiceID.'</invoice_id>
258
- </request>';
259
- $curlInvoiceSendResult = $this->sendCurlRequest($varSendInvoiceXml);
260
-
261
- }
262
-
263
- }
264
  }
265
 
266
  public function notify_to_admin($name, $email, $msg)
@@ -288,15 +275,21 @@ class qinvoice{
288
  private $password;
289
 
290
  public $companyname;
291
- public $contactname;
 
292
  public $email;
293
  public $address;
 
294
  public $city;
295
  public $country;
 
 
 
 
296
  public $vatnumber;
297
  public $remark;
298
  public $paid;
299
- public $send;
300
 
301
  public $layout;
302
 
@@ -334,6 +327,7 @@ class qinvoice{
334
  }
335
 
336
  public function addItem($params){
 
337
  $item['description'] = $params['description'];
338
  $item['price'] = $params['price'];
339
  $item['vatpercentage'] = $params['vatpercentage'];
@@ -381,18 +375,25 @@ class qinvoice{
381
  </login>
382
  <invoice>
383
  <companyname>'. $this->companyname .'</companyname>
384
- <contactname>'. $this->contactname .'</contactname>
 
385
  <email>'. $this->email .'</email>
386
  <address>'. $this->address .'</address>
387
  <zipcode>'. $this->zipcode .'</zipcode>
388
  <city>'. $this->city .'</city>
389
  <country>'. $this->country .'</country>
 
 
 
 
 
 
390
  <vat>'. $this->vatnumber .'</vat>
391
  <recurring>'. $this->recurring .'</recurring>
392
  <remark>'. $this->remark .'</remark>
393
  <layout>'. $this->layout .'</layout>
394
  <paid>'. $this->paid .'</paid>
395
- <send>'. $this->send .'</send>
396
  <tags>';
397
  foreach($this->tags as $tag){
398
  $string .= '<tag>'. $tag .'</tag>';
@@ -403,6 +404,7 @@ class qinvoice{
403
  foreach($this->items as $i){
404
 
405
  $string .= '<item>
 
406
  <quantity>'. $i['quantity'] .'</quantity>
407
  <description>'. $i['description'] .'</description>
408
  <price>'. $i['price'] .'</price>
10
  public function sendOnOrder($observer){
11
  $order = $observer->getEvent()->getOrder();
12
 
13
+
14
+
15
  // GETTING TRIGGER SETTING
16
  $db = Mage::getSingleton('core/resource')->getConnection('core_write');
17
+ $varPath = 'invoice_options/invoice/invoice_trigger';
18
  $resultTwo = $db->query("SELECT value FROM core_config_data WHERE path LIKE '".$varPath."'");
19
  $rowTwo = $resultTwo->fetch(PDO::FETCH_ASSOC);
20
  $varOnOrder = $rowTwo['value'];
21
 
22
+ if($varOnOrder == 'order'){
23
  $this->createInvoiceForQinvoice($order->getId(), false);
24
  }else{
25
  return true;
38
 
39
  // GETTING TRIGGER SETTING
40
  $db = Mage::getSingleton('core/resource')->getConnection('core_write');
41
+ $varPath = 'invoice_options/invoice/invoice_trigger';
42
  $resultTwo = $db->query("SELECT value FROM core_config_data WHERE path LIKE '".$varPath."'");
43
  $rowTwo = $resultTwo->fetch(PDO::FETCH_ASSOC);
44
  $varOnOrder = $rowTwo['value'];
45
 
46
+ if($varOnOrder == 'payment'){
47
  $this->createInvoiceForQinvoice($order_ids[0], true);
48
  }else{
49
  return true;
61
 
62
  $varCurrenyCode = Mage::app()->getStore()->getCurrentCurrency()->getCode();
63
  // GETTING ORDER STATUS
64
+ $resultOne = $db->query("SELECT entity_id, status, customer_email, base_currency_code, shipping_description, shipping_amount, shipping_tax_amount, increment_id, grand_total, total_paid, billing_address_id, shipping_address_id FROM sales_flat_order WHERE entity_id=".$varOrderID);
65
  $rowOne = $resultOne->fetch(PDO::FETCH_ASSOC);
66
 
67
 
122
 
123
 
124
  // GETTING CLIENT DETAILS
125
+ $resultThree = $db->query("SELECT firstname, lastname, company, email, telephone, street, city, region, postcode FROM sales_flat_order_address WHERE entity_id='".$rowOne['billing_address_id']."'");
126
  $rowThree = $resultThree->fetch(PDO::FETCH_ASSOC);
127
 
128
  $invoice = new qinvoice($username,$password);
129
 
130
+ $invoice->companyname = $rowThree['company']; // Your customers company name
131
+ $invoice->firstname = $rowThree['firstname']; // Your customers contact name
132
+ $invoice->lastname = $rowThree['lastname']; // Your customers contact name
133
  $invoice->email = $rowOne['customer_email']; // Your customers emailaddress (invoice will be sent here)
134
  $invoice->address = $rowThree['street']; // Self-explanatory
135
  $invoice->zipcode = $rowThree['postcode']; // Self-explanatory
136
  $invoice->city = $rowThree['city']; // Self-explanatory
137
  $invoice->country = ''; // 2 character country code: NL for Netherlands, DE for Germany etc
138
+
139
+ $resultFour = $db->query("SELECT firstname, lastname, company, email, telephone, street, city, region, postcode FROM sales_flat_order_address WHERE entity_id='".$rowOne['shipping_address_id']."'");
140
+ $rowFour = $resultFour->fetch(PDO::FETCH_ASSOC);
141
+
142
+ $invoice->delivery_address = $rowFour['street']; // Self-explanatory
143
+ $invoice->delivery_zipcode = $rowFour['postcode']; // Self-explanatory
144
+ $invoice->delivery_city = $rowFour['city']; // Self-explanatory
145
+ $invoice->delivery_country = '';
146
+
147
  $invoice->vat = ''; // Self-explanatory
148
  $invoice->paid = $paid;
149
 
153
  $invoice_remark = $rowRemark['value'];
154
  $invoice->remark = str_replace('{order_id}',$rowOne['increment_id'],$invoice_remark) .' '. $paid_remark; // Self-explanatory
155
 
156
+ $varActionPath = 'invoice_options/invoice/invoice_action';
157
+ $resultAction = $db->query("SELECT value FROM core_config_data WHERE path LIKE '".$varActionPath."'");
158
+ $rowAction = $resultAction->fetch(PDO::FETCH_ASSOC);
159
+ $invoice_action = $rowAction['value'];
160
 
161
  $varLayoutPath = 'invoice_options/invoice/layout_code';
162
  $resultLayout = $db->query("SELECT value FROM core_config_data WHERE path LIKE '".$varLayoutPath."'");
170
  $rowTag = $resultTag->fetch(PDO::FETCH_ASSOC);
171
  $invoice_tag = $rowTag['value'];
172
 
173
+ $invoice->action = $invoice_action;
174
 
175
  // OPTIONAL: Add tags
176
  $invoice->addTag($rowOne['increment_id']);
185
  $_productId = $arrData[$i]['product_id'];
186
  $_product = Mage::getModel('catalog/product')->load($_productId);
187
  $category = $_product->getData('qinvoice_category');
188
+ $productcode = $_product->getData('qinvoice_productcode');
189
 
190
  $arrItemOptions = unserialize($arrData[$i]['product_options']);
191
 
210
  $varDescription = "[".$arrData[$i]['sku']."] ".trim($arrData[$i]['name']);
211
  }
212
  $params = array(
213
+ 'code' => $productcode,
214
  'description' => $arrData[$i]['name'] ."\n". $varDescription,
215
  'price' => $arrData[$i]['base_price']*100,
216
  'vatpercentage' => trim(number_format($arrData[$i]['tax_percent'],2,'.', ''))*100,
248
 
249
 
250
  //$curlInvoiveResult = $this->sendCurlRequest($createInvoiceXML);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
  }
252
 
253
  public function notify_to_admin($name, $email, $msg)
275
  private $password;
276
 
277
  public $companyname;
278
+ public $firstname;
279
+ public $lastname;
280
  public $email;
281
  public $address;
282
+ public $zipcode;
283
  public $city;
284
  public $country;
285
+ public $delivery_address;
286
+ public $delivery_zipcode;
287
+ public $delivery_city;
288
+ public $delivery_country;
289
  public $vatnumber;
290
  public $remark;
291
  public $paid;
292
+ public $action;
293
 
294
  public $layout;
295
 
327
  }
328
 
329
  public function addItem($params){
330
+ $item['code'] = $params['code'];
331
  $item['description'] = $params['description'];
332
  $item['price'] = $params['price'];
333
  $item['vatpercentage'] = $params['vatpercentage'];
375
  </login>
376
  <invoice>
377
  <companyname>'. $this->companyname .'</companyname>
378
+ <firstname>'. $this->firstname .'</firstname>
379
+ <lastname>'. $this->lastname .'</lastname>
380
  <email>'. $this->email .'</email>
381
  <address>'. $this->address .'</address>
382
  <zipcode>'. $this->zipcode .'</zipcode>
383
  <city>'. $this->city .'</city>
384
  <country>'. $this->country .'</country>
385
+
386
+ <delivery_address>'. $this->delivery_address .'</delivery_address>
387
+ <delivery_zipcode>'. $this->delivery_zipcode .'</delivery_zipcode>
388
+ <delivery_city>'. $this->delivery_city .'</delivery_city>
389
+ <delivery_country>'. $this->delivery_country .'</delivery_country>
390
+
391
  <vat>'. $this->vatnumber .'</vat>
392
  <recurring>'. $this->recurring .'</recurring>
393
  <remark>'. $this->remark .'</remark>
394
  <layout>'. $this->layout .'</layout>
395
  <paid>'. $this->paid .'</paid>
396
+ <action>'. $this->action .'</action>
397
  <tags>';
398
  foreach($this->tags as $tag){
399
  $string .= '<tag>'. $tag .'</tag>';
404
  foreach($this->items as $i){
405
 
406
  $string .= '<item>
407
+ <code>'. $i['code'] .'</code>
408
  <quantity>'. $i['quantity'] .'</quantity>
409
  <description>'. $i['description'] .'</description>
410
  <price>'. $i['price'] .'</price>
app/code/community/Qinvoice/Connect/Model/Source/Invoice.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qinvoice_Connect_Model_Source_Invoice
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ return array(
7
+ array('value' => 0, 'label' => 'Save invoice as concept'),
8
+ array('value' => 1, 'label' => 'Finalize invoice'),
9
+ array('value' => 2, 'label' => 'Finalize and send via email')
10
+ );
11
+ }
12
+ }
13
+ ?>
app/code/community/Qinvoice/Connect/Model/Source/Trigger.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Qinvoice_Connect_Model_Source_Trigger
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ return array(
7
+ array('value' => 'order', 'label' =>'On every order'),
8
+ array('value' => 'payment', 'label' => 'Only on successful payment')
9
+ );
10
+ }
11
+ }
12
+ ?>
app/code/community/Qinvoice/Connect/etc/config.xml CHANGED
@@ -3,7 +3,7 @@
3
  <config>
4
  <modules>
5
  <Qinvoice_Connect>
6
- <version>1.0.1</version>
7
  </Qinvoice_Connect>
8
  </modules>
9
  <global>
3
  <config>
4
  <modules>
5
  <Qinvoice_Connect>
6
+ <version>1.0.2</version>
7
  </Qinvoice_Connect>
8
  </modules>
9
  <global>
app/code/community/Qinvoice/Connect/etc/system.xml CHANGED
@@ -31,7 +31,7 @@
31
  <show_in_default>1</show_in_default>
32
  <show_in_website>1</show_in_website>
33
  <show_in_store>1</show_in_store>
34
- <comment><![CDATA[e.g. https://app.q-invoice.com/api/xml/1.0/]]></comment>
35
  </api_url>
36
  <api_username translate="label">
37
  <label>API Username</label>
@@ -85,26 +85,27 @@
85
  <show_in_store>1</show_in_store>
86
  <comment><![CDATA[e.g. Your payment has been received.]]></comment>
87
  </paid_remark>
88
- <invoice_on_order translate="label">
89
- <label>Generate invoice on order</label>
90
  <frontend_type>select</frontend_type>
91
- <source_model>adminhtml/system_config_source_yesno</source_model>
92
  <sort_order>7</sort_order>
93
  <show_in_default>1</show_in_default>
94
  <show_in_website>1</show_in_website>
95
  <show_in_store>1</show_in_store>
96
- <comment><![CDATA[Yes: invoice for every order. No: invoice for every payment.]]></comment>
97
- </invoice_on_order>
98
- <send_mail translate="label">
99
- <label>Send invoice to customer</label>
100
  <frontend_type>select</frontend_type>
101
- <source_model>adminhtml/system_config_source_yesno</source_model>
102
  <sort_order>8</sort_order>
103
  <show_in_default>1</show_in_default>
104
  <show_in_website>1</show_in_website>
105
  <show_in_store>1</show_in_store>
106
- <comment><![CDATA[Send email with invoice to customer.]]></comment>
107
- </send_mail>
 
108
  </fields>
109
  </invoice>
110
  </groups>
31
  <show_in_default>1</show_in_default>
32
  <show_in_website>1</show_in_website>
33
  <show_in_store>1</show_in_store>
34
+ <comment><![CDATA[e.g. https://app.q-invoice.com/api/xml/1.1/]]></comment>
35
  </api_url>
36
  <api_username translate="label">
37
  <label>API Username</label>
85
  <show_in_store>1</show_in_store>
86
  <comment><![CDATA[e.g. Your payment has been received.]]></comment>
87
  </paid_remark>
88
+ <invoice_trigger translate="label">
89
+ <label>Send invoice request on</label>
90
  <frontend_type>select</frontend_type>
91
+ <source_model>invoice/source_trigger</source_model>
92
  <sort_order>7</sort_order>
93
  <show_in_default>1</show_in_default>
94
  <show_in_website>1</show_in_website>
95
  <show_in_store>1</show_in_store>
96
+ <comment><![CDATA[Select invoice trigger moment]]></comment>
97
+ </invoice_trigger>
98
+ <invoice_action translate="label">
99
+ <label>After request</label>
100
  <frontend_type>select</frontend_type>
101
+ <source_model>invoice/source_invoice</source_model>
102
  <sort_order>8</sort_order>
103
  <show_in_default>1</show_in_default>
104
  <show_in_website>1</show_in_website>
105
  <show_in_store>1</show_in_store>
106
+ <comment><![CDATA[Create invoice and send to customer?]]></comment>
107
+ </invoice_action>
108
+
109
  </fields>
110
  </invoice>
111
  </groups>
app/code/community/Qinvoice/Connect/readme.txt ADDED
File without changes
app/code/community/Qinvoice/Invoice_/Helper/Data.php DELETED
@@ -1,4 +0,0 @@
1
- <?php
2
- class Qinvoice_Invoice_Helper_Data extends Mage_Core_Helper_Abstract
3
- {
4
- }
 
 
 
 
app/code/community/Qinvoice/Invoice_/Order/Observer.php DELETED
@@ -1,422 +0,0 @@
1
- <?php
2
- //class NameSpaceName_ModuleName_Model_ObserverDir_Observer
3
- class Qinvoice_Invoice_Order_Observer
4
- {
5
- public function __contruct()
6
- {
7
-
8
- }
9
-
10
- public function sendOnOrder($observer){
11
- $order = $observer->getEvent()->getOrder();
12
-
13
- // GETTING TRIGGER SETTING
14
- $db = Mage::getSingleton('core/resource')->getConnection('core_write');
15
- $varPath = 'invoice_options/invoice/invoice_on_order';
16
- $resultTwo = $db->query("SELECT value FROM core_config_data WHERE path LIKE '".$varPath."'");
17
- $rowTwo = $resultTwo->fetch(PDO::FETCH_ASSOC);
18
- $varOnOrder = $rowTwo['value'];
19
-
20
- if($varOnOrder == 1){
21
- $this->createInvoiceForQinvoice($order->getId(), false);
22
- }else{
23
- return true;
24
- }
25
- }
26
- /**
27
- * Exports new orders to an xml file
28
- * @param Varien_Event_Observer $observer
29
- * @return Feed_Sales_Model_Order_Observer
30
- */
31
- public function sendOnPayment($observer){
32
- // Gets called even when other payment method is choosen.
33
-
34
- $order_ids = $observer->getEvent()->getOrderIds();
35
- $order = $observer->getEvent()->getOrder();
36
-
37
- // GETTING TRIGGER SETTING
38
- $db = Mage::getSingleton('core/resource')->getConnection('core_write');
39
- $varPath = 'invoice_options/invoice/invoice_on_order';
40
- $resultTwo = $db->query("SELECT value FROM core_config_data WHERE path LIKE '".$varPath."'");
41
- $rowTwo = $resultTwo->fetch(PDO::FETCH_ASSOC);
42
- $varOnOrder = $rowTwo['value'];
43
-
44
- if($varOnOrder == 0){
45
- $this->createInvoiceForQinvoice($order_ids[0], true);
46
- }else{
47
- return true;
48
- }
49
- }
50
- public function createInvoiceForQinvoice($varOrderID,$ifPaid = false)
51
- {
52
- $paid = 0;
53
- $db = Mage::getSingleton('core/resource')->getConnection('core_write');
54
- // GETTING ORDER ID
55
- //$resultOne = $db->query("SELECT max(entity_id) as LastOrderID FROM sales_flat_order");
56
- //$rowOne = $resultOne->fetch(PDO::FETCH_ASSOC);
57
-
58
- //$varOrderID = $rowOne['LastOrderID'];
59
-
60
- $varCurrenyCode = Mage::app()->getStore()->getCurrentCurrency()->getCode();
61
- // GETTING ORDER STATUS
62
- $resultOne = $db->query("SELECT entity_id, status, customer_email, base_currency_code, shipping_description, shipping_amount, shipping_tax_amount, increment_id, grand_total, total_paid FROM sales_flat_order WHERE entity_id=".$varOrderID);
63
- $rowOne = $resultOne->fetch(PDO::FETCH_ASSOC);
64
-
65
-
66
- if($rowOne['status'] == 'processing' || $rowOne['status'] == 'complete' || $rowOne['total_paid'] == $rowOne['grand_total'])
67
- {
68
- $varStatus = 'Paid';
69
- // GETTING API URL
70
- $varURLPath = 'invoice_options/invoice/paid_remark';
71
- $resultURL = $db->query("SELECT value FROM core_config_data WHERE path LIKE '".$varURLPath."'");
72
- $rowURL = $resultURL->fetch(PDO::FETCH_ASSOC);
73
- $paid_remark = $rowURL['value'];
74
- $paid = 1;
75
- }
76
- else
77
- {
78
- if($ifPaid == true){
79
- // cancel if invoice has to be paid
80
- return;
81
- }
82
- $paid_remark = '';
83
- $varStatus = 'Sent';
84
- }
85
-
86
- $result = $db->query("SELECT item_id, product_type, product_options, order_id, sku, name, description, qty_ordered, base_price, tax_percent, tax_amount, base_discount_amount FROM 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");
87
-
88
- if(!$result) {
89
- //return false;
90
- }
91
- while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
92
- $arrData[] = $row;
93
- }
94
- if(!$arrData) {
95
- //return false;
96
- }
97
- //$comment = '';
98
- //$comment = $data['comment_text'];
99
- // getting po_number
100
- $random_number = rand(0, pow(10, 7));
101
-
102
- // GETTING API USERNAME
103
- $varPath = 'invoice_options/invoice/api_username';
104
- $resultTwo = $db->query("SELECT value FROM core_config_data WHERE path LIKE '".$varPath."'");
105
- $rowTwo = $resultTwo->fetch(PDO::FETCH_ASSOC);
106
- $username = $rowTwo['value'];
107
-
108
- // GETTING API PASSWORD
109
- $varPath = 'invoice_options/invoice/api_password';
110
- $resultTwo = $db->query("SELECT value FROM core_config_data WHERE path LIKE '".$varPath."'");
111
- $rowTwo = $resultTwo->fetch(PDO::FETCH_ASSOC);
112
- $password = $rowTwo['value'];
113
-
114
- // GETTING LAYOUT CODE
115
- $varPath = 'invoice_options/invoice/layout_code';
116
- $resultTwo = $db->query("SELECT value FROM core_config_data WHERE path LIKE '".$varPath."'");
117
- $rowTwo = $resultTwo->fetch(PDO::FETCH_ASSOC);
118
- $layout_code = $rowTwo['value'];
119
-
120
-
121
- // GETTING CLIENT DETAILS
122
- $resultThree = $db->query("SELECT firstname, lastname, company, email, telephone, street, city, region, postcode FROM sales_flat_order_address WHERE email='".$rowOne['customer_email']."'");
123
- $rowThree = $resultThree->fetch(PDO::FETCH_ASSOC);
124
-
125
- $invoice = new qinvoice($username,$password);
126
-
127
- $invoice->companyname = $rowThree['firstname'].' '.$rowThree['lastname']; // Your customers company name
128
- $invoice->contactname = $rowThree['firstname'].' '.$rowThree['lastname']; // Your customers contact name
129
- $invoice->email = $rowOne['customer_email']; // Your customers emailaddress (invoice will be sent here)
130
- $invoice->address = $rowThree['street']; // Self-explanatory
131
- $invoice->zipcode = $rowThree['postcode']; // Self-explanatory
132
- $invoice->city = $rowThree['city']; // Self-explanatory
133
- $invoice->country = ''; // 2 character country code: NL for Netherlands, DE for Germany etc
134
- $invoice->vat = ''; // Self-explanatory
135
- $invoice->paid = $paid;
136
-
137
- $varRemarkPath = 'invoice_options/invoice/invoice_remark';
138
- $resultRemark = $db->query("SELECT value FROM core_config_data WHERE path LIKE '".$varRemarkPath."'");
139
- $rowRemark = $resultRemark->fetch(PDO::FETCH_ASSOC);
140
- $invoice_remark = $rowRemark['value'];
141
- $invoice->remark = str_replace('{order_id}',$rowOne['increment_id'],$invoice_remark) .' '. $paid_remark; // Self-explanatory
142
-
143
- $varSendPath = 'invoice_options/invoice/send_mail';
144
- $resultSend = $db->query("SELECT value FROM core_config_data WHERE path LIKE '".$varSendPath."'");
145
- $rowSend = $resultSend->fetch(PDO::FETCH_ASSOC);
146
- $send_mail = $rowSend['value'];
147
-
148
- $varLayoutPath = 'invoice_options/invoice/layout_code';
149
- $resultLayout = $db->query("SELECT value FROM core_config_data WHERE path LIKE '".$varLayoutPath."'");
150
- $rowLayout = $resultLayout->fetch(PDO::FETCH_ASSOC);
151
- $invoice_layout = $rowLayout['value'];
152
-
153
- $invoice->setLayout($invoice_layout);
154
-
155
- $varTagPath = 'invoice_options/invoice/invoice_tag';
156
- $resultTag = $db->query("SELECT value FROM core_config_data WHERE path LIKE '".$varTagPath."'");
157
- $rowTag = $resultTag->fetch(PDO::FETCH_ASSOC);
158
- $invoice_tag = $rowTag['value'];
159
-
160
- $invoice->send = $send_mail;
161
-
162
- // OPTIONAL: Add tags
163
- $invoice->addTag($rowOne['increment_id']);
164
- $invoice->addTag($invoice_tag);
165
- // $invoice->addTag('send: '. $send_mail);
166
- // $invoice->addTag('paid: '. $paid .' '. $rowOne['total_paid']);
167
-
168
-
169
- for($i=0;$i<count($arrData);$i++)
170
- {
171
- $arrItemOptions = unserialize($arrData[$i]['product_options']);
172
-
173
- $varDescription = '';
174
- if(@$arrItemOptions['options'])
175
- {
176
- for($k=0; $k <count($arrItemOptions['options']); $k++)
177
- {
178
- $varDescription .= $arrItemOptions['options'][$k]['label'].": ".$arrItemOptions['options'][$k]['print_value']."\n";
179
- }
180
- }
181
- else
182
- if(@$arrItemOptions['attributes_info'])
183
- {
184
- for($k=0; $k <count($arrItemOptions['attributes_info']); $k++)
185
- {
186
- $varDescription .= $arrItemOptions['attributes_info'][$k]['label'].": ".$arrItemOptions['attributes_info'][$k]['value']."\n";
187
- }
188
- }
189
- else
190
- {
191
- $varDescription = "[".$arrData[$i]['sku']."] ".trim($arrData[$i]['name']);
192
- }
193
- $params = array(
194
- 'description' => $arrData[$i]['name'] ."\n". $varDescription,
195
- 'price' => $arrData[$i]['base_price']*100,
196
- 'vatpercentage' => trim(number_format($arrData[$i]['tax_percent'],2,'.', ''))*100,
197
- 'discount' => trim(number_format($arrData[$i]['base_discount_amount'], 2, '.', '')/$arrData[$i]['base_price'])*100,
198
- 'quantity' => $arrData[$i]['qty_ordered']*100,
199
- 'categories' => ''
200
- );
201
- //mail('casper@expertnetwork.nl', 'vat', $arrData[$i]['tax_percent']);
202
- $invoice->addItem($params);
203
-
204
- }
205
- if($rowOne['shipping_amount'] > 0)
206
- {
207
- $params = array(
208
- 'description' => trim($rowOne['shipping_description']),
209
- 'price' => $rowOne['shipping_amount']*100,
210
- 'vatpercentage' => ($rowOne['shipping_tax_amount']/$rowOne['shipping_amount'])*100,
211
- 'discount' => 0,
212
- 'quantity' => 100,
213
- 'categories' => 'shipping'
214
- );
215
-
216
- $invoice->addItem($params);
217
-
218
- }
219
-
220
-
221
- $result = $invoice->sendRequest();
222
- if($result == 1){
223
- //notify_to_admin('Casper Mekel','casper@newday.sk','Invoice generated!');
224
- }else{
225
- //notify_to_admin('Casper Mekel','casper@newday.sk','Something went wrong!');
226
- }
227
- return true;
228
-
229
-
230
- //$curlInvoiveResult = $this->sendCurlRequest($createInvoiceXML);
231
-
232
- // GETTING SEND MAIL SETTING
233
- $db = Mage::getSingleton('core/resource')->getConnection('core_write');
234
- $varPath = 'invoice_options/invoice/send_mail';
235
- $resultTwo = $db->query("SELECT value FROM core_config_data WHERE path LIKE '".$varPath."'");
236
- $rowTwo = $resultTwo->fetch(PDO::FETCH_ASSOC);
237
- $varSendMailFlag = $rowTwo['value'];
238
-
239
- if($varSendMailFlag && 1==2)
240
- {
241
- $xml = stripslashes($curlInvoiveResult);
242
- $objXml = new SimpleXMLElement($xml);
243
- $arrParamList = $this->objectsIntoArray($objXml);
244
-
245
- if($arrParamList['@attributes']['status'] == '200')
246
- {
247
- $varInvoiceID = $arrParamList['invoice_id'];
248
-
249
- $varSendInvoiceXml = '<?xml version="1.0" encoding="utf-8"?>
250
- <request method="sendInvoiceMail">
251
- <invoice_id>'.$varInvoiceID.'</invoice_id>
252
- </request>';
253
- $curlInvoiceSendResult = $this->sendCurlRequest($varSendInvoiceXml);
254
-
255
- }
256
-
257
- }
258
- }
259
-
260
- public function notify_to_admin($name, $email, $msg)
261
- {
262
- $varSubject = 'Qinvoice Notification';
263
-
264
- //Mage::log($msg);
265
-
266
- $mail = Mage::getModel('core/email');
267
- $mail->setToName($name);
268
- $mail->setToEmail($email);
269
- $mail->setBody($msg);
270
- $mail->setSubject($varSubject);
271
- $mail->setFromEmail("support@qinvoice.com");
272
- $mail->setFromName("Qinvoice Development");
273
- $mail->setType('text');
274
- $mail->send();
275
- }
276
- }
277
-
278
- class qinvoice{
279
-
280
- protected $gateway = '';
281
- private $username;
282
- private $password;
283
-
284
- public $companyname;
285
- public $contactname;
286
- public $email;
287
- public $address;
288
- public $city;
289
- public $country;
290
- public $vatnumber;
291
- public $remark;
292
- public $paid;
293
- public $send;
294
-
295
- public $layout;
296
-
297
- private $tags = array();
298
- private $items = array();
299
- private $files = array();
300
- private $recurring;
301
-
302
- function __construct($username, $password){
303
- $this->username = $username;
304
- $this->password = $password;
305
- $this->recurring = 'none';
306
-
307
- $db = Mage::getSingleton('core/resource')->getConnection('core_write');
308
-
309
- // GETTING API URL
310
- $varURLPath = 'invoice_options/invoice/api_url';
311
- $resultURL = $db->query("SELECT value FROM core_config_data WHERE path LIKE '".$varURLPath."'");
312
- $rowURL = $resultURL->fetch(PDO::FETCH_ASSOC);
313
- $apiURL = $rowURL['value'];
314
-
315
- $this->gateway = $apiURL;
316
- }
317
-
318
- public function addTag($tag){
319
- $this->tags[] = $tag;
320
- }
321
-
322
- public function setLayout($code){
323
- $this->layout = $code;
324
- }
325
-
326
- public function setRecurring($recurring){
327
- $this->recurring = strtolower($recurring);
328
- }
329
-
330
- public function addItem($params){
331
- $item['description'] = $params['description'];
332
- $item['price'] = $params['price'];
333
- $item['vatpercentage'] = $params['vatpercentage'];
334
- $item['discount'] = $params['discount'];
335
- $item['quantity'] = $params['quantity'];
336
- $item['categories'] = $params['categories'];
337
- $this->items[] = $item;
338
- }
339
-
340
- public function addFile($name, $url){
341
- $this->files[] = array('url' => $url, 'name' => $name);
342
- }
343
-
344
- public function sendRequest() {
345
- $content = "<?xml version='1.0' encoding='UTF-8'?>";
346
- $content .= $this->buildXML();
347
-
348
- $headers = array("Content-type: application/atom+xml");
349
- $ch = curl_init();
350
- curl_setopt($ch, CURLOPT_URL, $this->gateway );
351
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
352
- curl_setopt($ch, CURLOPT_TIMEOUT, 120);
353
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
354
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
355
- curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
356
- $data = curl_exec($ch);
357
- if (curl_errno($ch)) {
358
- print curl_error($ch);
359
- } else {
360
- curl_close($ch);
361
- }
362
- if($data == 1){
363
- return true;
364
- }else{
365
- return false;
366
- }
367
-
368
- }
369
-
370
- private function buildXML(){
371
- $string = '<request>
372
- <login mode="newInvoice">
373
- <username>'.$this->username.'</username>
374
- <password>'.$this->password.'</password>
375
- </login>
376
- <invoice>
377
- <companyname>'. $this->companyname .'</companyname>
378
- <contactname>'. $this->contactname .'</contactname>
379
- <email>'. $this->email .'</email>
380
- <address>'. $this->address .'</address>
381
- <zipcode>'. $this->zipcode .'</zipcode>
382
- <city>'. $this->city .'</city>
383
- <country>'. $this->country .'</country>
384
- <vat>'. $this->vatnumber .'</vat>
385
- <recurring>'. $this->recurring .'</recurring>
386
- <remark>'. $this->remark .'</remark>
387
- <layout>'. $this->layout .'</layout>
388
- <paid>'. $this->paid .'</paid>
389
- <send>'. $this->send .'</send>
390
- <tags>';
391
- foreach($this->tags as $tag){
392
- $string .= '<tag>'. $tag .'</tag>';
393
- }
394
-
395
- $string .= '</tags>
396
- <items>';
397
- foreach($this->items as $i){
398
-
399
- $string .= '<item>
400
- <quantity>'. $i['quantity'] .'</quantity>
401
- <description>'. $i['description'] .'</description>
402
- <price>'. $i['price'] .'</price>
403
- <vatpercentage>'. $i['vatpercentage'] .'</vatpercentage>
404
- <discount>'. $i['discount'] .'</discount>
405
- <categories>'. $i['categories'] .'</categories>
406
-
407
- </item>';
408
- }
409
-
410
- $string .= '</items>
411
- <files>';
412
- foreach($this->files as $f){
413
- $string .= '<file url="'.$f['url'].'">'.$f['name'].'</file>';
414
- }
415
- $string .= '</files>
416
- </invoice>
417
- </request>';
418
- return $string;
419
- }
420
- }
421
-
422
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Qinvoice/Invoice_/etc/config.xml DELETED
@@ -1,61 +0,0 @@
1
- <?xml version="1.0"?>
2
- <!-- app/code/local/Qinvoice/Invoice/etc/config.xml -->
3
- <config>
4
- <modules>
5
- <Qinvoice_Invoice>
6
- <version>0.1.0</version>
7
- </Qinvoice_Invoice>
8
- </modules>
9
- <global>
10
- <models>
11
- <invoice>
12
- <class>Qinvoice_Invoice</class>
13
- </invoice>
14
- </models>
15
- <events>
16
- <sales_order_place_after>
17
- <observers>
18
- <invoice>
19
- <class>invoice/order_observer</class>
20
- <method>sendOnOrder</method>
21
- </invoice>
22
- </observers>
23
- </sales_order_place_after>
24
- <checkout_onepage_controller_success_action>
25
- <observers>
26
- <invoice>
27
- <class>invoice/order_observer</class>
28
- <method>sendOnPayment</method>
29
- </invoice>
30
- </observers>
31
- </checkout_onepage_controller_success_action>
32
- </events>
33
- <helpers>
34
- <invoice>
35
- <class>Qinvoice_Invoice_Helper</class>
36
- </invoice>
37
- </helpers>
38
- </global>
39
- <adminhtml>
40
- <acl>
41
- <resources>
42
- <admin>
43
- <children>
44
- <system>
45
- <children>
46
- <config>
47
- <children>
48
- <invoice_options>
49
- <title>Store Hello World Module Section</title>
50
- </invoice_options>
51
- </children>
52
- </config>
53
- </children>
54
- </system>
55
- </children>
56
- </admin>
57
- </resources>
58
- </acl>
59
- </adminhtml>
60
-
61
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Qinvoice/Invoice_/etc/configold.xml DELETED
@@ -1,66 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <global>
4
- <models>
5
- <invoice>
6
- <class>Qinvoice_Invoice</class>
7
- </invoice>
8
- </models>
9
- <events>
10
- <sales_order_place_after>
11
- <observers>
12
- <invoice_order_observer>
13
- <type>singleton</type>
14
- <class>invoice/order_observer</class>
15
- <method>sendOrder</method>
16
- </invoice_order_observer>
17
- </observers>
18
- </sales_order_place_after>
19
- </events>
20
-
21
- <helpers>
22
- <invoice>
23
- <class>Qinvoice_Invoice_Helper</class>
24
- </invoice>
25
- </helpers>
26
- <blocks>
27
- <adminhtml>
28
- <rewrite>
29
- <sales_order_grid>Qinvoice_Invoice_Block_Sales_Order_Grid</sales_order_grid>
30
- </rewrite>
31
- </adminhtml>
32
- </blocks>
33
- </global>
34
- <frontend>
35
- <routers>
36
- <helloworld>
37
- <args>
38
- <modules>
39
-
40
- </modules>
41
- </args>
42
- </helloworld>
43
- </routers>
44
- </frontend>
45
- <adminhtml>
46
- <acl>
47
- <resources>
48
- <admin>
49
- <children>
50
- <system>
51
- <children>
52
- <config>
53
- <children>
54
- <invoice_options>
55
- <title>Store Hello World Module Section</title>
56
- </invoice_options>
57
- </children>
58
- </config>
59
- </children>
60
- </system>
61
- </children>
62
- </admin>
63
- </resources>
64
- </acl>
65
- </adminhtml>
66
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Qinvoice/Invoice_/etc/system.xml DELETED
@@ -1,113 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <tabs>
4
- <qinvoice translate="label" module="invoice">
5
- <label>Qinvoice</label>
6
- <sort_order>300</sort_order>
7
- </qinvoice>
8
- </tabs>
9
- <sections>
10
- <invoice_options translate="label" module="invoice">
11
- <label>Qinvoice Configuration</label>
12
- <tab>qinvoice</tab>
13
- <frontend_type>text</frontend_type>
14
- <sort_order>1000</sort_order>
15
- <show_in_default>1</show_in_default>
16
- <show_in_website>1</show_in_website>
17
- <show_in_store>1</show_in_store>
18
- <groups>
19
- <invoice translate="label">
20
- <label>Qinvoice</label>
21
- <frontend_type>text</frontend_type>
22
- <sort_order>1</sort_order>
23
- <show_in_default>1</show_in_default>
24
- <show_in_website>1</show_in_website>
25
- <show_in_store>1</show_in_store>
26
- <fields>
27
- <api_url translate="label">
28
- <label>API URL</label>
29
- <frontend_type>text</frontend_type>
30
- <sort_order>1</sort_order>
31
- <show_in_default>1</show_in_default>
32
- <show_in_website>1</show_in_website>
33
- <show_in_store>1</show_in_store>
34
- <comment><![CDATA[e.g. https://app.q-invoice.com/api/xml/1.0/]]></comment>
35
- </api_url>
36
- <api_username translate="label">
37
- <label>API Username</label>
38
- <frontend_type>text</frontend_type>
39
- <sort_order>2</sort_order>
40
- <show_in_default>1</show_in_default>
41
- <show_in_website>1</show_in_website>
42
- <show_in_store>1</show_in_store>
43
- </api_username>
44
- <api_password translate="label">
45
- <label>API Password</label>
46
- <frontend_type>password</frontend_type>
47
- <sort_order>3</sort_order>
48
- <show_in_default>1</show_in_default>
49
- <show_in_website>1</show_in_website>
50
- <show_in_store>1</show_in_store>
51
- </api_password>
52
- <layout_code translate="label">
53
- <label>Layout Code</label>
54
- <frontend_type>text</frontend_type>
55
- <sort_order>4</sort_order>
56
- <show_in_default>1</show_in_default>
57
- <show_in_website>1</show_in_website>
58
- <show_in_store>1</show_in_store>
59
- <comment><![CDATA[Optional]]></comment>
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>
67
- <show_in_store>1</show_in_store>
68
- <comment><![CDATA[e.g. Order #{order_id}.]]></comment>
69
- </invoice_remark>
70
- <invoice_tag translate="label">
71
- <label>Invoice tag</label>
72
- <frontend_type>text</frontend_type>
73
- <sort_order>5</sort_order>
74
- <show_in_default>1</show_in_default>
75
- <show_in_website>1</show_in_website>
76
- <show_in_store>1</show_in_store>
77
- <comment><![CDATA[Optional. e.g. Your webshop name.]]></comment>
78
- </invoice_tag>
79
- <paid_remark translate="label">
80
- <label>Paid remark</label>
81
- <frontend_type>text</frontend_type>
82
- <sort_order>6</sort_order>
83
- <show_in_default>1</show_in_default>
84
- <show_in_website>1</show_in_website>
85
- <show_in_store>1</show_in_store>
86
- <comment><![CDATA[e.g. Your payment has been received.]]></comment>
87
- </paid_remark>
88
- <invoice_on_order translate="label">
89
- <label>Generate invoice on order</label>
90
- <frontend_type>select</frontend_type>
91
- <source_model>adminhtml/system_config_source_yesno</source_model>
92
- <sort_order>7</sort_order>
93
- <show_in_default>1</show_in_default>
94
- <show_in_website>1</show_in_website>
95
- <show_in_store>1</show_in_store>
96
- <comment><![CDATA[Yes: invoice for every order. No: invoice for every payment.]]></comment>
97
- </invoice_on_order>
98
- <send_mail translate="label">
99
- <label>Send invoice to customer</label>
100
- <frontend_type>select</frontend_type>
101
- <source_model>adminhtml/system_config_source_yesno</source_model>
102
- <sort_order>8</sort_order>
103
- <show_in_default>1</show_in_default>
104
- <show_in_website>1</show_in_website>
105
- <show_in_store>1</show_in_store>
106
- <comment><![CDATA[Send email with invoice to customer.]]></comment>
107
- </send_mail>
108
- </fields>
109
- </invoice>
110
- </groups>
111
- </invoice_options>
112
- </sections>
113
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,26 +1,31 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Qinvoice_Connect</name>
4
- <version>1.0.1</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>Added support for product_category in q-invoice.&#xD;
 
 
 
12
  &#xD;
13
- To enable please follow these steps.&#xD;
 
 
14
  &#xD;
15
- 1) Add attribute 'qinvoice_category' (without the quotes) to your installation and hide this attribute from frontend.&#xD;
 
16
  &#xD;
17
- 2) For every product add one or more categories, separated by commas. &#xD;
18
- &#xD;
19
- 3) Done.</notes>
20
  <authors><author><name>Casper Mekel</name><user>caspermekel</user><email>info@q-invoice.com</email></author></authors>
21
- <date>2013-08-14</date>
22
- <time>14:25:20</time>
23
- <contents><target name="magecommunity"><dir name="Qinvoice"><file name="CHANGELOG" hash="260c1b211fcfc288a3973f2031bd79a7"/><dir name="Connect"><dir name="Model"><dir name="Order"><file name="Observer.php" hash="aafc8f08226c818c562ada10fae878e4"/></dir></dir><dir name="etc"><file name="config.xml" hash="63a43c7562033ed41aec59498b1da5c8"/><file name="system.xml" hash="0146af102e16b6a8450aee736085e00f"/></dir></dir><dir name="Invoice_"><dir name="Helper"><file name="Data.php" hash="b17b2a7e7d551b9b24924d667759febb"/></dir><dir name="Order"><file name="Observer.php" hash="16bc431c2fb1c47f006ce7e0840683c5"/></dir><dir name="etc"><file name="config.xml" hash="dab71cf14d17e66a498adc4fe5e17f7d"/><file name="configold.xml" hash="190809fc9045610c7749b762b8568ced"/><file name="system.xml" hash="b8047d3ed2e8d3adcc12eb0b49ef25fc"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Qinvoice_Connect.xml" hash="fbedefa4e926092705c6941ad28f51f8"/></dir></target></contents>
24
  <compatible/>
25
  <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.7.0</max></package><extension><name>curl</name><min>5.1</min><max>6.0</max></extension></required></dependencies>
26
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Qinvoice_Connect</name>
4
+ <version>1.0.2</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>Added options for invoice action after trigger. &#xD;
12
+ 0) Generate concept&#xD;
13
+ 1) Finalize invoice&#xD;
14
+ 2) Finalize and send&#xD;
15
  &#xD;
16
+ Added support for product code&#xD;
17
+ - Add attribute qinvoice_productcode &#xD;
18
+ - If the product code matches a product in q-invoice, stock will be updated. &#xD;
19
  &#xD;
20
+ Added support for delivery address&#xD;
21
+ - The delivery address is now sent printed on the invoices and packaging slips&#xD;
22
  &#xD;
23
+ *IMPORTANT* &#xD;
24
+ Use API version 1.1 with this plugin</notes>
 
25
  <authors><author><name>Casper Mekel</name><user>caspermekel</user><email>info@q-invoice.com</email></author></authors>
26
+ <date>2013-09-03</date>
27
+ <time>15:12:04</time>
28
+ <contents><target name="magecommunity"><dir name="Qinvoice"><file name="CHANGELOG" hash="260c1b211fcfc288a3973f2031bd79a7"/><dir name="Connect"><dir name="Model"><dir name="Order"><file name="Observer.php" hash="29751a9fea70f5fbd3de979d0e9d31d9"/></dir><dir name="Source"><file name="Invoice.php" hash="4661f369f7e116fd761e5fffac9efeaf"/><file name="Trigger.php" hash="01f98ce71189afa6b0a112ca164c06cb"/></dir></dir><dir name="etc"><file name="config.xml" hash="0d6a10a687de2ebb038e577e2057f5f0"/><file name="system.xml" hash="0bad616d9605f6df51f2a36a69429391"/></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>
29
  <compatible/>
30
  <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.7.0</max></package><extension><name>curl</name><min>5.1</min><max>6.0</max></extension></required></dependencies>
31
  </package>