From e3f2e1bd55fc5f69ecf0163d25d9a37bc73871e9 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Tue, 24 Jun 2025 16:02:07 +0200 Subject: [PATCH 01/43] fix: negative quantity in reception are allowed and must be managed on revert stock mvt (#34615) --- htdocs/reception/class/reception.class.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 8751583acb5..c93e900e6ea 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1977,10 +1977,6 @@ class Reception extends CommonObject $qty = $obj->qty; - - if ($qty <= 0) { - continue; - } dol_syslog(get_class($this)."::reopen reception movement index ".$i." ed.rowid=".$obj->rowid." edb.rowid=".$obj->edbrowid); //var_dump($this->lines[$i]); From 82abb0e8ed804b0d27258027960ef2dffda69ae3 Mon Sep 17 00:00:00 2001 From: atm-irvine <165771178+atm-irvine@users.noreply.github.com> Date: Wed, 25 Jun 2025 19:19:16 +0200 Subject: [PATCH 02/43] fix(bookkeeping): doc_ref too long (#34628) --- htdocs/accountancy/class/bookkeeping.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 501b689fd9a..e63334650fd 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -232,6 +232,7 @@ class BookKeeping extends CommonObject } if (isset($this->doc_ref)) { $this->doc_ref = trim($this->doc_ref); + $this->doc_ref = dol_trunc($this->doc_ref, 300); // We limit to 300 chars to avoid problems with too long ref in DB } if (isset($this->fk_doc)) { $this->fk_doc = (int) $this->fk_doc; From 57a256791fa239644e5b714fd8b46d51bad7a957 Mon Sep 17 00:00:00 2001 From: Marc <99648320+emheyarssi@users.noreply.github.com> Date: Wed, 25 Jun 2025 19:21:54 +0200 Subject: [PATCH 03/43] FIX #34618 (#34621) Update api_salaries.class.php Replace POST with PUT --- htdocs/salaries/class/api_salaries.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/salaries/class/api_salaries.class.php b/htdocs/salaries/class/api_salaries.class.php index 648d7d0efaf..549a1d2b4be 100644 --- a/htdocs/salaries/class/api_salaries.class.php +++ b/htdocs/salaries/class/api_salaries.class.php @@ -350,7 +350,7 @@ class Salaries extends DolibarrApi * @param array $request_data data * @return Object PaymentSalary object * - * @url POST {id}/payments + * @url PUT {id}/payments * * @throws RestException */ From 3280be45835f87f284e46f70ea926b4dbea59136 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Wed, 25 Jun 2025 19:26:58 +0200 Subject: [PATCH 04/43] fix: remove php warning (#34614) * fix php warning * fix php warning --------- Co-authored-by: Laurent Destailleur --- htdocs/reception/class/reception.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index c93e900e6ea..327f946caa1 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -573,7 +573,7 @@ class Reception extends CommonObject if ($qty == 0 || ($qty < 0 && !getDolGlobalInt('RECEPTION_ALLOW_NEGATIVE_QTY'))) { continue; } - dol_syslog(get_class($this)."::valid movement index ".$i." ed.rowid=".$obj->rowid." edb.rowid=".$obj->edbrowid); + dol_syslog(get_class($this)."::valid movement index ".$i." ed.rowid=".$obj->rowid); //var_dump($this->lines[$i]); $mouvS = new MouvementStock($this->db); @@ -1977,7 +1977,7 @@ class Reception extends CommonObject $qty = $obj->qty; - dol_syslog(get_class($this)."::reopen reception movement index ".$i." ed.rowid=".$obj->rowid." edb.rowid=".$obj->edbrowid); + dol_syslog(get_class($this)."::reopen reception movement index ".$i." ed.rowid=".$obj->rowid); //var_dump($this->lines[$i]); $mouvS = new MouvementStock($this->db); From dc852ba93f4e9b7825af69a403935d241a5876ce Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Wed, 25 Jun 2025 19:27:49 +0200 Subject: [PATCH 05/43] FIX: if filter is set on export for Duree type filed, then there is SQL error (#34616) --- htdocs/exports/class/export.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index c90d354bcc2..ca85fad2e21 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -354,7 +354,6 @@ class Export } break; case 'Duree': - break; case 'Numeric': // if there is a signe + if (strpos($ValueField, "+") > 0) { @@ -575,7 +574,6 @@ class Export $szMsg = $langs->trans('ExportDateFilter'); break; case 'Duree': - break; case 'Numeric': $szMsg = $langs->trans('ExportNumericFilter'); break; From 094dd3a9d1b680fe9b38e9198a1125fdab45bf8d Mon Sep 17 00:00:00 2001 From: Florian Mortgat <50440633+atm-florianm@users.noreply.github.com> Date: Fri, 27 Jun 2025 00:30:00 +0200 Subject: [PATCH 06/43] FIX 21.0: $height and $width can be ints, but also 'auto' (#34636) * FIX 21.0: $height and $width can be ints, but also 'auto' (which is commonly used), so check for this special value before typecasting * Update html.form.class.php * Update html.form.class.php --------- Co-authored-by: Laurent Destailleur --- htdocs/core/class/html.form.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f5c2527bd68..b519abf38f9 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5900,8 +5900,8 @@ class Form $formconfirm .= ' resizable: false, - height: \'' . ((int) $height) . '\', - width: \'' . ((int) $width) . '\', + height: \'' . dol_escape_js($height) . '\', + width: \'' . dol_escape_js($width) . '\', modal: true, closeOnEscape: false, buttons: { From f7c837743deb8425d281cb22535b8d24a9c7391d Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Fri, 27 Jun 2025 12:57:55 +0200 Subject: [PATCH 07/43] Fix excludeloan by default on project profit. --- htdocs/projet/element.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 5ecd7788178..ac35c80422b 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -602,7 +602,7 @@ $listofreferent = array( 'name' => "Loan", 'title' => "ListLoanAssociatedProject", 'class' => 'Loan', - 'margin' => 'add', + 'margin' => '', 'table' => 'loan', 'datefieldname' => 'datestart', 'disableamount' => 0, From f97e3b6bbe1fdd037750483b0d3f0405a73ab858 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Fri, 27 Jun 2025 13:05:56 +0200 Subject: [PATCH 08/43] Debug v22 --- htdocs/projet/element.php | 7 +++---- htdocs/projet/tasks/time.php | 5 +++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index ac35c80422b..7481f8ef4dd 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -310,14 +310,13 @@ if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') && !empty($object->usage_opp if ($code) { print $langs->trans("OppStatus".$code); } - print ''; // Opportunity percent - print ''.$langs->trans("OpportunityProbability").''; - if (!is_null($object->opp_percent) && strcmp($object->opp_percent, '')) { + print ' / '; + if (strcmp($object->opp_percent, '')) { print price($object->opp_percent, 0, $langs, 1, 0).' %'; } - print ''; + print ''; // Opportunity Amount print ''.$langs->trans("OpportunityAmount").''; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 8551a8ce457..8dba6c5297d 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1926,6 +1926,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields $selectedfields .= (is_array($arrayofmassactions) && count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); + print ''."\n"; print '
'; print '' . "\n"; @@ -2155,9 +2156,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print ''."\n"; print ''."\n"; print ''."\n"; - -$result = $object->fetchAll($sortorder, $sortfield, 0, 0, array('t.type' => $mode, 't.entity' => array($user->entity,$conf->entity))); +//"(t.type:=:".$mode.") AND (t.entity:in:("((int)$user->entity).", ".((int)$conf->entity)."))" +$result = $object->fetchAll($sortorder, $sortfield, 0, 0, "(t.type:=:'".$mode."') AND (t.entity:in:".((int) $user->entity).", ".((int) $conf->entity).")"); if (!is_array($result) && $result < 0) { setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index ea52c344559..18c40adb3de 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -548,7 +548,7 @@ class Documents extends DolibarrApi } elseif ($modulepart == 'knowledgemanagement') { require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php'; - if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read') && !DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { + if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { throw new RestException(403); } From b940f2eae343742e8940c5cd06dd7938e50a4ee9 Mon Sep 17 00:00:00 2001 From: Vincent Maury Date: Sat, 28 Jun 2025 17:34:12 +0200 Subject: [PATCH 24/43] Fix bug in product->get_sousproduits_arbo (#34561) * Update product.class.php depending on php version used, when var $this->sousprods not correctly declared it'snot filled * Update product.class.php sousprods prop now initialized when declared --------- Co-authored-by: Laurent Destailleur --- 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 7f8de67a96a..b7647340ee9 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -496,7 +496,7 @@ class Product extends CommonObject * * @var array */ - public $sousprods; + public $sousprods = array(); /** * Path of subproducts. Build from ->sousprods with get_arbo_each_prod() From e18c5b9d68c5de56b26bf56001ed49779a2f8ce3 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sat, 28 Jun 2025 17:40:01 +0200 Subject: [PATCH 25/43] Fix CI --- htdocs/compta/facture/class/facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0ef47565253..881823813f8 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5118,7 +5118,7 @@ class Facture extends CommonInvoice while ($obj = $this->db->fetch_object($resql)) { // Create a loopError that is reset at each loop, this counter is added to the global counter at the end of loop $loopError = 0; - + // Load event $res = $tmpinvoice->fetch($obj->id); if ($res > 0) { @@ -5213,7 +5213,7 @@ class Facture extends CommonInvoice $errorsMsg[] = 'Failed to fetch record invoice with ID = '.$obj->id; $loopError++; } - + $error += $loopError; } } else { From 4841a8d2ce90903c73999d4dff5db08e044a74ee Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Sat, 28 Jun 2025 17:58:07 +0200 Subject: [PATCH 26/43] FIX: pre-send mail mass action: keep __EMAIL__ substitution (#34522) * FIX: pre-send mail mass action: keep __EMAIL__ substitution * FIX: comment * test github workflows * test github workflow for 18 * test v18 pr workflow * FIX: massaction email tpl: keep preset --------- Co-authored-by: Laurent Destailleur --- htdocs/core/tpl/massactions_pre.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index c5c561c5ec5..497d7c6ea18 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -280,7 +280,7 @@ if ($massaction == 'presend') { // Make substitution in email content $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object); - $substitutionarray['__EMAIL__'] = $sendto; + $substitutionarray['__EMAIL__'] = empty($sendto) ? '__EMAIL__' : $sendto; $substitutionarray['__CHECK_READ__'] = ''; $substitutionarray['__PERSONALIZED__'] = ''; // deprecated $substitutionarray['__CONTACTCIVNAME__'] = ''; From bb0be51ad5dfad48ff28d4729b1c3a3055ca5556 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sat, 28 Jun 2025 18:24:26 +0200 Subject: [PATCH 27/43] Better demo link --- htdocs/langs/en_US/other.lang | 1 + htdocs/public/demo/index.php | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 1b435a28aca..ebe0f9af2f5 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -117,6 +117,7 @@ PredefinedMailContentLink=You can click on the link below to make your payment i PredefinedMailContentGeneric=__(Hello)__\n\n\n__(Sincerely)__\n\n__SENDEREMAIL_SIGNATURE__ PredefinedMailContentSendActionComm=Event reminder "__EVENT_LABEL__" on __EVENT_DATE__ at __EVENT_TIME__

This is an automatic message, please do not reply. 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. +DemoDesc2=This is a shared demo, you may prefere to test on your own dedicated instance, for this you go here. ChooseYourDemoProfil=Choose the demo profile that best suits your needs... ChooseYourDemoProfilMore=...or build your own profile
(manual module selection) DemoFundation=Manage members of a foundation diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 386ed8cf212..339207b7c6d 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -295,8 +295,10 @@ print ''; print ''; print '
'; -print '
'; -print '
'.$langs->trans("DemoDesc").'

'; +print '
'; +print '
'.$langs->trans("DemoDesc").'
'; +print $langs->trans("DemoDesc2", 'https://www.dolibarr.org/onlinedemo'); +print '

'; print '
'.$langs->trans("ChooseYourDemoProfil").'
'; print '
'; print '
'; From 202f152a13bfda4cc40d77593a8bf4aecce3c97c Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sat, 28 Jun 2025 18:36:00 +0200 Subject: [PATCH 28/43] Trans --- htdocs/langs/en_US/other.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index ebe0f9af2f5..f5a31dae0c2 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -117,7 +117,7 @@ PredefinedMailContentLink=You can click on the link below to make your payment i PredefinedMailContentGeneric=__(Hello)__\n\n\n__(Sincerely)__\n\n__SENDEREMAIL_SIGNATURE__ PredefinedMailContentSendActionComm=Event reminder "__EVENT_LABEL__" on __EVENT_DATE__ at __EVENT_TIME__

This is an automatic message, please do not reply. 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. -DemoDesc2=This is a shared demo, you may prefere to test on your own dedicated instance, for this you go here. +DemoDesc2=This is a shared demo, you may prefere to test on your own dedicated instance, for this you go here . ChooseYourDemoProfil=Choose the demo profile that best suits your needs... ChooseYourDemoProfilMore=...or build your own profile
(manual module selection) DemoFundation=Manage members of a foundation From 320364b364e1a70df4f17ed2c81922e5247da792 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sat, 28 Jun 2025 18:38:03 +0200 Subject: [PATCH 29/43] Trans --- htdocs/langs/en_US/other.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index f5a31dae0c2..65b6442bef7 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -117,7 +117,7 @@ PredefinedMailContentLink=You can click on the link below to make your payment i PredefinedMailContentGeneric=__(Hello)__\n\n\n__(Sincerely)__\n\n__SENDEREMAIL_SIGNATURE__ PredefinedMailContentSendActionComm=Event reminder "__EVENT_LABEL__" on __EVENT_DATE__ at __EVENT_TIME__

This is an automatic message, please do not reply. 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. -DemoDesc2=This is a shared demo, you may prefere to test on your own dedicated instance, for this you go here . +DemoDesc2=This is a shared demo, you may prefer to test on your own dedicated instance, to do so, go here . ChooseYourDemoProfil=Choose the demo profile that best suits your needs... ChooseYourDemoProfilMore=...or build your own profile
(manual module selection) DemoFundation=Manage members of a foundation From 2cbb6d9e1ebc45263d35200eb4cfd8b8f2d4da7e Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sat, 28 Jun 2025 18:38:59 +0200 Subject: [PATCH 30/43] Trans --- htdocs/langs/en_US/other.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 65b6442bef7..223a0e7e51f 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -117,7 +117,7 @@ PredefinedMailContentLink=You can click on the link below to make your payment i PredefinedMailContentGeneric=__(Hello)__\n\n\n__(Sincerely)__\n\n__SENDEREMAIL_SIGNATURE__ PredefinedMailContentSendActionComm=Event reminder "__EVENT_LABEL__" on __EVENT_DATE__ at __EVENT_TIME__

This is an automatic message, please do not reply. 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. -DemoDesc2=This is a shared demo, you may prefer to test on your own dedicated instance, to do so, go here . +DemoDesc2=This is a restricted shared demo, you may prefer to test on your own dedicated instance with a full admin access, to do so, go here . ChooseYourDemoProfil=Choose the demo profile that best suits your needs... ChooseYourDemoProfilMore=...or build your own profile
(manual module selection) DemoFundation=Manage members of a foundation From f5cb64afaab948e71977f2663190b1a433d49e6c Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sat, 28 Jun 2025 18:53:12 +0200 Subject: [PATCH 31/43] Fix CI --- htdocs/compta/facture/class/facture.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 29c08d9aed6..ba243ae062a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5602,7 +5602,7 @@ class Facture extends CommonInvoice // Sending Mail if ($cMailFile->sendfile()) { $nbMailSend++; - + // Add a line into event table require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; @@ -5634,11 +5634,11 @@ class Facture extends CommonInvoice //$actioncomm->extraparams = $extraparams; - $actioncomm->create($user); + $actioncomm->create($user); } else { $errormesg = $cMailFile->error.' : '.$to; $loopError++; - + // Add a line into event table require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; @@ -5670,7 +5670,7 @@ class Facture extends CommonInvoice //$actioncomm->extraparams = $extraparams; - $actioncomm->create($user); + $actioncomm->create($user); } $this->db->commit(); // We always commit From 1be67fee52fffd60a9707b5028ba14e604cc601e Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sat, 28 Jun 2025 18:54:33 +0200 Subject: [PATCH 32/43] Merge branch '18.0' of git@github.com:Dolibarr/dolibarr.git into 18.0 --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 7d588293bc5..70fa77f193c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5762,7 +5762,7 @@ class Facture extends CommonInvoice } else { $outputlangs = $langs; } - + // Select email template according to language of recipient $arraymessage = $formmail->getEMailTemplate($this->db, 'facture_send', $user, $outputlangs, (is_numeric($template) ? $template : 0), 1, (is_numeric($template) ? '' : $template)); if (is_numeric($arraymessage) && $arraymessage <= 0) { From c0161ccead8b1b9c0d618491432fd67308babe6a Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sat, 28 Jun 2025 18:54:53 +0200 Subject: [PATCH 33/43] Fix CI --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index ec06b74b8a2..4a10e111f71 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5647,7 +5647,7 @@ class Facture extends CommonInvoice $actioncomm->elementtype = 'invoice'; $actioncomm->fk_element = $tmpinvoice->id; - + //$actioncomm->extraparams = $extraparams; $actioncomm->create($user); From 0d00a27a1cd800f7815743abf7a975ea9e274082 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 29 Jun 2025 12:43:14 +0200 Subject: [PATCH 34/43] QUAL Use GetDolGlobalString (#34662) * Typo comment * Use getGlobalString --- htdocs/accountancy/class/bookkeeping.class.php | 2 +- htdocs/accountancy/journal/bankjournal.php | 4 ++-- htdocs/eventorganization/class/conferenceorbooth.class.php | 2 +- .../class/conferenceorboothattendee.class.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index b3c557845f8..1a334eff40c 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1193,7 +1193,7 @@ class BookKeeping extends CommonObject // Manage filter if (is_array($filter)) { // deprecated, use $filter = USF syntax - dol_syslog("You are using a deprecated use of fetchAll. filter parameter mus be an USF string now.", LOG_WARNING); + dol_syslog("You are using a deprecated use of fetchAll. filter parameter must be an USF string now.", LOG_WARNING); $sqlwhere = array(); if (count($filter) > 0) { foreach ($filter as $key => $value) { diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index fa3573ae087..663b9d04d3f 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Christophe Battarel * Copyright (C) 2013-2022 Open-DSI - * Copyright (C) 2013-2024 Alexandre Spangaro + * Copyright (C) 2013-2025 Alexandre Spangaro * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2017-2025 Frédéric France @@ -673,7 +673,7 @@ if (!$error && $action == 'writebookkeeping' && $user->hasRight('accounting', 'b $accountingaccountpayment->fetch(0, getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'), true); $accountingaccountexpensereport = new AccountingAccount($db); - $accountingaccountexpensereport->fetch(0, $conf->global->ACCOUNTING_ACCOUNT_EXPENSEREPORT, true); + $accountingaccountexpensereport->fetch(0, getDolGlobalString('ACCOUNTING_ACCOUNT_EXPENSEREPORT'), true); $accountingaccountsuspense = new AccountingAccount($db); $accountingaccountsuspense->fetch(0, getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE'), true); diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 1d0110bc8ac..09017e310b3 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -332,7 +332,7 @@ class ConferenceOrBooth extends ActionComm // Manage filter if (is_array($filter)) { // deprecated, use $filter = USF syntax - dol_syslog("You are using a deprecated use of fetchAll. filter parameter mus be an USF string now.", LOG_WARNING); + dol_syslog("You are using a deprecated use of fetchAll. filter parameter must be an USF string now.", LOG_WARNING); $sqlwhere = array(); if (count($filter) > 0) { foreach ($filter as $key => $value) { diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 9b25b5cd546..c13ff500b44 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -476,7 +476,7 @@ class ConferenceOrBoothAttendee extends CommonObject // Manage filter if (is_array($filter)) { // deprecated, use $filter = USF syntax - dol_syslog("You are using a deprecated use of fetchAll. filter parameter mus be an USF string now.", LOG_WARNING); + dol_syslog("You are using a deprecated use of fetchAll. filter parameter must be an USF string now.", LOG_WARNING); $sqlwhere = array(); if (count($filter) > 0) { foreach ($filter as $key => $value) { From 621b91097a834498298a7e1e8fbfaf8d178b63f7 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 29 Jun 2025 12:45:29 +0200 Subject: [PATCH 35/43] Translate term Incoterm (#34661) --- htdocs/core/class/commonincoterm.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonincoterm.class.php b/htdocs/core/class/commonincoterm.class.php index 35aad528570..97e10e0724e 100644 --- a/htdocs/core/class/commonincoterm.class.php +++ b/htdocs/core/class/commonincoterm.class.php @@ -91,6 +91,8 @@ trait CommonIncoterm */ public function getIncotermsForPDF() { + global $langs; + $sql = "SELECT code FROM ".$this->db->prefix()."c_incoterms WHERE rowid = ".(int) $this->fk_incoterms; $resql = $this->db->query($sql); if ($resql) { @@ -98,7 +100,7 @@ trait CommonIncoterm if ($num > 0) { $res = $this->db->fetch_object($resql); if ($res) { - return 'Incoterm : '.$res->code.' - '.$this->location_incoterms; + return $langs->trans("IncotermLabel").': '.$res->code.' - '.$this->location_incoterms; } else { return $res; } From 95027c5dfd09bc423595ce3f51f3726ef2056964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Benke?= <1179011+defrance@users.noreply.github.com> Date: Sun, 29 Jun 2025 12:45:52 +0200 Subject: [PATCH 36/43] php error on takepos admin (#34660) --- htdocs/takepos/receipt.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index b393e095dad..f60be35d0b3 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -79,7 +79,7 @@ if (!$user->hasRight('takepos', 'run')) { top_htmlhead('', '', 1); -if ((string) $place != '') { +if ((string) $place != '' && !empty($_SESSION["takeposterminal"])) { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture"; $sql .= " WHERE ref = '(PROV-POS".$db->escape($_SESSION["takeposterminal"]."-".$place).")'"; $sql .= " AND entity IN (".getEntity('invoice').")"; From 5253346fca00d795c718102a94fa778744bef55e Mon Sep 17 00:00:00 2001 From: atm-lena <52402938+atm-lena@users.noreply.github.com> Date: Mon, 30 Jun 2025 14:21:03 +0200 Subject: [PATCH 37/43] Delete entity filter in user fetch (#34348) * Delete entity filter in user fetch * Fetch without entity if fetch by id --------- Co-authored-by: atm-lena Co-authored-by: Laurent Destailleur --- htdocs/user/class/user.class.php | 33 +++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index ff614aeeea6..518f2418bc6 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -590,21 +590,25 @@ class User extends CommonObject $sql .= " LEFT JOIN ".$this->db->prefix()."c_departements as d ON u.fk_state = d.rowid"; $sql .= " LEFT JOIN ".$this->db->prefix()."establishment as s ON u.fk_establishment = s.rowid"; - if ($entity < 0) { - if ((!isModEnabled('multicompany') || !getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) && (!empty($user->entity))) { - $sql .= " WHERE u.entity IN (0, ".((int) $conf->entity).")"; - } else { - $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database - } + if ($id > 0) { + $sql .= " WHERE u.rowid = ".((int) $id); } else { - // The fetch was forced on an entity - if (isModEnabled('multicompany') && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) { - $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database + if ($entity < 0) { + if ((! isModEnabled('multicompany') || ! getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) && (! empty($user->entity))) { + $sql .= " WHERE u.entity IN (0, " . ((int) $conf->entity) . ")"; + } else { + $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database + } } else { - if ($entity != '' && $entity == 0) { // If $entity = 0 - $sql .= " WHERE u.entity = 0"; - } else { // if $entity is -1 or > 0 - $sql .= " WHERE u.entity IN (0, ".((int) ($entity > 0 ? $entity : $conf->entity)).")"; + // The fetch was forced on an entity + if (isModEnabled('multicompany') && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) { + $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database + } else { + if ($entity != '' && $entity == 0) { // If $entity = 0 + $sql .= " WHERE u.entity = 0"; + } else { // if $entity is -1 or > 0 + $sql .= " WHERE u.entity IN (0, " . ((int) ($entity > 0 ? $entity : $conf->entity)) . ")"; + } } } } @@ -622,9 +626,8 @@ class User extends CommonObject $sql .= ")"; } elseif ($fk_socpeople > 0) { $sql .= " AND u.fk_socpeople = ".((int) $fk_socpeople); - } else { - $sql .= " AND u.rowid = ".((int) $id); } + $sql .= " ORDER BY u.entity ASC"; // Avoid random result when there is 2 login in 2 different entities if ($sid) { From 1d37671c67f6bbc83e1e57b6d26fcb2d1e86844f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 30 Jun 2025 15:35:03 +0300 Subject: [PATCH 38/43] PHPStan > Update baseline (#34664) Co-authored-by: Dolibot --- dev/build/phpstan/phpstan-baseline.neon | 6 ------ 1 file changed, 6 deletions(-) diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index a079a1d0cc9..eb215259415 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -1854,12 +1854,6 @@ parameters: count: 2 path: ../../../htdocs/api/class/api_documents.class.php - - - message: '#^Negated boolean expression is always true\.$#' - identifier: booleanNot.alwaysTrue - count: 1 - path: ../../../htdocs/api/class/api_documents.class.php - - message: '#^Variable \$disablevirusscan in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable From 00ff8d490a85ae36d797b7da9579710fa33a5e9a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Jun 2025 15:14:09 +0200 Subject: [PATCH 39/43] Debug v22 --- .../societe/doc/doc_generic_odt.modules.php | 2 +- htdocs/societe/admin/societe.php | 26 ++----------------- 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 0f55fbda3d3..949c8abf977 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -95,7 +95,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc */ public function info($langs) { - global $conf, $langs; + global $langs; // Load traductions files required by page $langs->loadLangs(array("companies", "errors")); diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index d36aeb1222e..51bb8c4a407 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -206,21 +206,6 @@ if ($action == "setaccountancycodecustomerinvoicemandatory") { setEventMessages($langs->trans("Error"), null, 'errors'); } } -/* This code is not needed anymore as we can use the setprofid functions instead with key = 'VAT_INTRA' -//Activate Set vat id unique -if ($action == "setvatintraunique") { - $setvatintraunique = GETPOSTINT('value'); - $res = dolibarr_set_const($db, "SOCIETE_VAT_INTRA_UNIQUE", $setvatintraunique, 'yesno', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - } - if (!$error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} -*/ //Activate Set ref in list if ($action == "setaddrefinlist") { @@ -627,22 +612,15 @@ foreach ($dirsociete as $dirroot) { // Activate / Disable if (in_array($name, $def)) { - print "
"; } else { if (versioncompare($module->phpmin, versionphparray()) > 0) { print '"; } else { print ''; if (!$i) { From e5aae4d7e3ca0e4e87465534f49310e6594b479d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Jun 2025 17:39:38 +0200 Subject: [PATCH 43/43] Debug v22 --- htdocs/holiday/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index a3563b839e4..5ea2ef1dfe6 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -90,7 +90,7 @@ if (!$sortorder) { $sortorder = "DESC"; } if (!$sortfield) { - $sortfield = "cp.ref"; + $sortfield = "cp.date_debut"; } $search_all = trim(GETPOST('search_all', 'alphanohtml'));
'; if (($action == 'editline' || $action == 'splitline') && GETPOSTINT('lineid') == $task_time->rowid) { print ''; - print ''; + print ''; print '
'; - print ''; + print ''; } elseif ($user->hasRight('projet', 'time') || $user->hasRight('projet', 'all', 'creer')) { // Read project and enter time consumed on assigned tasks if (in_array($task_time->fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) { print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; From 358daa3ca08ce50012095724190838cfa609c3a2 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Fri, 27 Jun 2025 13:39:50 +0200 Subject: [PATCH 09/43] Clean doc and code --- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/modules/asset/mod_asset_standard.php | 4 ++-- htdocs/core/modules/hrm/mod_evaluation_standard.php | 4 ++-- .../core/modules/stocktransfer/mod_stocktransfer_standard.php | 4 ++-- htdocs/core/modules/workstation/mod_workstation_standard.php | 2 +- .../knowledgemanagement/mod_knowledgerecord_standard.php | 4 ++-- .../template/core/modules/mymodule/mod_myobject_standard.php | 4 ++-- .../core/modules/partnership/mod_partnership_standard.php | 4 ++-- .../recruitment/mod_recruitmentcandidature_standard.php | 4 ++-- .../recruitment/mod_recruitmentjobposition_standard.php | 4 ++-- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 082d6ffd390..954c7bf66e9 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -125,7 +125,7 @@ abstract class CommonObject /** * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity for internal and external users, 'field@table'=Test with link by field@table (example 'fk_soc@societe') + * 0=No test on entity, 1=Test with field entity in local table, 'field@table'=Test entity into the field@table (example 'fk_soc@societe') */ public $ismultientitymanaged; diff --git a/htdocs/core/modules/asset/mod_asset_standard.php b/htdocs/core/modules/asset/mod_asset_standard.php index 9e6f8e128ea..46f8bee6247 100644 --- a/htdocs/core/modules/asset/mod_asset_standard.php +++ b/htdocs/core/modules/asset/mod_asset_standard.php @@ -98,7 +98,7 @@ class mod_asset_standard extends ModeleNumRefAsset $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; if ($object->ismultientitymanaged == 1) { $sql .= " AND entity = ".$conf->entity; - } elseif ($object->ismultientitymanaged == 2) { + } elseif (!is_numeric($object->ismultientitymanaged)) { // TODO } @@ -137,7 +137,7 @@ class mod_asset_standard extends ModeleNumRefAsset $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; if ($object->ismultientitymanaged == 1) { $sql .= " AND entity = ".$conf->entity; - } elseif ($object->ismultientitymanaged == 2) { + } elseif (!is_numeric($object->ismultientitymanaged)) { // TODO } diff --git a/htdocs/core/modules/hrm/mod_evaluation_standard.php b/htdocs/core/modules/hrm/mod_evaluation_standard.php index 7cafb0fde53..fbb0ed6ea6f 100644 --- a/htdocs/core/modules/hrm/mod_evaluation_standard.php +++ b/htdocs/core/modules/hrm/mod_evaluation_standard.php @@ -98,7 +98,7 @@ class mod_evaluation_standard extends ModeleNumRefEvaluation $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; if ($object->ismultientitymanaged == 1) { $sql .= " AND entity = ".$conf->entity; - } elseif ($object->ismultientitymanaged == 2) { + } elseif (!is_numeric($object->ismultientitymanaged)) { // TODO } @@ -136,7 +136,7 @@ class mod_evaluation_standard extends ModeleNumRefEvaluation $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; if ($object->ismultientitymanaged == 1) { $sql .= " AND entity = ".$conf->entity; - } elseif ($object->ismultientitymanaged == 2) { + } elseif (!is_numeric($object->ismultientitymanaged)) { // TODO } diff --git a/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php b/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php index 46d77a2f7c7..79481481e5d 100644 --- a/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php +++ b/htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php @@ -99,7 +99,7 @@ class mod_stocktransfer_standard extends ModeleNumRefStockTransfer $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; if ($object->ismultientitymanaged == 1) { $sql .= " AND entity = ".$conf->entity; - } elseif ($object->ismultientitymanaged == 2) { + } elseif (!is_numeric($object->ismultientitymanaged)) { // TODO } @@ -137,7 +137,7 @@ class mod_stocktransfer_standard extends ModeleNumRefStockTransfer $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; if ($object->ismultientitymanaged == 1) { $sql .= " AND entity = ".$conf->entity; - } elseif ($object->ismultientitymanaged == 2) { + } elseif (!is_numeric($object->ismultientitymanaged)) { // TODO } diff --git a/htdocs/core/modules/workstation/mod_workstation_standard.php b/htdocs/core/modules/workstation/mod_workstation_standard.php index 7950cd488f2..77b8aeaea0c 100644 --- a/htdocs/core/modules/workstation/mod_workstation_standard.php +++ b/htdocs/core/modules/workstation/mod_workstation_standard.php @@ -97,7 +97,7 @@ class mod_workstation_standard extends ModeleNumRefWorkstation $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."-%'"; if ($object->ismultientitymanaged == 1) { $sql .= " AND entity = ".$conf->entity; - } elseif ($object->ismultientitymanaged == 2) { + } elseif (!is_numeric($object->ismultientitymanaged)) { // TODO } diff --git a/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php index d12865c47c0..f1d52de6edf 100644 --- a/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php +++ b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php @@ -96,7 +96,7 @@ class mod_knowledgerecord_standard extends ModeleNumRefKnowledgeRecord $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; if ($object->ismultientitymanaged == 1) { $sql .= " AND entity = ".$conf->entity; - } elseif ($object->ismultientitymanaged == 2) { + } elseif (!is_numeric($object->ismultientitymanaged)) { // TODO } @@ -134,7 +134,7 @@ class mod_knowledgerecord_standard extends ModeleNumRefKnowledgeRecord $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; if ($object->ismultientitymanaged == 1) { $sql .= " AND entity = ".$conf->entity; - } elseif ($object->ismultientitymanaged == 2) { + } elseif (!is_numeric($object->ismultientitymanaged)) { // TODO } diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php index 98d9b5fbffe..8a78ef0e429 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php @@ -97,7 +97,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; if ($object->ismultientitymanaged == 1) { $sql .= " AND entity = ".$conf->entity; - } elseif ($object->ismultientitymanaged == 2) { // @phan-suppress-current-line PhanPluginEmptyStatementIf + } elseif (!is_numeric($object->ismultientitymanaged)) { // @phan-suppress-current-line PhanPluginEmptyStatementIf // TODO } @@ -135,7 +135,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; if ($object->ismultientitymanaged == 1) { $sql .= " AND entity = ".$conf->entity; - } elseif ($object->ismultientitymanaged == 2) { + } elseif (!is_numeric($object->ismultientitymanaged)) { // TODO } diff --git a/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php b/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php index 90c84a2909f..61f3f6f57ba 100644 --- a/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php +++ b/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php @@ -97,7 +97,7 @@ class mod_partnership_standard extends ModeleNumRefPartnership $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; if ($object->ismultientitymanaged == 1) { $sql .= " AND entity = ".$conf->entity; - } elseif ($object->ismultientitymanaged == 2) { + } elseif (!is_numeric($object->ismultientitymanaged)) { // TODO } @@ -135,7 +135,7 @@ class mod_partnership_standard extends ModeleNumRefPartnership $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; if ($object->ismultientitymanaged == 1) { $sql .= " AND entity = ".$conf->entity; - } elseif ($object->ismultientitymanaged == 2) { + } elseif (!is_numeric($object->ismultientitymanaged)) { // TODO } diff --git a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_standard.php b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_standard.php index 8a30e86e0f2..ccdbf553812 100644 --- a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_standard.php +++ b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_standard.php @@ -97,7 +97,7 @@ class mod_recruitmentcandidature_standard extends ModeleNumRefRecruitmentCandida $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; if ($object->ismultientitymanaged == 1) { $sql .= " AND entity = ".$conf->entity; - } elseif ($object->ismultientitymanaged == 2) { + } elseif (!is_numeric($object->ismultientitymanaged)) { // TODO } @@ -135,7 +135,7 @@ class mod_recruitmentcandidature_standard extends ModeleNumRefRecruitmentCandida $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; if ($object->ismultientitymanaged == 1) { $sql .= " AND entity = ".$conf->entity; - } elseif ($object->ismultientitymanaged == 2) { + } elseif (!is_numeric($object->ismultientitymanaged)) { // TODO } diff --git a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_standard.php b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_standard.php index fdfe40d948c..7e532877547 100644 --- a/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_standard.php +++ b/htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_standard.php @@ -97,7 +97,7 @@ class mod_recruitmentjobposition_standard extends ModeleNumRefRecruitmentJobPosi $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; if ($object->ismultientitymanaged == 1) { $sql .= " AND entity = ".$conf->entity; - } elseif ($object->ismultientitymanaged == 2) { + } elseif (!is_numeric($object->ismultientitymanaged)) { // TODO } @@ -135,7 +135,7 @@ class mod_recruitmentjobposition_standard extends ModeleNumRefRecruitmentJobPosi $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; if ($object->ismultientitymanaged == 1) { $sql .= " AND entity = ".$conf->entity; - } elseif ($object->ismultientitymanaged == 2) { + } elseif (!is_numeric($object->ismultientitymanaged)) { // TODO } From 1a5d71319e8db89248e6311411d107c9e2ea236f Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Fri, 27 Jun 2025 16:43:16 +0200 Subject: [PATCH 10/43] Fix check on entity is a different security check than check on external user so code must not be nested. --- htdocs/core/class/html.form.class.php | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6020e2ef491..c3de93acbc7 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -9127,6 +9127,8 @@ class Form $sql .= $hookmanager->resPrint; } else { $sql .= " WHERE 1=1"; + + // If table need a multientity restriction if (!empty($objecttmp->ismultientitymanaged)) { if ($objecttmp->ismultientitymanaged == 1) { $sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")"; @@ -9142,23 +9144,14 @@ class Form $sql .= " WHERE sc.fk_soc = t.fk_soc AND sc.fk_user = ".((int) $user->id).")"; } } - // If user is external user, we also make a test on llx_societe_commerciaux - if (!empty($user->socid)) { - if ($objecttmp->ismultientitymanaged == 1) { - if ($objecttmp->element == 'societe') { - $sql .= " AND t.rowid = " . ((int) $user->socid); - } else { - $sql .= " AND t.fk_soc = " . ((int) $user->socid); - } - } - if (!is_numeric($objecttmp->ismultientitymanaged)) { - $sql .= " AND t." . $this->db->sanitize($tmparray[0])." = ".((int) $user->socid); - } - // If the parent table is llx_societe and user is an external user, - // then we must also check that user has permissions - if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { - $sql .= " AND t.fk_soc = ".((int) $user->socid); - } + } + + // If user is external user, we must also make a test on llx_societe_commerciaux + if (!empty($user->socid)) { + if ($objecttmp->element == 'societe') { + $sql .= " AND t.rowid = " . ((int) $user->socid); + } elseif (!empty($objecttmp->fields['fk_soc']) || !empty($objecttmp->fields['t.fk_soc']) || property_exists($objecttmp, 'fk_soc') || property_exists($objecttmp, 'socid')) { + $sql .= " AND t.fk_soc = " . ((int) $user->socid); } } From da5c0749e9700301a23d15d04d5af6b0681ce3b6 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Fri, 27 Jun 2025 16:53:18 +0200 Subject: [PATCH 11/43] Fix warning --- htdocs/compta/bank/various_payment/list.php | 9 +++++---- htdocs/contrat/list.php | 8 ++++---- htdocs/core/lib/company.lib.php | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index a55d6cb4c89..21c3266c9cb 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -234,6 +234,7 @@ if (empty($reshook)) { } } + /* * View */ @@ -403,16 +404,16 @@ if ($search_label) { $param .= '&search_label='.urlencode($search_label); } if ($search_datep_start) { - $param .= '&search_datep_start='.urlencode($search_datep_start); + $param .= '&search_datep_start='.urlencode((string) $search_datep_start); } if ($search_datep_end) { - $param .= '&search_datep_end='.urlencode($search_datep_end); + $param .= '&search_datep_end='.urlencode((string) $search_datep_end); } if ($search_datev_start) { - $param .= '&search_datev_start='.urlencode($search_datev_start); + $param .= '&search_datev_start='.urlencode((string) $search_datev_start); } if ($search_datev_end) { - $param .= '&search_datev_end='.urlencode($search_datev_end); + $param .= '&search_datev_end='.urlencode((string) $search_datev_end); } if ($search_type_id > 0) { $param .= '&search_type_id='.urlencode((string) ($search_type_id)); diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index ab76050ada0..c7a26f17e28 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -664,7 +664,7 @@ if ($search_date_creation_startday) { $param .= '&search_date_creation_startday='.urlencode((string) ($search_date_creation_startday)); } if ($search_date_creation_start) { - $param .= '&search_date_creation_start='.urlencode($search_date_creation_start); + $param .= '&search_date_creation_start='.urlencode((string) $search_date_creation_start); } if ($search_date_creation_endmonth) { $param .= '&search_date_creation_endmonth='.urlencode((string) ($search_date_creation_endmonth)); @@ -676,7 +676,7 @@ if ($search_date_creation_endday) { $param .= '&search_date_creation_endday='.urlencode((string) ($search_date_creation_endday)); } if ($search_date_creation_end) { - $param .= '&search_date_creation_end='.urlencode($search_date_creation_end); + $param .= '&search_date_creation_end='.urlencode((string) $search_date_creation_end); } if ($search_date_modif_startmonth) { $param .= '&search_date_modif_startmonth='.urlencode((string) ($search_date_modif_startmonth)); @@ -688,7 +688,7 @@ if ($search_date_modif_startday) { $param .= '&search_date_modif_startday='.urlencode((string) ($search_date_modif_startday)); } if ($search_date_modif_start) { - $param .= '&search_date_modif_start='.urlencode($search_date_modif_start); + $param .= '&search_date_modif_start='.urlencode((string) $search_date_modif_start); } if ($search_date_modif_endmonth) { $param .= '&search_date_modif_endmonth='.urlencode((string) ($search_date_modif_endmonth)); @@ -700,7 +700,7 @@ if ($search_date_modif_endday) { $param .= '&search_date_modif_endday='.urlencode((string) ($search_date_modif_endday)); } if ($search_date_modif_end) { - $param .= '&search_date_modif_end=' . urlencode($search_date_modif_end); + $param .= '&search_date_modif_end=' . urlencode((string) $search_date_modif_end); } if ($search_date_startday > 0) { $param .= '&search_date_startday='.urlencode((string) ($search_date_startday)); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 761ceb975ea..cb6b48a3178 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1399,10 +1399,10 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl $param .= '&search_note_private='.urlencode($search_note_private); } if ($search_birthday_dtstart != '') { - $param .= '&search_birthday_dtstart='.urlencode($search_birthday_dtstart); + $param .= '&search_birthday_dtstart='.urlencode((string) $search_birthday_dtstart); } if ($search_birthday_dtend != '') { - $param .= '&search_birthday_dtend='.urlencode($search_birthday_dtend); + $param .= '&search_birthday_dtend='.urlencode((string) $search_birthday_dtend); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); From 48c16c74388dcc6449b5328bac8fdf874724fe33 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Fri, 27 Jun 2025 21:07:58 +0200 Subject: [PATCH 12/43] Fix CI --- htdocs/projet/list.php | 12 ++++++------ htdocs/projet/tasks.php | 8 ++++---- htdocs/societe/list.php | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index ee74bb01580..b72cee2eb8d 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -965,7 +965,7 @@ if ($search_date_start_startday) { $param .= '&search_date_start_startday='.urlencode((string) ($search_date_start_startday)); } if ($search_date_start_start) { - $param .= '&search_date_start_start='.urlencode($search_date_start_start); + $param .= '&search_date_start_start='.urlencode((string) $search_date_start_start); } if ($search_date_start_endmonth) { $param .= '&search_date_start_endmonth='.urlencode((string) ($search_date_start_endmonth)); @@ -989,7 +989,7 @@ if ($search_date_end_startday) { $param .= '&search_date_end_startday='.urlencode((string) ($search_date_end_startday)); } if ($search_date_end_start) { - $param .= '&search_date_end_start='.urlencode($search_date_end_start); + $param .= '&search_date_end_start='.urlencode((string) $search_date_end_start); } if ($search_date_end_endmonth) { $param .= '&search_date_end_endmonth='.urlencode((string) ($search_date_end_endmonth)); @@ -1001,7 +1001,7 @@ if ($search_date_end_endday) { $param .= '&search_date_end_endday='.urlencode((string) ($search_date_end_endday)); } if ($search_date_end_end) { - $param .= '&search_date_end_end=' . urlencode($search_date_end_end); + $param .= '&search_date_end_end=' . urlencode((string) $search_date_end_end); } if ($search_date_creation_startmonth) { $param .= '&search_date_creation_startmonth='.urlencode((string) ($search_date_creation_startmonth)); @@ -1013,7 +1013,7 @@ if ($search_date_creation_startday) { $param .= '&search_date_creation_startday='.urlencode((string) ($search_date_creation_startday)); } if ($search_date_creation_start) { - $param .= '&search_date_creation_start='.urlencode($search_date_creation_start); + $param .= '&search_date_creation_start='.urlencode((string) $search_date_creation_start); } if ($search_date_creation_endmonth) { $param .= '&search_date_creation_endmonth='.urlencode((string) ($search_date_creation_endmonth)); @@ -1037,7 +1037,7 @@ if ($search_date_modif_startday) { $param .= '&search_date_modif_startday='.urlencode((string) ($search_date_modif_startday)); } if ($search_date_modif_start) { - $param .= '&search_date_modif_start='.urlencode($search_date_modif_start); + $param .= '&search_date_modif_start='.urlencode((string) $search_date_modif_start); } if ($search_date_modif_endmonth) { $param .= '&search_date_modif_endmonth='.urlencode((string) ($search_date_modif_endmonth)); @@ -1049,7 +1049,7 @@ if ($search_date_modif_endday) { $param .= '&search_date_modif_endday='.urlencode((string) ($search_date_modif_endday)); } if ($search_date_modif_end) { - $param .= '&search_date_modif_end=' . urlencode($search_date_modif_end); + $param .= '&search_date_modif_end=' . urlencode((string) $search_date_modif_end); } if (!empty($search_category_array)) { foreach ($search_category_array as $tmpval) { diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 0e63277fa6c..652fbbdeb5a 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -527,7 +527,7 @@ if ($id > 0 || !empty($ref)) { $param .= '&search_date_start_startday='.urlencode((string) ($search_date_start_startday)); } if ($search_date_start_start) { - $param .= '&search_date_start_start='.urlencode($search_date_start_start); + $param .= '&search_date_start_start='.urlencode((string) $search_date_start_start); } if ($search_date_start_endmonth) { $param .= '&search_date_start_endmonth='.urlencode((string) ($search_date_start_endmonth)); @@ -539,7 +539,7 @@ if ($id > 0 || !empty($ref)) { $param .= '&search_date_start_endday='.urlencode((string) ($search_date_start_endday)); } if ($search_date_start_end) { - $param .= '&search_date_start_end='.urlencode($search_date_start_end); + $param .= '&search_date_start_end='.urlencode((string) $search_date_start_end); } if ($search_date_end_startmonth) { $param .= '&search_date_end_startmonth='.urlencode((string) ($search_date_end_startmonth)); @@ -551,7 +551,7 @@ if ($id > 0 || !empty($ref)) { $param .= '&search_date_end_startday='.urlencode((string) ($search_date_end_startday)); } if ($search_date_end_start) { - $param .= '&search_date_end_start='.urlencode($search_date_end_start); + $param .= '&search_date_end_start='.urlencode((string) $search_date_end_start); } if ($search_date_end_endmonth) { $param .= '&search_date_end_endmonth='.urlencode((string) ($search_date_end_endmonth)); @@ -563,7 +563,7 @@ if ($id > 0 || !empty($ref)) { $param .= '&search_date_end_endday='.urlencode((string) ($search_date_end_endday)); } if ($search_date_end_end) { - $param .= '&search_date_end_end=' . urlencode($search_date_end_end); + $param .= '&search_date_end_end=' . urlencode((string) $search_date_end_end); } if ($search_planedworkload) { $param .= '&search_planedworkload='.urlencode($search_planedworkload); diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index f7192cf0f55..70f1bbcbeb1 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1117,7 +1117,7 @@ if ($search_date_creation_startday) { $param .= '&search_date_creation_startday='.urlencode((string) ($search_date_creation_startday)); } if ($search_date_creation_start) { - $param .= '&search_date_creation_start='.urlencode($search_date_creation_start); + $param .= '&search_date_creation_start='.urlencode((string) $search_date_creation_start); } if ($search_date_creation_endmonth) { $param .= '&search_date_creation_endmonth='.urlencode((string) ($search_date_creation_endmonth)); @@ -1129,7 +1129,7 @@ if ($search_date_creation_endday) { $param .= '&search_date_creation_endday='.urlencode((string) ($search_date_creation_endday)); } if ($search_date_creation_end) { - $param .= '&search_date_creation_end='.urlencode($search_date_creation_end); + $param .= '&search_date_creation_end='.urlencode((string) $search_date_creation_end); } if ($search_date_modif_startmonth) { $param .= '&search_date_modif_startmonth='.urlencode((string) ($search_date_modif_startmonth)); @@ -1141,7 +1141,7 @@ if ($search_date_modif_startday) { $param .= '&search_date_modif_startday='.urlencode((string) ($search_date_modif_startday)); } if ($search_date_modif_start) { - $param .= '&search_date_modif_start='.urlencode($search_date_modif_start); + $param .= '&search_date_modif_start='.urlencode((string) $search_date_modif_start); } if ($search_date_modif_endmonth) { $param .= '&search_date_modif_endmonth='.urlencode((string) ($search_date_modif_endmonth)); @@ -1153,7 +1153,7 @@ if ($search_date_modif_endday) { $param .= '&search_date_modif_endday='.urlencode((string) ($search_date_modif_endday)); } if ($search_date_modif_end) { - $param .= '&search_date_modif_end=' . urlencode($search_date_modif_end); + $param .= '&search_date_modif_end=' . urlencode((string) $search_date_modif_end); } // Add $param from extra fields From c6a5bf3836212377a7988906d377bfd14109deae Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Fri, 27 Jun 2025 21:30:37 +0200 Subject: [PATCH 13/43] Fix CI --- htdocs/core/class/html.form.class.php | 2 +- .../modulebuilder/template/class/actions_mymodule.class.php | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c3de93acbc7..54c3de7f579 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -9105,7 +9105,7 @@ class Form $sql .= " LEFT JOIN " . $this->db->prefix() . "product as p ON p.rowid = t.fk_product"; } if (!empty($objecttmp->ismultientitymanaged)) { - if ($objecttmp->ismultientitymanaged == 1) { + if ($objecttmp->ismultientitymanaged == 1) { // @phan-suppress-current-line PhanPluginEmptyStatementIf // No need to join/link another table } if (!is_numeric($objecttmp->ismultientitymanaged)) { diff --git a/htdocs/modulebuilder/template/class/actions_mymodule.class.php b/htdocs/modulebuilder/template/class/actions_mymodule.class.php index 9d1a2598878..f885a0c48ae 100644 --- a/htdocs/modulebuilder/template/class/actions_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/actions_mymodule.class.php @@ -102,12 +102,9 @@ class ActionsMyModule extends CommonHookActions */ public function doActions($parameters, &$object, &$action, $hookmanager) { - global $conf, $user, $langs; - $error = 0; // Error counter /* print_r($parameters); print_r($object); echo "action: " . $action; */ - // @phan-suppress-next-line PhanPluginEmptyStatementIf if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { // do something only for the context 'somecontext1' or 'somecontext2' // Do what you want here... // You can for example load and use call global vars like $fieldstosearchall to overwrite them, or update the database depending on $action and GETPOST values. @@ -216,7 +213,8 @@ class ActionsMyModule extends CommonHookActions /* print_r($parameters); print_r($object); echo "action: " . $action; */ // @phan-suppress-next-line PhanPluginEmptyStatementIf - if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { // do something only for the context 'somecontext1' or 'somecontext2' + if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { + // do something only for the context 'somecontext1' or 'somecontext2' } return $ret; From 75c34567435deb124320cbf404c36d5f3d7c0553 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sat, 28 Jun 2025 13:14:11 +0200 Subject: [PATCH 14/43] FIX #34654 --- htdocs/core/actions_builddoc.inc.php | 16 ++++------------ htdocs/core/actions_massactions.inc.php | 25 +++++++++---------------- 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/htdocs/core/actions_builddoc.inc.php b/htdocs/core/actions_builddoc.inc.php index 0a5f63de9aa..04b5a627d56 100644 --- a/htdocs/core/actions_builddoc.inc.php +++ b/htdocs/core/actions_builddoc.inc.php @@ -81,18 +81,10 @@ if ($action == 'builddoc' && ($permissiontoadd || !empty($usercangeneretedoc))) } // To be sure vars is defined - if (empty($hidedetails)) { - $hidedetails = 0; - } - if (empty($hidedesc)) { - $hidedesc = 0; - } - if (empty($hideref)) { - $hideref = 0; - } - if (empty($moreparams)) { - $moreparams = null; - } + $hidedetails = isset($hidedetails) ? $hidedetails : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS') ? 1 : 0); + $hidedesc = isset($hidedesc) ? $hidedesc : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DESC') ? 1 : 0); + $hideref = isset($hideref) ? $hideref : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_REF') ? 1 : 0); + $moreparams = isset($moreparams) ? $moreparams : null; $result = $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); if ($result <= 0) { diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index a7e03343b91..9c71e3414c8 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -32,6 +32,7 @@ // $permissiontoread, $permissiontoadd, $permissiontodelete, $permissiontoclose may be defined // $uploaddir may be defined (example to $conf->project->dir_output."/";) +// $hidedetails, $hidedesc, $hideref and $moreparams may have been set or not. // $toselect may be defined // $diroutputmassaction may be defined @@ -1010,10 +1011,10 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) { $model = $objecttmp->model_pdf; $ret = $objecttmp->fetch($objecttmp->id); // Reload to get new records // To be sure vars is defined - $hidedetails = !empty($hidedetails) ? $hidedetails : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0); - $hidedesc = !empty($hidedesc) ? $hidedesc : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0); - $hideref = !empty($hideref) ? $hideref : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0); - $moreparams = !empty($moreparams) ? $moreparams : null; + $hidedetails = isset($hidedetails) ? $hidedetails : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS') ? 1 : 0); + $hidedesc = isset($hidedesc) ? $hidedesc : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DESC') ? 1 : 0); + $hideref = isset($hideref) ? $hideref : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_REF') ? 1 : 0); + $moreparams = isset($moreparams) ? $moreparams : null; $result = $objecttmp->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result < 0) { @@ -1169,18 +1170,10 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) { } // To be sure vars is defined - if (empty($hidedetails)) { - $hidedetails = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0); - } - if (empty($hidedesc)) { - $hidedesc = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0); - } - if (empty($hideref)) { - $hideref = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0); - } - if (empty($moreparams)) { - $moreparams = null; - } + $hidedetails = isset($hidedetails) ? $hidedetails : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS') ? 1 : 0); + $hidedesc = isset($hidedesc) ? $hidedesc : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DESC') ? 1 : 0); + $hideref = isset($hideref) ? $hideref : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_REF') ? 1 : 0); + $moreparams = isset($moreparams) ? $moreparams : null; $result = $objecttmp->generateDocument($objecttmp->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); From 910279ea3773f2fa662d4c6ca9f32accb9a6f7b1 Mon Sep 17 00:00:00 2001 From: dev2a Date: Sat, 28 Jun 2025 13:20:01 +0200 Subject: [PATCH 15/43] Fix Check delete task which return 0 on error (#34655) --- htdocs/projet/class/api_tasks.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php index 85710483550..508d3eff782 100644 --- a/htdocs/projet/class/api_tasks.class.php +++ b/htdocs/projet/class/api_tasks.class.php @@ -500,6 +500,7 @@ class Tasks extends DolibarrApi * @return array * @phan-return array{success:array{code:int,message:string}} * @phpstan-return array{success:array{code:int,message:string}} + * @throws RestException */ public function delete($id) { @@ -515,7 +516,7 @@ class Tasks extends DolibarrApi throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - if (!$this->task->delete(DolibarrApiAccess::$user)) { + if ($this->task->delete(DolibarrApiAccess::$user) <= 0) { throw new RestException(500, 'Error when delete task : '.$this->task->error); } From 4721a84cec719ce05fc023f986c55f375f8d12e3 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sat, 28 Jun 2025 13:30:32 +0200 Subject: [PATCH 16/43] Fix warnings --- htdocs/core/actions_builddoc.inc.php | 10 ++++++++-- htdocs/core/actions_massactions.inc.php | 7 ++++++- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/htdocs/core/actions_builddoc.inc.php b/htdocs/core/actions_builddoc.inc.php index 3a6a8aa0473..8a2e89fbef0 100644 --- a/htdocs/core/actions_builddoc.inc.php +++ b/htdocs/core/actions_builddoc.inc.php @@ -29,20 +29,26 @@ // $permissiontoadd must be defined // $upload_dir must be defined (example $conf->project->dir_output . "/";) // $hidedetails, $hidedesc, $hideref and $moreparams may have been set or not. + /** * @var Conf $conf * @var Translate $langs * @var User $user + * @var CommonObject $object + * * @var string $action * @var int $id - * @var CommonObject $object - * @var ?int $permissiontocreate + * @var ?int $permissioncreate + * @var ?int $usercangeneratedoc * @var int $permissiontoadd * @var string $upload_dir + * * @var ?int $hidedetails * @var ?int $hidedesc * @var ?int $hideref + * @var ?array $moreparams */ + if (!empty($permissioncreate) && empty($permissiontoadd)) { $permissiontoadd = $permissioncreate; // For backward compatibility } diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index ff8b38693f6..b1e3828e492 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -66,6 +66,11 @@ * @var string $month * @var string $year * @var int $error + * + * @var ?int $hidedetails + * @var ?int $hidedesc + * @var ?int $hideref + * @var ?array $moreparams */ ' @phan-var-force ?string $permissiontoread @@ -1090,7 +1095,7 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) { $hideref = isset($hideref) ? $hideref : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_REF') ? 1 : 0); $moreparams = isset($moreparams) ? $moreparams : null; - $result = $objecttmp->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + $result = $objecttmp->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); if ($result < 0) { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index a7d241193da..b20176c859f 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3547,7 +3547,7 @@ class CommandeFournisseur extends CommonOrder */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { - global $conf, $langs; + global $langs; if (!dol_strlen($modele)) { $modele = ''; // No doc template/generation by default From 7013499dfae85f9d8770c44716f9babce9f30b0d Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sat, 28 Jun 2025 14:40:48 +0200 Subject: [PATCH 17/43] Try fix CI --- htdocs/core/actions_builddoc.inc.php | 3 +++ htdocs/core/actions_massactions.inc.php | 1 + 2 files changed, 4 insertions(+) diff --git a/htdocs/core/actions_builddoc.inc.php b/htdocs/core/actions_builddoc.inc.php index 8a2e89fbef0..f5a087aec07 100644 --- a/htdocs/core/actions_builddoc.inc.php +++ b/htdocs/core/actions_builddoc.inc.php @@ -48,6 +48,9 @@ * @var ?int $hideref * @var ?array $moreparams */ +' +@phan-var-force ?array $moreparams +'; if (!empty($permissioncreate) && empty($permissiontoadd)) { $permissiontoadd = $permissioncreate; // For backward compatibility diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index b1e3828e492..b1229e13047 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -82,6 +82,7 @@ @phan-var-force ?string $objectlabel @phan-var-force ?string $option @phan-var-force int $deliveryreceipt +@phan-var-force ?array $moreparams '; From 30577d167245eebcd0ccc34e8e2e6ed379862092 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 28 Jun 2025 15:24:38 +0200 Subject: [PATCH 18/43] PHPStan > Update baseline (#34658) Co-authored-by: Dolibot --- dev/build/phpstan/phpstan-baseline.neon | 26 +------------------------ 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 2f11583f5f8..a079a1d0cc9 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -972,12 +972,6 @@ parameters: count: 1 path: ../../../htdocs/adherents/list.php - - - message: '#^Variable \$diroutputmassaction might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/adherents/list.php - - message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -1860,12 +1854,6 @@ parameters: count: 2 path: ../../../htdocs/api/class/api_documents.class.php - - - message: '#^Loose comparison using \!\= between ''adherent''\|''agenda''\|''commande''\|''contact''\|''contrat''\|''expensereport''\|''facture''\|''fichinter''\|''mrp''\|''product''\|''produit''\|''produit\|service''\|''project''\|''project_task''\|''projet''\|''propale''\|''service''\|''supplier_invoice''\|''supplier_order'' and ''ecm'' will always evaluate to true\.$#' - identifier: notEqual.alwaysTrue - count: 1 - path: ../../../htdocs/api/class/api_documents.class.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue @@ -3273,7 +3261,7 @@ parameters: - message: '#^Ternary operator condition is always true\.$#' identifier: ternary.alwaysTrue - count: 6 + count: 4 path: ../../../htdocs/comm/action/peruser.php - @@ -6678,12 +6666,6 @@ parameters: count: 1 path: ../../../htdocs/core/actions_setmoduleoptions.inc.php - - - message: '#^Variable \$modulepart might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/actions_setmoduleoptions.inc.php - - message: '#^Variable \$result might not be defined\.$#' identifier: variable.undefined @@ -19368,12 +19350,6 @@ parameters: count: 1 path: ../../../htdocs/projet/element.php - - - message: '#^Variable \$margin in isset\(\) always exists and is not nullable\.$#' - identifier: isset.variable - count: 2 - path: ../../../htdocs/projet/element.php - - message: '#^Variable \$total_time in isset\(\) always exists and is not nullable\.$#' identifier: isset.variable From f7bd8339cbc78fc28761c2e18c0c288d5aaa74de Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sat, 28 Jun 2025 16:35:41 +0200 Subject: [PATCH 19/43] Debug v22 --- htdocs/compta/facture/class/facture.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 34839f8b775..91129450e5a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -6365,7 +6365,6 @@ class Facture extends CommonInvoice $actioncomm->elementtype = 'invoice'; $actioncomm->elementid = $tmpinvoice->id; - $actioncomm->fk_element = $tmpinvoice->id; //$actioncomm->extraparams = $extraparams; @@ -6403,6 +6402,9 @@ class Facture extends CommonInvoice //$actioncomm->email_subject = $subject; $actioncomm->errors_to = $errors_to; + $actioncomm->elementtype = 'invoice'; + $actioncomm->elementid = $tmpinvoice->id; + //$actioncomm->extraparams = $extraparams; $actioncomm->create($user); From f1f682257810e26660ce4912056dd9a84e67f2da Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sat, 28 Jun 2025 16:38:54 +0200 Subject: [PATCH 20/43] Debug v22 --- htdocs/compta/facture/class/facture.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 91129450e5a..ba7be823853 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -6293,8 +6293,6 @@ class Facture extends CommonInvoice } if (!$error && !empty($to)) { - $this->db->begin(); - $to = implode(',', $to); if (!empty($arraymessage->email_to)) { // If a recipient is defined into template, we add it $to = $to.','.$arraymessage->email_to; @@ -6329,8 +6327,12 @@ class Facture extends CommonInvoice // Mail Creation $cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, $joinFile, $joinFileMime, $joinFileName, $email_tocc, $email_tobcc, 0, 1, $errors_to, '', $trackid, '', $sendcontext, ''); + $resultsendmail = $cMailFile->sendfile(); + + $this->db->begin(); + // Sending Mail - if ($cMailFile->sendfile()) { + if ($resultsendmail) { $nbMailSend++; // Add a line into event table From 0e8bc21748f4de1c3a5cd91e270aa9f7844b8ddd Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sat, 28 Jun 2025 16:45:31 +0200 Subject: [PATCH 21/43] Doc --- htdocs/compta/facture/class/facture.class.php | 3 ++- htdocs/install/mysql/tables/llx_facture.sql | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index ba7be823853..b883cb84df1 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -6189,7 +6189,7 @@ class Facture extends CommonInvoice } else { $sql .= " AND f.date_lim_reglement = '".$this->db->idate($tmpidate, 'gmt')."'"; } - $sql .= " AND f.entity IN (".getEntity('facture', 0).")"; // One batch process only one company (no sharing) + $sql .= " AND f.entity IN (".getEntity('facture', 0).")"; // One batch processes only one company (no sharing) if (!empty($paymentmode) && $paymentmode != 'all') { $sql .= " AND f.fk_mode_reglement = cp.id AND cp.code = '".$this->db->escape($paymentmode)."'"; } @@ -6199,6 +6199,7 @@ class Facture extends CommonInvoice } else { $sql .= $this->db->order("date_lim_reglement", "ASC"); } + // TODO Add a date date_last_remind_email in select. We can update date after the result of sendfile() later. To avoid to send it twiceif we rerun the batch. $resql = $this->db->query($sql); diff --git a/htdocs/install/mysql/tables/llx_facture.sql b/htdocs/install/mysql/tables/llx_facture.sql index 164b370c823..a5a1bc5f8ca 100644 --- a/htdocs/install/mysql/tables/llx_facture.sql +++ b/htdocs/install/mysql/tables/llx_facture.sql @@ -5,7 +5,7 @@ -- Copyright (C) 2010 Juanjo Menent -- Copyright (C) 2012 Cédric Salvador -- Copyright (C) 2014 Raphaël Doursenaud --- +-- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3 of the License, or @@ -54,7 +54,7 @@ create table llx_facture total_tva double(24,8) DEFAULT 0, -- amount total tva apres remise totale localtax1 double(24,8) DEFAULT 0, -- amount total localtax1 - localtax2 double(24,8) DEFAULT 0, -- amount total localtax2 + localtax2 double(24,8) DEFAULT 0, -- amount total localtax2 revenuestamp double(24,8) DEFAULT 0, -- amount total revenuestamp total_ht double(24,8) DEFAULT 0, -- amount total ht apres remise totale total_ttc double(24,8) DEFAULT 0, -- amount total ttc apres remise totale @@ -65,7 +65,7 @@ create table llx_facture fk_user_modif integer, -- user making last change fk_user_valid integer, -- user validating fk_user_closing integer, -- user closing - + module_source varchar(32), -- name of module when invoice generated by a dedicated module (POS, ecommerce...) pos_source varchar(32), -- numero of POS terminal when order is generated by a POS module, IDsession@IDwebsite when order is generated for a website basket. fk_fac_rec_source integer, -- facture rec source @@ -75,7 +75,7 @@ create table llx_facture fk_account integer, -- bank account fk_currency varchar(3), -- currency code - + fk_cond_reglement integer DEFAULT 1 NOT NULL, -- payment term (30 days, end of month...) fk_mode_reglement integer, -- payment mode (Virement, Prelevement) date_lim_reglement date, -- due date @@ -85,6 +85,7 @@ create table llx_facture model_pdf varchar(255), last_main_doc varchar(255), -- relative filepath+filename of last main generated document fk_input_reason integer DEFAULT NULL, -- id coming from c_input_reason + fk_incoterms integer, -- for incoterms location_incoterms varchar(255), -- for incoterms @@ -103,6 +104,7 @@ create table llx_facture import_key varchar(14), extraparams varchar(255), -- for other parameters with json format is_also_delivery_note tinyint DEFAULT 0 NOT NULL, -- 0=default, 1=can act also as a delivery note (for countries that accept invoices as delivery notes) + fk_multicurrency integer, multicurrency_code varchar(3), multicurrency_tx double(24,8) DEFAULT 1, From 18725aec6bbfdcc3ed30fb1c61b6adc33fc5ac18 Mon Sep 17 00:00:00 2001 From: POTIER Mathieu Date: Sat, 28 Jun 2025 16:45:52 +0200 Subject: [PATCH 22/43] [FIX] loop interrupt if an error occurs in sendEmailsRemindersOnInvoiceDueDate (#34657) --- htdocs/compta/facture/class/facture.class.php | 191 +++++++++--------- 1 file changed, 96 insertions(+), 95 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index dab895c9e75..4aea6baf290 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5094,116 +5094,117 @@ class Facture extends CommonInvoice if ($resql) { while ($obj = $this->db->fetch_object($resql)) { - if (!$error) { - // Load event - $res = $tmpinvoice->fetch($obj->id); + // Create a loopError that is reset at each loop, this counter is added to the global counter at the end of loop + $loopError = 0; + // Load event + $res = $tmpinvoice->fetch($obj->id); + if ($res > 0) { + $tmpinvoice->fetch_thirdparty(); + + $outputlangs = new Translate('', $conf); + if ($tmpinvoice->thirdparty->default_lang) { + $outputlangs->setDefaultLang($tmpinvoice->thirdparty->default_lang); + $outputlangs->loadLangs(array("main", "bills")); + } else { + $outputlangs = $langs; + } + + // Select email template + $arraymessage = $formmail->getEMailTemplate($this->db, 'facture_send', $user, $outputlangs, (is_numeric($template) ? $template : 0), 1, (is_numeric($template) ? '' : $template)); + if (is_numeric($arraymessage) && $arraymessage <= 0) { + $langs->load("errors"); + $this->output .= $langs->trans('ErrorFailedToFindEmailTemplate', $template); + return 0; // Hint: Strange to return 0 in case of error, because this function is used by cron task and 0 means OK. + } + + // PREPARE EMAIL + $errormesg = ''; + + // Make substitution in email content + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, '', $tmpinvoice); + + complete_substitutions_array($substitutionarray, $outputlangs, $tmpinvoice); + + // Topic + $sendTopic = make_substitutions(empty($arraymessage->topic) ? $outputlangs->transnoentitiesnoconv('InformationMessage') : $arraymessage->topic, $substitutionarray, $outputlangs, 1); + + // Content + $content = $outputlangs->transnoentitiesnoconv($arraymessage->content); + + $sendContent = make_substitutions($content, $substitutionarray, $outputlangs, 1); + + // Recipient + $res = $tmpinvoice->fetch_thirdparty(); + $recipient = $tmpinvoice->thirdparty; if ($res > 0) { - $tmpinvoice->fetch_thirdparty(); - - $outputlangs = new Translate('', $conf); - if ($tmpinvoice->thirdparty->default_lang) { - $outputlangs->setDefaultLang($tmpinvoice->thirdparty->default_lang); - $outputlangs->loadLangs(array("main", "bills")); + if (!empty($recipient->email)) { + $to = $recipient->email; } else { - $outputlangs = $langs; - } - - // Select email template - $arraymessage = $formmail->getEMailTemplate($this->db, 'facture_send', $user, $outputlangs, (is_numeric($template) ? $template : 0), 1, (is_numeric($template) ? '' : $template)); - if (is_numeric($arraymessage) && $arraymessage <= 0) { - $langs->load("errors"); - $this->output .= $langs->trans('ErrorFailedToFindEmailTemplate', $template); - return 0; - } - - // PREPARE EMAIL - $errormesg = ''; - - // Make substitution in email content - $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, '', $tmpinvoice); - - complete_substitutions_array($substitutionarray, $outputlangs, $tmpinvoice); - - // Topic - $sendTopic = make_substitutions(empty($arraymessage->topic) ? $outputlangs->transnoentitiesnoconv('InformationMessage') : $arraymessage->topic, $substitutionarray, $outputlangs, 1); - - // Content - $content = $outputlangs->transnoentitiesnoconv($arraymessage->content); - - $sendContent = make_substitutions($content, $substitutionarray, $outputlangs, 1); - - // Recipient - $res = $tmpinvoice->fetch_thirdparty(); - $recipient = $tmpinvoice->thirdparty; - if ($res > 0) { - if (!empty($recipient->email)) { - $to = $recipient->email; - } else { - $errormesg = "Failed to send remind to thirdparty id=".$tmpinvoice->fk_soc.". No email defined for user."; - $error++; - } - } else { - $errormesg = "Failed to load recipient with thirdparty id=".$tmpinvoice->fk_soc; - $error++; - } - - // Sender - $from = $conf->global->MAIN_MAIL_EMAIL_FROM; - if (empty($from)) { - $errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM"; - $error++; - } - - if (!$error) { - // Errors Recipient - $errors_to = $conf->global->MAIN_MAIL_ERRORS_TO; - - $trackid = 'inv'.$tmpinvoice->id; - - //join file is asked - $joinFile = []; - $joinFileName = []; - $joinFileMime = []; - if ($arraymessage->joinfiles == 1 && !empty($tmpinvoice->last_main_doc)) { - $joinFile[] = DOL_DATA_ROOT.$tmpinvoice->last_main_doc; - $joinFileName[] = basename($tmpinvoice->last_main_doc); - $joinFileMime[] = dol_mimetype(DOL_DATA_ROOT.$tmpinvoice->last_main_doc); - } - - // Mail Creation - $cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, $joinFile, $joinFileMime, $joinFileName, '', "", 0, 1, $errors_to, '', $trackid, '', '', ''); - - // Sending Mail - if ($cMailFile->sendfile()) { - $nbMailSend++; - } else { - $errormesg = $cMailFile->error.' : '.$to; - $error++; - } - } - - if ($errormesg) { - $errorsMsg[] = $errormesg; + $errormesg = "Failed to send remind to thirdparty id=".$tmpinvoice->fk_soc.". No email defined for user."; + $loopError++; } } else { - $errorsMsg[] = 'Failed to fetch record invoice with ID = '.$obj->id; - $error++; + $errormesg = "Failed to load recipient with thirdparty id=".$tmpinvoice->fk_soc; + $loopError++; } + + // Sender + $from = $conf->global->MAIN_MAIL_EMAIL_FROM; + if (empty($from)) { + $errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM"; + $loopError++; + } + + if (!$loopError) { // No error until then + // Errors Recipient + $errors_to = $conf->global->MAIN_MAIL_ERRORS_TO; + + $trackid = 'inv'.$tmpinvoice->id; + + //join file is asked + $joinFile = []; + $joinFileName = []; + $joinFileMime = []; + if ($arraymessage->joinfiles == 1 && !empty($tmpinvoice->last_main_doc)) { + $joinFile[] = DOL_DATA_ROOT.$tmpinvoice->last_main_doc; + $joinFileName[] = basename($tmpinvoice->last_main_doc); + $joinFileMime[] = dol_mimetype(DOL_DATA_ROOT.$tmpinvoice->last_main_doc); + } + + // Mail Creation + $cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, $joinFile, $joinFileMime, $joinFileName, '', "", 0, 1, $errors_to, '', $trackid, '', '', ''); + + // Sending Mail + if ($cMailFile->sendfile()) { + $nbMailSend++; + } else { + $errormesg = $cMailFile->error.' : '.$to; + $loopError++; + } + } + + if ($errormesg) { + $errorsMsg[] = $errormesg; + } + } else { + $errorsMsg[] = 'Failed to fetch record invoice with ID = '.$obj->id; + $loopError++; } + $error += $loopError; } } else { $error++; } - if (!$error) { - $this->output .= 'Nb of emails sent : '.$nbMailSend; - $this->db->commit(); - return 0; - } else { + if ($error > 0) { // If there is azt least an error, early return with specific message $this->db->commit(); // We commit also on error, to have the error message recorded. $this->error = 'Nb of emails sent : '.$nbMailSend.', '.(!empty($errorsMsg)) ? join(', ', $errorsMsg) : $error; return $error; } + + $this->output .= 'Nb of emails sent : '.$nbMailSend; + $this->db->commit(); + return 0; } } From cde963262227acd9f0c56b0516cd07955df467d9 Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Sat, 28 Jun 2025 16:46:52 +0200 Subject: [PATCH 23/43] Fix some phan warnings (#34650) * Fix some phan warnings * Update defaultvalues.php * Update hookmanager.class.php --------- Co-authored-by: Laurent Destailleur --- htdocs/accountancy/class/bookkeeping.class.php | 5 +++++ htdocs/admin/agenda_other.php | 4 ++-- htdocs/admin/defaultvalues.php | 4 ++-- htdocs/api/class/api_documents.class.php | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index ad7c1af6e0c..b3c557845f8 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -3904,4 +3904,9 @@ class BookKeepingLine extends CommonObjectLine * @var int|string */ public $date_lim_reglement; + + /** + * @var string + */ + public $code_tiers; } diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index ce9fffee5a6..6ee9d033e7b 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -101,7 +101,7 @@ if ($action == 'set') { dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity); $defaultValues = new DefaultValues($db); - $result = $defaultValues->fetchAll('', '', 0, 0, array('t.page' => 'comm/action/card.php', 't.param' => 'complete', 't.user_id' => '0', 't.type' => 'createform', 't.entity' => (string) $conf->entity)); + $result = $defaultValues->fetchAll('', '', 0, 0, "(t.page:=:'comm/action/card.php') AND (t.param:=:'complete') AND (t.user_id:=:0) AND (t.type:=:'createform') AND (t.entity:=:".((int) $conf->entity).")"); if (!is_array($result) && $result < 0) { setEventMessages($defaultValues->error, $defaultValues->errors, 'errors'); } elseif (count($result) > 0) { @@ -391,7 +391,7 @@ print '
 '."\n"; $defval = 'na'; $defaultValues = new DefaultValues($db); -$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page' => 'comm/action/card.php', 't.param' => 'complete', 't.user_id' => '0', 't.type' => 'createform', 't.entity' => (string) $conf->entity)); +$result = $defaultValues->fetchAll('', '', 0, 0, "(t.page:=:'comm/action/card.php') AND (t.param:=:'complete') AND (t.user_id:=:0) AND (t.type:=:'createform') AND (t.entity:=:".((int) $conf->entity).")"); if (!is_array($result) && $result < 0) { setEventMessages($defaultValues->error, $defaultValues->errors, 'errors'); } elseif (count($result) > 0) { diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index 43f4dffe6d9..b3855e14859 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -368,8 +368,8 @@ if (!getDolGlobalString('MAIN_ENABLE_DEFAULT_VALUES')) { print ''; print '
\n"; - //if ($conf->global->COMPANY_ADDON_PDF != "$name") - //{ + print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; - //} - //else - //{ - // print img_picto($langs->trans("Enabled"),'on'); - //} print "'."\n"; - print img_picto(dol_escape_htmltag($langs->trans("ErrorModuleRequirePHPVersion", implode('.', $module->phpmin))), 'switch_off'); + print img_picto(dol_escape_htmltag($langs->trans("ErrorModuleRequirePHPVersion", implode('.', $module->phpmin))), 'switch_off', 'class="opacitymedium"'); print "'."\n"; From fae0093b51b2dae6e02369b65552ddecd5f6ef7f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Jun 2025 15:47:49 +0200 Subject: [PATCH 40/43] Debug v22 --- htdocs/api/class/api_access.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index c7c92f9514d..6a81b2e5975 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -124,7 +124,7 @@ class DolibarrApiAccess implements iAuthenticate $api_key = preg_replace('/^Bearer\s+/i', '', empty($headers['Authorization']) ? '' : $headers['Authorization']); }; - $api_key = dol_string_nounprintableascii($api_key); + $api_key = dol_string_nounprintableascii($api_key, 1); if (preg_match('/^dolcrypt:/i', $api_key)) { throw new RestException(503, 'Bad value for the API key. An API key should not start with dolcrypt:'); From 8c8a45a191b134a0ee40684e9c4e429fed8ff2b4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Jun 2025 15:49:20 +0200 Subject: [PATCH 41/43] Doc --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0f49eebe26b..cecf472c14b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1996,7 +1996,7 @@ function dol_string_nounprintableascii($str, $removetabcrlf = 1) } /** - * Returns text slugified (no special char, separator is "-". + * Returns text slugified (lowercase and no special char, separator is "-"). * * @param string $stringtoslugify String to slugify * @return string Slugified string From c0b4af32befb25911b16cfb255a41d29544344ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Benke?= <1179011+defrance@users.noreply.github.com> Date: Mon, 30 Jun 2025 16:25:44 +0200 Subject: [PATCH 42/43] FIX some error on donation list (#34666) * fix some error on donation list * Update list.php --------- Co-authored-by: Laurent Destailleur --- htdocs/don/paiement/list.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/don/paiement/list.php b/htdocs/don/paiement/list.php index 03ccaf366d2..5251af4c646 100644 --- a/htdocs/don/paiement/list.php +++ b/htdocs/don/paiement/list.php @@ -87,6 +87,8 @@ if (!$sortfield) { $search_all = trim(GETPOST('search_all', 'alphanohtml')); +$object = new Don($db); + $morejs = array(); $morecss = array(); @@ -163,7 +165,6 @@ if (empty($reshook)) { */ $form = new Form($db); -$donationstatic = new Don($db); $companystatic = new Societe($db); $bankline = new AccountLine($db); $accountstatic = new Account($db); @@ -471,7 +472,7 @@ if (!empty($arrayfields['c.code']['checked'])) { $totalarray['nbfield']++; } if (!empty($arrayfields['pd.num_paiement']['checked'])) { - print_liste_field_titre($arrayfields['pd.num_paiement']['label'], $_SERVER["PHP_SELF"], "pd.num_payment", '', $param, '', $sortfield, $sortorder, '', $arrayfields['p.num_paiement']['tooltip']); + print_liste_field_titre($arrayfields['pd.num_paiement']['label'], $_SERVER["PHP_SELF"], "pd.num_payment", '', $param, '', $sortfield, $sortorder, '', $arrayfields['pd.num_paiement']['tooltip']); $totalarray['nbfield']++; } if (!empty($arrayfields['transaction']['checked'])) { @@ -565,7 +566,7 @@ while ($i < $imaxinloop) { if ($obj->soc_id > 0) { print $companystatic->getNomUrl(1, '', 24); } else { - print $donationstatic->societe = $obj->societe; + print $object->societe = $obj->societe; } print '