From 2970dc21516460e5b3822dcfd01760cc6a19a90a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 15 Jan 2021 15:14:23 +0100 Subject: [PATCH 1/3] Fix warning --- htdocs/accountancy/customer/list.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index eb2743258d7..a45bccbf4e1 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -606,13 +606,16 @@ if ($result) { { print '
'; $s = ''.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; - $shelp = ''; + $shelp = ''; $ttype = 'help'; if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC"); elseif ($suggestedaccountingaccountfor == 'eecwithvat') $shelp = $langs->trans("SaleEECWithVAT"); - elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') $shelp = $langs->trans("SaleEECWithoutVATNumber"); + elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') { + $shelp = $langs->trans("SaleEECWithoutVATNumber"); + $ttype = 'warning'; + } elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport"); $s .= (empty($objp->code_sell_p) ? ''.$langs->trans("NotDefined").'' : length_accountg($objp->code_sell_p)); - print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); + print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1); } print ''; From 62a5c8b6dab52af7ddf3284fe68853f5689fe7ef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 15 Jan 2021 15:33:12 +0100 Subject: [PATCH 2/3] FIX Bad balance of begin commit --- htdocs/compta/facture/class/facture-rec.class.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 29e78f90af8..1a50fadcc9c 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -2072,6 +2072,8 @@ class FactureLigneRec extends CommonInvoiceLine $sql .= ", fk_contract_line=".($this->fk_contract_line ? $this->fk_contract_line : "null"); $sql .= " WHERE rowid = ".$this->id; + $this->db->begin(); + dol_syslog(get_class($this)."::updateline", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -2091,13 +2093,18 @@ class FactureLigneRec extends CommonInvoiceLine $result = $this->call_trigger('LINEBILLREC_UPDATE', $user); if ($result < 0) { - $this->db->rollback(); - return -2; + $error++; } // End call triggers } - $this->db->commit(); - return 1; + + if ($error) { + $this->db->rollback(); + return -2; + } else { + $this->db->commit(); + return 1; + } } else { $this->error = $this->db->lasterror(); $this->db->rollback(); From 0e636031ba38bdd96201d7d0268e3a50fd77feae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 15 Jan 2021 16:06:22 +0100 Subject: [PATCH 3/3] Add option MAIN_USE_VAT_OF_PRODUCT_FOR_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID --- htdocs/core/lib/functions.lib.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c5b58bace4b..b1c1cfb59f5 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5488,6 +5488,10 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, $isacompany = $thirdparty_buyer->isACompany(); if ($isacompany) { + if (!empty($conf->global->MAIN_USE_VAT_OF_PRODUCT_FOR_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID) && !isValidVATID($thirdparty_buyer)) { + //print 'VATRULE 6'; + return get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice); + } //print 'VATRULE 3'; return 0; } else {