Version Notes
-Capacidad de incluir distintas modalidades de facturación:
Factura con detalle (inclusión de código GTIN)
Factura electrónica Generica
-Manejo de comprobantes de distintas clases, según tratamiento impositivo del cliente
-Capacidad automática de no incluir líneas de envio cuando el envio es igual a cero
-Cambio instantáneo de ambiente, permite seleccionar entre entornos on the fly
-Interpretacion de nombre de provincias automatico para la correcta interpretación de las ISOS de AFIP
-Facturacion automática con sub estados de ordenes
Download this release
Release Info
| Developer | Daniel Pili |
| Extension | Facturante |
| Version | 0.1.7 |
| Comparing to | |
| See all releases | |
Code changes from version 0.1.6 to 0.1.7
- app/code/local/Facturante/.DS_Store +0 -0
- app/code/local/Facturante/Customer/.DS_Store +0 -0
- app/code/local/Facturante/Customer/etc/.DS_Store +0 -0
- app/code/local/Facturante/Customer/etc/config.xml +1 -1
- app/code/local/Facturante/Invoicing/.DS_Store +0 -0
- app/code/local/Facturante/Invoicing/Block/System/Config/Form/Fieldset/Connection/Test.php +13 -3
- app/code/local/Facturante/Invoicing/Helper/.DS_Store +0 -0
- app/code/local/Facturante/Invoicing/Helper/Data.php +280 -116
- app/code/local/Facturante/Invoicing/Model/.DS_Store +0 -0
- app/code/local/Facturante/Invoicing/Model/CronComprobantesError.php +0 -54
- app/code/local/Facturante/Invoicing/Model/CronComprobantesPendientes.php +65 -63
- app/code/local/Facturante/Invoicing/Model/Observer.php +30 -26
- app/code/local/Facturante/Invoicing/Model/System/Config/Source/Dropdown/Modosfacturacion.php +22 -0
- app/code/local/Facturante/Invoicing/Model/System/Config/Source/Dropdown/Urlsapi.php +18 -0
- app/code/local/Facturante/Invoicing/controllers/Adminhtml/FacturanteController.php +35 -16
- app/code/local/Facturante/Invoicing/etc/.DS_Store +0 -0
- app/code/local/Facturante/Invoicing/etc/config.xml +14 -19
- app/code/local/Facturante/Invoicing/etc/system.xml +53 -1
- app/code/local/Facturante/Invoicing/sql/.DS_Store +0 -0
- app/code/local/Facturante/Invoicing/sql/facturante_invoicing_setup/.DS_Store +0 -0
- app/code/local/Facturante/Invoicing/sql/facturante_invoicing_setup/mysql4-upgrade-0.1.6-0.1.7.php +61 -0
- app/design/adminhtml/default/default/layout/facturante/.DS_Store +0 -0
- app/design/adminhtml/default/default/template/facturante/.DS_Store +0 -0
- app/design/adminhtml/default/default/template/facturante/form/.DS_Store +0 -0
- app/design/adminhtml/default/default/template/facturante/form/renderer/fieldset/attributes.phtml +0 -89
- app/design/adminhtml/default/default/template/facturante/form/renderer/fieldset/error.phtml +0 -22
- app/design/adminhtml/default/default/template/facturante/form/testconnection.phtml +0 -18
- app/design/adminhtml/default/default/template/facturante/order/.DS_Store +0 -0
- app/design/adminhtml/default/default/template/facturante/order/view/.DS_Store +0 -0
- app/design/adminhtml/default/default/template/facturante/order/view/tab/facturante.phtml +1 -9
- app/design/adminhtml/default/default/template/facturante/sales/.DS_Store +0 -0
- app/design/adminhtml/default/default/template/facturante/sales/order/.DS_Store +0 -0
- app/design/adminhtml/default/default/template/facturante/sales/order/view/.DS_Store +0 -0
- app/design/frontend/base/default/layout/facturante/.DS_Store +0 -0
- app/design/frontend/base/default/template/facturante/.DS_Store +0 -0
- app/design/frontend/base/default/template/facturante/checkout/.DS_Store +0 -0
- app/design/frontend/base/default/template/facturante/checkout/onepage/dni-number.phtml +7 -4
- app/design/frontend/base/default/template/facturante/customer/.DS_Store +0 -0
- app/design/frontend/base/default/template/facturante/customer/account/.DS_Store +0 -0
- app/design/frontend/base/default/template/facturante/customer/account/address/edit.phtml +19 -5
- app/design/frontend/base/default/template/facturante/customer/account/form/edit.phtml +22 -10
- app/design/frontend/base/default/template/facturante/customer/register.phtml +21 -9
- package.xml +36 -33
app/code/local/Facturante/.DS_Store
ADDED
|
Binary file
|
app/code/local/Facturante/Customer/.DS_Store
ADDED
|
Binary file
|
app/code/local/Facturante/Customer/etc/.DS_Store
ADDED
|
Binary file
|
app/code/local/Facturante/Customer/etc/config.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Facturante_Customer>
|
| 5 |
-
<version>0.1.
|
| 6 |
</Facturante_Customer>
|
| 7 |
</modules>
|
| 8 |
<global>
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Facturante_Customer>
|
| 5 |
+
<version>0.1.7</version>
|
| 6 |
</Facturante_Customer>
|
| 7 |
</modules>
|
| 8 |
<global>
|
app/code/local/Facturante/Invoicing/.DS_Store
ADDED
|
Binary file
|
app/code/local/Facturante/Invoicing/Block/System/Config/Form/Fieldset/Connection/Test.php
CHANGED
|
@@ -28,9 +28,19 @@ class Facturante_Invoicing_Block_System_Config_Form_Fieldset_Connection_Test ext
|
|
| 28 |
$block = Mage::app()->getLayout()->createBlock('adminhtml/widget_form_renderer_element')
|
| 29 |
->setTemplate('facturante/form/testconnection.phtml');
|
| 30 |
|
| 31 |
-
$
|
| 32 |
-
$
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
if($usernameValue != '' && $passwordValue != '' && $businessIdValue != '')
|
| 36 |
{
|
| 28 |
$block = Mage::app()->getLayout()->createBlock('adminhtml/widget_form_renderer_element')
|
| 29 |
->setTemplate('facturante/form/testconnection.phtml');
|
| 30 |
|
| 31 |
+
$storeId = 0;
|
| 32 |
+
if (strlen($code = Mage::getSingleton('adminhtml/config_data')->getStore())) // store level
|
| 33 |
+
{
|
| 34 |
+
$storeId = Mage::getModel('core/store')->load($code)->getId();
|
| 35 |
+
} elseif (strlen($code = Mage::getSingleton('adminhtml/config_data')->getWebsite())) // website level
|
| 36 |
+
{
|
| 37 |
+
$websiteId = Mage::getModel('core/website')->load($code)->getId();
|
| 38 |
+
$storeId = Mage::app()->getWebsite($websiteId)->getDefaultStore()->getId();
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
$usernameValue = Mage::getStoreConfig('facturante/connection/username', $storeId);
|
| 42 |
+
$passwordValue = Mage::getStoreConfig('facturante/connection/password', $storeId);
|
| 43 |
+
$businessIdValue = Mage::getStoreConfig('facturante/connection/business_id', $storeId);
|
| 44 |
|
| 45 |
if($usernameValue != '' && $passwordValue != '' && $businessIdValue != '')
|
| 46 |
{
|
app/code/local/Facturante/Invoicing/Helper/.DS_Store
ADDED
|
Binary file
|
app/code/local/Facturante/Invoicing/Helper/Data.php
CHANGED
|
@@ -13,13 +13,29 @@ class Facturante_Invoicing_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 13 |
const FACTURANTE_CODIGO_NOTA_DE_DEBITO = 'debito';
|
| 14 |
const FACTURANTE_CODIGO_NOTA_DE_CREDITO = 'credito';
|
| 15 |
|
| 16 |
-
public function testAPIConnection()
|
| 17 |
-
|
| 18 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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,
|
|
@@ -100,14 +116,20 @@ class Facturante_Invoicing_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 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 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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,
|
|
@@ -132,7 +154,18 @@ class Facturante_Invoicing_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 132 |
*/
|
| 133 |
$customerId = $order->getCustomerId();
|
| 134 |
$customer = Mage::getModel('customer/customer')->load($customerId);
|
| 135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
|
| 137 |
// Si no hay numero de documento para el customer,
|
| 138 |
// sino asignar customer ID como numero de documento
|
|
@@ -165,7 +198,7 @@ class Facturante_Invoicing_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 165 |
* 1: SI
|
| 166 |
* @type boolean
|
| 167 |
*/
|
| 168 |
-
$percibeIva = Mage::getStoreConfig('facturante/connection3/percibe_iva');
|
| 169 |
|
| 170 |
/**
|
| 171 |
* Percibe IIBB?
|
|
@@ -174,7 +207,8 @@ class Facturante_Invoicing_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 174 |
*
|
| 175 |
* @type boolean
|
| 176 |
*/
|
| 177 |
-
$percibeIIBB = false;
|
|
|
|
| 178 |
|
| 179 |
/**
|
| 180 |
* Tratamiento Impositivo
|
|
@@ -195,11 +229,9 @@ class Facturante_Invoicing_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 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 |
*
|
|
@@ -207,7 +239,7 @@ class Facturante_Invoicing_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 207 |
*
|
| 208 |
* @type bool
|
| 209 |
*/
|
| 210 |
-
$enviarComprobante = Mage::getStoreConfig('facturante/connection2/enviar_comprobante');
|
| 211 |
|
| 212 |
/**
|
| 213 |
* Provincia
|
|
@@ -289,7 +321,7 @@ class Facturante_Invoicing_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 289 |
*
|
| 290 |
* @type int
|
| 291 |
*/
|
| 292 |
-
$prefijo = Mage::getStoreConfig('facturante/connection3/prefijo');
|
| 293 |
$longitudActual = strlen($prefijo);
|
| 294 |
$longitudPrefijo = 4;
|
| 295 |
|
|
@@ -350,7 +382,7 @@ class Facturante_Invoicing_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 350 |
*
|
| 351 |
* @type int
|
| 352 |
*/
|
| 353 |
-
$bienes = Mage::getStoreConfig('facturante/connection3/bienes');
|
| 354 |
/**
|
| 355 |
* Fecha de servicio facturado (desde y hasta)
|
| 356 |
*
|
|
@@ -434,6 +466,18 @@ class Facturante_Invoicing_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 434 |
// total
|
| 435 |
// totalNeto
|
| 436 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 437 |
$encabezado = array(
|
| 438 |
"FechaHora" => $fechaHora,
|
| 439 |
"Prefijo" => $prefijo,
|
|
@@ -459,94 +503,164 @@ class Facturante_Invoicing_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 459 |
"PorcentajeIIBB" => $porcentajeIIBB
|
| 460 |
);
|
| 461 |
|
| 462 |
-
$orderedItems = $order->
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
$orderedProductTax = array();
|
| 467 |
|
| 468 |
-
$preciosFinales = Mage::getStoreConfig('facturante/connection2/precios_finales');
|
| 469 |
|
| 470 |
-
$
|
| 471 |
-
|
| 472 |
foreach ($orderedItems as $item) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 473 |
|
| 474 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 475 |
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 484 |
}
|
| 485 |
-
|
| 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 |
-
|
| 500 |
-
$
|
| 501 |
-
|
| 502 |
|
| 503 |
-
|
| 504 |
-
$
|
| 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 |
-
|
| 520 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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" => ($
|
| 530 |
-
"Total" => ($
|
| 531 |
"Gravado" => true,
|
| 532 |
"Bonificacion" => 0
|
| 533 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 534 |
$items[] = $shippingCost;
|
| 535 |
|
| 536 |
-
|
| 537 |
-
$discountAmount = abs($order->getDiscountAmount());
|
| 538 |
-
if ($discountAmount > 0)
|
| 539 |
-
{
|
| 540 |
$discounts = array(
|
| 541 |
"Cantidad" => 1,
|
| 542 |
"Detalle" => 'Descuentos',
|
| 543 |
"Codigo" => 'discounts',
|
| 544 |
-
"IVA" =>
|
| 545 |
-
"PrecioUnitario" =>
|
| 546 |
-
"Total" =>
|
| 547 |
-
"Gravado" =>
|
| 548 |
"Bonificacion" => 0
|
| 549 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 550 |
$items[] = $discounts;
|
| 551 |
}
|
| 552 |
|
|
@@ -561,38 +675,92 @@ class Facturante_Invoicing_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 561 |
// Request
|
| 562 |
$requestCrearComprobante = array("request" => $paramCrearComprobante);
|
| 563 |
|
| 564 |
-
|
| 565 |
-
$
|
| 566 |
-
|
| 567 |
-
|
| 568 |
-
|
| 569 |
-
|
| 570 |
-
|
| 571 |
-
|
| 572 |
-
|
| 573 |
-
|
| 574 |
-
|
| 575 |
-
|
| 576 |
-
|
| 577 |
-
|
| 578 |
-
|
| 579 |
-
|
| 580 |
-
|
| 581 |
-
|
| 582 |
-
|
| 583 |
-
$newInvoicingStatus->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
|
|
@@ -674,10 +842,7 @@ class Facturante_Invoicing_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 674 |
* @return boolean
|
| 675 |
*/
|
| 676 |
public function isCUIT($number) {
|
| 677 |
-
if (strlen((
|
| 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 |
}
|
|
@@ -690,8 +855,7 @@ class Facturante_Invoicing_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 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;
|
|
@@ -708,4 +872,4 @@ class Facturante_Invoicing_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 708 |
|
| 709 |
return $digito == $verif;
|
| 710 |
}
|
| 711 |
-
}
|
| 13 |
const FACTURANTE_CODIGO_NOTA_DE_DEBITO = 'debito';
|
| 14 |
const FACTURANTE_CODIGO_NOTA_DE_CREDITO = 'credito';
|
| 15 |
|
| 16 |
+
public function testAPIConnection() {
|
| 17 |
+
$storeId = 0;
|
| 18 |
+
if (strlen($code = Mage::getSingleton('adminhtml/config_data')->getStore())) // store level
|
| 19 |
+
{
|
| 20 |
+
$storeId = Mage::getModel('core/store')->load($code)->getId();
|
| 21 |
+
} elseif (strlen($code = Mage::getSingleton('adminhtml/config_data')->getWebsite())) // website level
|
| 22 |
+
{
|
| 23 |
+
$websiteId = Mage::getModel('core/website')->load($code)->getId();
|
| 24 |
+
$storeId = Mage::app()->getWebsite($websiteId)->getDefaultStore()->getId();
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
// Mage::log("Store ID: -> " . $storeId, null,'debug1.log');
|
| 28 |
+
|
| 29 |
+
/** Si aún no se ha configurado la url, entonces seteo la de testing. De ese modo permite ingresar al system config y cambiarla. */
|
| 30 |
+
$urlApi = Mage::getStoreConfig('facturante/connection/api_url', $storeId);
|
| 31 |
+
if( empty( $urlApi ) ) {
|
| 32 |
+
$urlApi = "http://testing.facturante.com/api/comprobantes.svc?wsdl";
|
| 33 |
+
}
|
| 34 |
+
$client = new SoapClient( $urlApi );
|
| 35 |
|
| 36 |
+
$usernameValue = Mage::getStoreConfig('facturante/connection/username', $storeId);
|
| 37 |
+
$passwordValue = Mage::getStoreConfig('facturante/connection/password', $storeId);
|
| 38 |
+
$businessIdValue = Mage::getStoreConfig('facturante/connection/business_id', $storeId);
|
| 39 |
|
| 40 |
$auth = array(
|
| 41 |
'Empresa' => $businessIdValue,
|
| 116 |
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.');
|
| 117 |
return false;
|
| 118 |
}
|
|
|
|
| 119 |
$billingAddress = $order->getBillingAddress();
|
| 120 |
|
| 121 |
+
$storeId = $order->getStoreId();
|
| 122 |
+
// Mage::log("Store ID: -> " . $storeId, null,'debug1.log');
|
| 123 |
+
|
| 124 |
+
$urlApi = Mage::getStoreConfig('facturante/connection/api_url', $storeId);
|
| 125 |
+
if( empty( $urlApi ) ) {
|
| 126 |
+
$urlApi = "http://testing.facturante.com/api/comprobantes.svc?wsdl";
|
| 127 |
+
}
|
| 128 |
+
$client = new SoapClient( $urlApi );
|
| 129 |
|
| 130 |
+
$usernameValue = Mage::getStoreConfig('facturante/connection/username', $storeId);
|
| 131 |
+
$passwordValue = Mage::getStoreConfig('facturante/connection/password', $storeId);
|
| 132 |
+
$businessIdValue = Mage::getStoreConfig('facturante/connection/business_id', $storeId);
|
| 133 |
|
| 134 |
$auth = array(
|
| 135 |
'Empresa' => $businessIdValue,
|
| 154 |
*/
|
| 155 |
$customerId = $order->getCustomerId();
|
| 156 |
$customer = Mage::getModel('customer/customer')->load($customerId);
|
| 157 |
+
|
| 158 |
+
/**
|
| 159 |
+
* @var $configTaxVatComoDni
|
| 160 |
+
* 0: Usa campo DNI
|
| 161 |
+
* 1: Usa Tax/Vat como número de DNI
|
| 162 |
+
*/
|
| 163 |
+
$configTaxVatComoDni = Mage::getStoreConfig('facturante/connection2/campo_tax_vat_dni', $storeId);
|
| 164 |
+
if( isset ( $configTaxVatComoDni ) && $configTaxVatComoDni == 1) {
|
| 165 |
+
$numeroDeDocumento = preg_replace('/[^0-9]/','', $customer->getData('taxvat'));
|
| 166 |
+
} else {
|
| 167 |
+
$numeroDeDocumento = preg_replace('/[^0-9]/','', $customer->getData('dni_number'));
|
| 168 |
+
}
|
| 169 |
|
| 170 |
// Si no hay numero de documento para el customer,
|
| 171 |
// sino asignar customer ID como numero de documento
|
| 198 |
* 1: SI
|
| 199 |
* @type boolean
|
| 200 |
*/
|
| 201 |
+
$percibeIva = Mage::getStoreConfig('facturante/connection3/percibe_iva', $storeId);
|
| 202 |
|
| 203 |
/**
|
| 204 |
* Percibe IIBB?
|
| 207 |
*
|
| 208 |
* @type boolean
|
| 209 |
*/
|
| 210 |
+
// $percibeIIBB = false;
|
| 211 |
+
$percibeIIBB = 0;
|
| 212 |
|
| 213 |
/**
|
| 214 |
* Tratamiento Impositivo
|
| 229 |
|
| 230 |
// Si el numero ingresado en el documento es un numero de CUIT,
|
| 231 |
// entonces el tratamiento impositivo debe ser responsable inscripto
|
| 232 |
+
if ( self::isCUIT( $numeroDeDocumento ) ) {
|
|
|
|
| 233 |
$tratamientoImpositivo = 2;
|
| 234 |
}
|
|
|
|
| 235 |
/**
|
| 236 |
* Enviar comprobante?
|
| 237 |
*
|
| 239 |
*
|
| 240 |
* @type bool
|
| 241 |
*/
|
| 242 |
+
$enviarComprobante = Mage::getStoreConfig('facturante/connection2/enviar_comprobante', $storeId);
|
| 243 |
|
| 244 |
/**
|
| 245 |
* Provincia
|
| 321 |
*
|
| 322 |
* @type int
|
| 323 |
*/
|
| 324 |
+
$prefijo = Mage::getStoreConfig('facturante/connection3/prefijo', $storeId);
|
| 325 |
$longitudActual = strlen($prefijo);
|
| 326 |
$longitudPrefijo = 4;
|
| 327 |
|
| 382 |
*
|
| 383 |
* @type int
|
| 384 |
*/
|
| 385 |
+
$bienes = Mage::getStoreConfig('facturante/connection3/bienes', $storeId);
|
| 386 |
/**
|
| 387 |
* Fecha de servicio facturado (desde y hasta)
|
| 388 |
*
|
| 466 |
// total
|
| 467 |
// totalNeto
|
| 468 |
|
| 469 |
+
/**
|
| 470 |
+
* ----- Funcionalidad GTIN -----
|
| 471 |
+
*
|
| 472 |
+
* @var $config_modo_facturacion
|
| 473 |
+
*
|
| 474 |
+
* '' (vacio): No se ha seteado el dato en el sistem config
|
| 475 |
+
* 1: Factura Electrónica Genérica -- AFIP RG 2485 o RG 3749
|
| 476 |
+
* 2: Factura Electrónica con Detalle -- (Mtx o Matrix) - RG 2904
|
| 477 |
+
*
|
| 478 |
+
*/
|
| 479 |
+
$config_modo_facturacion = Mage::getStoreConfig('facturante/connection5/modo_facturacion', $storeId);
|
| 480 |
+
|
| 481 |
$encabezado = array(
|
| 482 |
"FechaHora" => $fechaHora,
|
| 483 |
"Prefijo" => $prefijo,
|
| 503 |
"PorcentajeIIBB" => $porcentajeIIBB
|
| 504 |
);
|
| 505 |
|
| 506 |
+
$orderedItems = $order->getItemsCollection()
|
| 507 |
+
->addAttributeToSelect('*')
|
| 508 |
+
->addAttributeToFilter('product_type', array('eq'=>'simple'))
|
| 509 |
+
->load();
|
|
|
|
| 510 |
|
| 511 |
+
$preciosFinales = Mage::getStoreConfig('facturante/connection2/precios_finales', $storeId);
|
| 512 |
|
| 513 |
+
$items = array();
|
| 514 |
+
$productosConGtinFaltantes = 0;
|
| 515 |
foreach ($orderedItems as $item) {
|
| 516 |
+
if( $item->getProductType() == 'simple' ) {
|
| 517 |
+
/** Se evalúa la toma de datos según el tipo de producto. */
|
| 518 |
+
if ( $item->getParentItem() ) {
|
| 519 |
+
$price = $item->getParentItem()->getPrice();
|
| 520 |
+
$rowDiscount = $item->getParentItem()->getDiscountAmount();
|
| 521 |
+
} else {
|
| 522 |
+
$price = $item->getPrice();
|
| 523 |
+
$rowDiscount = $item->getDiscountAmount();
|
| 524 |
+
}
|
| 525 |
|
| 526 |
+
// Mage::log("Price: -> ".$price, null,'debug1.log');
|
| 527 |
+
|
| 528 |
+
$qtyOrdered = $item->getData('qty_ordered');
|
| 529 |
+
|
| 530 |
+
/** @var $itemDiscount
|
| 531 |
+
* Descuento unitario del producto.
|
| 532 |
+
* */
|
| 533 |
+
$itemDiscount = $rowDiscount / $qtyOrdered;
|
| 534 |
+
|
| 535 |
+
// Mage::log("item discount amount: -> ".$itemDiscount, null,'debug1.log');
|
| 536 |
+
|
| 537 |
+
/** @var $finalPrice
|
| 538 |
+
* Precio del producto menos el descuento aplicado de forma unitaria.
|
| 539 |
+
*/
|
| 540 |
+
// $finalPrice = $price - $itemDiscount;
|
| 541 |
+
$finalPrice = $price;
|
| 542 |
+
|
| 543 |
+
// Mage::log("Discount amount: -> ".$rowDiscount, null,'debug1.log');
|
| 544 |
+
|
| 545 |
+
// Mage::log("Final Price (after discount): -> ".$finalPrice."\n", null,'debug1.log');
|
| 546 |
+
|
| 547 |
+
/** NO ES PRECIO FINAL */
|
| 548 |
+
if ( $preciosFinales == 0 ) {
|
| 549 |
+
// En este caso, el precio final de los productos no incluye los impuestos
|
| 550 |
+
// El impuesto total para el producto va a ser el monto de impuesto dividido la cantidad
|
| 551 |
+
// de productos comprados
|
| 552 |
+
/** Tax seteado en Magento
|
| 553 |
+
* El taxClass cuyo codigo es "0" es taxClass vacio.
|
| 554 |
+
*/
|
| 555 |
+
$productTaxClass = $item->getProduct()->getTaxClassId();
|
| 556 |
+
|
| 557 |
+
/** Si taxClass es 'none', dejo un 21% por default. */
|
| 558 |
+
if ( $productTaxClass == 0 ) {
|
| 559 |
+
$porcentageImpuestoProducto = 21;
|
| 560 |
+
} else {
|
| 561 |
+
/** Caso contrario, tomo el valor de la clase seleccionada. */
|
| 562 |
+
$porcentageImpuestoProducto = $item->getTaxPercent();
|
| 563 |
+
}
|
| 564 |
+
// $subTotal = $finalPrice * $qtyOrdered;
|
| 565 |
+
// $total = round( ($subTotal) + $subTotal / 100 * $porcentageImpuestoProducto, 2);
|
| 566 |
+
|
| 567 |
+
$total = round( ( $finalPrice * $qtyOrdered ), 2 );
|
| 568 |
+
} else {
|
| 569 |
+
/** SI ES PRECIO FINAL */
|
| 570 |
+
// Si el precio de los productos es final
|
| 571 |
+
// entonces descontar un 21% del precio del producto
|
| 572 |
+
// (multiplicar precio de los productos por 1.21)
|
| 573 |
+
$porcentageImpuestoProducto = 21;
|
| 574 |
+
// $precioProducto = $finalPrice / 1.21;
|
| 575 |
+
$finalPrice = $finalPrice / 1.21;
|
| 576 |
+
$total = round( ( $finalPrice * $qtyOrdered ), 2 );
|
| 577 |
+
}
|
| 578 |
|
| 579 |
+
$newOrderedItem = array(
|
| 580 |
+
"Cantidad" => $qtyOrdered,
|
| 581 |
+
"Detalle" => $item->getProduct()->getData('description'),
|
| 582 |
+
"Codigo" => $item->getSku(),
|
| 583 |
+
"IVA" => $porcentageImpuestoProducto,
|
| 584 |
+
"PrecioUnitario" => round($finalPrice, 2),
|
| 585 |
+
"Total" => $total,
|
| 586 |
+
"Gravado" => true,
|
| 587 |
+
"Bonificacion" => 0
|
| 588 |
+
);
|
| 589 |
+
|
| 590 |
+
/** Si es factura con detalle, entonces agrego dos atributos más. */
|
| 591 |
+
if( $config_modo_facturacion == 2 ) {
|
| 592 |
+
$gtin = $item->getProduct()->getData('gtin');
|
| 593 |
+
|
| 594 |
+
/** Me fijo que gtin tenga dato. */
|
| 595 |
+
if( empty( $gtin ) ) {
|
| 596 |
+
$productosConGtinFaltantes++;
|
| 597 |
+
}
|
| 598 |
+
$newOrderedItem['CodigoMtx'] = $gtin;
|
| 599 |
+
$newOrderedItem['UnidadesMtx'] = $qtyOrdered;
|
| 600 |
}
|
| 601 |
+
$items[] = $newOrderedItem;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 602 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 603 |
}
|
| 604 |
|
| 605 |
+
// Response
|
| 606 |
+
$responseCrearComprobante = null;
|
| 607 |
+
//Agregar shipping cost al total de la orden como un item
|
| 608 |
|
| 609 |
+
// Agregar descuentos como valores negativos en el total de la orden como un item (si existen descuentos)
|
| 610 |
+
$discountAmount = abs($order->getDiscountAmount());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 611 |
|
| 612 |
+
if ( $preciosFinales == 1 ) {
|
| 613 |
+
/** SI ES PRECIO FINAL */
|
| 614 |
+
|
| 615 |
+
/** Shipping */
|
| 616 |
+
$precioUnitarioShipping = $order->getShippingAmount() / 1.21;
|
| 617 |
+
$totalShipping = $order->getShippingAmount();
|
| 618 |
+
/** Discount */
|
| 619 |
+
$precioUnitarioDiscount = ( -1 * $discountAmount ) / 1.21;
|
| 620 |
+
$totalDiscount = ( -1 * $discountAmount );
|
| 621 |
+
|
| 622 |
+
} else {
|
| 623 |
+
/** NO ES PRECIO FINAL ****** */
|
| 624 |
+
|
| 625 |
+
/** Shipping */
|
| 626 |
+
$precioUnitarioShipping = $order->getShippingAmount() / 1.21;
|
| 627 |
+
$totalShipping = $order->getShippingAmount();
|
| 628 |
+
/** Discount */
|
| 629 |
+
$precioUnitarioDiscount = ( -1 * $discountAmount );
|
| 630 |
+
$totalDiscount = ( -1 * $discountAmount ) * 1.21;
|
| 631 |
}
|
| 632 |
|
|
|
|
| 633 |
$shippingCost = array(
|
| 634 |
"Cantidad" => 1,
|
| 635 |
"Detalle" => 'Gastos de Envío',
|
| 636 |
"Codigo" => 'shipping',
|
| 637 |
"IVA" => 21,
|
| 638 |
+
"PrecioUnitario" => round( $precioUnitarioShipping, 2),
|
| 639 |
+
"Total" => round( $totalShipping, 2),
|
| 640 |
"Gravado" => true,
|
| 641 |
"Bonificacion" => 0
|
| 642 |
);
|
| 643 |
+
if( $config_modo_facturacion == 2 ) {
|
| 644 |
+
$shippingCost['CodigoMtx'] = 7790001001085;
|
| 645 |
+
$shippingCost['UnidadesMtx'] = 1;
|
| 646 |
+
}
|
| 647 |
$items[] = $shippingCost;
|
| 648 |
|
| 649 |
+
if ($discountAmount > 0) {
|
|
|
|
|
|
|
|
|
|
| 650 |
$discounts = array(
|
| 651 |
"Cantidad" => 1,
|
| 652 |
"Detalle" => 'Descuentos',
|
| 653 |
"Codigo" => 'discounts',
|
| 654 |
+
"IVA" => 21,
|
| 655 |
+
"PrecioUnitario" => round( $precioUnitarioDiscount, 2),
|
| 656 |
+
"Total" => round( $totalDiscount, 2),
|
| 657 |
+
"Gravado" => true,
|
| 658 |
"Bonificacion" => 0
|
| 659 |
);
|
| 660 |
+
if( $config_modo_facturacion == 2 ) {
|
| 661 |
+
$discounts['CodigoMtx'] = 7790001001030;
|
| 662 |
+
$discounts['UnidadesMtx'] = 1;
|
| 663 |
+
}
|
| 664 |
$items[] = $discounts;
|
| 665 |
}
|
| 666 |
|
| 675 |
// Request
|
| 676 |
$requestCrearComprobante = array("request" => $paramCrearComprobante);
|
| 677 |
|
| 678 |
+
/** Factura electrónica genérica */
|
| 679 |
+
if ( $config_modo_facturacion == 1 ) {
|
| 680 |
+
Mage::log($requestCrearComprobante, null,'debug1.log');
|
| 681 |
+
$responseCrearComprobante = $client->CrearComprobanteSinImpuestos( $requestCrearComprobante );
|
| 682 |
+
Mage::log($responseCrearComprobante, null,'debug1.log');
|
| 683 |
+
/**
|
| 684 |
+
* Luego de la llamada para crear el comprobante, solicito los detalles del comprobante para saber en que estado se encuentra.
|
| 685 |
+
*/
|
| 686 |
+
$comprobanteId = $responseCrearComprobante->CrearComprobanteSinImpuestosResult->IdComprobante;
|
| 687 |
+
|
| 688 |
+
if (!empty($comprobanteId)) {
|
| 689 |
+
$newInvoicingStatus = Mage::getModel('facturante_invoicing/order_invoicingstatus');
|
| 690 |
+
$newInvoicingStatus->setOrderId($order->getId());
|
| 691 |
+
$newInvoicingStatus->setOrderIncrementId($order->getIncrementId());
|
| 692 |
+
$newInvoicingStatus->setIdcomprobante($comprobanteId);
|
| 693 |
+
$detalleComprobante = $this->getDetalleComprobante($auth, $comprobanteId, $client);
|
| 694 |
+
$estadoDetalleComprobante = $detalleComprobante->DetalleComprobanteResult->Comprobante->EstadoComprobante;
|
| 695 |
+
|
| 696 |
+
$estadoDetalleComprobanteString = $this->getStringEstadoComprobante($estadoDetalleComprobante);
|
| 697 |
+
$newInvoicingStatus->setStatus($estadoDetalleComprobanteString);
|
| 698 |
+
if($estadoDetalleComprobante == 4) {
|
| 699 |
+
$newInvoicingStatus->setLink($detalleComprobante->DetalleComprobanteResult->Comprobante->URLPDF);
|
| 700 |
+
}
|
| 701 |
+
/** Aqui se guarda el mensaje de respuesta de la API */
|
| 702 |
+
$detalleApiError = $this->getDetalleApiRespuesta($responseCrearComprobante->CrearComprobanteSinImpuestosResult->Mensaje);
|
| 703 |
+
$newInvoicingStatus->setComments($detalleApiError);
|
| 704 |
+
$newInvoicingStatus->setUpdateDate(now());
|
| 705 |
+
$newInvoicingStatus->save();
|
| 706 |
+
|
| 707 |
+
// Guardar nuevo estado del comprobante en columna de grilla de ordenes
|
| 708 |
+
$order->setData('facturante_invoice_status', $estadoDetalleComprobanteString);
|
| 709 |
+
$order->setData('afip_last_invoice_type', $type);
|
| 710 |
+
$order->save();
|
| 711 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 712 |
}
|
| 713 |
+
/** Factura electrónica con detalle */
|
| 714 |
+
if( $config_modo_facturacion == 2 ) {
|
| 715 |
+
if( $productosConGtinFaltantes == 0 ) {
|
| 716 |
+
Mage::log($requestCrearComprobante, null,'debug1.log');
|
| 717 |
+
// die;
|
| 718 |
+
$responseCrearComprobante = $client->CrearComprobanteSinImpuestosMtx( $requestCrearComprobante );
|
| 719 |
+
Mage::log($responseCrearComprobante, null,'debug1.log');
|
| 720 |
+
/**
|
| 721 |
+
* Luego de la llamada para crear el comprobante, solicito los detalles del comprobante para saber en que estado se encuentra.
|
| 722 |
+
*/
|
| 723 |
+
$comprobanteId = $responseCrearComprobante->CrearComprobanteSinImpuestosMtxResult->IdComprobante;
|
| 724 |
+
if (!empty($comprobanteId)) {
|
| 725 |
+
$newInvoicingStatus = Mage::getModel('facturante_invoicing/order_invoicingstatus');
|
| 726 |
+
$newInvoicingStatus->setOrderId($order->getId());
|
| 727 |
+
$newInvoicingStatus->setOrderIncrementId($order->getIncrementId());
|
| 728 |
+
$newInvoicingStatus->setIdcomprobante($comprobanteId);
|
| 729 |
+
$detalleComprobante = $this->getDetalleComprobante($auth, $comprobanteId, $client);
|
| 730 |
+
|
| 731 |
+
$estadoDetalleComprobante = $detalleComprobante->DetalleComprobanteResult->Comprobante->EstadoComprobante;
|
| 732 |
+
|
| 733 |
+
$estadoDetalleComprobanteString = $this->getStringEstadoComprobante($estadoDetalleComprobante);
|
| 734 |
+
$newInvoicingStatus->setStatus($estadoDetalleComprobanteString);
|
| 735 |
+
if($estadoDetalleComprobante == 4) {
|
| 736 |
+
$newInvoicingStatus->setLink($detalleComprobante->DetalleComprobanteResult->Comprobante->URLPDF);
|
| 737 |
+
}
|
| 738 |
+
/** Aqui se guarda el mensaje de respuesta de la API */
|
| 739 |
+
$detalleApiError = $this->getDetalleApiRespuesta($responseCrearComprobante->CrearComprobanteSinImpuestosMtxResult->Mensaje);
|
| 740 |
+
$newInvoicingStatus->setComments($detalleApiError);
|
| 741 |
+
$newInvoicingStatus->setUpdateDate(now());
|
| 742 |
+
$newInvoicingStatus->save();
|
| 743 |
+
|
| 744 |
+
// Guardar nuevo estado del comprobante en columna de grilla de ordenes
|
| 745 |
+
if( !empty( $estadoDetalleComprobanteString ) ) {
|
| 746 |
+
$order->setData('facturante_invoice_status', $estadoDetalleComprobanteString);
|
| 747 |
+
}
|
| 748 |
+
$order->setData('afip_last_invoice_type', $type);
|
| 749 |
+
$order->save();
|
| 750 |
+
}
|
| 751 |
+
} elseif( $productosConGtinFaltantes > 0 ) {
|
| 752 |
+
/** En caso de existir productos con gtin faltantes, evito la llamada a la api y solo realizo la devolución de un mensaje de error. */
|
| 753 |
+
$responseCrearComprobante = (Object) [
|
| 754 |
+
'CrearComprobanteSinImpuestosMtxResult' => (Object) [
|
| 755 |
+
'Codigo' => 'GTIN Faltante',
|
| 756 |
+
'Estado' => 'Error',
|
| 757 |
+
'Mensaje' => 'Existen productos agregados en la orden que no tienen su código GTIN.',
|
| 758 |
+
'IdComprobante' => null
|
| 759 |
+
]
|
| 760 |
+
];
|
| 761 |
+
}
|
| 762 |
+
}
|
| 763 |
+
|
| 764 |
return $responseCrearComprobante;
|
| 765 |
}
|
| 766 |
|
| 842 |
* @return boolean
|
| 843 |
*/
|
| 844 |
public function isCUIT($number) {
|
| 845 |
+
if ( strlen( strval( $number ) ) == 11 ) {
|
|
|
|
|
|
|
|
|
|
| 846 |
$cuitValido = self::validarCuit($number);
|
| 847 |
return $cuitValido;
|
| 848 |
}
|
| 855 |
* @param int $cuit
|
| 856 |
* @return boolean
|
| 857 |
*/
|
| 858 |
+
public function validarCuit( $cuit ) {
|
|
|
|
| 859 |
$cuit = preg_replace( '/[^\d]/', '', (string) $cuit );
|
| 860 |
if( strlen( $cuit ) != 11 ){
|
| 861 |
return false;
|
| 872 |
|
| 873 |
return $digito == $verif;
|
| 874 |
}
|
| 875 |
+
}
|
app/code/local/Facturante/Invoicing/Model/.DS_Store
ADDED
|
Binary file
|
app/code/local/Facturante/Invoicing/Model/CronComprobantesError.php
DELETED
|
@@ -1,54 +0,0 @@
|
|
| 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
CHANGED
|
@@ -11,75 +11,77 @@ class Facturante_Invoicing_Model_CronComprobantesPendientes
|
|
| 11 |
*/
|
| 12 |
public function actualizarEstadoComprobantes()
|
| 13 |
{
|
| 14 |
-
$
|
| 15 |
-
$
|
| 16 |
-
|
|
|
|
| 17 |
|
| 18 |
-
|
| 19 |
-
'
|
| 20 |
-
'
|
| 21 |
-
'Usuario' => $usernameValue
|
| 22 |
-
);
|
| 23 |
-
$client = new SoapClient('http://testing.facturante.com/api/Comprobantes.svc?wsdl');
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
$
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 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 |
-
|
| 49 |
-
|
| 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 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
}
|
| 71 |
-
|
| 72 |
-
|
| 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 |
}
|
| 11 |
*/
|
| 12 |
public function actualizarEstadoComprobantes()
|
| 13 |
{
|
| 14 |
+
$allStores = Mage::app()->getStores();
|
| 15 |
+
foreach ($allStores as $eachStoreId => $val)
|
| 16 |
+
{
|
| 17 |
+
$storeId = Mage::app()->getStore($eachStoreId)->getId();
|
| 18 |
|
| 19 |
+
$usernameValue = Mage::getStoreConfig('facturante/connection/username', $storeId);
|
| 20 |
+
$passwordValue = Mage::getStoreConfig('facturante/connection/password', $storeId);
|
| 21 |
+
$businessIdValue = Mage::getStoreConfig('facturante/connection/business_id', $storeId);
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
+
$auth = array(
|
| 24 |
+
'Empresa' => $businessIdValue,
|
| 25 |
+
'Hash' => $passwordValue,
|
| 26 |
+
'Usuario' => $usernameValue
|
| 27 |
+
);
|
| 28 |
+
/** Si aún no se ha configurado la url, entonces seteo la de testing. De ese modo permite ingresar al system config y cambiarla. */
|
| 29 |
+
$urlApi = Mage::getStoreConfig('facturante/connection/api_url', $storeId);
|
| 30 |
+
if( empty( $urlApi ) ) {
|
| 31 |
+
$urlApi = "http://testing.facturante.com/api/comprobantes.svc?wsdl";
|
| 32 |
+
}
|
| 33 |
+
$client = new SoapClient( $urlApi );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
+
$orders = Mage::getModel('sales/order')->getCollection()
|
| 36 |
+
->addFieldToFilter('facturante_invoice_status', array('nin' => array('Procesado')));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
+
foreach ($orders as $order)
|
| 39 |
+
{
|
| 40 |
+
/** Acá tomo el estado de su última peticion de detalle de comprobante y luego actualizo el estado general
|
| 41 |
+
* de la orden */
|
| 42 |
+
$comprobantesOrder = Mage::getModel('facturante_invoicing/order_invoicingstatus')->getCollection()->addFilter('order_increment_id', $order->getIncrementId())->addFieldToFilter('status', array('nin' => array('Procesado', 'Error en Envío', 'No Generado')))->addFieldToSelect('idcomprobante')->addFieldToSelect('status')->setOrder('update_date', 'DESC')->load();
|
| 43 |
+
/** Tomo la ultima actualizacion de comprobante */
|
| 44 |
+
foreach ($comprobantesOrder as $comprobante)
|
| 45 |
+
{
|
| 46 |
+
$idComprobante = $comprobante->idcomprobante;
|
| 47 |
+
$estadoAnteriorComprobante = $comprobante->status;
|
| 48 |
+
$responseDetalleComprobante = Mage::helper('facturante_invoicing')->getDetalleComprobante($auth, $idComprobante, $client);
|
| 49 |
+
$estadoActualComprobante = Mage::helper('facturante_invoicing')->getStringEstadoComprobante($responseDetalleComprobante->DetalleComprobanteResult->Comprobante->EstadoComprobante);
|
| 50 |
+
/** Si el estado del comprobante ha cambiado, entonces guardo el registro en la tabla de invoicingstatus */
|
| 51 |
+
if (((string)$estadoAnteriorComprobante !== (string)$estadoActualComprobante) && (!empty($estadoActualComprobante)))
|
| 52 |
+
{
|
| 53 |
+
$newComprobanteStatus = Mage::getModel('facturante_invoicing/order_invoicingstatus');
|
| 54 |
+
$newComprobanteStatus->setOrderId($order->getId());
|
| 55 |
+
$newComprobanteStatus->setOrderIncrementId($order->getIncrementId());
|
| 56 |
+
$newComprobanteStatus->setIdcomprobante($idComprobante);
|
| 57 |
+
$newComprobanteStatus->setUpdateDate(now());
|
| 58 |
+
$newComprobanteStatus->setStatus($estadoActualComprobante);
|
| 59 |
+
switch ($estadoActualComprobante)
|
| 60 |
+
{
|
| 61 |
+
case 'Error en Comprobante':
|
| 62 |
+
$newComprobanteStatus->setComments($responseDetalleComprobante->DetalleComprobanteResult->Comprobante->MensajeAFIP);
|
| 63 |
+
break;
|
| 64 |
+
case 'Error en Envío':
|
| 65 |
+
$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.");
|
| 66 |
+
break;
|
| 67 |
+
case 'Procesado':
|
| 68 |
+
$newComprobanteStatus->setComments("Se realizó el envío al cliente con éxito.");
|
| 69 |
+
$newComprobanteStatus->setLink($responseDetalleComprobante->DetalleComprobanteResult->Comprobante->URLPDF);
|
| 70 |
+
break;
|
| 71 |
+
default:
|
| 72 |
+
break;
|
| 73 |
+
}
|
| 74 |
+
$newComprobanteStatus->save();
|
| 75 |
+
/** Acá analizo si el cambio de estado de comprobante amerita un cambio de estado a nivel global de la orden. */
|
| 76 |
+
$estadoNuevoOrden = Mage::helper('facturante_invoicing')->getStringEstadoOrden($estadoActualComprobante);
|
| 77 |
+
$orderObject = Mage::getModel('sales/order')->load($order->getId());
|
| 78 |
+
$orderObject->setFacturanteInvoiceStatus($estadoNuevoOrden);
|
| 79 |
+
$orderObject->save();
|
| 80 |
}
|
| 81 |
+
/** Solo trabajo con el ultimo registro y estado de cada comprobante. */
|
| 82 |
+
break;
|
| 83 |
+
/** Por eso luego del analisis hago el corte. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
}
|
|
|
|
|
|
|
|
|
|
| 85 |
}
|
| 86 |
}
|
| 87 |
}
|
app/code/local/Facturante/Invoicing/Model/Observer.php
CHANGED
|
@@ -3,13 +3,11 @@
|
|
| 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');
|
|
@@ -43,49 +41,55 @@ class Facturante_Invoicing_Model_Observer
|
|
| 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 |
-
$
|
|
|
|
|
|
|
|
|
|
| 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 =
|
| 83 |
-
$
|
| 84 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
}
|
| 86 |
}
|
| 87 |
}
|
| 88 |
-
|
| 89 |
}
|
| 90 |
}
|
| 91 |
-
}
|
| 3 |
* @category Facturante
|
| 4 |
* @package Invoicing
|
| 5 |
*/
|
| 6 |
+
class Facturante_Invoicing_Model_Observer {
|
|
|
|
| 7 |
protected $_orderStatusBefore;
|
| 8 |
protected $_orderStatusBeforeLabel = '';
|
| 9 |
|
| 10 |
+
public function adminhtmlWidgetContainerHtmlBefore($event) {
|
|
|
|
| 11 |
$block = $event->getBlock();
|
| 12 |
if ($block instanceof Mage_Adminhtml_Block_Sales_Order_View) {
|
| 13 |
$order = Mage::registry('current_order');
|
| 41 |
}
|
| 42 |
}
|
| 43 |
|
| 44 |
+
public function savePreviousOrderStatus($observer) {
|
|
|
|
| 45 |
$order = $observer->getEvent()->getOrder();
|
| 46 |
$this->_orderStatusBefore = $order->getOrigData('status');
|
| 47 |
}
|
| 48 |
|
| 49 |
+
public function autogenerateInvoice($observer) {
|
| 50 |
+
|
| 51 |
+
$order = $observer->getEvent()->getOrder();
|
| 52 |
+
$storeId = $order->getStoreId();
|
| 53 |
+
|
| 54 |
+
$autoInvoicing = Mage::getStoreConfig('facturante/connection4/configuracion_activada', $storeId);
|
| 55 |
|
| 56 |
// Si el modo autoinvoicing está activado
|
| 57 |
+
if ($autoInvoicing) {
|
|
|
|
|
|
|
| 58 |
$orderId = $order->getId();
|
| 59 |
$newOrderStatus = $order->getData('status');
|
| 60 |
$oldOrderStatus = $this->_orderStatusBefore;
|
| 61 |
|
| 62 |
+
if (!$oldOrderStatus) {
|
|
|
|
| 63 |
$oldOrderStatus = 'new-order';
|
| 64 |
}
|
| 65 |
|
| 66 |
+
$autoInvoicingStatus = Mage::getStoreConfig('facturante/connection4/estado_orden', $storeId);
|
| 67 |
|
| 68 |
// Si el estado en la orden cambió,
|
| 69 |
// y el estado de la orden para la autofacturación es el mismo que el estado nuevo
|
| 70 |
+
if($oldOrderStatus != $newOrderStatus && $newOrderStatus == $autoInvoicingStatus) {
|
|
|
|
| 71 |
// Autogenerar factura para orden
|
| 72 |
+
if ($orderId) {
|
|
|
|
| 73 |
$order = Mage::getModel('sales/order')->load($order->getId());
|
| 74 |
$response = Mage::helper('facturante_invoicing')->generateInvoiceForOrder($order, 'factura');
|
| 75 |
+
if ($response) {
|
| 76 |
+
$config_modo_facturacion = Mage::getStoreConfig('facturante/connection5/modo_facturacion', $storeId);
|
| 77 |
+
$estadoCrearComprobante = "";
|
| 78 |
+
$comprobante = "";
|
| 79 |
+
$mensaje = "";
|
| 80 |
+
if( $config_modo_facturacion == 1 ) {
|
| 81 |
+
$estadoCrearComprobante = $response->CrearComprobanteSinImpuestosResult->Estado;
|
| 82 |
+
$mensaje = $response->CrearComprobanteSinImpuestosResult->Mensaje;
|
| 83 |
+
$comprobante = $response->CrearComprobanteSinImpuestosResult->IdComprobante;
|
| 84 |
+
}
|
| 85 |
+
if( $config_modo_facturacion == 2 ) {
|
| 86 |
+
$estadoCrearComprobante = $response->CrearComprobanteSinImpuestosMtxResult->Estado;
|
| 87 |
+
$mensaje = $response->CrearComprobanteSinImpuestosMtxResult->Mensaje;
|
| 88 |
+
$comprobante = $response->CrearComprobanteSinImpuestosMtxResult->IdComprobante;
|
| 89 |
+
}
|
| 90 |
}
|
| 91 |
}
|
| 92 |
}
|
|
|
|
| 93 |
}
|
| 94 |
}
|
| 95 |
+
}
|
app/code/local/Facturante/Invoicing/Model/System/Config/Source/Dropdown/Modosfacturacion.php
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Facturante_Invoicing_Model_System_Config_Source_Dropdown_Modosfacturacion
|
| 4 |
+
{
|
| 5 |
+
public function toOptionArray()
|
| 6 |
+
{
|
| 7 |
+
return array(
|
| 8 |
+
array(
|
| 9 |
+
'value' => '',
|
| 10 |
+
'label' => '',
|
| 11 |
+
),
|
| 12 |
+
array(
|
| 13 |
+
'value' => '1',
|
| 14 |
+
'label' => 'Factura Electrónica genérica AFIP RG 2485 o RG 3749',
|
| 15 |
+
),
|
| 16 |
+
array(
|
| 17 |
+
'value' => '2',
|
| 18 |
+
'label' => 'Factura Electrónica con Detalle (Mtx o Matrix) - RG 2904',
|
| 19 |
+
)
|
| 20 |
+
);
|
| 21 |
+
}
|
| 22 |
+
}
|
app/code/local/Facturante/Invoicing/Model/System/Config/Source/Dropdown/Urlsapi.php
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Facturante_Invoicing_Model_System_Config_Source_Dropdown_Urlsapi
|
| 4 |
+
{
|
| 5 |
+
public function toOptionArray()
|
| 6 |
+
{
|
| 7 |
+
return array(
|
| 8 |
+
array(
|
| 9 |
+
'value' => 'http://testing.facturante.com/api/comprobantes.svc?wsdl',
|
| 10 |
+
'label' => 'http://testing.facturante.com/api/comprobantes.svc?wsdl',
|
| 11 |
+
),
|
| 12 |
+
array(
|
| 13 |
+
'value' => 'http://facturante.com/api/comprobantes.svc?wsdl',
|
| 14 |
+
'label' => 'http://facturante.com/api/comprobantes.svc?wsdl',
|
| 15 |
+
)
|
| 16 |
+
);
|
| 17 |
+
}
|
| 18 |
+
}
|
app/code/local/Facturante/Invoicing/controllers/Adminhtml/FacturanteController.php
CHANGED
|
@@ -75,39 +75,58 @@ class Facturante_Invoicing_Adminhtml_FacturanteController extends Mage_Adminhtml
|
|
| 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 |
-
|
| 103 |
-
|
| 104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
-
|
| 111 |
}
|
| 112 |
}
|
| 113 |
}
|
| 75 |
* @param int $ordenId
|
| 76 |
* @param string $type
|
| 77 |
*/
|
| 78 |
+
public function commonOrderProcess($ordenId, $type) {
|
| 79 |
+
|
| 80 |
+
$order = Mage::getModel('sales/order')->load($ordenId);
|
| 81 |
+
$storeId = $order->getStoreId();
|
| 82 |
+
|
| 83 |
// Validar primero que la configuración necesaria desde los system config existe
|
| 84 |
+
$prefijo = Mage::getStoreConfig('facturante/connection3/prefijo', $storeId);
|
| 85 |
+
$tipoFacturacion = Mage::getStoreConfig('facturante/connection3/bienes', $storeId);
|
| 86 |
|
| 87 |
+
if (!$prefijo) {
|
|
|
|
| 88 |
Mage::getSingleton('core/session')->addError('Por favor, configure el prefijo AFIP en: Sistema -> Configuración -> Facturante: Prefijo');
|
| 89 |
return false;
|
| 90 |
}
|
| 91 |
+
if (!$tipoFacturacion) {
|
|
|
|
| 92 |
Mage::getSingleton('core/session')->addError('Por favor, configure el tipo de facturación AFIP en: Sistema -> Configuración -> Facturante: Tipo de Facturación');
|
| 93 |
return false;
|
| 94 |
}
|
| 95 |
|
|
|
|
|
|
|
| 96 |
if ($order->getId()) {
|
| 97 |
$response = Mage::helper('facturante_invoicing')->generateInvoiceForOrder($order, $type);
|
| 98 |
|
| 99 |
+
if ($response) {
|
| 100 |
+
/**
|
| 101 |
+
* ----- Funcionalidad GTIN -----
|
| 102 |
+
*
|
| 103 |
+
* @var $config_modo_facturacion
|
| 104 |
+
*
|
| 105 |
+
* '' (vacio): No se ha seteado el dato en el sistem config
|
| 106 |
+
* 1: Factura Electrónica Genérica -- AFIP RG 2485 o RG 3749
|
| 107 |
+
* 2: Factura Electrónica con Detalle -- (Mtx o Matrix) - RG 2904
|
| 108 |
+
*
|
| 109 |
+
*/
|
| 110 |
+
$config_modo_facturacion = Mage::getStoreConfig('facturante/connection5/modo_facturacion', $storeId);
|
| 111 |
+
$estadoCrearComprobante = "";
|
| 112 |
+
$comprobante = "";
|
| 113 |
+
$mensaje = "";
|
| 114 |
+
if( $config_modo_facturacion == 1 ) {
|
| 115 |
+
$estadoCrearComprobante = $response->CrearComprobanteSinImpuestosResult->Estado;
|
| 116 |
+
$mensaje = $response->CrearComprobanteSinImpuestosResult->Mensaje;
|
| 117 |
+
$comprobante = $response->CrearComprobanteSinImpuestosResult->IdComprobante;
|
| 118 |
+
}
|
| 119 |
+
if( $config_modo_facturacion == 2 ) {
|
| 120 |
+
$estadoCrearComprobante = $response->CrearComprobanteSinImpuestosMtxResult->Estado;
|
| 121 |
+
$mensaje = $response->CrearComprobanteSinImpuestosMtxResult->Mensaje;
|
| 122 |
+
$comprobante = $response->CrearComprobanteSinImpuestosMtxResult->IdComprobante;
|
| 123 |
+
}
|
| 124 |
|
| 125 |
if($estadoCrearComprobante == 'OK') {
|
| 126 |
Mage::getSingleton('core/session')->addSuccess('Comprobante Nº'.$comprobante.' generado correctamente para la orden Nº '.$order->getIncrementId().'.');
|
| 127 |
} else {
|
| 128 |
Mage::getSingleton('core/session')->addError('Ha ocurrido un error al intentar generar el comprobante para la orden Nª '.$order->getIncrementId().'.<br>
|
| 129 |
+
Detalle: '.$mensaje);
|
| 130 |
}
|
| 131 |
}
|
| 132 |
}
|
app/code/local/Facturante/Invoicing/etc/.DS_Store
ADDED
|
Binary file
|
app/code/local/Facturante/Invoicing/etc/config.xml
CHANGED
|
@@ -2,19 +2,10 @@
|
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Facturante_Invoicing>
|
| 5 |
-
<version>0.1.
|
| 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>
|
|
@@ -124,14 +115,18 @@
|
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Facturante_Invoicing>
|
| 5 |
+
<version>0.1.8</version>
|
| 6 |
</Facturante_Invoicing>
|
| 7 |
</modules>
|
| 8 |
<adminhtml>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
<events>
|
| 10 |
<adminhtml_widget_container_html_before>
|
| 11 |
<observers>
|
| 115 |
<model>facturante_invoicing/CronComprobantesPendientes::actualizarEstadoComprobantes</model>
|
| 116 |
</run>
|
| 117 |
</comprobantes_pendientes>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
</jobs>
|
| 119 |
</crontab>
|
| 120 |
+
|
| 121 |
+
<!-- Por default seteo el modo de facturación "Factura electronica genérica AFIP RG 2485 o RG 3749" -->
|
| 122 |
+
<default>
|
| 123 |
+
<facturante>
|
| 124 |
+
<connection2>
|
| 125 |
+
<campo_tax_vat_dni>0</campo_tax_vat_dni>
|
| 126 |
+
</connection2>
|
| 127 |
+
<connection5>
|
| 128 |
+
<modo_gtin>1</modo_gtin>
|
| 129 |
+
</connection5>
|
| 130 |
+
</facturante>
|
| 131 |
+
</default>
|
| 132 |
+
</config>
|
app/code/local/Facturante/Invoicing/etc/system.xml
CHANGED
|
@@ -54,6 +54,15 @@
|
|
| 54 |
<show_in_website>0</show_in_website>
|
| 55 |
<show_in_store>0</show_in_store>
|
| 56 |
</test_connection>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
</fields>
|
| 58 |
</connection>
|
| 59 |
|
|
@@ -88,6 +97,18 @@
|
|
| 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 |
|
|
@@ -150,7 +171,7 @@
|
|
| 150 |
<show_in_store>1</show_in_store>
|
| 151 |
<fields>
|
| 152 |
<configuracion_activada translate="label">
|
| 153 |
-
<label>¿Activar
|
| 154 |
<frontend_type>select</frontend_type>
|
| 155 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 156 |
<sort_order>2</sort_order>
|
|
@@ -170,6 +191,37 @@
|
|
| 170 |
</fields>
|
| 171 |
</connection4>
|
| 172 |
<!-- FIN - Configuracion AFIP -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
</groups>
|
| 174 |
</facturante>
|
| 175 |
</sections>
|
| 54 |
<show_in_website>0</show_in_website>
|
| 55 |
<show_in_store>0</show_in_store>
|
| 56 |
</test_connection>
|
| 57 |
+
<api_url translate="label">
|
| 58 |
+
<label>URL de API</label>
|
| 59 |
+
<frontend_type>select</frontend_type>
|
| 60 |
+
<source_model>facturante_invoicing/system_config_source_dropdown_urlsapi</source_model>
|
| 61 |
+
<sort_order>40</sort_order>
|
| 62 |
+
<show_in_default>1</show_in_default>
|
| 63 |
+
<show_in_website>1</show_in_website>
|
| 64 |
+
<show_in_store>1</show_in_store>
|
| 65 |
+
</api_url>
|
| 66 |
</fields>
|
| 67 |
</connection>
|
| 68 |
|
| 97 |
<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>
|
| 98 |
</precios_finales>
|
| 99 |
</fields>
|
| 100 |
+
<fields>
|
| 101 |
+
<campo_tax_vat_dni translate="label">
|
| 102 |
+
<label>¿Utilizar campo TAX/VAT como DNI?</label>
|
| 103 |
+
<frontend_type>select</frontend_type>
|
| 104 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 105 |
+
<sort_order>3</sort_order>
|
| 106 |
+
<show_in_default>1</show_in_default>
|
| 107 |
+
<show_in_website>1</show_in_website>
|
| 108 |
+
<show_in_store>1</show_in_store>
|
| 109 |
+
<comment>Si selecciona "Si", entonces se utilizará el campo TAX/VAT de Magento en vez del campo DNI.</comment>
|
| 110 |
+
</campo_tax_vat_dni>
|
| 111 |
+
</fields>
|
| 112 |
</connection2>
|
| 113 |
<!-- FIN - Configuracion General -->
|
| 114 |
|
| 171 |
<show_in_store>1</show_in_store>
|
| 172 |
<fields>
|
| 173 |
<configuracion_activada translate="label">
|
| 174 |
+
<label>¿Activar facturación automática?</label>
|
| 175 |
<frontend_type>select</frontend_type>
|
| 176 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 177 |
<sort_order>2</sort_order>
|
| 191 |
</fields>
|
| 192 |
</connection4>
|
| 193 |
<!-- FIN - Configuracion AFIP -->
|
| 194 |
+
|
| 195 |
+
<!-- INICIO - Configuracion funcionalidad GTIN -->
|
| 196 |
+
<connection5 translate="label">
|
| 197 |
+
<label>Configuración GTIN</label>
|
| 198 |
+
<frontend_type>text</frontend_type>
|
| 199 |
+
<sort_order>16</sort_order>
|
| 200 |
+
<show_in_default>1</show_in_default>
|
| 201 |
+
<show_in_website>1</show_in_website>
|
| 202 |
+
<show_in_store>1</show_in_store>
|
| 203 |
+
<fields>
|
| 204 |
+
<!--<activar_gtin translate="label">-->
|
| 205 |
+
<!--<label>¿ Desea activar el campo GTIN para el detalle de la factura ?</label>-->
|
| 206 |
+
<!--<frontend_type>select</frontend_type>-->
|
| 207 |
+
<!--<source_model>adminhtml/system_config_source_yesno</source_model>-->
|
| 208 |
+
<!--<sort_order>1</sort_order>-->
|
| 209 |
+
<!--<show_in_default>1</show_in_default>-->
|
| 210 |
+
<!--<show_in_website>1</show_in_website>-->
|
| 211 |
+
<!--<show_in_store>1</show_in_store>-->
|
| 212 |
+
<!--</activar_gtin>-->
|
| 213 |
+
<modo_facturacion translate="label">
|
| 214 |
+
<label>Modo de facturación</label>
|
| 215 |
+
<frontend_type>select</frontend_type>
|
| 216 |
+
<source_model>facturante_invoicing/system_config_source_dropdown_modosfacturacion</source_model>
|
| 217 |
+
<sort_order>2</sort_order>
|
| 218 |
+
<show_in_default>1</show_in_default>
|
| 219 |
+
<show_in_website>1</show_in_website>
|
| 220 |
+
<show_in_store>1</show_in_store>
|
| 221 |
+
</modo_facturacion>
|
| 222 |
+
</fields>
|
| 223 |
+
</connection5>
|
| 224 |
+
<!-- FIN - Configuracion funcionalidad GTIN -->
|
| 225 |
</groups>
|
| 226 |
</facturante>
|
| 227 |
</sections>
|
app/code/local/Facturante/Invoicing/sql/.DS_Store
ADDED
|
Binary file
|
app/code/local/Facturante/Invoicing/sql/facturante_invoicing_setup/.DS_Store
ADDED
|
Binary file
|
app/code/local/Facturante/Invoicing/sql/facturante_invoicing_setup/mysql4-upgrade-0.1.6-0.1.7.php
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Module upgrade: Update structure of 'Argentina' provinces to ISO format.
|
| 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', '0', 'Ciudad Autónoma de Buenos Aires');
|
| 18 |
+
");
|
| 19 |
+
$setup->run("
|
| 20 |
+
UPDATE `directory_country_region` SET code = 1 WHERE default_name = 'Buenos Aires';
|
| 21 |
+
UPDATE `directory_country_region` SET code = 2 WHERE default_name = 'Catamarca';
|
| 22 |
+
UPDATE `directory_country_region` SET code = 3 WHERE default_name = 'Córdoba';
|
| 23 |
+
UPDATE `directory_country_region` SET code = 4 WHERE default_name = 'Corrientes';
|
| 24 |
+
UPDATE `directory_country_region` SET code = 5 WHERE default_name = 'Entre Ríos';
|
| 25 |
+
UPDATE `directory_country_region` SET code = 6 WHERE default_name = 'Jujuy';
|
| 26 |
+
UPDATE `directory_country_region` SET code = 7 WHERE default_name = 'Mendoza';
|
| 27 |
+
UPDATE `directory_country_region` SET code = 8 WHERE default_name = 'La Rioja';
|
| 28 |
+
UPDATE `directory_country_region` SET code = 9 WHERE default_name = 'Salta';
|
| 29 |
+
UPDATE `directory_country_region` SET code = 10 WHERE default_name = 'San Juan';
|
| 30 |
+
UPDATE `directory_country_region` SET code = 11 WHERE default_name = 'San Luis';
|
| 31 |
+
UPDATE `directory_country_region` SET code = 12 WHERE default_name = 'Santa Fe';
|
| 32 |
+
UPDATE `directory_country_region` SET code = 13 WHERE default_name = 'Santiago del Estero';
|
| 33 |
+
UPDATE `directory_country_region` SET code = 14 WHERE default_name = 'Tucumán';
|
| 34 |
+
UPDATE `directory_country_region` SET code = 16 WHERE default_name = 'Chaco';
|
| 35 |
+
UPDATE `directory_country_region` SET code = 17 WHERE default_name = 'Chubut';
|
| 36 |
+
UPDATE `directory_country_region` SET code = 18 WHERE default_name = 'Formosa';
|
| 37 |
+
UPDATE `directory_country_region` SET code = 19 WHERE default_name = 'Misiones';
|
| 38 |
+
UPDATE `directory_country_region` SET code = 20 WHERE default_name = 'Neuquén';
|
| 39 |
+
UPDATE `directory_country_region` SET code = 21 WHERE default_name = 'La Pampa';
|
| 40 |
+
UPDATE `directory_country_region` SET code = 22 WHERE default_name = 'Río Negro';
|
| 41 |
+
UPDATE `directory_country_region` SET code = 23 WHERE default_name = 'Santa Cruz';
|
| 42 |
+
UPDATE `directory_country_region` SET code = 24 WHERE default_name = 'Tierra del Fuego';
|
| 43 |
+
");
|
| 44 |
+
|
| 45 |
+
Mage::log('Adding attribute to products', null, 'facturante-module-upgrade-0.1.7.log');
|
| 46 |
+
|
| 47 |
+
$this->addAttribute('catalog_product', 'gtin', array(
|
| 48 |
+
'type' => 'varchar',
|
| 49 |
+
'size' => 13,
|
| 50 |
+
'unsigned' => true,
|
| 51 |
+
'label' => 'GTIN',
|
| 52 |
+
'visible' => true,
|
| 53 |
+
'required' => false,
|
| 54 |
+
'visible_on_front' => false,
|
| 55 |
+
'user_defined' => false,
|
| 56 |
+
'apply_to' => 'simple'
|
| 57 |
+
));
|
| 58 |
+
|
| 59 |
+
Mage::log('Added attribute to products', null, 'facturante-module-upgrade-0.1.7.log');
|
| 60 |
+
|
| 61 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/facturante/.DS_Store
ADDED
|
Binary file
|
app/design/adminhtml/default/default/template/facturante/.DS_Store
CHANGED
|
Binary file
|
app/design/adminhtml/default/default/template/facturante/form/.DS_Store
ADDED
|
Binary file
|
app/design/adminhtml/default/default/template/facturante/form/renderer/fieldset/attributes.phtml
CHANGED
|
@@ -1,89 +0,0 @@
|
|
| 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
CHANGED
|
@@ -1,22 +0,0 @@
|
|
| 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
CHANGED
|
@@ -1,18 +0,0 @@
|
|
| 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/.DS_Store
ADDED
|
Binary file
|
app/design/adminhtml/default/default/template/facturante/order/view/.DS_Store
ADDED
|
Binary file
|
app/design/adminhtml/default/default/template/facturante/order/view/tab/facturante.phtml
CHANGED
|
@@ -1,11 +1,3 @@
|
|
| 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 |
-
|
| 11 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
<?php
|
| 2 |
+
echo $this->getLayout()->createBlock('facturante_invoicing/adminhtml_sales_order_gridfacturante')->toHtml();
|
| 3 |
?>
|
app/design/adminhtml/default/default/template/facturante/sales/.DS_Store
ADDED
|
Binary file
|
app/design/adminhtml/default/default/template/facturante/sales/order/.DS_Store
ADDED
|
Binary file
|
app/design/adminhtml/default/default/template/facturante/sales/order/view/.DS_Store
ADDED
|
Binary file
|
app/design/frontend/base/default/layout/facturante/.DS_Store
ADDED
|
Binary file
|
app/design/frontend/base/default/template/facturante/.DS_Store
ADDED
|
Binary file
|
app/design/frontend/base/default/template/facturante/checkout/.DS_Store
ADDED
|
Binary file
|
app/design/frontend/base/default/template/facturante/checkout/onepage/dni-number.phtml
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
<?php
|
| 2 |
$_dniNumber = '';
|
| 3 |
-
if (Mage::getSingleton('customer/session')->isLoggedIn())
|
| 4 |
-
{
|
| 5 |
$_customer = Mage::getSingleton('customer/session')->getCustomer();
|
| 6 |
|
| 7 |
$_dniNumber = $_customer->getResource()
|
|
@@ -9,10 +8,14 @@
|
|
| 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>
|
|
|
| 1 |
<?php
|
| 2 |
$_dniNumber = '';
|
| 3 |
+
if ( Mage::getSingleton('customer/session')->isLoggedIn() ) {
|
|
|
|
| 4 |
$_customer = Mage::getSingleton('customer/session')->getCustomer();
|
| 5 |
|
| 6 |
$_dniNumber = $_customer->getResource()
|
| 8 |
->getFrontend()
|
| 9 |
->getValue($_customer);
|
| 10 |
}
|
| 11 |
+
|
| 12 |
+
/** Si esta seteado en 1 entonces significa que se utiliza el campo TAX/VAT como DNI. */
|
| 13 |
+
$config = Mage::getStoreConfig('facturante/connection2/campo_tax_vat_dni');
|
| 14 |
+
if( $config == 0 ) { ?>
|
| 15 |
<div class="field">
|
| 16 |
<label for="billing:dni_number_address"><?php echo $this->__('Número de DNI / CUIT') ?></label>
|
| 17 |
<div class="input-box">
|
| 18 |
<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 ?>" />
|
| 19 |
</div>
|
| 20 |
+
</div>
|
| 21 |
+
<?php } ?>
|
app/design/frontend/base/default/template/facturante/customer/.DS_Store
ADDED
|
Binary file
|
app/design/frontend/base/default/template/facturante/customer/account/.DS_Store
ADDED
|
Binary file
|
app/design/frontend/base/default/template/facturante/customer/account/address/edit.phtml
CHANGED
|
@@ -132,12 +132,26 @@
|
|
| 132 |
</div>
|
| 133 |
</li>
|
| 134 |
<li class="fields">
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
</div>
|
| 140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
</li>
|
| 142 |
<li<?php if($this->canSetAsDefaultBilling()) echo ' class="control"' ?>>
|
| 143 |
<?php if($this->isDefaultBilling()): ?>
|
| 132 |
</div>
|
| 133 |
</li>
|
| 134 |
<li class="fields">
|
| 135 |
+
<?php
|
| 136 |
+
/** Si esta seteado en 1 entonces significa que se utiliza el campo TAX/VAT como DNI. */
|
| 137 |
+
$config_tax_vat = Mage::getStoreConfig('facturante/connection2/campo_tax_vat_dni');
|
| 138 |
+
|
| 139 |
+
/** Decido en que campo guardo el numero de documento del customer según sytem config. */
|
| 140 |
+
if( $config_tax_vat == 1 ) { ?>
|
| 141 |
+
<div class="field">
|
| 142 |
+
<label for="taxvat"><?php echo $this->__('Número de DNI / CUIT') ?></label>
|
| 143 |
+
<div class="input-box">
|
| 144 |
+
<input type="text" name="taxvat" id="taxvat" title="<?php echo $this->quoteEscape($this->__('Número de DNI / CUIT')) ?>" class="input-text" />
|
| 145 |
+
</div>
|
| 146 |
</div>
|
| 147 |
+
<?php } else { ?>
|
| 148 |
+
<div class="field">
|
| 149 |
+
<label for="dni_number_address"><?php echo $this->__('Número de DNI / CUIT') ?></label>
|
| 150 |
+
<div class="input-box">
|
| 151 |
+
<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" />
|
| 152 |
+
</div>
|
| 153 |
+
</div>
|
| 154 |
+
<?php } ?>
|
| 155 |
</li>
|
| 156 |
<li<?php if($this->canSetAsDefaultBilling()) echo ' class="control"' ?>>
|
| 157 |
<?php if($this->isDefaultBilling()): ?>
|
app/design/frontend/base/default/template/facturante/customer/account/form/edit.phtml
CHANGED
|
@@ -43,20 +43,32 @@
|
|
| 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 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>
|
| 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 |
+
|
| 47 |
+
<?php
|
| 48 |
+
/** Si esta seteado en 1 entonces significa que se utiliza el campo TAX/VAT como DNI. */
|
| 49 |
+
$config_tax_vat = Mage::getStoreConfig('facturante/connection2/campo_tax_vat_dni');
|
| 50 |
+
|
| 51 |
+
/** Decido en que campo guardo el numero de documento del customer según sytem config. */
|
| 52 |
+
if( $config_tax_vat == 1 ) { ?>
|
| 53 |
+
<li>
|
| 54 |
+
<label for="taxvat"><?php echo $this->__('Número de DNI / CUIT') ?></label>
|
| 55 |
+
<div class="input-box">
|
| 56 |
+
<input type="text" name="taxvat" id="taxvat" value="<?php echo $this->escapeHtml($this->getCustomer()->getTaxvat()) ?>" title="<?php echo $this->quoteEscape($this->__('Número de DNI / CUIT')) ?>" class="input-text" />
|
| 57 |
+
</div>
|
| 58 |
+
</li>
|
| 59 |
+
<?php } else { ?>
|
| 60 |
+
<li>
|
| 61 |
+
<label for="dni_number"><?php echo $this->__('Número de DNI / CUIT') ?></label>
|
| 62 |
+
<div class="input-box">
|
| 63 |
+
<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" />
|
| 64 |
+
</div>
|
| 65 |
+
</li>
|
| 66 |
+
<?php } ?>
|
| 67 |
+
|
| 68 |
<?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
|
| 69 |
<?php if ($_dob->isEnabled()): ?>
|
| 70 |
<li><?php echo $_dob->setDate($this->getCustomer()->getDob())->toHtml() ?></li>
|
| 71 |
<?php endif ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
<?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
|
| 73 |
<?php if ($_gender->isEnabled()): ?>
|
| 74 |
<li><?php echo $_gender->setGender($this->getCustomer()->getGender())->toHtml() ?></li>
|
app/design/frontend/base/default/template/facturante/customer/register.phtml
CHANGED
|
@@ -66,10 +66,6 @@
|
|
| 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>
|
|
@@ -169,12 +165,28 @@
|
|
| 169 |
</div>
|
| 170 |
</li>
|
| 171 |
<?php echo $this->getChildHtml('form.additional.info'); ?>
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
</div>
|
| 177 |
-
|
|
|
|
| 178 |
<?php echo $this->getChildHtml('persistent.remember.me'); ?>
|
| 179 |
</ul>
|
| 180 |
<?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
|
| 66 |
<?php if ($_dob->isEnabled()): ?>
|
| 67 |
<li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
|
| 68 |
<?php endif ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
<?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
|
| 70 |
<?php if ($_gender->isEnabled()): ?>
|
| 71 |
<li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
|
| 165 |
</div>
|
| 166 |
</li>
|
| 167 |
<?php echo $this->getChildHtml('form.additional.info'); ?>
|
| 168 |
+
|
| 169 |
+
<?php
|
| 170 |
+
/** Si esta seteado en 1 entonces significa que se utiliza el campo TAX/VAT como DNI. */
|
| 171 |
+
$config_tax_vat = Mage::getStoreConfig('facturante/connection2/campo_tax_vat_dni');
|
| 172 |
+
|
| 173 |
+
/** Decido en que campo guardo el numero de documento del customer según sytem config. */
|
| 174 |
+
if( $config_tax_vat == 1 ) { ?>
|
| 175 |
+
<div class="field">
|
| 176 |
+
<label for="taxvat"><?php echo $this->__('Número de DNI / CUIT') ?></label>
|
| 177 |
+
<div class="input-box">
|
| 178 |
+
<input type="text" name="taxvat" id="taxvat" value="<?php echo $this->escapeHtml($this->getCustomer()->getTaxvat()) ?>" title="<?php echo $this->quoteEscape($this->__('Número de DNI / CUIT')) ?>" class="input-text" />
|
| 179 |
+
</div>
|
| 180 |
+
</div>
|
| 181 |
+
<?php } else { ?>
|
| 182 |
+
<div class="field">
|
| 183 |
+
<label for="dni_number"><?php echo $this->__('Número de DNI / CUIT') ?></label>
|
| 184 |
+
<div class="input-box">
|
| 185 |
+
<input type="text" name="dni_number" id="dni_number" title="<?php echo $this->quoteEscape($this->__('Número de DNI / CUIT')) ?>" class="input-text" />
|
| 186 |
+
</div>
|
| 187 |
</div>
|
| 188 |
+
<?php } ?>
|
| 189 |
+
|
| 190 |
<?php echo $this->getChildHtml('persistent.remember.me'); ?>
|
| 191 |
</ul>
|
| 192 |
<?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
|
package.xml
CHANGED
|
@@ -1,41 +1,44 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Facturante</name>
|
| 4 |
-
<version>0.1.
|
| 5 |
<stability>stable</stability>
|
| 6 |
-
<license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
-
<summary>
|
| 10 |
-
<description
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-

|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
<
|
|
|
|
|
|
|
|
|
|
| 39 |
<compatible/>
|
| 40 |
-
<dependencies><required><php><min>5.
|
| 41 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Facturante</name>
|
| 4 |
+
<version>0.1.7</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
+
<license>GPL</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
+
<summary>Facturante v. 0.1.7</summary>
|
| 10 |
+
<description>-Capacidad de incluir distintas modalidades de facturación: 
|
| 11 |
+
Factura con detalle (inclusión de código GTIN)
|
| 12 |
+
Factura electrónica Generica 
|
| 13 |
+

|
| 14 |
+
-Manejo de comprobantes de distintas clases, según tratamiento impositivo del cliente
|
| 15 |
+

|
| 16 |
+
-Capacidad automática de no incluir líneas de envio cuando el envio es igual a cero 
|
| 17 |
+

|
| 18 |
+
-Cambio instantáneo de ambiente, permite seleccionar entre entornos on the fly
|
| 19 |
+

|
| 20 |
+
-Interpretacion de nombre de provincias automatico para la correcta interpretación de las ISOS de AFIP
|
| 21 |
+

|
| 22 |
+
-Facturacion automática con sub estados de ordenes
|
| 23 |
+
</description>
|
| 24 |
+
<notes>-Capacidad de incluir distintas modalidades de facturación: 
|
| 25 |
+
Factura con detalle (inclusión de código GTIN)
|
| 26 |
+
Factura electrónica Generica 
|
| 27 |
+

|
| 28 |
+
-Manejo de comprobantes de distintas clases, según tratamiento impositivo del cliente
|
| 29 |
+

|
| 30 |
+
-Capacidad automática de no incluir líneas de envio cuando el envio es igual a cero 
|
| 31 |
+

|
| 32 |
+
-Cambio instantáneo de ambiente, permite seleccionar entre entornos on the fly
|
| 33 |
+

|
| 34 |
+
-Interpretacion de nombre de provincias automatico para la correcta interpretación de las ISOS de AFIP
|
| 35 |
+

|
| 36 |
+
-Facturacion automática con sub estados de ordenes
|
| 37 |
+
</notes>
|
| 38 |
+
<authors><author><name>Daniel Pili</name><user>facturante</user><email>contacto@facturante.com</email></author></authors>
|
| 39 |
+
<date>2016-10-21</date>
|
| 40 |
+
<time>18:06:14</time>
|
| 41 |
+
<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="c55006b86cd07fa121019094dde9b49d"/><file name=".DS_Store" hash="5c1d51d504074ee8fa5010ff7b26ca40"/></dir><dir name="sql"><dir name="facturante_customer_setup"><file name="install-0.1.0.php" hash="57c5c6e63a9518fa4476cb1e4dbad8dd"/></dir></dir><file name=".DS_Store" hash="cc1f33a149d6968384baa3d08cd57212"/></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="e1dcc77f148fda08b31ce46299e46931"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="8d9f0cb0c141128a38275149ae93a5cb"/><file name=".DS_Store" hash="437544c43163b0c119f0d54b3165090c"/></dir><dir name="Model"><file name="CronComprobantesPendientes.php" hash="66c8ebfbb9f42e7e72324c8f9c94bb23"/><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="8d6d0c30b9e4bcd16b99e792b71aa284"/><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="Modosfacturacion.php" hash="f7cc43567c3f3c57ef74a47e882ac2ea"/><file name="Orderstatus.php" hash="7af7b334503d9851d1b4e1518b388703"/><file name="Urlsapi.php" hash="817365b0ea079966ede18812d473ddfb"/><file name="Values.php" hash="9f6bd1e4e7a77d2194ce910b278fc096"/></dir></dir></dir></dir><file name=".DS_Store" hash="b237fd7cfe1d18a38129d6c2a87abf6e"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FacturanteController.php" hash="952a9a69d00467e8430c0078a744acd5"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="c95bf686d8707c884f83c646c97279e8"/><file name="config.xml" hash="b4ec54fc2d68f973b9479d767becb320"/><file name="system.xml" hash="4b262c3509bd6c6c0443aa70bdc3461f"/><file name=".DS_Store" hash="27a317087bcd060fbe002c2c804d1e4b"/></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"/><file name="mysql4-upgrade-0.1.6-0.1.7.php" hash="67edc28997b5339bd186cdcb52738190"/><file name=".DS_Store" hash="c745d8d257b96f22ab82068eed5c0ea7"/></dir><file name=".DS_Store" hash="fc188cad5ecee041ab9efa3b57086c8e"/></dir><file name=".DS_Store" hash="c186e6eea19742a9285d546bd427eaab"/></dir><file name=".DS_Store" hash="09d9bb5ae0a9530ebd7986ed6f2d91dd"/></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"/><file name=".DS_Store" hash="5cf7622802efc7c6b1cb88a780d86453"/></dir></dir><dir name="template"><dir name="facturante"><dir><dir name="form"><dir name="renderer"><dir name="fieldset"><file name="attributes.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="error.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></dir><file name="testconnection.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name=".DS_Store" hash="f541b6def0df3de56917883a0005d48c"/></dir><dir name="order"><dir name="view"><dir name="tab"><file name="facturante.phtml" hash="dd5d346396998a1e6e8da22cccd77d5b"/></dir><file name=".DS_Store" hash="3aaa95054879da8a9000a2baee1cf96f"/></dir><file name=".DS_Store" hash="947cb5d387842207a9dab65aef464c9a"/></dir><dir name="sales"><dir name="order"><dir name="view"><file name="info.phtml" hash="ec38b7622ea428ee673277e43fce71e7"/><file name=".DS_Store" hash="2316a625899f8bb5a641f102815f656e"/></dir><file name=".DS_Store" hash="600d986a9b9c408100fed05914854f85"/></dir><file name=".DS_Store" hash="7c4d67ad948411afc692597fb7101f29"/></dir></dir><file name=".DS_Store" hash="d1c7cb748e7cd365a91e973cb7812c34"/></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"/><file name=".DS_Store" hash="c5fb7eed57a3b980da93e27ea0946f9d"/></dir></dir><dir name="template"><dir name="facturante"><dir><dir name="checkout"><dir name="onepage"><file name="dni-number.phtml" hash="4e3cbd7564c0f576297143fdd6bba575"/></dir><file name=".DS_Store" hash="93f3aeca24a9835e8746dc4e312c9e6a"/></dir><dir name="customer"><dir name="account"><dir name="address"><file name="edit.phtml" hash="3c3e1da81e790f242cf637f6df49c0fe"/></dir><dir name="form"><file name="edit.phtml" hash="5523fc72b5402a6c39cd44533d17c734"/></dir><file name=".DS_Store" hash="fe96526427d53d86370dd353df1a2b29"/></dir><file name="register.phtml" hash="c7bf4aaaee483e396eca884171bda7f8"/><file name=".DS_Store" hash="df3161a93137652c8b3263c8f0476f20"/></dir></dir><file name=".DS_Store" hash="278a8103dd4724639fa16b1bcdfaa56a"/></dir></dir></dir></dir></dir></target></contents>
|
| 42 |
<compatible/>
|
| 43 |
+
<dependencies><required><php><min>5.4.0</min><max>5.5.6</max></php></required></dependencies>
|
| 44 |
</package>
|
