From a47af9a9a8a54dd62d19c0967fcd6406c2e013d3 Mon Sep 17 00:00:00 2001 From: kamel Date: Tue, 12 Jul 2022 16:34:36 +0200 Subject: [PATCH] - Ajout d'une option pour creer la facture meme si le montant est egale a 0 --- ChangeLog.md | 3 +++ admin/eCommerceSetup.php | 2 ++ admin/tpl/eCommerceSetup.tpl.php | 2 ++ class/business/eCommerceSynchro.class.php | 4 +++- core/modules/modECommerceNg.class.php | 2 +- langs/en_US/ecommerce.lang | 1 + langs/fr_FR/ecommerce.lang | 1 + syncmanual.php | 11 +++++++++++ 8 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 syncmanual.php diff --git a/ChangeLog.md b/ChangeLog.md index 56bcd27..1daf49e 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,8 @@ # ChangeLog +## 4.1.8.0 +- Ajout d'une option pour creer la facture meme si le montant est egale a 0 + ## 4.1.7.0 - Mouvement de stock à la validation d'une commande synchronisée si la synchro des stocks est paramètré dolibarr vers WooCommerce et qu'il n'y a qu'un entrepot de selectionné diff --git a/admin/eCommerceSetup.php b/admin/eCommerceSetup.php index 6b566ce..d52c34a 100644 --- a/admin/eCommerceSetup.php +++ b/admin/eCommerceSetup.php @@ -177,10 +177,12 @@ $ecommerceOrderActions['send_invoice_by_mail'] = GETPOST('ecommerce_send_invoice_by_mail', 'int') ? 1 : 0; $ecommerceOrderActions['create_invoice_deposit_type'] = GETPOST('ecommerce_create_invoice_deposit_type', 'aZ09'); $ecommerceOrderActions['create_invoice_deposit_value'] = GETPOST('ecommerce_create_invoice_deposit_value', 'int'); + $ecommerceOrderActions['create_invoice_if_amount_0'] = GETPOST('ecommerce_create_invoice_if_amount_0', 'int') ? 1 : 0; if (empty($ecommerceOrderActions['create_invoice'])) { $ecommerceOrderActions['send_invoice_by_mail'] = 0; $ecommerceOrderActions['create_invoice_deposit_type'] = ''; $ecommerceOrderActions['create_invoice_deposit_value'] = 0; + $ecommerceOrderActions['create_invoice_if_amount_0'] = 0; } } if ($conf->supplier_invoice->enabled && !empty($ecommerceOrderActions['create_invoice'])) { diff --git a/admin/tpl/eCommerceSetup.tpl.php b/admin/tpl/eCommerceSetup.tpl.php index 6b77bbd..e5d8aed 100644 --- a/admin/tpl/eCommerceSetup.tpl.php +++ b/admin/tpl/eCommerceSetup.tpl.php @@ -388,6 +388,8 @@ function ecommerce_update_invoice_deposit_value_text() { } }); +
+   error = $invoice->error; $this->errors = array_merge($this->errors, $invoice->errors); $error++; - } elseif (!empty($this->eCommerceSite->parameters['order_actions']['create_invoice']) && !empty($order_data['billed'])) { + } elseif (!empty($this->eCommerceSite->parameters['order_actions']['create_invoice']) && !empty($order_data['billed']) && + (empty($this->eCommerceSite->parameters['order_actions']['create_invoice_if_amount_0']) || price2num($order_data['payment_amount_ttc']) != 0) + ) { // Check if order / invoice already synchronized $this->initECommerceCommande(); $result = $this->eCommerceCommande->fetchByRemoteId($order_data['remote_id'], $this->eCommerceSite->id); diff --git a/core/modules/modECommerceNg.class.php b/core/modules/modECommerceNg.class.php index 69a987d..0ca2fc3 100644 --- a/core/modules/modECommerceNg.class.php +++ b/core/modules/modECommerceNg.class.php @@ -61,7 +61,7 @@ function __construct($db) $this->editor_url = 'http://www.open-dsi.fr'; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = '4.1.7'; + $this->version = '4.1.8'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) diff --git a/langs/en_US/ecommerce.lang b/langs/en_US/ecommerce.lang index c6eae8a..d4357df 100755 --- a/langs/en_US/ecommerce.lang +++ b/langs/en_US/ecommerce.lang @@ -297,6 +297,7 @@ ECommerceCreateInvoice = Create the bill ECommerceCreateSupplierInvoiceFromFee = Create the supplier bill from the charges ECommerceSendInvoiceByMail = Send the bill by email ECommerceCreateOrderDescription = Related actions when retrieving WooCommerce orders (Enter the payment methods associated with WooCommerce) +ECommerceCreateInvoiceIfAmount0 =Créer la facture même si le montant est égale à 0 ECommercePaymentGatewaysCorrespondence = Correspondence of the payment methods with the site ECommercePaymentGatewayLabel = Payment method on the site diff --git a/langs/fr_FR/ecommerce.lang b/langs/fr_FR/ecommerce.lang index 4aa7431..22ff199 100644 --- a/langs/fr_FR/ecommerce.lang +++ b/langs/fr_FR/ecommerce.lang @@ -289,6 +289,7 @@ ECommerceCreateInvoice ECommerceCreateSupplierInvoiceFromFee =Créer la facture fournisseur à partir des frais ECommerceSendInvoiceByMail =Envoyer la facture par mail ECommerceCreateOrderDescription =Actions associées lors de la récupération des commandes WooCommerce (Renseigner les modes de paiements associés à WooCommerce) +ECommerceCreateInvoiceIfAmount0 =Créer la facture même si le montant est égale à 0 ECommercePaymentGatewaysCorrespondence =Correspondance des modes de paiements avec le site ECommercePaymentGatewayLabel =Mode de paiement sur le site diff --git a/syncmanual.php b/syncmanual.php new file mode 100644 index 0000000..c4b5838 --- /dev/null +++ b/syncmanual.php @@ -0,0 +1,11 @@ +> ' . DOL_DATA_ROOT . '/manualsync.log & echo $!;'); + +$db->close();