Facturante - Version 0.1.6

Version Notes

First stable release

Download this release

Release Info

Developer Daniel Pili
Extension Facturante
Version 0.1.6
Comparing to
See all releases


Version 0.1.6

Files changed (46) hide show
  1. app/code/local/Facturante/Customer/Helper/Data.php +5 -0
  2. app/code/local/Facturante/Customer/etc/config.xml +59 -0
  3. app/code/local/Facturante/Customer/sql/facturante_customer_setup/install-0.1.0.php +102 -0
  4. app/code/local/Facturante/Invoicing/Block/Adminhtml/Order/View/Tab/Facturante.php +35 -0
  5. app/code/local/Facturante/Invoicing/Block/Adminhtml/Sales/Order/Grid.php +46 -0
  6. app/code/local/Facturante/Invoicing/Block/Adminhtml/Sales/Order/Gridfacturante.php +69 -0
  7. app/code/local/Facturante/Invoicing/Block/Adminhtml/Sales/Order/Renderer/AfipInvoiceStatus.php +20 -0
  8. app/code/local/Facturante/Invoicing/Block/Adminhtml/Sales/Order/Renderer/HumanDate.php +17 -0
  9. app/code/local/Facturante/Invoicing/Block/Adminhtml/Sales/Order/Renderer/LinkView.php +34 -0
  10. app/code/local/Facturante/Invoicing/Block/System/Config/Form/Fieldset/Connection/Test.php +47 -0
  11. app/code/local/Facturante/Invoicing/Helper/Data.php +711 -0
  12. app/code/local/Facturante/Invoicing/Model/CronComprobantesError.php +54 -0
  13. app/code/local/Facturante/Invoicing/Model/CronComprobantesPendientes.php +86 -0
  14. app/code/local/Facturante/Invoicing/Model/Eav/Entity/Attribute/Source/Taxtype.php +127 -0
  15. app/code/local/Facturante/Invoicing/Model/Observer.php +91 -0
  16. app/code/local/Facturante/Invoicing/Model/Order/Invoicingstatus.php +12 -0
  17. app/code/local/Facturante/Invoicing/Model/Resource/Order/Invoicingstatus.php +12 -0
  18. app/code/local/Facturante/Invoicing/Model/Resource/Order/Invoicingstatus/Collection.php +12 -0
  19. app/code/local/Facturante/Invoicing/Model/System/Config/Source/Dropdown/Orderstatus.php +23 -0
  20. app/code/local/Facturante/Invoicing/Model/System/Config/Source/Dropdown/Values.php +26 -0
  21. app/code/local/Facturante/Invoicing/controllers/Adminhtml/FacturanteController.php +115 -0
  22. app/code/local/Facturante/Invoicing/etc/adminhtml.xml +22 -0
  23. app/code/local/Facturante/Invoicing/etc/config.xml +137 -0
  24. app/code/local/Facturante/Invoicing/etc/system.xml +176 -0
  25. app/code/local/Facturante/Invoicing/sql/facturante_invoicing_setup/mysql4-install-0.1.0.php +13 -0
  26. app/code/local/Facturante/Invoicing/sql/facturante_invoicing_setup/mysql4-upgrade-0.1.0-0.1.1.php +28 -0
  27. app/code/local/Facturante/Invoicing/sql/facturante_invoicing_setup/mysql4-upgrade-0.1.1-0.1.2.php +14 -0
  28. app/code/local/Facturante/Invoicing/sql/facturante_invoicing_setup/mysql4-upgrade-0.1.2-0.1.3.php +32 -0
  29. app/code/local/Facturante/Invoicing/sql/facturante_invoicing_setup/mysql4-upgrade-0.1.3-0.1.4.php +9 -0
  30. app/code/local/Facturante/Invoicing/sql/facturante_invoicing_setup/mysql4-upgrade-0.1.4-0.1.5.php +28 -0
  31. app/code/local/Facturante/Invoicing/sql/facturante_invoicing_setup/mysql4-upgrade-0.1.5-0.1.6.php +42 -0
  32. app/design/adminhtml/default/default/layout/facturante/invoicing.xml +14 -0
  33. app/design/adminhtml/default/default/template/facturante/.DS_Store +0 -0
  34. app/design/adminhtml/default/default/template/facturante/form/renderer/fieldset/attributes.phtml +89 -0
  35. app/design/adminhtml/default/default/template/facturante/form/renderer/fieldset/error.phtml +22 -0
  36. app/design/adminhtml/default/default/template/facturante/form/testconnection.phtml +18 -0
  37. app/design/adminhtml/default/default/template/facturante/order/view/tab/facturante.phtml +11 -0
  38. app/design/adminhtml/default/default/template/facturante/sales/order/view/info.phtml +180 -0
  39. app/design/frontend/base/default/layout/facturante/customer.xml +29 -0
  40. app/design/frontend/base/default/template/facturante/checkout/onepage/dni-number.phtml +18 -0
  41. app/design/frontend/base/default/template/facturante/customer/account/address/edit.phtml +173 -0
  42. app/design/frontend/base/default/template/facturante/customer/account/form/edit.phtml +123 -0
  43. app/design/frontend/base/default/template/facturante/customer/register.phtml +199 -0
  44. app/etc/modules/Facturante_Customer.xml +9 -0
  45. app/etc/modules/Facturante_Invoicing.xml +12 -0
  46. package.xml +41 -0
