From ffb3d810def9e2988a941f43bd58aabf9fc477a1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 31 Aug 2020 16:21:59 +0200 Subject: [PATCH 01/16] Complete fix for #14580 for v10 (backport of change of develop) --- htdocs/core/class/html.formmail.class.php | 2 +- htdocs/langs/en_US/other.lang | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 98c55c71232..347ce29df1c 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1208,7 +1208,7 @@ class FormMail extends Form elseif ($type_template=='fichinter_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendFichInter"); } elseif ($type_template=='thirdparty') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentThirdparty"); } elseif ($type_template=='user') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentUser"); } - elseif (!empty($type_template)) { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContent".ucfirst($type_template)); } + elseif (!empty($type_template)) { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentGeneric"); } $ret->label = 'default'; $ret->lang = $outputlangs->defaultlang; diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 5dd7422539a..83db92bd9e2 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -97,6 +97,7 @@ PredefinedMailContentThirdparty=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNA PredefinedMailContentContact=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentUser=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentLink=You can click on the link below to make your payment if it is not already done.\n\n%s\n\n +PredefinedMailContentGeneric=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ DemoDesc=Dolibarr is a compact ERP/CRM supporting several business modules. A demo showcasing all modules makes no sense as this scenario never occurs (several hundred available). So, several demo profiles are available. ChooseYourDemoProfil=Choose the demo profile that best suits your needs... ChooseYourDemoProfilMore=...or build your own profile
(manual module selection) From 134a47a93f2b97356627a6f332f43ee2c1f8229a Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Tue, 1 Sep 2020 15:36:35 +0200 Subject: [PATCH 02/16] FIX 10.0 - when the mime file name is different from the filesystem name, the attachment name should be the mime filename --- htdocs/core/class/CMailFile.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 853f2f98b05..7c12f4f9d5b 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -463,6 +463,9 @@ class CMailFile { //$this->message->attach(Swift_Attachment::fromPath($filename_list[$i],$mimetype_list[$i])); $attachment = Swift_Attachment::fromPath($filename_list[$i], $mimetype_list[$i]); + if (!empty($mimefilename_list[$i])) { + $attachment->setFilename($mimefilename_list[$i]); + } $this->message->attach($attachment); } } From c17bc8b3c8c89b410430b148a3a622959c8733bf Mon Sep 17 00:00:00 2001 From: John Botella Date: Thu, 3 Sep 2020 10:45:03 +0200 Subject: [PATCH 03/16] Fix missing param for hook --- htdocs/societe/class/societe.class.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 9becbd199cc..f10cead50fd 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2412,7 +2412,15 @@ class Societe extends CommonObject global $action; $hookmanager->initHooks(array('thirdpartydao')); - $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $parameters = array( + 'id'=>$this->id, + 'getnomurl'=>$result, + 'withpicto '=> $withpicto, + 'option'=> $option, + 'maxlen'=> $maxlen, + 'notooltip'=> $notooltip, + 'save_lastsearch_value'=> $save_lastsearch_value + ); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $result = $hookmanager->resPrint; else $result .= $hookmanager->resPrint; From bb92e64e433f068beb28a6c3758a726928e4e23d Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Thu, 3 Sep 2020 12:43:38 +0200 Subject: [PATCH 04/16] FIX: #14474 Error when deleting --- htdocs/comm/propal/class/propal.class.php | 10 ++++- htdocs/commande/class/commande.class.php | 7 ++- htdocs/compta/facture/class/facture.class.php | 8 +++- htdocs/core/class/commonobject.class.php | 45 ++++++++++++++++++- htdocs/expedition/class/expedition.class.php | 8 +++- htdocs/fichinter/class/fichinter.class.php | 8 +++- .../class/fournisseur.commande.class.php | 8 +++- .../fourn/class/fournisseur.facture.class.php | 8 +++- .../class/supplier_proposal.class.php | 8 +++- 9 files changed, 100 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index a2d1e934d35..325a0894302 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2019 Juanjo Menent + * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2010-2017 Philippe Grand * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2012 Cedric Salvador @@ -1063,7 +1063,7 @@ class Propal extends CommonObject $ret = $this->add_object_linked(); if (! $ret) dol_print_error($this->db); } - + /* * Insertion du detail des produits dans la base * Insert products detail in database @@ -2900,6 +2900,12 @@ class Propal extends CommonObject if (! $error) { + // On delete ecm_files database info + if (!$this->delete_ecmfiles()) { + $this->db->rollback(); + return 0; + } + // We remove directory $ref = dol_sanitizeFileName($this->ref); if ($conf->propal->multidir_output[$this->entity] && !empty($this->ref)) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 7d8e2680977..47ffec60592 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2016 Juanjo Menent + * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2011 Jean Heimburger * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2012 Cedric Salvador @@ -3327,6 +3327,11 @@ class Commande extends CommonOrder if (! $error) { + // On delete ecm_files database info + if (!$this->delete_ecmfiles()) { + $this->db->rollback(); + return 0; + } // Remove directory with files $comref = dol_sanitizeFileName($this->ref); if ($conf->commande->dir_output && !empty($this->ref)) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 12d60b067fa..21f68e1c329 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2007 Franky Van Liedekerke - * Copyright (C) 2010-2016 Juanjo Menent + * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2012 Cédric Salvador @@ -2019,6 +2019,12 @@ class Facture extends CommonInvoice $resql=$this->db->query($sql); if ($resql) { + // On delete ecm_files database info + if (!$this->delete_ecmfiles()) { + $this->db->rollback(); + return 0; + } + // On efface le repertoire de pdf provisoire $ref = dol_sanitizeFileName($this->ref); if ($conf->facture->dir_output && !empty($this->ref)) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 157fc718700..ccbcb9d6789 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2005-2013 Regis Houssin - * Copyright (C) 2010-2015 Juanjo Menent + * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2011-2019 Philippe Grand * Copyright (C) 2012-2015 Marcos García @@ -7734,4 +7734,47 @@ abstract class CommonObject } } } + + /** + * Delete related files of object in database + * + * @return bool + */ + public function delete_ecmfiles(){ + global $conf; + $this->db->begin(); + + switch ($this->element){ + case 'propal': + $element = 'propale'; + break; + case 'product': + $element = 'produit'; + break; + case 'order_supplier': + $element ='fournisseur/commande'; + break; + case 'invoice_supplier': + $element = 'fournisseur/facture/' . get_exdir($this->id, 2, 0, 1, $this, 'invoice_supplier'); + break; + case 'shipping': + $element = 'expedition/sending'; + break; + default: + $element = $this->element; + } + + $sql = "DELETE FROM ".MAIN_DB_PREFIX."ecm_files"; + $sql.= " WHERE filename LIKE '".$this->db->escape($this->ref)."%'"; + $sql.= " AND filepath = '".$element."/".$this->db->escape($this->ref)."' AND entity = ".$conf->entity; + + if (!$this->db->query($sql)) { + $this->error = $this->db->lasterror(); + $this->db->rollback(); + return false; + } + + $this->db->commit(); + return true; + } } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 8417ddb9bfb..b3584327f3c 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2006-2012 Laurent Destailleur - * Copyright (C) 2011-2017 Juanjo Menent + * Copyright (C) 2011-2020 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Cedric GROSS * Copyright (C) 2014-2015 Marcos García @@ -1310,6 +1310,12 @@ class Expedition extends CommonObject { $this->db->commit(); + // On delete ecm_files database info + if (!$this->delete_ecmfiles()) { + $this->db->rollback(); + return 0; + } + // We delete PDFs $ref = dol_sanitizeFileName($this->ref); if (! empty($conf->expedition->dir_output)) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 4ce2aa954b2..a9ec1ba588e 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2002-2003 Rodolphe Quiedeville * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2011-2013 Juanjo Menent + * Copyright (C) 2011-2020 Juanjo Menent * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Charlie Benke * Copyright (C) 2018 Nicolas ZABOURI @@ -1003,6 +1003,12 @@ class Fichinter extends CommonObject if (! $error) { + // On delete ecm_files database info + if (!$this->delete_ecmfiles()) { + $this->db->rollback(); + return 0; + } + // Remove directory with files $fichinterref = dol_sanitizeFileName($this->ref); if ($conf->ficheinter->dir_output) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index ef8d4b4d93f..6d73ee59f4d 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke - * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2010-2018 Philippe Grand * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2013 Florian Henry @@ -1979,6 +1979,12 @@ class CommandeFournisseur extends CommonOrder if (! $error) { + // On delete ecm_files database info + if (!$this->delete_ecmfiles()) { + $this->db->rollback(); + return 0; + } + // We remove directory $ref = dol_sanitizeFileName($this->ref); if ($conf->fournisseur->commande->dir_output) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index e20a3f9e7de..f1bd120f082 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005 Marc Barilley * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010-2017 Juanjo Menent + * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2013-2019 Philippe Grand * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2016 Marcos García @@ -1157,6 +1157,12 @@ class FactureFournisseur extends CommonInvoice if (! $error) { + // On delete ecm_files database info + if (!$this->delete_ecmfiles()) { + $this->db->rollback(); + return 0; + } + // We remove directory if ($conf->fournisseur->facture->dir_output) { diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 2e6c0f45397..4279925054d 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2015 Juanjo Menent + * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2010-2018 Philippe Grand * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2013 Florian Henry @@ -2065,6 +2065,12 @@ class SupplierProposal extends CommonObject if (! $error) { + // On delete ecm_files database info + if (!$this->delete_ecmfiles()) { + $this->db->rollback(); + return 0; + } + // We remove directory $ref = dol_sanitizeFileName($this->ref); if ($conf->supplier_proposal->dir_output && !empty($this->ref)) From 9bd5ed627f195f6cc927ce372d75d697ab0230de Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 4 Sep 2020 09:55:02 +0200 Subject: [PATCH 05/16] Fix travis issues --- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/commande/class/commande.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/core/class/commonobject.class.php | 3 ++- htdocs/expedition/class/expedition.class.php | 2 +- htdocs/fichinter/class/fichinter.class.php | 2 +- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- htdocs/supplier_proposal/class/supplier_proposal.class.php | 2 +- 9 files changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 325a0894302..3000fb8b2e3 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2901,7 +2901,7 @@ class Propal extends CommonObject if (! $error) { // On delete ecm_files database info - if (!$this->delete_ecmfiles()) { + if (!$this->deleteEcmFiles()) { $this->db->rollback(); return 0; } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 47ffec60592..d56329c93d9 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3328,7 +3328,7 @@ class Commande extends CommonOrder if (! $error) { // On delete ecm_files database info - if (!$this->delete_ecmfiles()) { + if (!$this->deleteEcmFiles()) { $this->db->rollback(); return 0; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 21f68e1c329..5ea423fa942 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2020,7 +2020,7 @@ class Facture extends CommonInvoice if ($resql) { // On delete ecm_files database info - if (!$this->delete_ecmfiles()) { + if (!$this->deleteEcmFiles()) { $this->db->rollback(); return 0; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ccbcb9d6789..103d704a546 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7740,7 +7740,8 @@ abstract class CommonObject * * @return bool */ - public function delete_ecmfiles(){ + public function deleteEcmFiles() + { global $conf; $this->db->begin(); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index b3584327f3c..fd764aca981 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1311,7 +1311,7 @@ class Expedition extends CommonObject $this->db->commit(); // On delete ecm_files database info - if (!$this->delete_ecmfiles()) { + if (!$this->deleteEcmFiles()) { $this->db->rollback(); return 0; } diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index a9ec1ba588e..8e7d23a8cd8 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1004,7 +1004,7 @@ class Fichinter extends CommonObject if (! $error) { // On delete ecm_files database info - if (!$this->delete_ecmfiles()) { + if (!$this->deleteEcmFiles()) { $this->db->rollback(); return 0; } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 6d73ee59f4d..663d72b26b1 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1980,7 +1980,7 @@ class CommandeFournisseur extends CommonOrder if (! $error) { // On delete ecm_files database info - if (!$this->delete_ecmfiles()) { + if (!$this->deleteEcmFiles()) { $this->db->rollback(); return 0; } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index f1bd120f082..b5339d913c5 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1158,7 +1158,7 @@ class FactureFournisseur extends CommonInvoice if (! $error) { // On delete ecm_files database info - if (!$this->delete_ecmfiles()) { + if (!$this->deleteEcmFiles()) { $this->db->rollback(); return 0; } diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 4279925054d..0014db887a1 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2066,7 +2066,7 @@ class SupplierProposal extends CommonObject if (! $error) { // On delete ecm_files database info - if (!$this->delete_ecmfiles()) { + if (!$this->deleteEcmFiles()) { $this->db->rollback(); return 0; } From 6bd6b285fd83330551dfdf0a5e450440e9739689 Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Tue, 8 Sep 2020 16:03:18 +0200 Subject: [PATCH 06/16] FIX : Static property called as non static --- htdocs/api/class/api.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 46431cdb510..89450c57366 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -32,7 +32,7 @@ class DolibarrApi /** * @var DoliDb $db Database object */ - protected static $db; + protected $db; /** * @var Restler $r Restler object From 5a0622c906c55950b89280207aa5a1ca80740c4c Mon Sep 17 00:00:00 2001 From: John Botella Date: Tue, 8 Sep 2020 16:14:14 +0200 Subject: [PATCH 07/16] FIX cron load lang --- htdocs/core/class/translate.class.php | 49 +++++++++++++++++++++++++++ htdocs/cron/class/cronjob.class.php | 6 +++- 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 22ae1787ee4..ad243db872e 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -388,6 +388,55 @@ class Translate return 1; } + + + /** + * re-load translation key-value for a particular file, into a memory array. + * If data for file already loaded, do nothing. + * All data in translation array are stored in UTF-8 format. + * tab_loaded is completed with $domain key. + * rule "we keep first entry found with we keep last entry found" so it is probably not what you want to do. + * + * Value for hash are: 1:Loaded from disk, 2:Not found, 3:Loaded from cache + * + * @param string $domain File name to load (.lang file). Must be "file" or "file@module" for module language files: + * If $domain is "file@module" instead of "file" then we look for module lang file + * in htdocs/custom/modules/mymodule/langs/code_CODE/file.lang + * then in htdocs/module/langs/code_CODE/file.lang instead of htdocs/langs/code_CODE/file.lang + * @param integer $alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US) + * @param int $stopafterdirection Stop when the DIRECTION tag is found (optimize speed) + * @param int $forcelangdir To force a different lang directory + * @param int $loadfromfileonly 1=Do not load overwritten translation from file or old conf. + * @return int <0 if KO, 0 if loading not required, >0 if OK + * @see loadLangs() + */ + public function reload($domain, $alt = 0, $stopafterdirection = 0, $forcelangdir = '', $loadfromfileonly = 0) + { + // Check parameters + if (empty($domain)) { + dol_print_error('', get_class($this) . "::Load ErrorWrongParameters"); + return -1; + } + + if ($this->defaultlang == 'none_NONE') return 0; // Special language code to not translate keys + + $newdomain = $domain; + + // Search if a module directory name is provided into lang file name + $regs = array(); + if (preg_match('/^([^@]+)@([^@]+)$/i', $domain, $regs)) { + $newdomain = $regs[1]; + } + + // Check cache and remove it + if (!empty($this->_tab_loaded[$newdomain])) // File already loaded for this domain + { + unset($this->_tab_loaded[$newdomain]); + } + + return $this->load($domain, $alt, $stopafterdirection, $forcelangdir, $loadfromfileonly); + } + /** * Load translation key-value from database into a memory array. * If data already loaded, do nothing. diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 6139f157f8a..61511cbfd3d 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1057,7 +1057,11 @@ class Cronjob extends CommonObject if (!$error) { $result = $langs->load($this->module_name); - $result = $langs->load($this->module_name.'@'.$this->module_name); // If this->module_name was an existing language file, this will make nothing + if($result<0){ + $result = $langs->reload($this->module_name.'@'.$this->module_name); + } + + // If this->module_name was an existing language file, this will make nothing if ($result < 0) // If technical error { dol_syslog(get_class($this)."::run_jobs Cannot load module lang file - ".$langs->error, LOG_ERR); From 87d9dfa0091c6ed6b837f9a52521f4b09603fdb8 Mon Sep 17 00:00:00 2001 From: John Botella Date: Tue, 8 Sep 2020 16:17:11 +0200 Subject: [PATCH 08/16] remove useless comm --- htdocs/cron/class/cronjob.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 61511cbfd3d..cb4ef824690 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1061,7 +1061,6 @@ class Cronjob extends CommonObject $result = $langs->reload($this->module_name.'@'.$this->module_name); } - // If this->module_name was an existing language file, this will make nothing if ($result < 0) // If technical error { dol_syslog(get_class($this)."::run_jobs Cannot load module lang file - ".$langs->error, LOG_ERR); From 59d5391c2a4f830ad623eec9740648ed2fa7c720 Mon Sep 17 00:00:00 2001 From: John Botella Date: Thu, 10 Sep 2020 10:41:16 +0200 Subject: [PATCH 09/16] Add force reload param to load method --- htdocs/core/class/translate.class.php | 73 +++++---------------------- htdocs/cron/class/cronjob.class.php | 4 +- 2 files changed, 14 insertions(+), 63 deletions(-) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index ad243db872e..06d8432f3e1 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -163,18 +163,19 @@ class Translate * * Value for hash are: 1:Loaded from disk, 2:Not found, 3:Loaded from cache * - * @param string $domain File name to load (.lang file). Must be "file" or "file@module" for module language files: - * If $domain is "file@module" instead of "file" then we look for module lang file - * in htdocs/custom/modules/mymodule/langs/code_CODE/file.lang - * then in htdocs/module/langs/code_CODE/file.lang instead of htdocs/langs/code_CODE/file.lang - * @param integer $alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US) - * @param int $stopafterdirection Stop when the DIRECTION tag is found (optimize speed) - * @param int $forcelangdir To force a different lang directory - * @param int $loadfromfileonly 1=Do not load overwritten translation from file or old conf. - * @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK + * @param string $domain File name to load (.lang file). Must be "file" or "file@module" for module language files: + * If $domain is "file@module" instead of "file" then we look for module lang file + * in htdocs/custom/modules/mymodule/langs/code_CODE/file.lang + * then in htdocs/module/langs/code_CODE/file.lang instead of htdocs/langs/code_CODE/file.lang + * @param integer $alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US) + * @param int $stopafterdirection Stop when the DIRECTION tag is found (optimize speed) + * @param int $forcelangdir To force a different lang directory + * @param int $loadfromfileonly 1=Do not load overwritten translation from file or old conf. + * @param int $forceloadifalreadynotfound Force attempt to reload lang file if it was previously not found + * @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK * @see loadLangs() */ - public function load($domain, $alt = 0, $stopafterdirection = 0, $forcelangdir = '', $loadfromfileonly = 0) + public function load($domain, $alt = 0, $stopafterdirection = 0, $forcelangdir = '', $loadfromfileonly = 0, $forceloadifalreadynotfound = 0) { global $conf,$db; @@ -205,7 +206,8 @@ class Translate } // Check cache - if (! empty($this->_tab_loaded[$newdomain])) // File already loaded for this domain + if (! empty($this->_tab_loaded[$newdomain]) + && ($this->_tab_loaded[$newdomain] != 2 || empty($forceloadifalreadynotfound)) ) // File already loaded and found and not forced for this domain { //dol_syslog("Translate::Load already loaded for newdomain=".$newdomain); return 0; @@ -388,55 +390,6 @@ class Translate return 1; } - - - /** - * re-load translation key-value for a particular file, into a memory array. - * If data for file already loaded, do nothing. - * All data in translation array are stored in UTF-8 format. - * tab_loaded is completed with $domain key. - * rule "we keep first entry found with we keep last entry found" so it is probably not what you want to do. - * - * Value for hash are: 1:Loaded from disk, 2:Not found, 3:Loaded from cache - * - * @param string $domain File name to load (.lang file). Must be "file" or "file@module" for module language files: - * If $domain is "file@module" instead of "file" then we look for module lang file - * in htdocs/custom/modules/mymodule/langs/code_CODE/file.lang - * then in htdocs/module/langs/code_CODE/file.lang instead of htdocs/langs/code_CODE/file.lang - * @param integer $alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US) - * @param int $stopafterdirection Stop when the DIRECTION tag is found (optimize speed) - * @param int $forcelangdir To force a different lang directory - * @param int $loadfromfileonly 1=Do not load overwritten translation from file or old conf. - * @return int <0 if KO, 0 if loading not required, >0 if OK - * @see loadLangs() - */ - public function reload($domain, $alt = 0, $stopafterdirection = 0, $forcelangdir = '', $loadfromfileonly = 0) - { - // Check parameters - if (empty($domain)) { - dol_print_error('', get_class($this) . "::Load ErrorWrongParameters"); - return -1; - } - - if ($this->defaultlang == 'none_NONE') return 0; // Special language code to not translate keys - - $newdomain = $domain; - - // Search if a module directory name is provided into lang file name - $regs = array(); - if (preg_match('/^([^@]+)@([^@]+)$/i', $domain, $regs)) { - $newdomain = $regs[1]; - } - - // Check cache and remove it - if (!empty($this->_tab_loaded[$newdomain])) // File already loaded for this domain - { - unset($this->_tab_loaded[$newdomain]); - } - - return $this->load($domain, $alt, $stopafterdirection, $forcelangdir, $loadfromfileonly); - } - /** * Load translation key-value from database into a memory array. * If data already loaded, do nothing. diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index cb4ef824690..f0cee68a01f 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1057,9 +1057,7 @@ class Cronjob extends CommonObject if (!$error) { $result = $langs->load($this->module_name); - if($result<0){ - $result = $langs->reload($this->module_name.'@'.$this->module_name); - } + $result = $langs->load($this->module_name.'@'.$this->module_name, 0, 0, '', 0, 1); if ($result < 0) // If technical error { From 7944c21fe549edb84ba2b8234b5bca538fb88f3f Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Thu, 10 Sep 2020 12:32:12 +0200 Subject: [PATCH 10/16] FIX : Wrong redirection --- htdocs/projet/tasks/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 36c06cd97f2..c7b651cb93d 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -381,7 +381,7 @@ if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && { $obj = $db->fetch_object($resql); $id = $obj->id; - header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$id.'&withprojet=1'); + header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$id.'&withproject=1'); exit; } From 358f8357f95f6d8c8f663f51ead8bc7e0edad6bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Sep 2020 18:25:38 +0200 Subject: [PATCH 11/16] FIX #14703 --- htdocs/compta/bank/class/account.class.php | 5 ++++- htdocs/compta/tva/card.php | 10 +++++----- htdocs/compta/tva/class/tva.class.php | 5 +++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 07e4abb0197..31d7749a430 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -476,7 +476,7 @@ class Account extends CommonObject * @param string $oper 1,2,3,4... (deprecated) or 'TYP','VIR','PRE','LIQ','VAD','CB','CHQ'... * @param string $label Descripton * @param float $amount Amount - * @param string $num_chq Numero cheque ou virement + * @param string $num_chq Numero cheque or transfer * @param int $categorie Category id (optionnal) * @param User $user User that create * @param string $emetteur Name of cheque writer @@ -572,15 +572,18 @@ class Account extends CommonObject if (!$result) { $this->error = $this->db->lasterror(); $this->db->rollback(); + return -3; } } $this->db->commit(); + return $accline->id; } else { $this->error = $this->db->lasterror(); $this->db->rollback(); + return -2; } } diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 658c9353a00..6d7c5935418 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -100,16 +100,16 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $object->label = GETPOST("label", 'alpha'); $object->note = GETPOST("note", 'none'); - if (empty($object->datev)) - { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateValue")), null, 'errors'); - $error++; - } if (empty($object->datep)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment")), null, 'errors'); $error++; } + if (empty($object->datev)) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PeriodEndDate")), null, 'errors'); + $error++; + } if (empty($object->type_payment) || $object->type_payment < 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentMode")), null, 'errors'); diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index c01408f3c9a..668a58c4f77 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -519,6 +519,7 @@ class Tva extends CommonObject $this->amount = price2num(trim($this->amount)); $this->label = trim($this->label); $this->note = trim($this->note); + $this->num_payment = trim($this->num_payment); $this->fk_bank = (int) $this->fk_bank; $this->fk_user_creat = (int) $this->fk_user_creat; $this->fk_user_modif = (int) $this->fk_user_modif; @@ -603,9 +604,9 @@ class Tva extends CommonObject if ($result <= 0) dol_print_error($this->db); if ($this->amount > 0) { - $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, -abs($this->amount), '', '', $user); + $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, -abs($this->amount), $this->num_payment, '', $user); } else { - $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, abs($this->amount), '', '', $user); + $bank_line_id = $acc->addline($this->datep, $this->type_payment, $this->label, abs($this->amount), $this->num_payment, '', $user); } // Update fk_bank into llx_tva. So we know vat line used to generate bank transaction From 05a2fc618622e0ec7e2ef4f8450ac2e8190a076d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Sep 2020 19:40:03 +0200 Subject: [PATCH 12/16] Fix rate for tunisia --- htdocs/install/mysql/data/llx_c_tva.sql | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index afd3a762ccc..8138711e8a0 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -295,13 +295,14 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (21 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2132, 213, '5','0','VAT 5%',1); -- TUNISIA (id country=10) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (101,10, '0','0','VAT Rate 0', 1, 1, '4', 0, 0); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (102,10, '12','0','VAT 12%',1, 1, '4', 0, 0); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (103,10, '18','0','VAT 18%',1, 1, '4', 0, 0); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (104,10, '7.5','0','VAT 6% Majoré à 25% (7.5%)',1, 1, '4', 0, 0); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (105,10, '15','0','VAT 12% Majoré à 25% (15%)',1, 1, '4', 0, 0); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (106,10, '22.5','0','VAT 18% Majoré à 25% (22.5%)',1, 1, '4', 0, 0); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (107,10, '6','0','VAT 6%', 1, 1, '4', 0, 0); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (101,10, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (102,10, '12','0','VAT 12%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (103,10, '18','0','VAT 18%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (104,10, '7.5','0','VAT 6% Majoré à 25% (7.5%)',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (105,10, '15','0','VAT 12% Majoré à 25% (15%)',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (106,10, '22.5','0','VAT 18% Majoré à 25% (22.5%)',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (107,10, '6','0','VAT 6%', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active,localtax1,localtax1_type,localtax2,localtax2_type) values (107,10,'18.18','0','VAT 18%+FODEC', 1, 1, '4', 0, 0); -- UKRAINE (id country=226) INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2261,226, '0','0','VAT Rate 0',1); From 04329c38b317d0ecf4a7829ca423206b0590dda0 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 11 Sep 2020 06:42:22 +0200 Subject: [PATCH 13/16] FIX - Accountancy balance Error SQL on entity --- htdocs/accountancy/bookkeeping/balance.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 456da29d954..ee51560818f 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -267,8 +267,12 @@ if ($action != 'export_csv') $sous_total_credit = 0; $displayed_account = ""; - $sql = "select t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance from ".MAIN_DB_PREFIX."accounting_bookkeeping as t where entity in ".$conf->entity; - $sql .= " AND t.doc_date < '".$db->idate($search_date_start)."' GROUP BY t.numero_compte"; + $sql = "SELECT t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance"; + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t"; + $sql .= " WHERE t.entity IN (".getEntity('accountancy').")"; + $sql .= " AND t.doc_date < '".$db->idate($search_date_start)."'"; + $sql .= " GROUP BY t.numero_compte"; + $resql = $db->query($sql); $nrows = $resql->num_rows; $opening_balances = array(); @@ -289,10 +293,10 @@ if ($action != 'export_csv') } print ''; - // Permet d'afficher le compte comptable + // Display the accounting account if (empty($displayed_account) || $root_account_description != $displayed_account) { - // Affiche un Sous-Total par compte comptable + // Display a sub-total per account if ($displayed_account != "") { print ''.$langs->trans("SubTotal").':'.price($sous_total_debit).''.price($sous_total_credit).''.price(price2num($sous_total_credit - $sous_total_debit)).''; print " \n"; @@ -321,7 +325,7 @@ if ($action != 'export_csv') print ''; print "\n"; - // Comptabilise le sous-total + // Records the sub-total $sous_total_debit += $line->debit; $sous_total_credit += $line->credit; } From 8fc9b78b4762e2cf4d957d9c6bd592de57a27b6e Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 11 Sep 2020 06:55:03 +0200 Subject: [PATCH 14/16] FIX Problems on FEC format --- .../accountancy/class/accountancyexport.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index bfb08746c16..b3a4430db36 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -689,8 +689,8 @@ class AccountancyExport foreach ($objectLines as $line) { $date_creation = dol_print_date($line->date_creation, '%Y%m%d'); - $date_doc = dol_print_date($line->doc_date, '%Y%m%d'); - $date_valid = dol_print_date($line->date_validated, '%Y%m%d'); + $date_document = dol_print_date($line->doc_date, '%Y%m%d'); + $date_validation = dol_print_date($line->date_validated, '%Y%m%d'); // FEC:JournalCode print $line->code_journal . $separator; @@ -702,25 +702,25 @@ class AccountancyExport print $line->piece_num . $separator; // FEC:EcritureDate - print $date_creation . $separator; + print $date_document . $separator; // FEC:CompteNum print $line->numero_compte . $separator; // FEC:CompteLib - print $line->label_compte . $separator; + print dol_string_unaccent($line->label_compte) . $separator; // FEC:CompAuxNum print $line->subledger_account . $separator; // FEC:CompAuxLib - print $line->subledger_label . $separator; + print dol_string_unaccent($line->subledger_label) . $separator; // FEC:PieceRef print $line->doc_ref . $separator; // FEC:PieceDate - print $date_doc . $separator; + print dol_string_unaccent($date_creation) . $separator; // FEC:EcritureLib print $line->label_operation . $separator; @@ -738,7 +738,7 @@ class AccountancyExport print $line->date_lettering . $separator; // FEC:ValidDate - print $date_valid . $separator; + print $date_validation . $separator; // FEC:Montantdevise print $line->multicurrency_amount . $separator; From e41afeacf470374ac4d70612566e9e07a34adf14 Mon Sep 17 00:00:00 2001 From: "DEMAREST Maxime (Indelog)" Date: Fri, 11 Sep 2020 15:34:11 +0200 Subject: [PATCH 15/16] Fix: short label of unit in Product::getLabelOfUnit --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 6a832eced1e..d1f36ca055d 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5392,7 +5392,7 @@ class Product extends CommonObject $resql = $this->db->query($sql); if ($resql && $this->db->num_rows($resql) > 0) { $res = $this->db->fetch_array($resql); - $label = ($label_type == 'short' ? $res[$label_type] : 'unit'.$res['code']); + $label = ($label_type == 'short_label' ? $res[$label_type] : 'unit'.$res['code']); $this->db->free($resql); return $label; } From d44952011fc2b16de44a17268eecf55466cfa499 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 12 Sep 2020 01:16:02 +0200 Subject: [PATCH 16/16] Update balance.php --- htdocs/accountancy/bookkeeping/balance.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index ee51560818f..a9a1f1d12cf 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -269,7 +269,7 @@ if ($action != 'export_csv') $sql = "SELECT t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t"; - $sql .= " WHERE t.entity IN (".getEntity('accountancy').")"; + $sql .= " WHERE t.entity = ".$conf->entity; // Never do sharing into accounting features $sql .= " AND t.doc_date < '".$db->idate($search_date_start)."'"; $sql .= " GROUP BY t.numero_compte";