app/code/local/Facturante/Customer/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Facturante_Customer_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+
5
+ }
app/code/local/Facturante/Customer/etc/config.xml ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Facturante_Customer>
5
+ <version>0.1.0</version>
6
+ </Facturante_Customer>
7
+ </modules>
8
+ <global>
9
+ <helpers>
10
+ <facturante_customer>
11
+ <class>Facturante_Customer_Helper</class>
12
+ </facturante_customer>
13
+ </helpers>
14
+ <resources>
15
+ <facturante_customer_setup>
16
+ <setup>
17
+ <module>Facturante_Customer</module>
18
+ <class>Mage_Customer_Model_Entity_Setup</class>
19
+ </setup>
20
+ </facturante_customer_setup>
21
+ </resources>
22
+ <fieldsets>
23
+ <checkout_onepage_quote>
24
+ <dni_number_address>
25
+ <to_customer>*</to_customer>
26
+ </dni_number_address>
27
+ </checkout_onepage_quote>
28
+ <customer_account>
29
+ <dni_number_address>
30
+ <to_quote>*</to_quote>
31
+ </dni_number_address>
32
+ </customer_account>
33
+ <customer_address>
34
+ <dni_number_address>
35
+ <to_quote_address>*</to_quote_address>
36
+ <to_order_address>*</to_order_address>
37
+ </dni_number_address>
38
+ </customer_address>
39
+ <sales_convert_quote_address>
40
+ <dni_number_address>
41
+ <to_order_address>*</to_order_address>
42
+ <to_customer_address>*</to_customer_address>
43
+ </dni_number_address>
44
+ </sales_convert_quote_address>
45
+ <customer_dataflow>
46
+ <dni_number_address><billing>1</billing></dni_number_address>
47
+ </customer_dataflow>
48
+ </fieldsets>
49
+ </global>
50
+ <frontend>
51
+ <layout>
52
+ <updates>
53
+ <facturante_customer>
54
+ <file>facturante/customer.xml</file>
55
+ </facturante_customer>
56
+ </updates>
57
+ </layout>
58
+ </frontend>
59
+ </config>
app/code/local/Facturante/Customer/sql/facturante_customer_setup/install-0.1.0.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+ $installer->startSetup();
5
+
6
+ $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
7
+
8
+ $entityTypeId = $setup->getEntityTypeId('customer');
9
+ $attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId);
10
+ $attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
11
+
12
+ /** Agrego el atributo dni_number para customer */
13
+ $installer->addAttribute("customer", "dni_number", array(
14
+ "type" => "varchar",
15
+ "backend" => "",
16
+ "label" => "Número de DNI / CUIT",
17
+ "input" => "text",
18
+ "source" => "",
19
+ "visible" => true,
20
+ "required" => false,
21
+ "default" => "",
22
+ "frontend" => "",
23
+ "unique" => false
24
+ ));
25
+
26
+ $attribute = Mage::getSingleton("eav/config")->getAttribute("customer", "dni_number");
27
+
28
+ $setup->addAttributeToGroup(
29
+ $entityTypeId,
30
+ $attributeSetId,
31
+ $attributeGroupId,
32
+ 'dni_number',
33
+ '999' //sort_order
34
+ );
35
+
36
+ $used_in_forms=array();
37
+
38
+ $used_in_forms[]="adminhtml_customer";
39
+ $used_in_forms[]="checkout_register";
40
+ $used_in_forms[]="customer_account_create";
41
+ $used_in_forms[]="adminhtml_checkout";
42
+ $used_in_forms[]="customer_account_edit";
43
+ $attribute->setData("used_in_forms", $used_in_forms)
44
+ ->setData("is_used_for_customer_segment", true)
45
+ ->setData("is_system", 0)
46
+ ->setData("is_user_defined", 1)
47
+ ->setData("is_visible", 1)
48
+ ->setData("sort_order", 100)
49
+ ;
50
+ $attribute->save();
51
+
52
+ /** Agrego el atributo dni_number_address para customer_address */
53
+ $installer->addAttribute('customer_address', 'dni_number_address', array(
54
+ 'type' => 'varchar',
55
+ 'input' => 'text',
56
+ 'label' => 'Número de DNI / CUIT',
57
+ 'global' => 1,
58
+ 'visible' => 1,
59
+ 'required' => 0,
60
+ 'user_defined' => 1,
61
+ 'visible_on_front' => 1
62
+ ));
63
+
64
+ Mage::getSingleton('eav/config')
65
+ ->getAttribute('customer_address', 'dni_number_address')
66
+ ->setData('used_in_forms',
67
+ array(
68
+ 'customer_register_address',
69
+ 'adminhtml_checkout',
70
+ 'adminhtml_customer',
71
+ 'checkout_register',
72
+ 'customer_account_create',
73
+ 'customer_account_edit',
74
+ 'customer_address_edit',
75
+ 'adminhtml_customer_address'
76
+ ))->save();
77
+
78
+ /**
79
+ * agrego campo a sales_flat_quote_address
80
+ */
81
+ $sales_quote_address = $installer->getTable('sales/quote_address');
82
+ $installer->getConnection()
83
+ ->addColumn($sales_quote_address, 'dni_number_address', array(
84
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
85
+ 'comment' => 'DNI/CUIT'
86
+ ));
87
+
88
+ /**
89
+ * Agrego campo a sales_flat_order_address
90
+ */
91
+ $sales_order_address = $installer->getTable('sales/order_address');
92
+ $installer->getConnection()
93
+ ->addColumn($sales_order_address, 'dni_number_address', array(
94
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
95
+ 'comment' => 'DNI/CUIT'
96
+ ));
97
+
98
+ $tablequote = $this->getTable('sales/quote');
99
+ $installer->run("ALTER TABLE $tablequote ADD `dni_number_address` VARCHAR( 255 ) NOT NULL
100
+ ");
101
+
102
+ $installer->endSetup();
app/code/local/Facturante/Invoicing/Block/Adminhtml/Order/View/Tab/Facturante.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin order tab interface
4
+ *
5
+ * @category Facturante
6
+ * @package Invoicing
7
+ */
8
+ class Facturante_Invoicing_Block_Adminhtml_Order_View_Tab_Facturante extends Mage_Adminhtml_Block_Template implements Mage_Adminhtml_Block_Widget_Tab_Interface
9
+ {
10
+ protected function _construct()
11
+ {
12
+ parent::_construct();
13
+ $this->setTemplate( 'facturante/order/view/tab/facturante.phtml' );
14
+ }
15
+
16
+ public function getTabLabel() {
17
+ return $this->__('Facturante');
18
+ }
19
+
20
+ public function getTabTitle() {
21
+ return $this->__('Facturante');
22
+ }
23
+
24
+ public function canShowTab() {
25
+ return true;
26
+ }
27
+
28
+ public function isHidden() {
29
+ return false;
30
+ }
31
+
32
+ public function getOrder(){
33
+ return Mage::registry('current_order');
34
+ }
35
+ }
app/code/local/Facturante/Invoicing/Block/Adminhtml/Sales/Order/Grid.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin order grid customization
4
+ *
5
+ * @category Facturante
6
+ * @package Invoicing
7
+ */
8
+ class Facturante_Invoicing_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
9
+ {
10
+ /**
11
+ * Add new column to sales order grid
12
+ */
13
+ protected function _prepareColumns()
14
+ {
15
+ parent::_prepareColumns();
16
+
17
+ $this->addColumnAfter('facturante_invoice_status', array(
18
+ 'header'=> Mage::helper('sales')->__('Estado Facturación'),
19
+ 'width' => '80px',
20
+ 'type' => 'text',
21
+ 'index' => 'increment_id',
22
+ 'filter' => false,
23
+ 'renderer' => 'facturante_invoicing/adminhtml_sales_order_renderer_afipInvoiceStatus'
24
+ ), 'status');
25
+
26
+ $this->sortColumnsByOrder();
27
+
28
+ return $this;
29
+ }
30
+
31
+ /**
32
+ * Add Generar Factura AFIP mass action
33
+ */
34
+ protected function _prepareMassaction()
35
+ {
36
+ parent::_prepareMassaction();
37
+
38
+ $this->getMassactionBlock()->addItem('mass_generate_invoice', array(
39
+ 'label'=> Mage::helper('sales')->__('Generar Factura AFIP'),
40
+ 'url' => $this->getUrl('*/facturante/massInvoice'),
41
+ ));
42
+
43
+ return $this;
44
+ }
45
+
46
+ }
app/code/local/Facturante/Invoicing/Block/Adminhtml/Sales/Order/Gridfacturante.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin grid from order tab customization
4
+ *
5
+ * @category Facturante
6
+ * @package Invoicing
7
+ */
8
+ class Facturante_Invoicing_Block_Adminhtml_Sales_Order_Gridfacturante extends Mage_Adminhtml_Block_Widget_Grid
9
+ {
10
+ public function __construct()
11
+ {
12
+ parent::__construct();
13
+ $this->setId('grid');
14
+ $this->setSaveParametersInSession(true);
15
+ $this->setDefaultSort('update_date');
16
+ $this->setDefaultDir('desc');
17
+ }
18
+
19
+ protected function _prepareCollection()
20
+ {
21
+ $orderId = $this->getRequest()->getParam('order_id');
22
+ $collection = Mage::getModel('facturante_invoicing/order_invoicingstatus')->getCollection();
23
+ $collection->addFieldToFilter(
24
+ 'order_id', array('attribute' => 'order_id', 'eq' => $orderId)
25
+ );
26
+ $this->setCollection($collection);
27
+ return parent::_prepareCollection();
28
+ }
29
+ protected function _prepareColumns()
30
+ {
31
+ parent::_prepareColumns();
32
+
33
+ $this->addColumn('update_date', array(
34
+ 'header' => 'Fecha',
35
+ 'align' =>'right',
36
+ 'width' => '100px',
37
+ 'index' => 'update_date',
38
+ 'renderer' => 'Facturante_Invoicing_Block_Adminhtml_Sales_Order_Renderer_HumanDate',
39
+ ));
40
+ $this->addColumn('idcomprobante', array(
41
+ 'header' => 'Comprobante ID',
42
+ 'align' =>'right',
43
+ 'width' => '30px',
44
+ 'index' => 'idcomprobante',
45
+ ));
46
+ $this->addColumn('status', array(
47
+ 'header' => 'Estado',
48
+ 'align' =>'right',
49
+ 'width' => '150px',
50
+ 'index' => 'status',
51
+ ));
52
+ $this->addColumn('comments', array(
53
+ 'header' => 'Comentarios',
54
+ 'align' =>'right',
55
+ 'width' => '150px',
56
+ 'index' => 'comments',
57
+ ));
58
+ $this->addColumn('action', array(
59
+ 'header' => 'Acciones',
60
+ 'align' =>'right',
61
+ 'width' => '50px',
62
+ 'field' => 'id',
63
+ 'type' => 'action',
64
+ 'renderer' => 'facturante_invoicing/adminhtml_sales_order_renderer_linkView'
65
+ ));
66
+
67
+ return $this;
68
+ }
69
+ }
app/code/local/Facturante/Invoicing/Block/Adminhtml/Sales/Order/Renderer/AfipInvoiceStatus.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin order column renderer
4
+ *
5
+ * @category Facturante
6
+ * @package Invoicing
7
+ */
8
+ class Facturante_Invoicing_Block_Adminhtml_Sales_Order_Renderer_AfipInvoiceStatus extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
9
+ {
10
+
11
+ public function render(Varien_Object $row)
12
+ {
13
+ $orderId = $row->getData($this->getColumn()->getIndex());
14
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
15
+ $afipInvoicingStatus = $order->getData('facturante_invoice_status');
16
+
17
+ return $afipInvoicingStatus;
18
+ }
19
+
20
+ }
app/code/local/Facturante/Invoicing/Block/Adminhtml/Sales/Order/Renderer/HumanDate.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin order column renderer
4
+ *
5
+ * @category Facturante
6
+ * @package Invoicing
7
+ */
8
+ class Facturante_Invoicing_Block_Adminhtml_Sales_Order_Renderer_HumanDate extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
9
+ {
10
+ public function render(Varien_Object $row)
11
+ {
12
+ $fechaInvoicingStatus = $row->getData($this->getColumn()->getIndex());
13
+ $date = new DateTime($fechaInvoicingStatus);
14
+ $humanDate = $date->format('d/m/Y H:i:s');
15
+ return $humanDate;
16
+ }
17
+ }
app/code/local/Facturante/Invoicing/Block/Adminhtml/Sales/Order/Renderer/LinkView.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin order column renderer
4
+ *
5
+ * @category Facturante
6
+ * @package Invoicing
7
+ */
8
+ class Facturante_Invoicing_Block_Adminhtml_Sales_Order_Renderer_LinkView extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
9
+ {
10
+ public function render(Varien_Object $row)
11
+ {
12
+ $link = "";
13
+ /** Tomo la info del row actual para despues hacer una busqueda en la base */
14
+ $estado = $row->getData('status');
15
+ $comprobanteId = $row->getData('idcomprobante');
16
+ $orderId = $row->getData('order_id');
17
+
18
+ if($estado == "Procesado")
19
+ {
20
+ /** Con la info recogida, filtro la base y tomo el respectivo enlace al archivo si lo hubiere */
21
+ $collection = Mage::getModel('facturante_invoicing/order_invoicingstatus')->getCollection();
22
+ $collection->addFieldToFilter('order_id', array('attribute' => 'order_id', 'eq' => $orderId));
23
+ $collection->addFieldToFilter('idcomprobante', array('attribute' => 'order_id', 'eq' => $comprobanteId));
24
+ $collection->addFieldToFilter('status', array('attribute' => 'order_id', 'eq' => 'Procesado'));
25
+ /** Este foreach solo debería iterar una vez, puesto que no debería existir dos comprobantes con el mismo id y con las condiciones anteriormente establecidas. */
26
+ foreach ($collection as $comprobante)
27
+ {
28
+ $url = $comprobante->getLink();
29
+ $link = "<a href='".$url."'>Ver PDF</a>";
30
+ }
31
+ }
32
+ return $link;
33
+ }
34
+ }
app/code/local/Facturante/Invoicing/Block/System/Config/Form/Fieldset/Connection/Test.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Facturante module system config form field
4
+ *
5
+ * @category Facturante
6
+ * @package Invoicing
7
+ */
8
+ class Facturante_Invoicing_Block_System_Config_Form_Fieldset_Connection_Test extends Mage_Adminhtml_Block_System_Config_Form_Field
9
+ {
10
+
11
+ /**
12
+ * Add jQuery to system configuration section
13
+ */
14
+ public function _prepareLayout()
15
+ {
16
+ $head = $this->getLayout()->getBlock('head');
17
+ $head->addJs('lib/jquery/jquery-1.10.2.js');
18
+ $head->addJs('lib/jquery/noconflict.js');
19
+
20
+ return parent::_prepareLayout();
21
+ }
22
+
23
+ /**
24
+ * Customize test connection system configuration element
25
+ */
26
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
27
+ {
28
+ $block = Mage::app()->getLayout()->createBlock('adminhtml/widget_form_renderer_element')
29
+ ->setTemplate('facturante/form/testconnection.phtml');
30
+
31
+ $usernameValue = Mage::getStoreConfig('facturante/connection/username');
32
+ $passwordValue = Mage::getStoreConfig('facturante/connection/password');
33
+ $businessIdValue = Mage::getStoreConfig('facturante/connection/business_id');
34
+
35
+ if($usernameValue != '' && $passwordValue != '' && $businessIdValue != '')
36
+ {
37
+ if (Mage::helper('facturante_invoicing')->testAPIConnection())
38
+ {
39
+ $block->setSuccessfulApiConnection(true);
40
+ }
41
+ }
42
+
43
+ return $block->toHtml();
44
+ }
45
+
46
+
47
+ }
app/code/local/Facturante/Invoicing/Helper/Data.php ADDED
@@ -0,0 +1,711 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Common module functions
4
+ *
5
+ * @category Facturante
6
+ * @package Facturante_Invoicing
7
+ */
8
+ class Facturante_Invoicing_Helper_Data extends Mage_Core_Helper_Abstract
9
+ {
10
+
11
+ const FACTURANTE_API_CALL_STATUS_OK = 'OK';
12
+ const FACTURANTE_CODIGO_FACTURA = 'factura';
13
+ const FACTURANTE_CODIGO_NOTA_DE_DEBITO = 'debito';
14
+ const FACTURANTE_CODIGO_NOTA_DE_CREDITO = 'credito';
15
+
16
+ public function testAPIConnection()
17
+ {
18
+ $client = new SoapClient('http://testing.facturante.com/api/Comprobantes.svc?wsdl');
19
+
20
+ $usernameValue = Mage::getStoreConfig('facturante/connection/username');
21
+ $passwordValue = Mage::getStoreConfig('facturante/connection/password');
22
+ $businessIdValue = Mage::getStoreConfig('facturante/connection/business_id');
23
+
24
+ $auth = array(
25
+ 'Empresa' => $businessIdValue,
26
+ 'Hash' => $passwordValue,
27
+ 'Usuario' => $usernameValue
28
+ );
29
+
30
+ $param = array(
31
+ 'Autenticacion' => $auth,
32
+ 'FechaDesde' => self::getCurrentFormattedDate(),
33
+ 'FechaHasta' => self::getCurrentFormattedDate(),
34
+ 'NroPagina' => 1,
35
+ );
36
+
37
+ $request = array('request' => $param);
38
+ $response = $client->ListadoComprobantes($request);
39
+ $estado = $response->ListadoComprobantesResult->Estado;
40
+
41
+ if ($estado == self::FACTURANTE_API_CALL_STATUS_OK)
42
+ {
43
+ return true;
44
+ }
45
+
46
+ return false;
47
+ }
48
+
49
+ /**
50
+ * Generar factura/nota de débito/nota de crédito a traves de la API de facturante
51
+ * Posibles valores para $type: 'factura', 'debito' o 'credito'
52
+ *
53
+ * @param int $order
54
+ * @param string $type
55
+ */
56
+ public function generateInvoiceForOrder($order, $type)
57
+ {
58
+ $invoiceStatus = $order->getFacturanteInvoiceStatus();
59
+ $lastInvoiceType = $order->getAfipLastInvoiceType();
60
+
61
+ // Si no hay invoice type, quiere decir que nunca se realizo un intento de generación de factura
62
+ // por lo tanto el unico comprobante que puede hacerse es factura
63
+ if (!$lastInvoiceType && $type != self::FACTURANTE_CODIGO_FACTURA)
64
+ {
65
+ Mage::getSingleton('core/session')->addNotice('Ninguna factura ha sido realizada en esta orden, para realizar una nota de débito o crédito primero la orden debe ser facturada.');
66
+ return false;
67
+ }
68
+ // Si el invoice status es 'Esperando CAE', entonces no permitir
69
+ // generar una nuevo comprobante ya que se está generando
70
+ if ($invoiceStatus == 'Esperando CAE' || $invoiceStatus == 'Enviando')
71
+ {
72
+ Mage::getSingleton('core/session')->addNotice('Existe un comprobante generandose para la orden Nª ' . $order->getIncrementId() . '. Por favor, espere unos momentos para que el comprobante sea procesado.');
73
+ return false;
74
+ }
75
+
76
+ // Si el ultimo comprobante que tiene un pedido es una factura
77
+ // (en cualquiera de sus estados, procesado , leido),
78
+ // lo único que puede hacerse es una nota de credito
79
+ if ($lastInvoiceType == self::FACTURANTE_CODIGO_FACTURA
80
+ && $type != self::FACTURANTE_CODIGO_NOTA_DE_CREDITO
81
+ && $invoiceStatus != 'Error en Comprobante')
82
+ {
83
+ Mage::getSingleton('core/session')->addNotice('Ya se ha generado una factura para la orden Nª ' . $order->getIncrementId() . '. Solo es posible generar una nota de crédito para esta orden.');
84
+ return false;
85
+ }
86
+
87
+ // Si el ultimo comprobante que tiene un pedido es una nota de crédito,
88
+ // solo puede hacerse una factura o nota de debito
89
+ if ($lastInvoiceType == self::FACTURANTE_CODIGO_NOTA_DE_CREDITO
90
+ && $type == self::FACTURANTE_CODIGO_NOTA_DE_CREDITO)
91
+ {
92
+ Mage::getSingleton('core/session')->addNotice('Ya se ha generado una nota de crédito para la orden Nª ' . $order->getIncrementId() . '. Solo es posible generar una nueva factura o nota de débito para esta orden.');
93
+ return false;
94
+ }
95
+
96
+ // Si el ultimo comprobante que tiene un pedido es una nota de debito,
97
+ // no debe permitir hacer ningun comprobante mas.
98
+ if ($lastInvoiceType == self::FACTURANTE_CODIGO_NOTA_DE_DEBITO)
99
+ {
100
+ Mage::getSingleton('core/session')->addNotice('Ya se ha generado una nota de débito para la orden Nª ' . $order->getIncrementId() . '. No es posible realizar una nueva factura o nota de crédito para esta orden.');
101
+ return false;
102
+ }
103
+
104
+ $billingAddress = $order->getBillingAddress();
105
+
106
+ $client = new SoapClient('http://testing.facturante.com/api/Comprobantes.svc?wsdl');
107
+
108
+ $usernameValue = Mage::getStoreConfig('facturante/connection/username');
109
+ $passwordValue = Mage::getStoreConfig('facturante/connection/password');
110
+ $businessIdValue = Mage::getStoreConfig('facturante/connection/business_id');
111
+
112
+ $auth = array(
113
+ 'Empresa' => $businessIdValue,
114
+ 'Hash' => $passwordValue,
115
+ 'Usuario' => $usernameValue
116
+ );
117
+
118
+ /**
119
+ * Razon Social
120
+ *
121
+ * Nombre de la persona física o jurídica del cliente a
122
+ * emitir el comprobante(receptor del comprobante)
123
+ */
124
+ $razonSocial = $billingAddress->getName();
125
+ if ($company = $billingAddress->getCompany())
126
+ {
127
+ $razonSocial = $company;
128
+ }
129
+
130
+ /**
131
+ * Numero de DNI
132
+ */
133
+ $customerId = $order->getCustomerId();
134
+ $customer = Mage::getModel('customer/customer')->load($customerId);
135
+ $numeroDeDocumento = preg_replace('/[^0-9]/','', $customer->getData('dni_number'));
136
+
137
+ // Si no hay numero de documento para el customer,
138
+ // sino asignar customer ID como numero de documento
139
+ // si no hay customer ID, entonces es guest order, pasar numero fijo 1
140
+ if (!$numeroDeDocumento)
141
+ {
142
+ if ($customerId)
143
+ {
144
+ $numeroDeDocumento = $customerId;
145
+ } else
146
+ {
147
+ $numeroDeDocumento = 1;
148
+ }
149
+ }
150
+
151
+ // Verificar si hay numero de documento en el billing address,
152
+ // si existe entonces ese va a a ser el numero de documento
153
+ $dniNumberAddress = preg_replace('/[^0-9]/','', $order->getBillingAddress()->getData('dni_number_address'));
154
+
155
+ if ($dniNumberAddress)
156
+ {
157
+ $numeroDeDocumento = $dniNumberAddress;
158
+ }
159
+
160
+ /**
161
+ * Percibe IVA?
162
+ *
163
+ * True: Si la empresa emisora es Agente de Retención de IVA
164
+ * 0: NO
165
+ * 1: SI
166
+ * @type boolean
167
+ */
168
+ $percibeIva = Mage::getStoreConfig('facturante/connection3/percibe_iva');
169
+
170
+ /**
171
+ * Percibe IIBB?
172
+ *
173
+ * True: Si la empresa emisora es Agente de Retención de ARBA
174
+ *
175
+ * @type boolean
176
+ */
177
+ $percibeIIBB = false;
178
+
179
+ /**
180
+ * Tratamiento Impositivo
181
+ *
182
+ * 1: MONOTRIBUTISTA
183
+ * 2: RESPONSABLE INSCRIPTO
184
+ * 3: CONSUMIDOR FINAL
185
+ * 4: IVA EXENTO
186
+ * 5: IVA NO RESPONSABLE
187
+ *
188
+ * @type int
189
+ */
190
+ $tratamientoImpositivo = $customer->getTaxType();
191
+ if (!$tratamientoImpositivo)
192
+ {
193
+ $tratamientoImpositivo = 3;
194
+ }
195
+
196
+ // Si el numero ingresado en el documento es un numero de CUIT,
197
+ // entonces el tratamiento impositivo debe ser responsable inscripto
198
+ if (self::isCUIT($numeroDeDocumento))
199
+ {
200
+ $tratamientoImpositivo = 2;
201
+ }
202
+
203
+ /**
204
+ * Enviar comprobante?
205
+ *
206
+ * Si se envía el comprobante por email al cliente
207
+ *
208
+ * @type bool
209
+ */
210
+ $enviarComprobante = Mage::getStoreConfig('facturante/connection2/enviar_comprobante');
211
+
212
+ /**
213
+ * Provincia
214
+ */
215
+ $regionId = $order->getBillingAddress()->getData('region_id');
216
+ $region = Mage::getModel('directory/region')->load($regionId);
217
+ $provincia = $region->getName();
218
+
219
+ /**
220
+ * Condición de Pago
221
+ *
222
+ * Soporte por defecto a métodos nativos
223
+ * de Magento que además sean válidos para la AFIP
224
+ *
225
+ * 1= Contado
226
+ * 2= Cuenta Corriente
227
+ * 3= Tarjeta de Debito
228
+ * 4= Tarjeta de Credito
229
+ * 5= Cheque
230
+ * 6= Ticket
231
+ * 7= Otro
232
+ * 8= MercadoPago
233
+ * 9= Cobro Digital
234
+ * 10= DineroMail
235
+ * 11= Decidir
236
+ * 12= TodoPago
237
+ *
238
+ * @type int
239
+ */
240
+ $paymentMethod = 1;
241
+ $payment = $order->getPayment()->getMethodInstance()->getCode();
242
+
243
+ if ($payment == 'ccsave' ||
244
+ $payment == 'moneybookers_acc' ||
245
+ $payment == 'authorizenet_directpost' ||
246
+ $payment == 'payflow_advanced' ||
247
+ $payment == 'payflow_link' ||
248
+ $payment == 'authorizenet')
249
+ {
250
+ $paymentMethod = 4;
251
+ } else if ($payment == 'checkmo')
252
+ {
253
+ $paymentMethod = 5;
254
+ } else if ($payment == 'banktransfer')
255
+ {
256
+ $paymentMethod = 2;
257
+ }
258
+
259
+ /**
260
+ * Fecha del comprobante
261
+ *
262
+ * Fecha y hora actual en formato: "2016-01-18T00:00:00"
263
+ *
264
+ * @type datetime
265
+ */
266
+ $fechaHora = self::getCurrentFormattedDate();
267
+
268
+ $cliente = array(
269
+ "RazonSocial" => $razonSocial,
270
+ "NroDocumento" => $numeroDeDocumento,
271
+ "DireccionFiscal" => $order->getBillingAddress()->getData('street'),
272
+ "Provincia" => $provincia,
273
+ "CodigoPostal" => $billingAddress->getPostcode(),
274
+ "PercibeIVA" => $percibeIva,
275
+ "PercibeIIBB" => $percibeIIBB,
276
+ "TratamientoImpositivo" => $tratamientoImpositivo,
277
+ "CondicionPago" => $paymentMethod,
278
+ "EnviarComprobante" => $enviarComprobante,
279
+ "MailFacturacion" => $billingAddress->getEmail(),
280
+ "MailContacto" => $order->getCustomerEmail(),
281
+ "Contacto" => $order->getCustomerName(),
282
+ "Telefono" => $billingAddress->getTelephone()
283
+ );
284
+
285
+ /**
286
+ * Prefijo
287
+ *
288
+ * Siempre completar con ceros adelante del número si es menor a 4 digitos. Ej: 0004
289
+ *
290
+ * @type int
291
+ */
292
+ $prefijo = Mage::getStoreConfig('facturante/connection3/prefijo');
293
+ $longitudActual = strlen($prefijo);
294
+ $longitudPrefijo = 4;
295
+
296
+ $diferenciaLongitudes = $longitudPrefijo - $longitudActual;
297
+
298
+ if($diferenciaLongitudes >= 1)
299
+ {
300
+ for($i = 0; $i < $diferenciaLongitudes; $i++)
301
+ {
302
+ $prefijo = '0' . $prefijo;
303
+ }
304
+ }
305
+
306
+ /**
307
+ * Tipo de comprobante
308
+ *
309
+ * FA: FACTURA A
310
+ * NCA: NOTA DE CREDITO A
311
+ * NDA: NOTA DE DEBITO A
312
+ *
313
+ * @type string
314
+ */
315
+ $tipoComprobante = 'F';
316
+ if ($type == self::FACTURANTE_CODIGO_NOTA_DE_CREDITO)
317
+ {
318
+ $tipoComprobante = 'NC';
319
+ } else if ($type == self::FACTURANTE_CODIGO_NOTA_DE_DEBITO)
320
+ {
321
+ $tipoComprobante = 'ND';
322
+ }
323
+
324
+ /**
325
+ * Percepcion IVA
326
+ *
327
+ * Importe Total correspondiente al % aplicado en concepto de percepción de
328
+ * ARBA al cliente - SOLO Si la empresa emisora es Agente de Retención de ARBA. Por defecto = 0
329
+ *
330
+ * @type int
331
+ */
332
+ $percepcionIVA = 0;
333
+
334
+ /**
335
+ * Percepcion IIBB - numeric(18,3)
336
+ *
337
+ * Total correspondiente al % aplicado en concepto de percepción de IVA al cliente
338
+ * SOLO Si la empresa emisora es Agente de Retención de IVA. Por defecto = 0
339
+ *
340
+ * @type int
341
+ */
342
+ $percepcionIIBB = 0;
343
+
344
+ /**
345
+ * Bienes
346
+ *
347
+ * 1- Bienes
348
+ * 2- Servicios
349
+ * 3- Productos y Servicios
350
+ *
351
+ * @type int
352
+ */
353
+ $bienes = Mage::getStoreConfig('facturante/connection3/bienes');
354
+ /**
355
+ * Fecha de servicio facturado (desde y hasta)
356
+ *
357
+ * @type datetime
358
+ */
359
+ $fechaServDesde = self::getCurrentFormattedDate();
360
+ $fechaServHasta = self::getCurrentFormattedDate();
361
+
362
+ /**
363
+ * Fecha de servicio facturado (desde y hasta)
364
+ *
365
+ * @type datetime
366
+ */
367
+ $fechaVencPago = self::getCurrentFormattedDate();
368
+
369
+ /**
370
+ * Importe correspondiente a impuestos internos aplicados
371
+ *
372
+ * @type int
373
+ */
374
+ $importeImpInternos = 0;
375
+
376
+ /**
377
+ * Importe correspondiente a impuestos municipales aplicados
378
+ *
379
+ * @type int
380
+ */
381
+ $importeImpMunicipales = 0;
382
+
383
+ /**
384
+ * Moneda
385
+ *
386
+ * Código numérico de Moneda correspondiente. Actualmente AFIP solo admite PESOS = 2,
387
+ * por lo que todos los importes del comprobante son expresados en pesos Arg.
388
+ *
389
+ * @type int
390
+ */
391
+ $moneda = 2;
392
+
393
+ /**
394
+ * Tipo de cambio
395
+ *
396
+ * Factor de conversión a la moneda seleccionada. Para PESOS Arg = 1
397
+ *
398
+ * @type int
399
+ */
400
+ $tipoCambio = 1;
401
+
402
+ /**
403
+ * Subtotal no alcanzado
404
+ *
405
+ * Sumatoria de los totales NO alcanzados(productos específicos determinados por AFIP)
406
+ *
407
+ * @type int
408
+ */
409
+ $subtotalNoAlcanzado = 0;
410
+
411
+ /**
412
+ * Subtotal exento
413
+ *
414
+ * Sumatoria de los totales exentos (rubros o articulos específicos determinados por AFIP. Ej: entradas de espectáculos)
415
+ *
416
+ * @type int
417
+ */
418
+ $subtotalExento = 0;
419
+
420
+ /**
421
+ * Porcentaje IIBB
422
+ *
423
+ * Utilizada si la empresa emisora es agente de retención de ARBA
424
+ * Alícuota definida por ARBA aplicada en la percepción de IIBB. Default = 0
425
+ *
426
+ * @type int
427
+ */
428
+ $porcentajeIIBB = 0;
429
+
430
+ // Valores a omitir (omitir, no cero):
431
+ // subTotal
432
+ // subTotalExento
433
+ // subTotalNoAlcanzado
434
+ // total
435
+ // totalNeto
436
+
437
+ $encabezado = array(
438
+ "FechaHora" => $fechaHora,
439
+ "Prefijo" => $prefijo,
440
+ "TipoComprobante" => $tipoComprobante,
441
+
442
+ "PercepcionIVA" => $percepcionIVA,
443
+ "PercepcionIIBB" => $percepcionIIBB,
444
+ "OrdenCompra" => $order->getIncrementId(),
445
+
446
+ "Bienes" => $bienes,
447
+ "EnviarComprobante" => $enviarComprobante,
448
+ "FechaServDesde" => $fechaServDesde,
449
+ "FechaServHasta" => $fechaServHasta,
450
+ "FechaVtoPago" => $fechaVencPago,
451
+
452
+ "ImporteImpuestosInternos" => $importeImpInternos,
453
+ "ImportePercepcionesMunic" => $importeImpMunicipales,
454
+
455
+ "Moneda" => $moneda,
456
+
457
+ "TipoDeCambio" => $tipoCambio,
458
+ "CondicionVenta" => $paymentMethod,
459
+ "PorcentajeIIBB" => $porcentajeIIBB
460
+ );
461
+
462
+ $orderedItems = $order->getAllVisibleItems();
463
+ $orderedProductIds = array();
464
+ $orderedProductQtys = array();
465
+ $orderedProductPrice = array();
466
+ $orderedProductTax = array();
467
+
468
+ $preciosFinales = Mage::getStoreConfig('facturante/connection2/precios_finales');
469
+
470
+ $porcentageImpuestoProducto = 21;
471
+
472
+ foreach ($orderedItems as $item) {
473
+
474
+ $qtyOrdered = $item->getData('qty_ordered');
475
+
476
+ if (!$preciosFinales)
477
+ {
478
+ // En este caso, el precio final de los productos no incluye los impuestos
479
+ // El impuesto total para el producto va a ser el monto de impuesto dividido la cantidad
480
+ // de productos comprados
481
+ $precioProducto = $item->getPrice();
482
+ if ($item->getTaxPercent()) {
483
+ $porcentageImpuestoProducto = $item->getTaxPercent();
484
+ }
485
+ } else {
486
+ // Si el precio de los productos es final
487
+ // entonces descontar un 21% del precio del producto
488
+ // (multiplicar precio de los productos por 1.21)
489
+ $itemPrice = $item->getPrice();
490
+ $precioProducto = $itemPrice / 1.21;
491
+ }
492
+
493
+ $orderedProductIds[] = $item->getData('product_id');
494
+ $orderedProductQtys[] = $qtyOrdered;
495
+ $orderedProductPrice[] = $precioProducto;
496
+ $orderedProductTax[] = $porcentageImpuestoProducto;
497
+ }
498
+
499
+ $productCollection = Mage::getModel('catalog/product')->getCollection();
500
+ $productCollection->addAttributeToSelect('*');
501
+ $productCollection->addIdFilter($orderedProductIds);
502
+
503
+ $items = array();
504
+ $currentItem = 0;
505
+ foreach ($productCollection as $orderedProduct)
506
+ {
507
+ $subTotal = $orderedProductPrice[$currentItem] * $orderedProductQtys[$currentItem];
508
+ $newOrderedItem = array(
509
+ "Cantidad" => $orderedProductQtys[$currentItem],
510
+ "Detalle" => $orderedProduct->getShortDescription(),
511
+ "Codigo" => $orderedProduct->getSku(),
512
+ "IVA" => $orderedProductTax[$currentItem],
513
+ "PrecioUnitario" => $orderedProductPrice[$currentItem],
514
+ "Total" => ($subTotal) + $subTotal / 100 * $orderedProductTax[$currentItem],
515
+ "Gravado" => true,
516
+ "Bonificacion" => 0
517
+ );
518
+
519
+ $items[] = $newOrderedItem;
520
+ $currentItem++;
521
+ }
522
+
523
+ // Agregar shipping cost al total de la orden como un item
524
+ $shippingCost = array(
525
+ "Cantidad" => 1,
526
+ "Detalle" => 'Gastos de Envío',
527
+ "Codigo" => 'shipping',
528
+ "IVA" => 21,
529
+ "PrecioUnitario" => ($order->getShippingAmount() / 1.21),
530
+ "Total" => ($order->getShippingAmount() / 1.21),
531
+ "Gravado" => true,
532
+ "Bonificacion" => 0
533
+ );
534
+ $items[] = $shippingCost;
535
+
536
+ // Agregar descuentos como valores negativos en el total de la orden como un item (si existen descuentos)
537
+ $discountAmount = abs($order->getDiscountAmount());
538
+ if ($discountAmount > 0)
539
+ {
540
+ $discounts = array(
541
+ "Cantidad" => 1,
542
+ "Detalle" => 'Descuentos',
543
+ "Codigo" => 'discounts',
544
+ "IVA" => 0,
545
+ "PrecioUnitario" => -1 * $discountAmount,
546
+ "Total" => -1 * $discountAmount,
547
+ "Gravado" => false,
548
+ "Bonificacion" => 0
549
+ );
550
+ $items[] = $discounts;
551
+ }
552
+
553
+ // Parametros
554
+ $paramCrearComprobante = array(
555
+ "Autenticacion" => $auth,
556
+ "Cliente" => $cliente,
557
+ "Encabezado" => $encabezado,
558
+ "Items" => $items
559
+ );
560
+
561
+ // Request
562
+ $requestCrearComprobante = array("request" => $paramCrearComprobante);
563
+
564
+ // Response
565
+ $responseCrearComprobante = $client->CrearComprobanteSinImpuestos($requestCrearComprobante);
566
+
567
+ /**
568
+ * Luego de la llamada para crear el comprobante, solicito los detalles del comprobante para saber en que estado se encuentra.
569
+ */
570
+ $comprobanteId = $responseCrearComprobante->CrearComprobanteSinImpuestosResult->IdComprobante;
571
+
572
+ if (!empty($comprobanteId)) {
573
+ $newInvoicingStatus = Mage::getModel('facturante_invoicing/order_invoicingstatus');
574
+ $newInvoicingStatus->setOrderId($order->getId());
575
+ $newInvoicingStatus->setOrderIncrementId($order->getIncrementId());
576
+ $newInvoicingStatus->setIdcomprobante($comprobanteId);
577
+ $detalleComprobante = $this->getDetalleComprobante($auth, $comprobanteId, $client);
578
+ $estadoDetalleComprobante = $detalleComprobante->DetalleComprobanteResult->Comprobante->EstadoComprobante;
579
+ $estadoDetalleComprobanteString = $this->getStringEstadoComprobante($estadoDetalleComprobante);
580
+ $newInvoicingStatus->setStatus($estadoDetalleComprobanteString);
581
+ if($estadoDetalleComprobante == 4)
582
+ {
583
+ $newInvoicingStatus->setLink($detalleComprobante->DetalleComprobanteResult->Comprobante->URLPDF);
584
+ }
585
+ /** Aqui se guarda el mensaje de respuesta de la API */
586
+ $detalleApiError = $this->getDetalleApiRespuesta($responseCrearComprobante->CrearComprobanteSinImpuestosResult->Mensaje);
587
+ $newInvoicingStatus->setComments($detalleApiError);
588
+ $newInvoicingStatus->setUpdateDate(now());
589
+ $newInvoicingStatus->save();
590
+
591
+ // Guardar nuevo estado del comprobante en columna de grilla de ordenes
592
+ $order->setData('facturante_invoice_status', $estadoDetalleComprobanteString);
593
+ $order->setData('afip_last_invoice_type', $type);
594
+ $order->save();
595
+ }
596
+ return $responseCrearComprobante;
597
+ }
598
+
599
+ /** Recibe el codigo de estado entregado por la api y lo traduce a string */
600
+ public function getStringEstadoComprobante($codigo) {
601
+ switch($codigo) {
602
+ case 8: return "Esperando CAE";
603
+ break;
604
+ case 2: return "Enviando";
605
+ break;
606
+ case 4: return "Procesado";
607
+ break;
608
+ case 6: return "Error en Comprobante";
609
+ break;
610
+ case 3: return "Error en Envío";
611
+ break;
612
+ default:
613
+ break;
614
+ }
615
+ return "";
616
+ }
617
+ /** Esta funcion recibe el mensaje de respuesta de la api y devuelve un string de estado para la orden a nivel global */
618
+ public function getStringEstadoOrden($codigo) {
619
+ switch($codigo) {
620
+ case "Esperando CAE": return "Pendiente";
621
+ break;
622
+ case "Enviando": return "Procesando";
623
+ break;
624
+ case "Procesado": return "Procesado";
625
+ break;
626
+ case "Error en Envío": return "Error en Envío de E-mail";
627
+ break;
628
+ case "Error en Comprobante": return "Error en Comprobante";
629
+ break;
630
+ default:
631
+ break;
632
+ }
633
+ return "";
634
+ }
635
+
636
+ /**
637
+ * Recibe $auth que son los datos de autenticacion, $idComprobante y $clienteSoap que es la instancia del web Service
638
+ * Devuelve el estado del comprobante actualmente.
639
+ *
640
+ */
641
+ public function getDetalleComprobante($auth, $idComprobante, $clienteSoap) {
642
+ $paramDetalleComprobante = array(
643
+ "Autenticacion" => $auth,
644
+ "IdComprobante" => $idComprobante,
645
+ );
646
+ $requestDetalleComprobante = array('request' => $paramDetalleComprobante);
647
+ $responseDetalleComprobante = $clienteSoap->DetalleComprobante($requestDetalleComprobante);
648
+
649
+ return $responseDetalleComprobante;
650
+ }
651
+
652
+ /** Recibe el codigo de mensaje de la api y devuelve la descripcion */
653
+ public function getDetalleApiRespuesta($codMensaje) {
654
+ return $codMensaje;
655
+ }
656
+
657
+ /**
658
+ * Obtener fecha actual en formato "1900-12-03T00:00:00", ejemplo: "2016-01-20T12:24:14"
659
+ *
660
+ * @return string
661
+ */
662
+ public function getCurrentFormattedDate()
663
+ {
664
+ $currentDate = date(DATE_ATOM, time());
665
+ $currentDate = substr($currentDate,0,-6);
666
+
667
+ return $currentDate;
668
+ }
669
+
670
+ /**
671
+ * Validar si numero es DNI o CUIT basandose en numero de digitos
672
+ *
673
+ * @param int $number
674
+ * @return boolean
675
+ */
676
+ public function isCUIT($number) {
677
+ if (strlen((string)$number == 11))
678
+ {
679
+ // Si el numero tiene 11 digitos, entonces es CUIT
680
+ // Validar que sea valido
681
+ $cuitValido = self::validarCuit($number);
682
+ return $cuitValido;
683
+ }
684
+ return false;
685
+ }
686
+
687
+ /**
688
+ * Validar si el CUIT es valido
689
+ *
690
+ * @param int $cuit
691
+ * @return boolean
692
+ */
693
+ public function validarCuit($cuit)
694
+ {
695
+ $cuit = preg_replace( '/[^\d]/', '', (string) $cuit );
696
+ if( strlen( $cuit ) != 11 ){
697
+ return false;
698
+ }
699
+ $acumulado = 0;
700
+ $digitos = str_split( $cuit );
701
+ $digito = array_pop( $digitos );
702
+
703
+ for( $i = 0; $i < count( $digitos ); $i++ ){
704
+ $acumulado += $digitos[ 9 - $i ] * ( 2 + ( $i % 6 ) );
705
+ }
706
+ $verif = 11 - ( $acumulado % 11 );
707
+ $verif = $verif == 11? 0 : $verif;
708
+
709
+ return $digito == $verif;
710
+ }
711
+ }
app/code/local/Facturante/Invoicing/Model/CronComprobantesError.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Facturante
4
+ * @package Invoicing
5
+ */
6
+ class Facturante_Invoicing_Model_CronComprobantesError {
7
+ /**
8
+ * Este cron busca las ordenes con error en comprobante y corre el generateinvoicefororder nuevamente.
9
+ */
10
+ public function callGenerateInvoiceForOrder() {
11
+ /** Tomo las ordenes con estado general de error */
12
+ $orders = Mage::getModel('sales/order')->getCollection();
13
+ $orders->addFilter('facturante_invoice_status','Error en Comprobante');
14
+
15
+ foreach ($orders as $order) {
16
+ /** @var $cantidadComprobantesError
17
+ * Por cada orden tomo la cantidad de comprobantes con error para luego evaluar si corresponde o no hacer una nueva peticion a la api.
18
+ */
19
+ $cantidadComprobantesError = Mage::getModel('facturante_invoicing/order_invoicingstatus')->getCollection()
20
+ ->addFilter('order_increment_id', $order->getIncrementId())
21
+ ->addFieldToFilter('status', array('in' => array('Error en Comprobante')))
22
+ ->setOrder('idcomprobante')
23
+ ->count();
24
+
25
+ /** Si la consulta anterior nos dice que hay comprobantes con errores, entonces procedemos a analizar */
26
+ if($cantidadComprobantesError > 0) {
27
+ /** Si tiene menos de 10 errores entonces puedo peticionar nuevamente a la api. */
28
+ if($cantidadComprobantesError < 10) {
29
+ Mage::helper('facturante_invoicing')->generateInvoiceForOrder($order, Facturante_Invoicing_Helper_Data::FACTURANTE_CODIGO_FACTURA);
30
+ }
31
+ /** Caso contrario genero un nuevo registro en la tabla indicando que se ha llegado al limite de reintentos posibles */
32
+ else if ($cantidadComprobantesError == 10) {
33
+ /** @var $checkInformado
34
+ * Si el count me devuelve '0' significa que todavia no le informe que se llego al limite de reintentos.
35
+ */
36
+ $checkInformado = Mage::getModel('facturante_invoicing/order_invoicingstatus')->getCollection()
37
+ ->addFilter('order_increment_id', $order->getIncrementId())
38
+ ->addFieldToFilter('status', array('in' => array('No Generado')))
39
+ ->count();
40
+ /** Aca me fijo si ya le avise que se llego al limite de reintentos. */
41
+ if($checkInformado == 0) {
42
+ $newInvoicingStatus = Mage::getModel('facturante_invoicing/order_invoicingstatus');
43
+ $newInvoicingStatus->setOrderId($order->getId());
44
+ $newInvoicingStatus->setOrderIncrementId($order->getIncrementId());
45
+ $newInvoicingStatus->setStatus('No Generado');
46
+ $newInvoicingStatus->setComments('Se ha alcanzado un limite de 10 errores para este comprobante. Por favor contacte a la mesa de ayuda de Facturante al (011) 5199-2087');
47
+ $newInvoicingStatus->setUpdateDate(now());
48
+ $newInvoicingStatus->save();
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
app/code/local/Facturante/Invoicing/Model/CronComprobantesPendientes.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Facturante
4
+ * @package Invoicing
5
+ */
6
+ class Facturante_Invoicing_Model_CronComprobantesPendientes
7
+ {
8
+
9
+ /**
10
+ * Esta funcion solicita a facturante que informe el estado de cada comprobante que actualmente esta en estado 'ESPERANDO CAE'. Si el estado ha cambiado, entonces lo actualiza.
11
+ */
12
+ public function actualizarEstadoComprobantes()
13
+ {
14
+ $usernameValue = Mage::getStoreConfig('facturante/connection/username');
15
+ $passwordValue = Mage::getStoreConfig('facturante/connection/password');
16
+ $businessIdValue = Mage::getStoreConfig('facturante/connection/business_id');
17
+
18
+ $auth = array(
19
+ 'Empresa' => $businessIdValue,
20
+ 'Hash' => $passwordValue,
21
+ 'Usuario' => $usernameValue
22
+ );
23
+ $client = new SoapClient('http://testing.facturante.com/api/Comprobantes.svc?wsdl');
24
+
25
+ $orders = Mage::getModel('sales/order')->getCollection()
26
+ ->addFieldToFilter('facturante_invoice_status', array('nin' => array('Procesado')));
27
+
28
+ foreach ($orders as $order) {
29
+ /** Acá tomo el estado de su última peticion de detalle de comprobante y luego actualizo el estado general
30
+ * de la orden */
31
+ $comprobantesOrder = Mage::getModel('facturante_invoicing/order_invoicingstatus')->getCollection()
32
+ ->addFilter('order_increment_id', $order->getIncrementId())
33
+ ->addFieldToFilter('status', array('nin' => array('Procesado','Error en Envío', 'No Generado')))
34
+ ->addFieldToSelect('idcomprobante')
35
+ ->addFieldToSelect('status')
36
+ ->setOrder('update_date','DESC')
37
+ ->load();
38
+
39
+ /** Tomo la ultima actualizacion de comprobante */
40
+ foreach ($comprobantesOrder as $comprobante) {
41
+ $idComprobante = $comprobante->idcomprobante;
42
+
43
+ $estadoAnteriorComprobante = $comprobante->status;
44
+ $responseDetalleComprobante = Mage::helper('facturante_invoicing')->getDetalleComprobante($auth, $idComprobante, $client);
45
+
46
+ $estadoActualComprobante = Mage::helper('facturante_invoicing')->getStringEstadoComprobante($responseDetalleComprobante->DetalleComprobanteResult->Comprobante->EstadoComprobante);
47
+
48
+ /** Si el estado del comprobante ha cambiado, entonces guardo el registro en la tabla de invoicingstatus */
49
+ if(((string) $estadoAnteriorComprobante !== (string) $estadoActualComprobante) && (!empty($estadoActualComprobante))) {
50
+ $newComprobanteStatus = Mage::getModel('facturante_invoicing/order_invoicingstatus');
51
+ $newComprobanteStatus->setOrderId($order->getId());
52
+ $newComprobanteStatus->setOrderIncrementId($order->getIncrementId());
53
+ $newComprobanteStatus->setIdcomprobante($idComprobante);
54
+ $newComprobanteStatus->setUpdateDate(now());
55
+ $newComprobanteStatus->setStatus($estadoActualComprobante);
56
+
57
+ switch($estadoActualComprobante) {
58
+ case 'Error en Comprobante':
59
+ $newComprobanteStatus->setComments($responseDetalleComprobante->DetalleComprobanteResult->Comprobante->MensajeAFIP);
60
+ break;
61
+ case 'Error en Envío':
62
+ $newComprobanteStatus->setComments("Comprobante generado con éxito y enviado, pero no ha llegado al destinatario. Puede que el email sea incorrecto, que la casilla destino no esté disponible o que esté llena.");
63
+ break;
64
+ case 'Procesado':
65
+ $newComprobanteStatus->setComments("Se realizó el envío al cliente con éxito.");
66
+ $newComprobanteStatus->setLink($responseDetalleComprobante->DetalleComprobanteResult->Comprobante->URLPDF);
67
+ break;
68
+ default:
69
+ break;
70
+ }
71
+
72
+ $newComprobanteStatus->save();
73
+
74
+ /** Acá analizo si el cambio de estado de comprobante amerita un cambio de estado a nivel global de la orden. */
75
+ $estadoNuevoOrden = Mage::helper('facturante_invoicing')->getStringEstadoOrden($estadoActualComprobante);
76
+ $orderObject = Mage::getModel('sales/order')->load($order->getId());
77
+ $orderObject->setFacturanteInvoiceStatus($estadoNuevoOrden);
78
+ $orderObject->save();
79
+ }
80
+ /** Solo trabajo con el ultimo registro y estado de cada comprobante. */
81
+ break;
82
+ /** Por eso luego del analisis hago el corte. */
83
+ }
84
+ }
85
+ }
86
+ }
app/code/local/Facturante/Invoicing/Model/Eav/Entity/Attribute/Source/Taxtype.php ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Facturante
4
+ * @package Invoicing
5
+ */
6
+ class Facturante_Invoicing_Model_Eav_Entity_Attribute_Source_Taxtype extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
7
+ {
8
+ /**
9
+ * Retrieve all options array
10
+ *
11
+ * @return array
12
+ */
13
+ public function getAllOptions()
14
+ {
15
+ if (is_null($this->_options)) {
16
+ $this->_options = array(
17
+ array(
18
+ "label" => Mage::helper("eav")->__(""),
19
+ "value" => 0
20
+ ),
21
+ array(
22
+ "label" => Mage::helper("eav")->__("MONOTRIBUTISTA"),
23
+ "value" => 1
24
+ ),
25
+ array(
26
+ "label" => Mage::helper("eav")->__("RESPONSABLE INSCRIPTO"),
27
+ "value" => 2
28
+ ),
29
+ array(
30
+ "label" => Mage::helper("eav")->__("CONSUMIDOR FINAL"),
31
+ "value" => 3
32
+ ),
33
+ array(
34
+ "label" => Mage::helper("eav")->__("IVA EXENTO"),
35
+ "value" => 4
36
+ ),
37
+ array(
38
+ "label" => Mage::helper("eav")->__("IVA NO RESPONSABLE"),
39
+ "value" => 5
40
+ ),
41
+ );
42
+ }
43
+ return $this->_options;
44
+ }
45
+
46
+ /**
47
+ * Retrieve option array
48
+ *
49
+ * @return array
50
+ */
51
+ public function getOptionArray()
52
+ {
53
+ $_options = array();
54
+ foreach ($this->getAllOptions() as $option) {
55
+ $_options[$option["value"]] = $option["label"];
56
+ }
57
+ return $_options;
58
+ }
59
+
60
+ /**
61
+ * Get a text for option value
62
+ *
63
+ * @param string|integer $value
64
+ * @return string
65
+ */
66
+ public function getOptionText($value)
67
+ {
68
+ $options = $this->getAllOptions();
69
+ foreach ($options as $option)
70
+ {
71
+ if ($option["value"] == $value)
72
+ {
73
+ return $option["label"];
74
+ }
75
+ }
76
+ return false;
77
+ }
78
+
79
+ /**
80
+ * Retrieve Column(s) for Flat
81
+ *
82
+ * @return array
83
+ */
84
+ public function getFlatColums()
85
+ {
86
+ $columns = array();
87
+ $columns[$this->getAttribute()->getAttributeCode()] = array(
88
+ "type" => "tinyint(1)",
89
+ "unsigned" => false,
90
+ "is_null" => true,
91
+ "default" => null,
92
+ "extra" => null
93
+ );
94
+
95
+ return $columns;
96
+ }
97
+
98
+ /**
99
+ * Retrieve Indexes(s) for Flat
100
+ *
101
+ * @return array
102
+ */
103
+ public function getFlatIndexes()
104
+ {
105
+ $indexes = array();
106
+
107
+ $index = "IDX_" . strtoupper($this->getAttribute()->getAttributeCode());
108
+ $indexes[$index] = array(
109
+ "type" => "index",
110
+ "fields" => array($this->getAttribute()->getAttributeCode())
111
+ );
112
+
113
+ return $indexes;
114
+ }
115
+
116
+ /**
117
+ * Retrieve Select For Flat Attribute update
118
+ *
119
+ * @param int $store
120
+ * @return Varien_Db_Select|null
121
+ */
122
+ public function getFlatUpdateSelect($store)
123
+ {
124
+ return Mage::getResourceModel("eav/entity_attribute")
125
+ ->getFlatUpdateSelect($this->getAttribute(), $store);
126
+ }
127
+ }
app/code/local/Facturante/Invoicing/Model/Observer.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Facturante
4
+ * @package Invoicing
5
+ */
6
+ class Facturante_Invoicing_Model_Observer
7
+ {
8
+ protected $_orderStatusBefore;
9
+ protected $_orderStatusBeforeLabel = '';
10
+
11
+ public function adminhtmlWidgetContainerHtmlBefore($event)
12
+ {
13
+ $block = $event->getBlock();
14
+ if ($block instanceof Mage_Adminhtml_Block_Sales_Order_View) {
15
+ $order = Mage::registry('current_order');
16
+
17
+ // Generar factura
18
+ $invoiceMessage = Mage::helper('facturante_invoicing')->__('¿Deseas generar una factura AFIP para esta orden?');
19
+ $invoiceUrl = Mage::helper('adminhtml')->getUrl('*/facturante/singleAfipInvoiceGeneration',array('order_id'=>$order->getId()));
20
+ $block->addButton('generate_afip_invoice', array(
21
+ 'label' => Mage::helper('facturante_invoicing')->__('Generar Factura'),
22
+ 'onclick' => "confirmSetLocation('{$invoiceMessage}','{$invoiceUrl}')",
23
+ 'class' => 'go'
24
+ ));
25
+
26
+ // Generar nota de crédito
27
+ $creditMessage = Mage::helper('facturante_invoicing')->__('¿Deseas generar una nota de crédito AFIP para esta orden?');
28
+ $creditUrl = Mage::helper('adminhtml')->getUrl('*/facturante/singleAfipCreditGeneration',array('order_id'=>$order->getId()));
29
+ $block->addButton('generate_afip_debit', array(
30
+ 'label' => Mage::helper('facturante_invoicing')->__('Generar Nota de Crédito'),
31
+ 'onclick' => "confirmSetLocation('{$creditMessage}','{$creditUrl}')",
32
+ 'class' => 'go'
33
+ ));
34
+
35
+ // Generar ntoa de debito
36
+ $debitMessage = Mage::helper('facturante_invoicing')->__('¿Deseas generar una nota de débito AFIP para esta orden?');
37
+ $debitUrl = Mage::helper('adminhtml')->getUrl('*/facturante/singleAfipDebitGeneration',array('order_id'=>$order->getId()));
38
+ $block->addButton('generate_afip_credit', array(
39
+ 'label' => Mage::helper('facturante_invoicing')->__('Generar Nota de Débito'),
40
+ 'onclick' => "confirmSetLocation('{$debitMessage}','{$debitUrl}')",
41
+ 'class' => 'go'
42
+ ));
43
+ }
44
+ }
45
+
46
+ public function savePreviousOrderStatus($observer)
47
+ {
48
+ $order = $observer->getEvent()->getOrder();
49
+ $this->_orderStatusBefore = $order->getOrigData('status');
50
+ }
51
+
52
+ public function autogenerateInvoice($observer)
53
+ {
54
+ $autoInvoicing = Mage::getStoreConfig('facturante/connection4/configuracion_activada');
55
+
56
+ // Si el modo autoinvoicing está activado
57
+ if ($autoInvoicing)
58
+ {
59
+ $order = $observer->getEvent()->getOrder();
60
+ $orderId = $order->getId();
61
+ $newOrderStatus = $order->getData('status');
62
+ $oldOrderStatus = $this->_orderStatusBefore;
63
+
64
+ if (!$oldOrderStatus)
65
+ {
66
+ $oldOrderStatus = 'new-order';
67
+ }
68
+
69
+ $autoInvoicingStatus = Mage::getStoreConfig('facturante/connection4/estado_orden');
70
+
71
+ // Si el estado en la orden cambió,
72
+ // y el estado de la orden para la autofacturación es el mismo que el estado nuevo
73
+ if($oldOrderStatus != $newOrderStatus && $newOrderStatus == $autoInvoicingStatus)
74
+ {
75
+ // Autogenerar factura para orden
76
+ if ($orderId)
77
+ {
78
+ $order = Mage::getModel('sales/order')->load($order->getId());
79
+ $response = Mage::helper('facturante_invoicing')->generateInvoiceForOrder($order, 'factura');
80
+ if ($response)
81
+ {
82
+ $estadoCrearComprobante = $response->CrearComprobanteSinImpuestosResult->Estado;
83
+ $mensaje = $response->CrearComprobanteSinImpuestosResult->Mensaje;
84
+ $comprobante = $response->CrearComprobanteSinImpuestosResult->IdComprobante;
85
+ }
86
+ }
87
+ }
88
+
89
+ }
90
+ }
91
+ }
app/code/local/Facturante/Invoicing/Model/Order/Invoicingstatus.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Facturante
4
+ * @package Invoicing
5
+ */
6
+ class Facturante_Invoicing_Model_Order_Invoicingstatus extends Mage_Core_Model_Abstract
7
+ {
8
+ protected function _construct()
9
+ {
10
+ $this->_init('facturante_invoicing/order_invoicingstatus');
11
+ }
12
+ }
app/code/local/Facturante/Invoicing/Model/Resource/Order/Invoicingstatus.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Facturante
4
+ * @package Invoicing
5
+ */
6
+ class Facturante_Invoicing_Model_Resource_Order_Invoicingstatus extends Mage_Core_Model_Resource_Db_Abstract
7
+ {
8
+ protected function _construct()
9
+ {
10
+ $this->_init('facturante_invoicing/order_invoicingstatus', 'order_invoicingstatus_id');
11
+ }
12
+ }
app/code/local/Facturante/Invoicing/Model/Resource/Order/Invoicingstatus/Collection.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Facturante
4
+ * @package Invoicing
5
+ */
6
+ class Facturante_Invoicing_Model_Resource_Order_Invoicingstatus_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
7
+ {
8
+ protected function _construct()
9
+ {
10
+ $this->_init('facturante_invoicing/order_invoicingstatus');
11
+ }
12
+ }
app/code/local/Facturante/Invoicing/Model/System/Config/Source/Dropdown/Orderstatus.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Facturante_Invoicing_Model_System_Config_Source_Dropdown_Orderstatus
4
+ {
5
+ protected $_orderStatuses;
6
+
7
+ public function toOptionArray()
8
+ {
9
+ $statuses = Mage::getModel('sales/order_config')->getStatuses();
10
+
11
+ $this->_orderStatuses = array();
12
+ $statusesCount = 0;
13
+
14
+ foreach ($statuses as $code => $label)
15
+ {
16
+ $this->_orderStatuses[$statusesCount]['value'] = $code;
17
+ $this->_orderStatuses[$statusesCount]['label'] = $label;
18
+ $statusesCount++;
19
+ }
20
+
21
+ return $this->_orderStatuses;
22
+ }
23
+ }
app/code/local/Facturante/Invoicing/Model/System/Config/Source/Dropdown/Values.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Facturante_Invoicing_Model_System_Config_Source_Dropdown_Values
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ array(
9
+ 'value' => '',
10
+ 'label' => '',
11
+ ),
12
+ array(
13
+ 'value' => '1',
14
+ 'label' => 'Bienes',
15
+ ),
16
+ array(
17
+ 'value' => '2',
18
+ 'label' => 'Servicios',
19
+ ),
20
+ array(
21
+ 'value' => '3',
22
+ 'label' => 'Productos y Servicios',
23
+ )
24
+ );
25
+ }
26
+ }
app/code/local/Facturante/Invoicing/controllers/Adminhtml/FacturanteController.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Facturante admin orders page controller
4
+ *
5
+ * @category Facturante
6
+ * @package Invoicing
7
+ */
8
+
9
+ class Facturante_Invoicing_Adminhtml_FacturanteController extends Mage_Adminhtml_Controller_Action
10
+ {
11
+ public function massInvoiceAction() {
12
+ $request = $this->getRequest();
13
+ $orderIds = $request->getParam('order_ids');
14
+
15
+ if(!is_array($orderIds)) {
16
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select order(s).'));
17
+
18
+ } else {
19
+ try {
20
+ foreach ($orderIds as $orderId) {
21
+ self::commonOrderProcess($orderId, Facturante_Invoicing_Helper_Data::FACTURANTE_CODIGO_FACTURA);
22
+ }
23
+ } catch (Exception $e) {
24
+ self::getErrorResponse($e);
25
+ }
26
+ }
27
+ $this->_redirect('*/sales_order/index');
28
+ }
29
+
30
+ public function singleAfipInvoiceGenerationAction() {
31
+ $orderId = $this->getRequest()->getParam('order_id');
32
+ try {
33
+ self::commonOrderProcess($orderId, Facturante_Invoicing_Helper_Data::FACTURANTE_CODIGO_FACTURA);
34
+ } catch (Exception $e) {
35
+ self::getErrorResponse($e);
36
+ }
37
+ $this->_redirect('*/sales_order/view/order_id/'.$orderId);
38
+ }
39
+
40
+ public function singleAfipCreditGenerationAction()
41
+ {
42
+ $orderId = $this->getRequest()->getParam('order_id');
43
+ try {
44
+ self::commonOrderProcess($orderId, Facturante_Invoicing_Helper_Data::FACTURANTE_CODIGO_NOTA_DE_CREDITO);
45
+ } catch (Exception $e) {
46
+ self::getErrorResponse($e);
47
+ }
48
+ $this->_redirect('*/sales_order/view/order_id/'.$orderId);
49
+ }
50
+
51
+ public function singleAfipDebitGenerationAction()
52
+ {
53
+ $orderId = $this->getRequest()->getParam('order_id');
54
+ try {
55
+ self::commonOrderProcess($orderId, Facturante_Invoicing_Helper_Data::FACTURANTE_CODIGO_NOTA_DE_DEBITO);
56
+ } catch (Exception $e) {
57
+ self::getErrorResponse($e);
58
+ }
59
+ $this->_redirect('*/sales_order/view/order_id/'.$orderId);
60
+ }
61
+
62
+ /** Analiza el error y devuelve el mensaje */
63
+ public function getErrorResponse($e) {
64
+ if($e->getMessage() == "Could not connect to host") {
65
+ Mage::getSingleton('adminhtml/session')->addError("En estos momentos no es posible procesar su solicitud. Verifique su conexión a internet y reintente más tarde.");
66
+ } else {
67
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Procesar orden a traves de la API de facturante
73
+ * Posibles valores para $type: 'factura', 'debito' o 'credito'
74
+ *
75
+ * @param int $ordenId
76
+ * @param string $type
77
+ */
78
+ public function commonOrderProcess($ordenId, $type)
79
+ {
80
+ // Validar primero que la configuración necesaria desde los system config existe
81
+ $prefijo = Mage::getStoreConfig('facturante/connection3/prefijo');
82
+ $tipoFacturacion = Mage::getStoreConfig('facturante/connection3/bienes');
83
+
84
+ if (!$prefijo)
85
+ {
86
+ Mage::getSingleton('core/session')->addError('Por favor, configure el prefijo AFIP en: Sistema -> Configuración -> Facturante: Prefijo');
87
+ return false;
88
+ }
89
+ if (!$tipoFacturacion)
90
+ {
91
+ Mage::getSingleton('core/session')->addError('Por favor, configure el tipo de facturación AFIP en: Sistema -> Configuración -> Facturante: Tipo de Facturación');
92
+ return false;
93
+ }
94
+
95
+ $order = Mage::getModel('sales/order')->load($ordenId);
96
+
97
+ if ($order->getId()) {
98
+ $response = Mage::helper('facturante_invoicing')->generateInvoiceForOrder($order, $type);
99
+
100
+ if ($response)
101
+ {
102
+ $estadoCrearComprobante = $response->CrearComprobanteSinImpuestosResult->Estado;
103
+ $mensaje = $response->CrearComprobanteSinImpuestosResult->Mensaje;
104
+ $comprobante = $response->CrearComprobanteSinImpuestosResult->IdComprobante;
105
+
106
+ if($estadoCrearComprobante == 'OK') {
107
+ Mage::getSingleton('core/session')->addSuccess('Comprobante Nº'.$comprobante.' generado correctamente para la orden Nº '.$order->getIncrementId().'.');
108
+ } else {
109
+ Mage::getSingleton('core/session')->addError('Ha ocurrido un error al intentar generar el comprobante para la orden Nª '.$order->getIncrementId().'.<br>
110
+ Detalle: '.$mensaje);
111
+ }
112
+ }
113
+ }
114
+ }
115
+ }
app/code/local/Facturante/Invoicing/etc/adminhtml.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <facturante translate="title" module="facturante_invoicing">
12
+ <title>Facturante</title>
13
+ </facturante>
14
+ </children>
15
+ </config>
16
+ </children>
17
+ </system>
18
+ </children>
19
+ </admin>
20
+ </resources>
21
+ </acl>
22
+ </config>
app/code/local/Facturante/Invoicing/etc/config.xml ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Facturante_Invoicing>
5
+ <version>0.1.6</version>
6
+ </Facturante_Invoicing>
7
+ </modules>
8
+ <adminhtml>
9
+ <translate>
10
+ <modules>
11
+ <Facturante_Invoicing>
12
+ <files>
13
+ <default>Facturante_Invoicing.csv</default>
14
+ </files>
15
+ </Facturante_Invoicing>
16
+ </modules>
17
+ </translate>
18
+ <events>
19
+ <adminhtml_widget_container_html_before>
20
+ <observers>
21
+ <facturante_invoicing>
22
+ <class>facturante_invoicing/observer</class>
23
+ <type>singleton</type>
24
+ <method>adminhtmlWidgetContainerHtmlBefore</method>
25
+ </facturante_invoicing>
26
+ </observers>
27
+ </adminhtml_widget_container_html_before>
28
+ </events>
29
+ </adminhtml>
30
+ <global>
31
+ <models>
32
+ <facturante_invoicing>
33
+ <class>Facturante_Invoicing_Model</class>
34
+ <resourceModel>facturante_invoicing_resource</resourceModel>
35
+ </facturante_invoicing>
36
+ <facturante_invoicing_resource>
37
+ <class>Facturante_Invoicing_Model_Resource</class>
38
+ <entities>
39
+ <order_invoicingstatus>
40
+ <table>order_invoicingstatus</table>
41
+ </order_invoicingstatus>
42
+ </entities>
43
+ </facturante_invoicing_resource>
44
+ </models>
45
+ <events>
46
+ <sales_order_save_before>
47
+ <observers>
48
+ <facturante_invoicing>
49
+ <type>singleton</type>
50
+ <class>facturante_invoicing/observer</class>
51
+ <method>savePreviousOrderStatus</method>
52
+ </facturante_invoicing>
53
+ </observers>
54
+ </sales_order_save_before>
55
+ <sales_order_save_after>
56
+ <observers>
57
+ <facturante_invoicing>
58
+ <type>singleton</type>
59
+ <class>facturante_invoicing/observer</class>
60
+ <method>autogenerateInvoice</method>
61
+ </facturante_invoicing>
62
+ </observers>
63
+ </sales_order_save_after>
64
+ </events>
65
+ <blocks>
66
+ <facturante_invoicing>
67
+ <class>Facturante_Invoicing_Block</class>
68
+ </facturante_invoicing>
69
+ <adminhtml>
70
+ <rewrite>
71
+ <sales_order_grid>Facturante_Invoicing_Block_Adminhtml_Sales_Order_Grid</sales_order_grid>
72
+ </rewrite>
73
+ </adminhtml>
74
+ </blocks>
75
+ <helpers>
76
+ <facturante_invoicing>
77
+ <class>Facturante_Invoicing_Helper</class>
78
+ </facturante_invoicing>
79
+ </helpers>
80
+ <resources>
81
+ <facturante_invoicing_setup>
82
+ <setup>
83
+ <class>Mage_Sales_Model_Resource_Setup</class>
84
+ <module>Facturante_Invoicing</module>
85
+ </setup>
86
+ </facturante_invoicing_setup>
87
+ </resources>
88
+ <fieldsets>
89
+ <sales_convert_quote>
90
+ <afip_invoicing_status><to_order>*</to_order></afip_invoicing_status>
91
+ </sales_convert_quote>
92
+ <sales_convert_order>
93
+ <afip_invoicing_status><to_quote>*</to_quote></afip_invoicing_status>
94
+ </sales_convert_order>
95
+ </fieldsets>
96
+ </global>
97
+ <adminhtml>
98
+ <layout>
99
+ <updates>
100
+ <facturante_invoicing>
101
+ <file>facturante/invoicing.xml</file>
102
+ </facturante_invoicing>
103
+ </updates>
104
+ </layout>
105
+ </adminhtml>
106
+ <admin>
107
+ <routers>
108
+ <adminhtml>
109
+ <args>
110
+ <modules>
111
+ <Facturante_Invoicing after="Mage_Adminhtml">Facturante_Invoicing_Adminhtml</Facturante_Invoicing>
112
+ </modules>
113
+ </args>
114
+ </adminhtml>
115
+ </routers>
116
+ </admin>
117
+ <crontab>
118
+ <jobs>
119
+ <comprobantes_pendientes>
120
+ <schedule>
121
+ <cron_expr>* * * * *</cron_expr>
122
+ </schedule>
123
+ <run>
124
+ <model>facturante_invoicing/CronComprobantesPendientes::actualizarEstadoComprobantes</model>
125
+ </run>
126
+ </comprobantes_pendientes>
127
+ <comprobantes_con_error>
128
+ <schedule>
129
+ <cron_expr>*/2 * * * *</cron_expr>
130
+ </schedule>
131
+ <run>
132
+ <model>facturante_invoicing/CronComprobantesError::callGenerateInvoiceForOrder</model>
133
+ </run>
134
+ </comprobantes_con_error>
135
+ </jobs>
136
+ </crontab>
137
+ </config>
app/code/local/Facturante/Invoicing/etc/system.xml ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <facturante translate="label" module="facturante_invoicing">
5
+ <label>Facturante</label>
6
+ <tab>sales</tab>
7
+ <frontend_type>text</frontend_type>
8
+ <sort_order>301</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>1</show_in_store>
12
+ <groups>
13
+ <connection translate="label">
14
+ <label>Conexión API</label>
15
+ <frontend_type>text</frontend_type>
16
+ <sort_order>10</sort_order>
17
+ <show_in_default>1</show_in_default>
18
+ <show_in_website>1</show_in_website>
19
+ <show_in_store>1</show_in_store>
20
+ <fields>
21
+ <username translate="label">
22
+ <label>Usuario</label>
23
+ <frontend_type>text</frontend_type>
24
+ <sort_order>10</sort_order>
25
+ <show_in_default>1</show_in_default>
26
+ <show_in_website>1</show_in_website>
27
+ <show_in_store>1</show_in_store>
28
+ </username>
29
+ <password translate="label">
30
+ <label>Clave</label>
31
+ <frontend_type>password</frontend_type>
32
+ <validate>validate-alphanum</validate>
33
+ <sort_order>20</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>1</show_in_store>
37
+ </password>
38
+ <business_id translate="label">
39
+ <label>ID de Empresa</label>
40
+ <frontend_type>text</frontend_type>
41
+ <validate>validate-not-negative-number</validate>
42
+ <sort_order>30</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ </business_id>
47
+ <test_connection>
48
+ <label></label>
49
+ <comment></comment>
50
+ <frontend_type>text</frontend_type>
51
+ <frontend_model>facturante_invoicing/system_config_form_fieldset_connection_test</frontend_model>
52
+ <sort_order>50</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>0</show_in_website>
55
+ <show_in_store>0</show_in_store>
56
+ </test_connection>
57
+ </fields>
58
+ </connection>
59
+
60
+ <!-- INICIO - Configuracion General -->
61
+ <connection2 translate="label">
62
+ <label>Configuracion General</label>
63
+ <frontend_type>text</frontend_type>
64
+ <sort_order>11</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
+ <fields>
69
+ <enviar_comprobante translate="label">
70
+ <label>¿Enviar Comprobante?</label>
71
+ <frontend_type>select</frontend_type>
72
+ <source_model>adminhtml/system_config_source_yesno</source_model>
73
+ <sort_order>1</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
+ </enviar_comprobante>
78
+ </fields>
79
+ <fields>
80
+ <precios_finales translate="label">
81
+ <label>¿Los precios en el catálogo son finales?</label>
82
+ <frontend_type>select</frontend_type>
83
+ <source_model>adminhtml/system_config_source_yesno</source_model>
84
+ <sort_order>2</sort_order>
85
+ <show_in_default>1</show_in_default>
86
+ <show_in_website>1</show_in_website>
87
+ <show_in_store>1</show_in_store>
88
+ <comment>Si selecciona "No", entonces se considerarán los precios como netos, y se agregarán los impuestos configurados en Magento. Caso contrario, se tomarán los precios como finales y no se incluirán los impuestos de Magento.</comment>
89
+ </precios_finales>
90
+ </fields>
91
+ </connection2>
92
+ <!-- FIN - Configuracion General -->
93
+
94
+ <!-- INICIO - Configuracion AFIP -->
95
+ <connection3 translate="label">
96
+ <label>Configuración AFIP</label>
97
+ <frontend_type>text</frontend_type>
98
+ <sort_order>12</sort_order>
99
+ <show_in_default>1</show_in_default>
100
+ <show_in_website>1</show_in_website>
101
+ <show_in_store>1</show_in_store>
102
+ <fields>
103
+ <prefijo translate="label">
104
+ <label>Punto de Venta</label>
105
+ <frontend_type>text</frontend_type>
106
+ <sort_order>1</sort_order>
107
+ <show_in_default>1</show_in_default>
108
+ <show_in_website>1</show_in_website>
109
+ <show_in_store>1</show_in_store>
110
+ <validate>validate-number</validate>
111
+ </prefijo>
112
+ <percibe_iva translate="label">
113
+ <label>¿Percibe IVA?</label>
114
+ <frontend_type>select</frontend_type>
115
+ <source_model>adminhtml/system_config_source_yesno</source_model>
116
+ <sort_order>2</sort_order>
117
+ <show_in_default>1</show_in_default>
118
+ <show_in_website>1</show_in_website>
119
+ <show_in_store>1</show_in_store>
120
+ </percibe_iva>
121
+ <percibe_iibb translate="label">
122
+ <label>¿Percibe IIBB?</label>
123
+ <frontend_type>select</frontend_type>
124
+ <source_model>adminhtml/system_config_source_yesno</source_model>
125
+ <sort_order>3</sort_order>
126
+ <show_in_default>1</show_in_default>
127
+ <show_in_website>1</show_in_website>
128
+ <show_in_store>1</show_in_store>
129
+ </percibe_iibb>
130
+ <bienes translate="label">
131
+ <label>Indique tipo de facturación</label>
132
+ <frontend_type>select</frontend_type>
133
+ <source_model>facturante_invoicing/system_config_source_dropdown_values</source_model>
134
+ <sort_order>4</sort_order>
135
+ <show_in_default>1</show_in_default>
136
+ <show_in_website>1</show_in_website>
137
+ <show_in_store>1</show_in_store>
138
+ </bienes>
139
+ </fields>
140
+ </connection3>
141
+ <!-- FIN - Configuracion AFIP -->
142
+
143
+ <!-- INICIO - Configuracion AFIP -->
144
+ <connection4 translate="label">
145
+ <label>Facturación Automática</label>
146
+ <frontend_type>text</frontend_type>
147
+ <sort_order>15</sort_order>
148
+ <show_in_default>1</show_in_default>
149
+ <show_in_website>1</show_in_website>
150
+ <show_in_store>1</show_in_store>
151
+ <fields>
152
+ <configuracion_activada translate="label">
153
+ <label>¿Activar configuración automática?</label>
154
+ <frontend_type>select</frontend_type>
155
+ <source_model>adminhtml/system_config_source_yesno</source_model>
156
+ <sort_order>2</sort_order>
157
+ <show_in_default>1</show_in_default>
158
+ <show_in_website>1</show_in_website>
159
+ <show_in_store>1</show_in_store>
160
+ </configuracion_activada>
161
+ <estado_orden translate="label">
162
+ <label>Indique estado de orden para emitir factura de forma automática</label>
163
+ <frontend_type>select</frontend_type>
164
+ <source_model>facturante_invoicing/system_config_source_dropdown_orderstatus</source_model>
165
+ <sort_order>4</sort_order>
166
+ <show_in_default>1</show_in_default>
167
+ <show_in_website>1</show_in_website>
168
+ <show_in_store>1</show_in_store>
169
+ </estado_orden>
170
+ </fields>
171
+ </connection4>
172
+ <!-- FIN - Configuracion AFIP -->
173
+ </groups>
174
+ </facturante>
175
+ </sections>
176
+ </config>
app/code/local/Facturante/Invoicing/sql/facturante_invoicing_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Module installer
4
+ *
5
+ * @category Facturante
6
+ * @package Facturante_Invoicing
7
+ */
8
+
9
+ /* @var $installer Mage_Core_Model_Resource_Setup */
10
+ $installer = $this;
11
+
12
+ $installer->startSetup();
13
+ $installer->endSetup();
app/code/local/Facturante/Invoicing/sql/facturante_invoicing_setup/mysql4-upgrade-0.1.0-0.1.1.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Module upgrade: Add quote and order 'afip_invoicing_status' attribute
4
+ *
5
+ * @category Facturante
6
+ * @package Facturante_Invoicing
7
+ */
8
+
9
+ /* @var $installer Mage_Core_Model_Resource_Setup */
10
+ $installer = $this;
11
+
12
+ $installer->startSetup();
13
+
14
+ Mage::log('Adding attribute', null,'facturante-module-upgrade-0.1.1.log');
15
+
16
+ $this->addAttribute('order', 'facturante_invoice_status', array(
17
+ 'type' => 'varchar',
18
+ 'label' => 'Estado Facturación',
19
+ 'visible' => true,
20
+ 'required' => false,
21
+ 'visible_on_front' => false,
22
+ 'user_defined' => false,
23
+ 'default' => 'Pendiente'
24
+ ));
25
+
26
+ Mage::log('Added attribute', null,'facturante-module-upgrade-0.1.1.log');
27
+
28
+ $installer->endSetup();
app/code/local/Facturante/Invoicing/sql/facturante_invoicing_setup/mysql4-upgrade-0.1.1-0.1.2.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Module upgrade: Add quote and order 'afip_invoicing_status' attribute
4
+ *
5
+ * @category Facturante
6
+ * @package Facturante_Invoicing
7
+ */
8
+
9
+ /* @var $installer Mage_Core_Model_Resource_Setup */
10
+ $installer = $this;
11
+
12
+ $installer->startSetup();
13
+
14
+ $installer->endSetup();
app/code/local/Facturante/Invoicing/sql/facturante_invoicing_setup/mysql4-upgrade-0.1.2-0.1.3.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Facturante
4
+ * @package Facturante_Invoicing
5
+ */
6
+
7
+ /* @var $installer Mage_Core_Model_Resource_Setup */
8
+ $installer = $this;
9
+
10
+ $installer->startSetup();
11
+
12
+ Mage::log('Adding order_invoicingstatus table', null,'facturante-module-upgrade-0.1.2.log');
13
+
14
+ if (!$installer->tableExists($installer->getTable('facturante_invoicing/order_invoicingstatus'))) {
15
+ $installer->run("
16
+ CREATE TABLE `{$installer->getTable('facturante_invoicing/order_invoicingstatus')}` (
17
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
18
+ `order_increment_id` int(10) unsigned NOT NULL,
19
+ `order_id` int(10) unsigned NOT NULL,
20
+ `idcomprobante` int(10) unsigned DEFAULT NULL,
21
+ `comments` varchar(255) DEFAULT NULL,
22
+ `status` varchar(255) DEFAULT NULL,
23
+ `link` varchar(255) DEFAULT NULL,
24
+ `update_date` datetime DEFAULT NULL,
25
+ PRIMARY KEY (`id`)
26
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
27
+ ");
28
+ }
29
+
30
+ Mage::log('Added order_invoicingstatus table', null,'facturante-module-upgrade-0.1.2.log');
31
+
32
+ $installer->endSetup();
app/code/local/Facturante/Invoicing/sql/facturante_invoicing_setup/mysql4-upgrade-0.1.3-0.1.4.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+ $installer->startSetup();
5
+
6
+ $requiredCountries = Mage::getStoreConfig('general/region/state_required');
7
+ Mage::getConfig()->saveConfig('general/region/state_required', $requiredCountries . ',AR');
8
+
9
+ $installer->endSetup();
app/code/local/Facturante/Invoicing/sql/facturante_invoicing_setup/mysql4-upgrade-0.1.4-0.1.5.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Module upgrade: Add order 'afip_last_invoice_type' attribute
4
+ *
5
+ * @category Facturante
6
+ * @package Facturante_Invoicing
7
+ */
8
+
9
+ /* @var $installer Mage_Core_Model_Resource_Setup */
10
+ $installer = $this;
11
+
12
+ $installer->startSetup();
13
+
14
+ Mage::log('Adding attribute', null,'facturante-module-upgrade-0.1.5.log');
15
+
16
+ $this->addAttribute('order', 'afip_last_invoice_type', array(
17
+ 'type' => 'varchar',
18
+ 'label' => 'Ultimo Tipo de Factura',
19
+ 'visible' => false,
20
+ 'required' => false,
21
+ 'visible_on_front' => false,
22
+ 'user_defined' => false,
23
+ 'default' => ''
24
+ ));
25
+
26
+ Mage::log('Added attribute', null,'facturante-module-upgrade-0.1.5.log');
27
+
28
+ $installer->endSetup();
app/code/local/Facturante/Invoicing/sql/facturante_invoicing_setup/mysql4-upgrade-0.1.5-0.1.6.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Module upgrade: Add 'Argentina' provinces
4
+ *
5
+ * @category Facturante
6
+ * @package Facturante_Invoicing
7
+ */
8
+
9
+ /* @var $installer Mage_Core_Model_Resource_Setup */
10
+ $installer = $this;
11
+ $installer->startSetup();
12
+
13
+ $setup = $this;
14
+
15
+ $setup->run("
16
+ INSERT INTO `directory_country_region` (`region_id`, `country_id`, `code`, `default_name`) VALUES
17
+ (NULL, 'AR', 'BA', 'Buenos Aires'),
18
+ (NULL, 'AR', 'CA', 'Catamarca'),
19
+ (NULL, 'AR', 'CH', 'Chaco'),
20
+ (NULL, 'AR', 'CU', 'Chubut'),
21
+ (NULL, 'AR', 'CO', 'Córdoba'),
22
+ (NULL, 'AR', 'CR', 'Corrientes'),
23
+ (NULL, 'AR', 'ER', 'Entre Ríos'),
24
+ (NULL, 'AR', 'FO', 'Formosa'),
25
+ (NULL, 'AR', 'JU', 'Jujuy'),
26
+ (NULL, 'AR', 'LP', 'La Pampa'),
27
+ (NULL, 'AR', 'LR', 'La Rioja'),
28
+ (NULL, 'AR', 'MZ', 'Mendoza'),
29
+ (NULL, 'AR', 'MI', 'Misiones'),
30
+ (NULL, 'AR', 'NE', 'Neuquén'),
31
+ (NULL, 'AR', 'RN', 'Río Negro'),
32
+ (NULL, 'AR', 'SA', 'Salta'),
33
+ (NULL, 'AR', 'SJ', 'San Juan'),
34
+ (NULL, 'AR', 'SL', 'San Luis'),
35
+ (NULL, 'AR', 'SC', 'Santa Cruz'),
36
+ (NULL, 'AR', 'SF', 'Santa Fe'),
37
+ (NULL, 'AR', 'SE', 'Santiago del Estero'),
38
+ (NULL, 'AR', 'TF', 'Tierra del Fuego'),
39
+ (NULL, 'AR', 'TU', 'Tucumán');
40
+ ");
41
+
42
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/facturante/invoicing.xml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <adminhtml_sales_order_view>
4
+ <reference name="sales_order_tabs">
5
+ <action method="addTab">
6
+ <name>Facturante</name>
7
+ <block>facturante_invoicing/Adminhtml_Order_View_Tab_Facturante</block>
8
+ </action>
9
+ </reference>
10
+ <reference name="order_info">
11
+ <action method="setTemplate"><template>facturante/sales/order/view/info.phtml</template></action>
12
+ </reference>
13
+ </adminhtml_sales_order_view>
14
+ </layout>
app/design/adminhtml/default/default/template/facturante/.DS_Store ADDED
Binary file
app/design/adminhtml/default/default/template/facturante/form/renderer/fieldset/attributes.phtml ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $_element = $this->getElement();
3
+ $_htmlId = $this->getElement()->getHtmlId();
4
+ $_htmlClass = $this->getElement()->getClass();
5
+ $_htmlName = $this->getElement()->getName();
6
+ $values = $this->getValues();
7
+ $selectedAttributes = $values instanceof Varien_Object && $values->getData('attributes') ? $values->getData('attributes') : array();
8
+ ?>
9
+ <?php $attributes = $this->getData('index_attributes') ? $this->getData('index_attributes') : array() ?>
10
+ <?php if ($_element->getFieldsetContainerId()): ?>
11
+ <div id="<?php echo $_element->getFieldsetContainerId(); ?>">
12
+ <?php endif; ?>
13
+ <?php if ($_element->getLegend()): ?>
14
+ <div class="entry-edit-head">
15
+ <h4 class="icon-head head-edit-form fieldset-legend"><?php echo $_element->getLegend() ?></h4>
16
+ <div class="form-buttons"><?php echo $_element->getHeaderBar() ?></div>
17
+ </div>
18
+ <?php endif; ?>
19
+ <?php if (!$_element->getNoContainer()): ?>
20
+ <div class="fieldset <?php echo $_element->getClass() ?>" id="<?php echo $_element->getHtmlId() ?>">
21
+ <?php endif; ?>
22
+ <div class="hor-scroll grid tier">
23
+ <?php if ($_element->getComment()): ?>
24
+ <p class="comment"><?php echo $this->escapeHtml($_element->getComment()) ?></p>
25
+ <?php endif; ?>
26
+ <?php if ($_element->hasHtmlContent()): ?>
27
+ <?php echo $_element->getHtmlContent(); ?>
28
+ <?php else: ?>
29
+ <table cellspacing="0" class="data border">
30
+ <thead>
31
+ <tr class="headings">
32
+ <th><?php echo $this->__('Attribute') ?></th>
33
+ <th><?php echo $this->__('Weight') ?></th>
34
+ <th />
35
+ </tr>
36
+ <tr id="<?php echo $_htmlId ?>_add_template" class="template no-display">
37
+ <td class="no-br">
38
+ <select disabled="no-template" class="<?php echo $_htmlClass ?> custgroup" name="<?php echo $_htmlName ?>[__index__][attribute]" id="attributes_row___index___attribute">
39
+ <?php foreach($attributes as $k => $v) : ?>
40
+ <option value="<?php echo $k ?>"><?php echo $v ?></option>
41
+ <?php endforeach ?>
42
+ </select>
43
+ </td>
44
+ <td class="no-br">
45
+ <input disabled="no-template" class="<?php echo $_htmlClass ?> required-entry validate-number validate-digits validate-greater-than-zero" type="text" name="<?php echo $_htmlName ?>[__index__][weight]" value="#{weight}" id="attributes_row___index___weight" />
46
+ </td>
47
+ <td class="last"><input type="hidden" name="<?php echo $_htmlName ?>[__index__][delete]" class="delete" disabled="no-template" value="" /><button title="Delete attribute" class="scalable delete icon-btn delete-product-option" onclick="attributesControl.deleteItem(event);return false"><span>Delete</span></button></td>
48
+ </tr>
49
+ </thead>
50
+ <tfoot>
51
+ <tr>
52
+ <td></td>
53
+ <td colspan="3" class="a-right">
54
+ <button style="" onclick="attributesControl.addItem()" class="scalable add" type="button"><span>Add attribute</span></button>
55
+ </td>
56
+ </tr>
57
+ </tfoot>
58
+ <tbody id="<?php echo $_htmlId ?>_container">
59
+ <?php $_index = 0 ?>
60
+ <?php foreach($selectedAttributes as $sa) : ?>
61
+ <tr id="<?php echo $_htmlId ?>_add_template" class="template">
62
+ <td class="no-br">
63
+ <select class="<?php echo $_htmlClass ?> custgroup" name="<?php echo $_htmlName ?>[<?php echo $_index ?>][attribute]" id="attributes_row_<?php echo $_index ?>_attribute">
64
+ <?php foreach($attributes as $k => $v) : ?>
65
+ <option value="<?php echo $k ?>"<?php if($sa['attribute'] == $k) : ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
66
+ <?php endforeach ?>
67
+ </select>
68
+ </td>
69
+ <td class="no-br">
70
+ <input class="<?php echo $_htmlClass ?> required-entry validate-number validate-digits validate-greater-than-zero" type="text" name="<?php echo $_htmlName ?>[<?php echo $_index ?>][weight]" value="<?php echo $sa['weight'] ?>" id="attributes_row_<?php echo $_index ?>_weight" />
71
+ </td>
72
+ <td class="last"><input type="hidden" name="<?php echo $_htmlName ?>[<?php echo $_index ?>][delete]" class="delete" value="" /><button title="Delete attribute" class="scalable delete icon-btn delete-product-option" onclick="attributesControl.deleteItem(event);return false"><span>Delete</span></button></td>
73
+ </tr>
74
+ <?php $_index++ ?>
75
+ <?php endforeach ?>
76
+ </tbody>
77
+ </table>
78
+ <?php endif; ?>
79
+ </div>
80
+ <?php echo $_element->getSubFieldsetHtml() ?>
81
+ <?php if (!$_element->getNoContainer()): ?>
82
+ </div>
83
+ <?php endif; ?>
84
+ <?php if ($_element->getFieldsetContainerId()): ?>
85
+ </div>
86
+ <?php endif; ?>
87
+ <script type="text/javascript">
88
+ attributesControl.setCount(<?php echo $_index ?>);
89
+ </script>
app/design/adminhtml/default/default/template/facturante/form/renderer/fieldset/error.phtml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $_element = $this->getElement();
3
+ ?>
4
+ <?php if ($_element->getFieldsetContainerId()): ?>
5
+ <div id="<?php echo $_element->getFieldsetContainerId(); ?>">
6
+ <?php endif; ?>
7
+ <?php if ($_element->getLegend()): ?>
8
+ <div class="entry-edit-head">
9
+ <h4 class="icon-head head-edit-form fieldset-legend"><?php echo $_element->getLegend() ?></h4>
10
+ <div class="form-buttons"><?php echo $_element->getHeaderBar() ?></div>
11
+ </div>
12
+ <?php endif; ?>
13
+ <?php if (!$_element->getNoContainer()): ?>
14
+ <div class="fieldset <?php echo $_element->getClass() ?>" id="<?php echo $_element->getHtmlId() ?>">
15
+ <?php endif; ?>
16
+ <span style="color: red;font-weight: bold;"><?php echo $this->__('Some error occurs. Please, retry type selection') ?></span>
17
+ <?php if (!$_element->getNoContainer()): ?>
18
+ </div>
19
+ <?php endif; ?>
20
+ <?php if ($_element->getFieldsetContainerId()): ?>
21
+ </div>
22
+ <?php endif; ?>
app/design/adminhtml/default/default/template/facturante/form/testconnection.phtml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="test_connection_container">
2
+ <div>
3
+ <?php
4
+ $usernameValue = Mage::getStoreConfig('facturante/connection/username');
5
+ $passwordValue = Mage::getStoreConfig('facturante/connection/password');
6
+ $businessIdValue = Mage::getStoreConfig('facturante/connection/business_id');
7
+
8
+ if($usernameValue != '' && $passwordValue != '' && $businessIdValue != ''): ?>
9
+ <?php if ($this->getSuccessfulApiConnection()): ?>
10
+ <div style="color: green; font-weight: bold;"><?php echo $this->__('Conexión exitosamente establecida') ?></div>
11
+ <?php else: ?>
12
+ <div style="color: red; font-weight: bold;"><?php echo $this->__('No se pudo establecer una conexión con Facturante con las credenciales configuradas. Por favor revise sus credenciales y vuelva a intentarlo.') ?></div>
13
+ <?php endif ?>
14
+ <?php else: ?>
15
+ <div><?php echo $this->__('Agregue sus credenciales de Facturante y guarde esta página para configurar el módulo de Facturante') ?></div>
16
+ <?php endif ?>
17
+ </div>
18
+ </div>
app/design/adminhtml/default/default/template/facturante/order/view/tab/facturante.phtml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--<div class="entry-edit">-->
2
+ <!-- <div class="entry-edit-head">-->
3
+ <!-- <h4>--><?php //echo $this->__('Nuevo TAB'); ?><!--</h4>-->
4
+ <!-- </div>-->
5
+ <!-- <div class="fieldset fieldset-wide">-->
6
+ <!-- Lorem ipsum -->
7
+ <!-- </div>-->
8
+ <!--</div>-->
9
+ <?php
10
+ echo $this->getLayout()->createBlock('facturante_invoicing/adminhtml_sales_order_gridfacturante')->toHtml();
11
+ ?>
app/design/adminhtml/default/default/template/facturante/sales/order/view/info.phtml ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php $_order = $this->getOrder() ?>
28
+ <?php
29
+ $orderAdminDate = $this->formatDate($_order->getCreatedAtDate(), 'medium', true);
30
+ $orderStoreDate = $this->formatDate($_order->getCreatedAtStoreDate(), 'medium', true);
31
+ ?>
32
+ <div class="box-left">
33
+ <!--Order Information-->
34
+ <div class="entry-edit">
35
+ <?php if ($_order->getEmailSent()):
36
+ $_email = Mage::helper('sales')->__('the order confirmation email was sent');
37
+ else:
38
+ $_email = Mage::helper('sales')->__('the order confirmation email is not sent');
39
+ endif; ?>
40
+ <div class="entry-edit-head">
41
+ <?php if ($this->getNoUseOrderLink()): ?>
42
+ <h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('Order # %s', $_order->getRealOrderId()) ?> (<?php echo $_email ?>)</h4>
43
+ <?php else: ?>
44
+ <a href="<?php echo $this->getViewUrl($_order->getId()) ?>"><?php echo Mage::helper('sales')->__('Order # %s', $_order->getRealOrderId()) ?></a>
45
+ <strong>(<?php echo $_email ?>)</strong>
46
+ <?php endif; ?>
47
+ </div>
48
+ <div class="fieldset">
49
+ <table cellspacing="0" class="form-list">
50
+ <tr>
51
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Order Date') ?></label></td>
52
+ <td class="value"><strong><?php echo $orderAdminDate ?></strong></td>
53
+ </tr>
54
+ <?php if ($orderAdminDate != $orderStoreDate):?>
55
+ <tr>
56
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Order Date (%s)', $_order->getCreatedAtStoreDate()->getTimezone()) ?></label></td>
57
+ <td class="value"><strong><?php echo $orderStoreDate ?></strong></td>
58
+ </tr>
59
+ <?php endif;?>
60
+ <tr>
61
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Order Status') ?></label></td>
62
+ <td class="value"><strong><span id="order_status"><?php echo $_order->getStatusLabel() ?></span></strong></td>
63
+ </tr>
64
+ <tr>
65
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Purchased From') ?></label></td>
66
+ <td class="value"><strong><?php echo $this->getOrderStoreName() ?></strong></td>
67
+ </tr>
68
+ <?php if($_order->getRelationChildId()): ?>
69
+ <tr>
70
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Link to the New Order') ?></label></td>
71
+ <td class="value"><a href="<?php echo $this->getViewUrl($_order->getRelationChildId()) ?>">
72
+ <?php echo $_order->getRelationChildRealId() ?>
73
+ </a></td>
74
+ </tr>
75
+ <?php endif; ?>
76
+ <?php if($_order->getRelationParentId()): ?>
77
+ <tr>
78
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Link to the Previous Order') ?></label></td>
79
+ <td class="value"><a href="<?php echo $this->getViewUrl($_order->getRelationParentId()) ?>">
80
+ <?php echo $_order->getRelationParentRealId() ?>
81
+ </a></td>
82
+ </tr>
83
+ <?php endif; ?>
84
+ <?php if($_order->getRemoteIp() && $this->shouldDisplayCustomerIp()): ?>
85
+ <tr>
86
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Placed from IP') ?></label></td>
87
+ <td class="value"><strong><?php echo $_order->getRemoteIp(); echo ($_order->getXForwardedFor())?' (' . $this->escapeHtml($_order->getXForwardedFor()) . ')':''; ?></strong></td>
88
+ </tr>
89
+ <?php endif; ?>
90
+ <?php if($_order->getGlobalCurrencyCode() != $_order->getBaseCurrencyCode()): ?>
91
+ <tr>
92
+ <td class="label"><label><?php echo Mage::helper('sales')->__('%s / %s rate:', $_order->getGlobalCurrencyCode(), $_order->getBaseCurrencyCode()) ?></label></td>
93
+ <td class="value"><strong><?php echo $_order->getBaseToGlobalRate() ?></strong></td>
94
+ </tr>
95
+ <?php endif; ?>
96
+ <?php if($_order->getBaseCurrencyCode() != $_order->getOrderCurrencyCode()): ?>
97
+ <tr>
98
+ <td class="label"><label><?php echo Mage::helper('sales')->__('%s / %s rate:', $_order->getOrderCurrencyCode(), $_order->getBaseCurrencyCode()) ?></label></td>
99
+ <td class="value"><strong><?php echo $_order->getBaseToOrderRate() ?></strong></td>
100
+ </tr>
101
+ <?php endif; ?>
102
+ </table>
103
+ </div>
104
+ </div>
105
+ </div>
106
+ <div class="box-right">
107
+ <!--Account Information-->
108
+ <div class="entry-edit">
109
+ <div class="entry-edit-head">
110
+ <h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('Account Information') ?></h4>
111
+ <div class="tools"><?php echo $this->getAccountEditLink()?></div>
112
+ </div>
113
+ <div class="fieldset">
114
+ <div class="hor-scroll">
115
+ <table cellspacing="0" class="form-list">
116
+ <tr>
117
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Customer Name') ?></label></td>
118
+ <td class="value">
119
+ <?php if ($_customerUrl=$this->getCustomerViewUrl()) : ?>
120
+ <a href="<?php echo $_customerUrl ?>" target="_blank"><strong><?php echo $this->escapeHtml($_order->getCustomerName()) ?></strong></a>
121
+ <?php else: ?>
122
+ <strong><?php echo $this->escapeHtml($_order->getCustomerName()) ?></strong>
123
+ <?php endif; ?>
124
+ </td>
125
+ </tr>
126
+ <tr>
127
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Email') ?></label></td>
128
+ <td class="value"><a href="mailto:<?php echo $_order->getCustomerEmail() ?>"><strong><?php echo $_order->getCustomerEmail() ?></strong></a></td>
129
+ </tr>
130
+ <?php if ($_groupName = $this->getCustomerGroupName()) : ?>
131
+ <tr>
132
+ <td class="label"><label><?php echo Mage::helper('sales')->__('Customer Group') ?></label></td>
133
+ <td class="value"><strong><?php echo $_groupName ?></strong></td>
134
+ </tr>
135
+ <?php endif; ?>
136
+ <?php foreach ($this->getCustomerAccountData() as $data):?>
137
+ <tr>
138
+ <td class="label"><label><?php echo $data['label'] ?></label></td>
139
+ <td class="value"><strong><?php echo $data['value'] ?></strong></td>
140
+ </tr>
141
+ <?php endforeach;?>
142
+ </table>
143
+ </div>
144
+ </div>
145
+ </div>
146
+ </div>
147
+ <div class="clear"></div>
148
+
149
+ <div class="box-left">
150
+ <!--Billing Address-->
151
+ <div class="entry-edit">
152
+ <div class="entry-edit-head">
153
+ <h4 class="icon-head head-billing-address"><?php echo Mage::helper('sales')->__('Billing Address') ?></h4>
154
+ <div class="tools"><?php echo $this->getAddressEditLink($_order->getBillingAddress())?></div>
155
+ </div>
156
+ <fieldset>
157
+ <address>
158
+ <?php echo $_order->getBillingAddress()->getFormated(true) ?>
159
+ <?php if ($_dniNumber = $_order->getBillingAddress()->getDniNumberAddress()): ?>
160
+ <br><?php echo $this->__ ('Número de DNI / CUIT: ') ?><?php echo $_dniNumber ?>
161
+ <?php endif ?>
162
+ </address>
163
+ </fieldset>
164
+ </div>
165
+ </div>
166
+ <?php if (!$this->getOrder()->getIsVirtual()): ?>
167
+ <div class="box-right">
168
+ <!--Shipping Address-->
169
+ <div class="entry-edit">
170
+ <div class="entry-edit-head">
171
+ <h4 class="icon-head head-shipping-address"><?php echo Mage::helper('sales')->__('Shipping Address') ?></h4>
172
+ <div class="tools"><?php echo $this->getAddressEditLink($_order->getShippingAddress())?></div>
173
+ </div>
174
+ <fieldset>
175
+ <address><?php echo $_order->getShippingAddress()->getFormated(true) ?></address>
176
+ </fieldset>
177
+ </div>
178
+ </div>
179
+ <div class="clear"></div>
180
+ <?php endif; ?>
app/design/frontend/base/default/layout/facturante/customer.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+ <customer_account_create>
4
+ <reference name="customer_form_register">
5
+ <action method="setTemplate">
6
+ <template>facturante/customer/register.phtml</template>
7
+ </action>
8
+ </reference>
9
+ </customer_account_create>
10
+ <customer_account_edit>
11
+ <reference name="customer_edit">
12
+ <action method="setTemplate">
13
+ <template>facturante/customer/account/form/edit.phtml</template>
14
+ </action>
15
+ </reference>
16
+ </customer_account_edit>
17
+ <customer_address_form>
18
+ <reference name="customer_address_edit">
19
+ <action method="setTemplate">
20
+ <template>facturante/customer/account/address/edit.phtml</template>
21
+ </action>
22
+ </reference>
23
+ </customer_address_form>
24
+ <checkout_onepage_index>
25
+ <reference name='checkout.onepage.billing'>
26
+ <block type='checkout/onepage_billing' name='form.additional.info' template='facturante/checkout/onepage/dni-number.phtml'></block>
27
+ </reference>
28
+ </checkout_onepage_index>
29
+ </layout>
app/design/frontend/base/default/template/facturante/checkout/onepage/dni-number.phtml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $_dniNumber = '';
3
+ if (Mage::getSingleton('customer/session')->isLoggedIn())
4
+ {
5
+ $_customer = Mage::getSingleton('customer/session')->getCustomer();
6
+
7
+ $_dniNumber = $_customer->getResource()
8
+ ->getAttribute('dni_number')
9
+ ->getFrontend()
10
+ ->getValue($_customer);
11
+ }
12
+ ?>
13
+ <div class="field">
14
+ <label for="billing:dni_number_address"><?php echo $this->__('Número de DNI / CUIT') ?></label>
15
+ <div class="input-box">
16
+ <input type="text" name="billing[dni_number_address]" id="billing:dni_number_address" title="<?php echo $this->quoteEscape($this->__('Número de DNI / CUIT')) ?>" class="input-text" value="<?php echo $_dniNumber ?>" />
17
+ </div>
18
+ </div>
app/design/frontend/base/default/template/facturante/customer/account/address/edit.phtml ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Edit customer address template
30
+ *
31
+ * @see Mage_Customer_Block_Address_Edit
32
+ */
33
+ ?>
34
+ <?php if($this->getTitle()): ?>
35
+ <div class="page-title">
36
+ <h1><?php echo $this->getTitle() ?></h1>
37
+ </div>
38
+ <?php endif; ?>
39
+ <?php echo $this->getMessagesBlock()->toHtml() ?>
40
+ <form action="<?php echo $this->getSaveUrl() ?>" method="post" id="form-validate">
41
+ <div class="fieldset">
42
+ <?php echo $this->getBlockHtml('formkey')?>
43
+ <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
44
+ <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
45
+ <h2 class="legend"><?php echo $this->__('Contact Information') ?></h2>
46
+ <ul class="form-list">
47
+ <li class="fields">
48
+ <?php echo $this->getNameBlockHtml() ?>
49
+ </li>
50
+ <li class="wide">
51
+ <label for="company"><?php echo $this->__('Company') ?></label>
52
+ <div class="input-box">
53
+ <input type="text" name="company" id="company" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Company')) ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
54
+ </div>
55
+ </li>
56
+ <li class="fields">
57
+ <div class="field">
58
+ <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
59
+ <div class="input-box">
60
+ <input type="text" name="telephone" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Telephone')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="telephone" />
61
+ </div>
62
+ </div>
63
+ <div class="field">
64
+ <label for="fax"><?php echo $this->__('Fax') ?></label>
65
+ <div class="input-box">
66
+ <input type="text" name="fax" id="fax" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Fax')) ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" />
67
+ </div>
68
+ </div>
69
+ </li>
70
+ </ul>
71
+ </div>
72
+ <div class="fieldset">
73
+ <h2 class="legend"><?php echo $this->__('Address') ?></h2>
74
+ <ul class="form-list">
75
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
76
+ <li class="wide">
77
+ <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
78
+ <div class="input-box">
79
+ <input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Street Address')) ?>" id="street_1" class="input-text <?php echo $_streetValidationClass ?>" />
80
+ </div>
81
+ </li>
82
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
83
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
84
+ <li class="wide">
85
+ <div class="input-box">
86
+ <input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Street Address %s', $_i)) ?>" id="street_<?php echo $_i ?>" class="input-text <?php echo $_streetValidationClass ?>" />
87
+ </div>
88
+ </li>
89
+ <?php endfor; ?>
90
+ <?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
91
+ <li class="wide">
92
+ <label for="vat_id"><?php echo $this->__('VAT Number') ?></label>
93
+ <div class="input-box">
94
+ <input type="text" name="vat_id" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('VAT Number')) ?>" id="vat_id" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
95
+ </div>
96
+ </li>
97
+ <?php endif; ?>
98
+ <li class="fields">
99
+ <div class="field">
100
+ <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
101
+ <div class="input-box">
102
+ <input type="text" name="city" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('City')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="city" />
103
+ </div>
104
+ </div>
105
+ <div class="field">
106
+ <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
107
+ <div class="input-box">
108
+ <select id="region_id" name="region_id" title="<?php echo Mage::helper('core')->quoteEscape($this->__('State/Province')) ?>" class="validate-select" style="display:none;">
109
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
110
+ </select>
111
+ <script type="text/javascript">
112
+ //<![CDATA[
113
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
114
+ //]]>
115
+ </script>
116
+ <input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('State/Province')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" />
117
+ </div>
118
+ </div>
119
+ </li>
120
+ <li class="fields">
121
+ <div class="field">
122
+ <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
123
+ <div class="input-box">
124
+ <input type="text" name="postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Zip/Postal Code')) ?>" id="zip" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
125
+ </div>
126
+ </div>
127
+ <div class="field">
128
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
129
+ <div class="input-box">
130
+ <?php echo $this->getCountryHtmlSelect() ?>
131
+ </div>
132
+ </div>
133
+ </li>
134
+ <li class="fields">
135
+ <div class="field">
136
+ <label for="dni_number_address"><?php echo $this->__('Número de DNI / CUIT') ?></label>
137
+ <div class="input-box">
138
+ <input type="text" name="dni_number_address" value="<?php echo $this->escapeHtml($this->getAddress()->getDniNumberAddress()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Número de DNI / CUIT')) ?>" id="dni_number_address" class="input-text" />
139
+ </div>
140
+ </div>
141
+ </li>
142
+ <li<?php if($this->canSetAsDefaultBilling()) echo ' class="control"' ?>>
143
+ <?php if($this->isDefaultBilling()): ?>
144
+ <strong><?php echo $this->__('Default Billing Address') ?></strong>
145
+ <?php elseif($this->canSetAsDefaultBilling()): ?>
146
+ <input type="checkbox" id="primary_billing" name="default_billing" value="1" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Use as My Default Billing Address')) ?>" class="checkbox" /><label for="primary_billing"><?php echo $this->__('Use as my default billing address') ?></label>
147
+ <?php else: ?>
148
+ <input type="hidden" name="default_billing" value="1" />
149
+ <?php endif; ?>
150
+ </li>
151
+ <li<?php if($this->canSetAsDefaultShipping()) echo ' class="control"' ?>>
152
+ <?php if($this->isDefaultShipping()): ?>
153
+ <strong><?php echo $this->__('Default Shipping Address') ?></strong>
154
+ <?php elseif($this->canSetAsDefaultShipping()): ?>
155
+ <input type="checkbox" id="primary_shipping" name="default_shipping" value="1" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Use as My Default Shipping Address')) ?>" class="checkbox" /><label for="primary_shipping"><?php echo $this->__('Use as my default shipping address') ?></label>
156
+ <?php else: ?>
157
+ <input type="hidden" name="default_shipping" value="1" />
158
+ <?php endif; ?>
159
+ </li>
160
+ </ul>
161
+ </div>
162
+ <div class="buttons-set">
163
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
164
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
165
+ <button data-action="save-customer-address" type="submit" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Save Address')) ?>" class="button"><span><span><?php echo $this->__('Save Address') ?></span></span></button>
166
+ </div>
167
+ </form>
168
+ <script type="text/javascript">
169
+ //<![CDATA[
170
+ var dataForm = new VarienForm('form-validate', true);
171
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
172
+ //]]>
173
+ </script>
app/design/frontend/base/default/template/facturante/customer/account/form/edit.phtml ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package rwd_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <div class="page-title">
28
+ <h1><?php echo $this->__('Edit Account Information') ?></h1>
29
+ </div>
30
+ <?php echo $this->getMessagesBlock()->toHtml() ?>
31
+ <form action="<?php echo $this->getUrl('customer/account/editPost') ?>" method="post" autocomplete="off" id="form-validate" class="scaffold-form" enctype="multipart/form-data">
32
+ <div class="fieldset">
33
+ <?php echo $this->getBlockHtml('formkey')?>
34
+ <h2 class="legend"><?php echo $this->__('Account Information') ?></h2>
35
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
36
+ <ul class="form-list">
37
+ <li class="fields">
38
+ <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getCustomer())->toHtml() ?>
39
+ </li>
40
+ <li>
41
+ <label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
42
+ <div class="input-box">
43
+ <input type="email" autocapitalize="off" autocorrect="off" spellcheck="false" name="email" id="email" value="<?php echo $this->escapeHtml($this->getCustomer()->getEmail()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Email Address')) ?>" class="input-text required-entry validate-email" />
44
+ </div>
45
+ </li>
46
+ <li>
47
+ <label for="dni_number"><?php echo $this->__('Número de DNI / CUIT') ?></label>
48
+ <div class="input-box">
49
+ <input type="text" name="dni_number" id="dni_number" value="<?php echo $this->escapeHtml($this->getCustomer()->getDniNumber()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Número de DNI / CUIT')) ?>" class="input-text" />
50
+ </div>
51
+ </li>
52
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
53
+ <?php if ($_dob->isEnabled()): ?>
54
+ <li><?php echo $_dob->setDate($this->getCustomer()->getDob())->toHtml() ?></li>
55
+ <?php endif ?>
56
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
57
+ <?php if ($_taxvat->isEnabled()): ?>
58
+ <li><?php echo $_taxvat->setTaxvat($this->getCustomer()->getTaxvat())->toHtml() ?></li>
59
+ <?php endif ?>
60
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
61
+ <?php if ($_gender->isEnabled()): ?>
62
+ <li><?php echo $_gender->setGender($this->getCustomer()->getGender())->toHtml() ?></li>
63
+ <?php endif ?>
64
+ <li class="control">
65
+ <input type="checkbox" name="change_password" id="change_password" value="1" onclick="setPasswordForm(this.checked)" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Change Password')) ?>"<?php if($this->getCustomer()->getChangePassword()==1): ?> checked="checked"<?php endif; ?> class="checkbox" /><label for="change_password"><?php echo $this->__('Change Password') ?></label>
66
+ </li>
67
+ </ul>
68
+ </div>
69
+ <div class="fieldset" style="display:none;">
70
+ <h2 class="legend"><?php echo $this->__('Change Password') ?></h2>
71
+ <ul class="form-list">
72
+ <li>
73
+ <label for="current_password" class="required"><em>*</em><?php echo $this->__('Current Password') ?></label>
74
+ <div class="input-box">
75
+ <!-- This is a dummy hidden field to trick firefox from auto filling the password -->
76
+ <input type="text" class="input-text no-display" name="dummy" id="dummy" />
77
+ <input type="password" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Current Password')) ?>" class="input-text" name="current_password" id="current_password" />
78
+ </div>
79
+ </li>
80
+ <li class="fields">
81
+ <div class="field">
82
+ <label for="password" class="required"><em>*</em><?php echo $this->__('New Password') ?></label>
83
+ <div class="input-box">
84
+ <input type="password" title="<?php echo Mage::helper('core')->quoteEscape($this->__('New Password')) ?>" class="input-text validate-password" name="password" id="password" />
85
+ </div>
86
+ </div>
87
+ <div class="field">
88
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm New Password') ?></label>
89
+ <div class="input-box">
90
+ <input type="password" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Confirm New Password')) ?>" class="input-text validate-cpassword" name="confirmation" id="confirmation" />
91
+ </div>
92
+ </div>
93
+ </li>
94
+ </ul>
95
+ </div>
96
+ <div class="buttons-set">
97
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
98
+ <button type="submit" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Save')) ?>" class="button"><span><span><?php echo $this->__('Save') ?></span></span></button>
99
+ </div>
100
+ </form>
101
+ <script type="text/javascript">
102
+ //<![CDATA[
103
+ var dataForm = new VarienForm('form-validate', true);
104
+ function setPasswordForm(arg){
105
+ if(arg){
106
+ $('current_password').up(3).show();
107
+ $('current_password').addClassName('required-entry');
108
+ $('password').addClassName('required-entry');
109
+ $('confirmation').addClassName('required-entry');
110
+
111
+ }else{
112
+ $('current_password').up(3).hide();
113
+ $('current_password').removeClassName('required-entry');
114
+ $('password').removeClassName('required-entry');
115
+ $('confirmation').removeClassName('required-entry');
116
+ }
117
+ }
118
+
119
+ <?php if($this->getCustomer()->getChangePassword()): ?>
120
+ setPasswordForm(true);
121
+ <?php endif; ?>
122
+ //]]>
123
+ </script>
app/design/frontend/base/default/template/facturante/customer/register.phtml ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magento.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magento.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Create account form template
30
+ *
31
+ * @see app/design/frontend/base/default/template/customer/form/register.phtml
32
+ */
33
+ /** @var $this Mage_Customer_Block_Form_Register */
34
+ ?>
35
+ <div class="account-create">
36
+ <div class="page-title">
37
+ <h1><?php echo $this->__('Create an Account') ?></h1>
38
+ </div>
39
+ <?php echo $this->getChildHtml('form_fields_before')?>
40
+ <?php echo $this->getMessagesBlock()->toHtml() ?>
41
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate">
42
+ <div class="fieldset">
43
+ <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
44
+ <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
45
+ <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
46
+ <h2 class="legend"><?php echo $this->__('Personal Information') ?></h2>
47
+ <ul class="form-list">
48
+ <li class="fields">
49
+ <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->setForceUseCustomerAttributes(true)->toHtml() ?>
50
+ </li>
51
+ <li>
52
+ <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
53
+ <div class="input-box">
54
+ <input type="text" name="email" id="email_address" value="<?php echo $this->escapeHtml($this->getFormData()->getEmail()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Email Address')) ?>" class="input-text validate-email required-entry" />
55
+ </div>
56
+ </li>
57
+ <?php if ($this->isNewsletterEnabled()): ?>
58
+ <li class="control">
59
+ <div class="input-box">
60
+ <input type="checkbox" name="is_subscribed" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Sign Up for Newsletter')) ?>" value="1" id="is_subscribed"<?php if($this->getFormData()->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" />
61
+ </div>
62
+ <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
63
+ </li>
64
+ <?php endif ?>
65
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
66
+ <?php if ($_dob->isEnabled()): ?>
67
+ <li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
68
+ <?php endif ?>
69
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
70
+ <?php if ($_taxvat->isEnabled()): ?>
71
+ <li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
72
+ <?php endif ?>
73
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
74
+ <?php if ($_gender->isEnabled()): ?>
75
+ <li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
76
+ <?php endif ?>
77
+ </ul>
78
+ </div>
79
+ <?php if($this->getShowAddressFields()): ?>
80
+ <div class="fieldset">
81
+ <input type="hidden" name="create_address" value="1" />
82
+ <h2 class="legend"><?php echo $this->__('Address Information') ?></h2>
83
+ <ul class="form-list">
84
+ <li class="fields">
85
+ <div class="field">
86
+ <label for="company"><?php echo $this->__('Company') ?></label>
87
+ <div class="input-box">
88
+ <input type="text" name="company" id="company" value="<?php echo $this->escapeHtml($this->getFormData()->getCompany()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Company')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
89
+ </div>
90
+ </div>
91
+ <div class="field">
92
+ <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
93
+ <div class="input-box">
94
+ <input type="text" name="telephone" id="telephone" value="<?php echo $this->escapeHtml($this->getFormData()->getTelephone()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Telephone')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" />
95
+ </div>
96
+ </div>
97
+ </li>
98
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
99
+ <li class="wide">
100
+ <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
101
+ <div class="input-box">
102
+ <input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet(1)) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Street Address')) ?>" id="street_1" class="input-text <?php echo $_streetValidationClass ?>" />
103
+ </div>
104
+ </li>
105
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
106
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
107
+ <li class="wide">
108
+ <div class="input-box">
109
+ <input type="text" name="street[]" value="<?php echo $this->escapeHtml($this->getFormData()->getStreet($_i)) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Street Address %s', $_i)) ?>" id="street_<?php echo $_i ?>" class="input-text <?php echo $_streetValidationClass ?>" />
110
+ </div>
111
+ </li>
112
+ <?php endfor; ?>
113
+ <li class="fields">
114
+ <div class="field">
115
+ <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
116
+ <div class="input-box">
117
+ <input type="text" name="city" value="<?php echo $this->escapeHtml($this->getFormData()->getCity()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('City')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="city" />
118
+ </div>
119
+ </div>
120
+ <div class="field">
121
+ <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
122
+ <div class="input-box">
123
+ <select id="region_id" name="region_id" title="<?php echo Mage::helper('core')->quoteEscape($this->__('State/Province')) ?>" class="validate-select" style="display:none;">
124
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
125
+ </select>
126
+ <script type="text/javascript">
127
+ //<![CDATA[
128
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
129
+ //]]>
130
+ </script>
131
+ <input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getRegion()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('State/Province')) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
132
+ </div>
133
+ </div>
134
+ </li>
135
+ <li class="fields">
136
+ <div class="field">
137
+ <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
138
+ <div class="input-box">
139
+ <input type="text" name="postcode" value="<?php echo $this->escapeHtml($this->getFormData()->getPostcode()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Zip/Postal Code')) ?>" id="zip" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
140
+ </div>
141
+ </div>
142
+ <div class="field">
143
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
144
+ <div class="input-box">
145
+ <?php echo $this->getCountryHtmlSelect() ?>
146
+ </div>
147
+ </div>
148
+ </li>
149
+ </ul>
150
+ <input type="hidden" name="default_billing" value="1" />
151
+ <input type="hidden" name="default_shipping" value="1" />
152
+ </div>
153
+ <?php endif; ?>
154
+ <div class="fieldset">
155
+ <h2 class="legend"><?php echo $this->__('Login Information') ?></h2>
156
+ <ul class="form-list">
157
+ <li class="fields">
158
+ <div class="field">
159
+ <label for="password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
160
+ <div class="input-box">
161
+ <input type="password" name="password" id="password" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Password')) ?>" class="input-text required-entry validate-password" />
162
+ </div>
163
+ </div>
164
+ <div class="field">
165
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
166
+ <div class="input-box">
167
+ <input type="password" name="confirmation" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Confirm Password')) ?>" id="confirmation" class="input-text required-entry validate-cpassword" />
168
+ </div>
169
+ </div>
170
+ </li>
171
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
172
+ <div class="field">
173
+ <label for="dni_number"><?php echo $this->__('Número de DNI / CUIT') ?></label>
174
+ <div class="input-box">
175
+ <input type="text" name="dni_number" id="dni_number" title="<?php echo $this->quoteEscape($this->__('Número de DNI / CUIT')) ?>" class="input-text" />
176
+ </div>
177
+ </div>
178
+ <?php echo $this->getChildHtml('persistent.remember.me'); ?>
179
+ </ul>
180
+ <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
181
+ </div>
182
+ <div class="buttons-set">
183
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
184
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
185
+ <button type="submit" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Submit')) ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
186
+ </div>
187
+ <?php if (Mage::helper('checkout')->isContextCheckout()): ?>
188
+ <input name="context" type="hidden" value="checkout" />
189
+ <?php endif; ?>
190
+ </form>
191
+ <script type="text/javascript">
192
+ //<![CDATA[
193
+ var dataForm = new VarienForm('form-validate', true);
194
+ <?php if($this->getShowAddressFields()): ?>
195
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
196
+ <?php endif; ?>
197
+ //]]>
198
+ </script>
199
+ </div>
app/etc/modules/Facturante_Customer.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Facturante_Customer>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Facturante_Customer>
8
+ </modules>
9
+ </config>
app/etc/modules/Facturante_Invoicing.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Facturante_Invoicing>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ <depends>
8
+ <Mage_Sales/>
9
+ </depends>
10
+ </Facturante_Invoicing>
11
+ </modules>
12
+ </config>
package.xml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Facturante</name>
4
+ <version>0.1.6</version>
5
+ <stability>stable</stability>
6
+ <license>GNU General Public License (GPL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Magento Module 100% integrated in your platform. If your ecommerce site is developed in Magento and you need to apply electronic invoice the API of Facturante will be the most suitable and economical alternative. You can easily invoice without wasting time on the interpretation of official regulations and without wasting money on countable advice and skilled programmers- who charge you for maintaining AFIP&#xB4;s regulations and adjustment in force (AFIP = the Argentine Tax Authority) - Through Facturante you will be able to invoice from the order list and to monitor the shipment statement on real time. You also will be able to issue either final consumer invoices or VAT invoices with automatic calculation of Argentinean tax variation (National and Province)</summary>
10
+ <description>Magento Module 100% integrated in your platform. If your ecommerce site is developed in Magento and you need to apply electronic invoice the API of Facturante will be the most suitable and economical alternative. You can easily invoice without wasting time on the interpretation of official regulations and without wasting money on countable advice and skilled programmers- who charge you for maintaining AFIP&#xB4;s regulations and adjustment in force (AFIP = the Argentine Tax Authority) - Through Facturante you will be able to invoice from the order list and to monitor the shipment statement on real time. You also will be able to issue either final consumer invoices or VAT invoices with automatic calculation of Argentinean tax variation (National and Province)&#xD;
11
+ In a short period of time you&#xB4;ll be invoicing without neglecting your business because that will be our job. &#xD;
12
+ Our Special Features: &#xD;
13
+ Our service has been developed, tested and already in use for five years now.&#xD;
14
+ We secured the issue of all invoices request through our internal engine of requests -of type FIFO- which has a quick automatic clean up &#xD;
15
+ We rectify errors before sending the invoice to AFIP showing an easy error&#xB4;s interpretation for the user&#xD;
16
+ The issued invoice delivery is automated , with each step of the creation, reading and payment process &#xD;
17
+ It allows to invoice with multiple companies and easily sign them at ERP/SAP&#xD;
18
+ We constantly updated the platform to come up to the required regulations. We detect and resolve new errors cases&#xD;
19
+ We resolve the connection, interpretations and inconsistencies of the AFIP service (Missing invoices, internal errors, etc.) and the invoice process is not interrupted by AFIP&#xD;
20
+ Automatic registration of invoices in ERP. Processes of bach and invoices duplication are prevented&#xD;
21
+ Communication with AFIP services is automatically reestablished in order to give you the opportunity to invoice 24 hours a day&#xD;
22
+ Detect the suspension of AFIP service, and automatic regeneration of the pending invoices when the service is reestablished&#xD;
23
+ Communication between Facturante and AFIP is automatic and reduced to only one request&#xD;
24
+ Electronic invoice duplicated is storage (PDF)&#xD;
25
+ &#xD;
26
+ Trough the integration we offer: &#xD;
27
+ testing environment&#xD;
28
+ monitor API Health of Facturante and AFIP (testing and production environments) &#xD;
29
+ technical paperwork about integration and configuration&#xD;
30
+ SAP expert consultancy&#xD;
31
+ MAGENTO expert consultancy&#xD;
32
+ different languages models&#xD;
33
+ professional support </description>
34
+ <notes>First stable release</notes>
35
+ <authors><author><name>Daniel Pili</name><user>facturante</user><email>daniel.pili@facturante.com</email></author></authors>
36
+ <date>2016-05-04</date>
37
+ <time>15:47:20</time>
38
+ <contents><target name="magelocal"><dir name="Facturante"><dir name="Customer"><dir name="Helper"><file name="Data.php" hash="1ced219f479337fd9e643071c68d044f"/></dir><dir name="etc"><file name="config.xml" hash="78986a21cf0af0de48e4418160bc1d51"/></dir><dir name="sql"><dir name="facturante_customer_setup"><file name="install-0.1.0.php" hash="57c5c6e63a9518fa4476cb1e4dbad8dd"/></dir></dir></dir><dir name="Invoicing"><dir name="Block"><dir name="Adminhtml"><dir name="Order"><dir name="View"><dir name="Tab"><file name="Facturante.php" hash="f94d5cc176c3b3c33ce8defe79cf1aab"/></dir></dir></dir><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="0220ec77c6ee8dd147c2d2e8bed74bd7"/><file name="Gridfacturante.php" hash="951c739f509009799a842dcb23ce07a1"/><dir name="Renderer"><file name="AfipInvoiceStatus.php" hash="d305ea49289e524cd49f1420a7548c32"/><file name="HumanDate.php" hash="3913f0f69625b61d7df9ba143b8036ef"/><file name="LinkView.php" hash="acfa23179e78c9b4a629eb36200405d2"/></dir></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Fieldset"><dir name="Connection"><file name="Test.php" hash="93ddd23b5f285ff99bdf9792ae1bae24"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="55e0b1d5ac8373f90cf63f497253f48a"/></dir><dir name="Model"><file name="CronComprobantesError.php" hash="e3b75d4af571850546dedb3b91a4e9dc"/><file name="CronComprobantesPendientes.php" hash="335446fd4092f484b3003c89752a30d2"/><dir name="Eav"><dir name="Entity"><dir name="Attribute"><dir name="Source"><file name="Taxtype.php" hash="70bc155f5b7b91ef38fff2c1f3d5a3f7"/></dir></dir></dir></dir><file name="Observer.php" hash="c4799896b782f076288a1d5976bfdcf4"/><dir name="Order"><file name="Invoicingstatus.php" hash="6356ed91963eed4c7cc0fe98273f6e64"/></dir><dir name="Resource"><dir name="Order"><dir name="Invoicingstatus"><file name="Collection.php" hash="f7f39c79bf6946228a8a5d360cf7a827"/></dir><file name="Invoicingstatus.php" hash="95a3b0995d42def24c0dfbd7c10ed170"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Dropdown"><file name="Orderstatus.php" hash="7af7b334503d9851d1b4e1518b388703"/><file name="Values.php" hash="9f6bd1e4e7a77d2194ce910b278fc096"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="FacturanteController.php" hash="dd2766fbc42f3432fa5cecd8f4a9284f"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="c95bf686d8707c884f83c646c97279e8"/><file name="config.xml" hash="8ae24acb6968ce837a2d53eaa3c16485"/><file name="system.xml" hash="3376ddf7fc49b59a6c8517e5048c0c26"/></dir><dir name="sql"><dir name="facturante_invoicing_setup"><file name="mysql4-install-0.1.0.php" hash="7d554bcb566034d911ea3efc7d3873df"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="2e354e131d6e5cf794c7177714003327"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="8430c6187d43fc71c105e724a9b0980c"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="f3cc24e65ea47f60b1b8d31be4b3b298"/><file name="mysql4-upgrade-0.1.3-0.1.4.php" hash="c374748674e8a3daa68dd65aa0a96dce"/><file name="mysql4-upgrade-0.1.4-0.1.5.php" hash="d600178485870151f4661c1e16bc634a"/><file name="mysql4-upgrade-0.1.5-0.1.6.php" hash="ef7c6618b7d4cc2023f17605f17ffdf9"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Facturante_Customer.xml" hash="9c8ecfacb777d41eb48b3c67047df82d"/><file name="Facturante_Invoicing.xml" hash="11a0abe75e6cf71f02a8314469364367"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="facturante"><file name="invoicing.xml" hash="74940a43b1980c82a73858e4382c2ecc"/></dir></dir><dir name="template"><dir name="facturante"><dir name="form"><dir name="renderer"><dir name="fieldset"><file name="attributes.phtml" hash="74196c4f278f9a454d09dbbcf78fae35"/><file name="error.phtml" hash="b42473e304ab6968b1a2ff84aae57c3b"/></dir></dir><file name="testconnection.phtml" hash="0b3b852fe142e31a09ff619eb572b3d2"/></dir><dir name="order"><dir name="view"><dir name="tab"><file name="facturante.phtml" hash="dd623666a3b6263ef134ab5cc8b0ccee"/></dir></dir></dir><dir name="sales"><dir name="order"><dir name="view"><file name="info.phtml" hash="ec38b7622ea428ee673277e43fce71e7"/></dir></dir></dir><file name=".DS_Store" hash="40fc4d7672484ad7a7eafa598a3b216d"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="facturante"><file name="customer.xml" hash="ae278e40c51c52ec468cb8d9d554231b"/></dir></dir><dir name="template"><dir name="facturante"><dir name="checkout"><dir name="onepage"><file name="dni-number.phtml" hash="b75740fd0ce8af2951e8439975f2afde"/></dir></dir><dir name="customer"><dir name="account"><dir name="address"><file name="edit.phtml" hash="c132e0dc239206cdb3fb308defca3d08"/></dir><dir name="form"><file name="edit.phtml" hash="31418ba94ea97262d9cd7256478fcec6"/></dir></dir><file name="register.phtml" hash="cdad41d2a30c3fdd441715a48f9e9933"/></dir></dir></dir></dir></dir></dir></target></contents>
39
+ <compatible/>
40
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
41
+ </package>