From c8e2343d56e86a30f4250ce1d4eecf40385c646c Mon Sep 17 00:00:00 2001 From: ThomasNgr-OpenDSI Date: Tue, 28 Apr 2026 14:00:45 +0200 Subject: [PATCH 01/79] FIX : use company default RIB when it is defined (#38016) Co-authored-by: Laurent Destailleur --- htdocs/compta/facture/prelevement.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 83632e54288..a8116c7fed2 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -821,20 +821,21 @@ if ($object->id > 0) { print $langs->trans('CustomerIBAN').' '; // if societe rib in model invoice, we preselect it - $selectedRib = ''; + $selectedRibId = 0; if ($object->element == 'invoice' && $object->fk_fac_rec_source) { $facturerec = new FactureRec($db); $facturerec->fetch($object->fk_fac_rec_source); if ($facturerec->fk_societe_rib) { $companyBankAccount = new CompanyBankAccount($db); $res = $companyBankAccount->fetch($facturerec->fk_societe_rib); - $selectedRib = $companyBankAccount->id; + $selectedRibId = $companyBankAccount->id; } } - - $selectedRib = $form->selectRib($selectedRib, 'accountcustomerid', 'fk_soc='.$object->socid, 1, '', 1); - $defaultRibId = $object->thirdparty->getDefaultRib(); + if (empty($selectedRibId)) $selectedRibId = (int) $defaultRibId; + + $selectedRib = $form->selectRib($selectedRibId, 'accountcustomerid', 'fk_soc='.$object->socid, 1, '', 1); + if ($defaultRibId) { $companyBankAccount = new CompanyBankAccount($db); $res = $companyBankAccount->fetch($defaultRibId); From f830b997c6f901b581d4d6e8ef487d699304ea5c Mon Sep 17 00:00:00 2001 From: Joachim Kueter Date: Fri, 1 May 2026 23:14:46 +0200 Subject: [PATCH 02/79] Fix empty data-rowid on holiday list rows (#38050) --- 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 5ea2ef1dfe6..e39e0c7d88b 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -909,7 +909,7 @@ if ($id && !$user->hasRight('holiday', 'readall') && !in_array($id, $childids)) } else { // Show here line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; From aaa80c8346898db4c3e28203cf41c7168cdf3246 Mon Sep 17 00:00:00 2001 From: atm-lena <52402938+atm-lena@users.noreply.github.com> Date: Fri, 1 May 2026 23:23:43 +0200 Subject: [PATCH 03/79] Fix Translation Fr NumberScheduledJobError (#38041) Co-authored-by: atm-lena-c --- htdocs/langs/fr_FR/cron.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/fr_FR/cron.lang b/htdocs/langs/fr_FR/cron.lang index 3283ae751e5..46d3292d0d5 100644 --- a/htdocs/langs/fr_FR/cron.lang +++ b/htdocs/langs/fr_FR/cron.lang @@ -98,5 +98,5 @@ ErrorInBatch=Erreur lors de l'exécution du travail %s # Cron Boxes LastExecutedScheduledJob=Dernier travail planifié exécuté NextScheduledJobExecute=Prochain travail planifié à exécuter -NumberScheduledJobError=Nombre de travaux planifiées en erreur +NumberScheduledJobError=Nombre de travaux planifiés en erreur NumberScheduledJobNeverFinished=Nombre de tâches planifiées jamais terminées From c24bb892bc0b262fc1f9208fb7c00f5c24974b5f Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 1 May 2026 23:27:26 +0200 Subject: [PATCH 04/79] FIX #36589 (#38037) --- 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 5f48b2803f9..662715f7019 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -14251,7 +14251,7 @@ function fetchObjectByElement($element_id, $element_type, $element_ref = '', $us //var_dump($element_prop); //var_dump($element_prop['module'].' '.$ismodenabled); if (is_array($element_prop) && (empty($element_prop['module']) || $ismodenabled)) { - if ($useCache === 1 + if ($useCache === 1 && $element_id > 0 && !empty($conf->cache['fetchObjectByElement'][$element_type]) && !empty($conf->cache['fetchObjectByElement'][$element_type][$element_id]) && is_object($conf->cache['fetchObjectByElement'][$element_type][$element_id]) From 73003f82edd4ee35ed159b87552d3d4c970d077a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 May 2026 22:16:36 +0200 Subject: [PATCH 05/79] Trans --- htdocs/langs/en_US/languages.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index 705d9c98dff..143d8c50f0a 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -114,6 +114,7 @@ Language_ru_UA=Russian (Ukraine) Language_ta_IN=Tamil Language_tg_TJ=Tajik Language_tr_TR=Turkish +Language_si_LK=Sinhala Language_sl_SI=Slovenian Language_sv_SV=Swedish Language_sv_SE=Swedish From 7a572cd1d3e56c7d1d154db20355f5bbc2696eee Mon Sep 17 00:00:00 2001 From: ATM-NicolasV <92087862+ATM-NicolasV@users.noreply.github.com> Date: Mon, 4 May 2026 12:57:51 +0200 Subject: [PATCH 06/79] FIX product price.php: preserve default_vat_code and tva_npr when auto-creating initial product_price row (#38034) When a product has no row in llx_product_price (typical for products imported in bulk where only llx_product was populated), price.php auto-creates an initial history line on first display of the price tab (branch starting at "We must have at least one initial line"). The two updatePrice() calls in this branch omitted parameter 11 (\$newdefaultvatcode) which defaults to ''. In Product::updatePrice() the SQL then writes default_vat_code = NULL in BOTH llx_product and the new llx_product_price row, silently wiping a correctly-stored VAT code on every first display. Symptom: "ErrorBadValueForParamNotAString" rendered next to selling price/min selling price (because \$langs->trans(\$object->price_base_type) is called with NULL when the row is freshly created with empty fields), and default_vat_code persistently reset to NULL until the user manually re-saves through the form. Fix: forward \$object->default_vat_code (and \$object->tva_npr for the non-multiprice branch) to updatePrice() so the auto-init preserves the product's VAT configuration. --- htdocs/product/price.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index dcb86da3588..d5aed441828 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -2766,9 +2766,9 @@ if ((!getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || $action == 'showlog_defau // We add it to fix this if not (trouble with old versions) // We emulate the change of the price from interface with the same value than the one into table llx_product if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { - $ret = $object->updatePrice(($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_ttc[1] : $object->multiprices[1]), $object->multiprices_base_type[1], $user, (empty($object->multiprices_tva_tx[1]) ? 0 : $object->multiprices_tva_tx[1]), ($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_min_ttc[1] : $object->multiprices_min[1]), 1); + $ret = $object->updatePrice(($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_ttc[1] : $object->multiprices[1]), $object->multiprices_base_type[1], $user, (empty($object->multiprices_tva_tx[1]) ? 0 : $object->multiprices_tva_tx[1]), ($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_min_ttc[1] : $object->multiprices_min[1]), 1, 0, 0, 0, array(), $object->default_vat_code); } else { - $ret = $object->updatePrice(($object->price_base_type == 'TTC' ? $object->price_ttc : $object->price), $object->price_base_type, $user, $object->tva_tx, ($object->price_base_type == 'TTC' ? $object->price_min_ttc : $object->price_min)); + $ret = $object->updatePrice(($object->price_base_type == 'TTC' ? $object->price_ttc : $object->price), $object->price_base_type, $user, $object->tva_tx, ($object->price_base_type == 'TTC' ? $object->price_min_ttc : $object->price_min), 0, $object->tva_npr, 0, 0, array(), $object->default_vat_code); } if ($ret < 0) { From 4861151c929174267dfeb814c4286628b16521f9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 4 May 2026 13:10:20 +0200 Subject: [PATCH 07/79] FIX #38074 (#38075) --- htdocs/asset/class/asset.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index a9fa58ad208..d2c71880b50 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -748,7 +748,7 @@ class Asset extends CommonObject } $sql = "SELECT ad.rowid, ad.depreciation_mode, ad.ref, ad.depreciation_date, ad.depreciation_ht, ad.cumulative_depreciation_ht,"; - $sql .= " " . $this->db->ifsql('EXISTS (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type = \'asset\' AND ab.fk_docdet = ad.rowid)', '1', '0') . " AS bookkeeping"; + $sql .= " " . $this->db->ifsql('EXISTS (SELECT fk_docdet FROM ' . MAIN_DB_PREFIX . 'accounting_bookkeeping as ab WHERE ab.doc_type = \'asset\' AND ab.fk_docdet = ad.rowid)', '1', '0') . " AS bookkeeping"; $sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad"; $sql .= " WHERE ad.fk_asset = " . (int) $this->id; $sql .= " ORDER BY ad.depreciation_date ASC"; From 3de2fa834a0b44d2fe955590f98cd180a542f77b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 May 2026 18:20:25 +0200 Subject: [PATCH 08/79] Fix typo --- htdocs/public/members/new.php | 2 +- htdocs/public/payment/newpayment.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 174c4db8f88..9dd6c7a9911 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -1006,7 +1006,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR if (getDolGlobalString('MEMBER_NEWFORM_DOLIBARRTURNOVER')) { // Do not set a default amount MEMBER_NEWFORM_AMOUNT if you use MEMBER_NEWFORM_DOLIBARRTURNOVER $s = $langs->trans("AreYouAPreferredPartner", '{s1}'); - $s = str_replace('{s1}', 'Peferred Partner', $s); + $s = str_replace('{s1}', 'Preferred Partner', $s); print ''; print ''; print ''; diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 670634e79cf..d2e935c2501 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1836,7 +1836,7 @@ if ($source == 'member' || $source == 'membersubscription') { // Do not set a default amount MEMBER_NEWFORM_AMOUNT if you use MEMBER_NEWFORM_DOLIBARRTURNOVER $s = $langs->trans("AreYouAPreferredPartner", '{s1}'); - $s = str_replace('{s1}', 'Peferred Partner', $s); + $s = str_replace('{s1}', 'Preferred Partner', $s); print ''; print ''; print ''; From f3e1e4b3f97eb039060b3f5e41d276390f960866 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 May 2026 21:54:06 +0200 Subject: [PATCH 09/79] FIX generation of SEPA files for credit tranfer with several requests --- .../class/bonprelevement.class.php | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 215032b0539..dad2a82f178 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1072,7 +1072,7 @@ class BonPrelevement extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Create a BAN payment order: - * - Select waiting requests from prelevement_demande (or use $did if provided) + * - Select waiting requests from prelevement_demande (or use $dids if provided) * - Check BAN values * - Then create a direct debit order or a credit transfer order * - Link the order with the prelevement_demande lines @@ -1098,7 +1098,7 @@ class BonPrelevement extends CommonObject // phpcs:enable global $conf, $langs, $user; - dol_syslog(__METHOD__ . " Bank=".$banque." Office=".$agence." mode=".$mode." format=".$format." type=".$type." dids=".$dids." fk_bank_account=".$fk_bank_account." sourcetype=".$sourcetype, LOG_DEBUG); + dol_syslog(__METHOD__ . " mode=".$mode." format=".$format." type=".$type." dids=".$dids." fk_bank_account=".$fk_bank_account." sourcetype=".$sourcetype, LOG_DEBUG); require_once DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php"; require_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php"; @@ -1127,7 +1127,7 @@ class BonPrelevement extends CommonObject $error = 0; // Pre-store some values into variables to simplify following sql requests if ($sourcetype != 'salary') { - $entities = $type != 'bank-transfer' ? getEntity('invoice', 1) : getEntity('supplier_invoice', 1); // Return alist of entities + $entities = $type != 'bank-transfer' ? getEntity('invoice', 1) : getEntity('supplier_invoice', 1); // Return a list of entities $sqlTable = $type != 'bank-transfer' ? "facture" : "facture_fourn"; $socOrUser = 'fk_soc'; $societeOrUser = 'societe'; @@ -1138,6 +1138,7 @@ class BonPrelevement extends CommonObject $societeOrUser = 'user'; } + /* $thirdpartyBANId = 0; // Check if there is an iban associated to the bank transfer request or if we take the default @@ -1163,6 +1164,7 @@ class BonPrelevement extends CommonObject $this->db->free($resql); } + */ $datetimeprev = dol_now('gmt'); // Choice of the date of the execution direct debit @@ -1176,7 +1178,7 @@ class BonPrelevement extends CommonObject $this->invoice_in_error = array(); $this->thirdparty_in_error = array(); - // Read invoices + // Get all invoices to process into $factures $factures = array(); $factures_prev = array(); $factures_prev_id = array(); @@ -1196,17 +1198,13 @@ class BonPrelevement extends CommonObject $sql .= ", f.ref"; $sql .= ", sr.bic, sr.iban_prefix, 'FRST' as frstrecur, sr.default_rib, '' as rum"; } - $sql .= ", pd.fk_societe_rib as soc_rib_id"; + $sql .= ", pd.fk_societe_rib as soc_rib_id"; // Forced payment IBAN to use in priority $sql .= " FROM " . $this->db->prefix() . $sqlTable . " as f"; // f is salary, facture or facture_fourn - $sql .= " LEFT JOIN " . $this->db->prefix() . "prelevement_demande as pd ON f.rowid = pd.fk_".$this->db->sanitize($sqlTable); + $sql .= " INNER JOIN " . $this->db->prefix() . "prelevement_demande as pd ON f.rowid = pd.fk_".$this->db->sanitize($sqlTable); $sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($societeOrUser)." as s ON s.rowid = f.".$this->db->sanitize($socOrUser); - $sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($societeOrUser."_rib")." as sr ON s.rowid = sr.".$this->db->sanitize($socOrUser); + $sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($societeOrUser."_rib")." as sr ON s.rowid = sr.".$this->db->sanitize($socOrUser); // To get the default BAN of thirdparty if ($sourcetype != 'salary') { - if (!empty($thirdpartyBANId)) { - $sql .= " AND sr.rowid = " . ((int) $thirdpartyBANId); - } else { - $sql .= " AND sr.default_rib = 1"; - } + $sql .= " AND sr.default_rib = 1"; $sql .= " AND sr.type = 'ban'"; } else { //$sql .= " AND sr.type = 'ban'"; // TODO Add AND sr.type = 'ban' for users too @@ -1246,10 +1244,11 @@ class BonPrelevement extends CommonObject // All fields: // 0=rowid, 1=pfdrowid, 2=$socOrUser, 3=code_banque, 4=code_guichet, 5=number, 6=key, - // 7=amount, 8=name, 9=ref, 10=bic, 11=iban, 12=frstrecur, 13=default_rib, 14=rum, 15=soc_rib_id + // 7=amount, 8=company name, 9=invoice ref, + // 10=default bic, 11=default iban (=the BAN to use if no soc_rib_id set), 12=default frstrecur, 13=default_rib, 14=default rum, 15=soc_rib_id (=the BAN to use in priority) $factures[$i] = $row; - // Decode BAN + // Decode default BAN $factures[$i][11] = dolDecrypt($factures[$i][11]); if ($row[7] == 0) { @@ -1299,8 +1298,8 @@ class BonPrelevement extends CommonObject } // If a bank account was forced on llx_prelevement_demande (the direct debit or credit transfer request), - // we must use this oney,so we reload values from soc_rib_id - if (!empty($fac[14])) { + // we must use this one, so we reload values from soc_rib_id + if (!empty($fac[15])) { $bankaccount = new CompanyBankAccount($this->db); $bankaccount->fetch((int) $fac[15]); if ($bankaccount->id > 0) { From 3b65a87ce25b5caa800b25d9955be803162a5b0a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 May 2026 00:12:34 +0200 Subject: [PATCH 10/79] FIX generation of SEPA files for credit tranfer with several requests --- htdocs/compta/facture/list.php | 2 +- htdocs/compta/facture/prelevement.php | 2 +- htdocs/compta/prelevement/card.php | 20 ++-- .../class/bonprelevement.class.php | 98 ++++++++++++------- htdocs/compta/prelevement/factures.php | 6 +- htdocs/fourn/facture/list.php | 2 +- .../install/mysql/migration/23.0.0-24.0.0.sql | 2 + .../mysql/tables/llx_prelevement_lignes.sql | 15 +-- 8 files changed, 88 insertions(+), 59 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 58c6bc7a7dc..bb183c369f1 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -679,7 +679,7 @@ if ($action == 'makepayment_confirm' && $user->hasRight('facture', 'paiement')) $nbwithdrawrequestok = 0; foreach ($listofbills as $aBill) { // Note: The 2 following SQL requests are wrong but it works because we have one record into pfd for one record into pl and for into p for the same fk_facture_fourn. - // The table prelevement and prelevement_lignes and must be removed in future and merged into prelevement_demande + // The table prelevement and prelevement_lignes must be removed in future and merged into prelevement_demande // Step 1: Move field fk_... of llx_prelevement into llx_prelevement_lignes // Step 2: Move field fk_... + status into prelevement_demande. $pending = 0; diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index b89d22f8703..476fdfcd79d 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -722,7 +722,7 @@ if ($object->id > 0) { // For which amount ? // Note: The 2 following SQL requests are wrong but it works because we have one record into pfd for one record into pl and for into p for the same fk_facture_fourn. - // The table prelevement and prelevement_lignes and must be removed in future and merged into prelevement_demande + // The table prelevement and prelevement_lignes must be removed in future and merged into prelevement_demande // Step 1: Move field fk_... of llx_prelevement into llx_prelevement_lignes // Step 2: Move field fk_... + status into prelevement_demande. $pending = 0; diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index ae4d0a38258..877cd21004b 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -486,8 +486,8 @@ if ($id > 0 || $ref) { // Lines into withdraw request if ($salaryBonPl) { - $sql = "SELECT pl.rowid, pl.statut, pl.amount, pl.fk_user,"; - $sql .= " u.rowid as socid, u.login as name"; + $sql = "SELECT pl.rowid, pl.statut as status, pl.amount,"; + $sql .= " u.rowid as parentid, u.login as name"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl"; $sql .= ", ".MAIN_DB_PREFIX."prelevement_bons as pb"; $sql .= ", ".MAIN_DB_PREFIX."user as u"; @@ -500,8 +500,8 @@ if ($id > 0 || $ref) { } $sql .= $db->order($sortfield, $sortorder); } else { - $sql = "SELECT pl.rowid, pl.statut, pl.amount,"; - $sql .= " s.rowid as socid, s.nom as name"; + $sql = "SELECT pl.rowid, pl.statut as status, pl.amount,"; + $sql .= " s.rowid as parentid, s.nom as name"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl"; $sql .= ", ".MAIN_DB_PREFIX."prelevement_bons as pb"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; @@ -577,16 +577,16 @@ if ($id > 0 || $ref) { // Status of line print ""; print ''; - print $ligne->LibStatut($obj->statut, 2); + print $ligne->LibStatut($obj->status, 2); print ''.$obj->rowid.''; print ''; if (!$salaryBonPl) { $thirdparty = new Societe($db); - $thirdparty->fetch($obj->socid); + $thirdparty->fetch($obj->parentid); $name = $thirdparty->getNomUrl(1); } else { $userSalary = new User($db); - $userSalary->fetch($obj->fk_user); + $userSalary->fetch($obj->parentid); $name = $userSalary->getNomUrl(-1); } print ''; @@ -597,11 +597,11 @@ if ($id > 0 || $ref) { print ''; - if ($obj->statut == 3) { + if ($obj->status == 3) { print ''.$langs->trans("StatusRefused").''; } else { - if ($object->statut == BonPrelevement::STATUS_CREDITED) { - if ($obj->statut == LignePrelevement::STATUS_CREDITED) { + if ($object->status == BonPrelevement::STATUS_CREDITED) { + if ($obj->status == LignePrelevement::STATUS_CREDITED) { if ($user->hasRight('prelevement', 'bons', 'credit')) { //print ''.$langs->trans("StandingOrderReject").''; print ''.$langs->trans("StandingOrderReject").''; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 833c08219cf..787d5aadc91 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -350,16 +350,19 @@ class BonPrelevement extends CommonObject * @param string $bic BIC used * @param string $iban IBAN used * @param string $rum RUM + * @param string $id_prelevement_demande ID of debit or credit request * @return int >0 if OK, <0 if KO */ - public function AddFacture($invoice_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $type = 'debit-order', $sourcetype = '', $bic = '', $iban = '', $rum = '') + public function addWithdrawDetail($invoice_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $type = 'debit-order', $sourcetype = '', $bic = '', $iban = '', $rum = '', $id_prelevement_demande = 0) { // phpcs:enable $result = 0; $line_id = 0; + // TODO Save the $id_prelevement_demande + // Add lines into prelevement_lignes for tracking. The ID of line inserted is returned into $line_id. - $result = $this->addline($line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $sourcetype, $bic, $iban, $rum); + $result = $this->addline($line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $sourcetype, $bic, $iban, $rum, $id_prelevement_demande); if ($result == 0) { @@ -384,17 +387,17 @@ class BonPrelevement extends CommonObject $result = 0; } else { $result = -1; - $this->errors[] = get_class($this) . "::AddFacture " . $this->db->lasterror; - dol_syslog(get_class($this) . "::AddFacture Error $result"); + $this->errors[] = get_class($this) . "::addWithdrawDetail " . $this->db->lasterror; + dol_syslog(get_class($this) . "::addWithdrawDetail Error $result"); } } else { $result = -2; - $this->errors[] = get_class($this) . "::AddFacture linedid Empty"; - dol_syslog(get_class($this) . "::AddFacture Error $result"); + $this->errors[] = get_class($this) . "::addWithdrawDetail linedid Empty"; + dol_syslog(get_class($this) . "::addWithdrawDetail Error $result"); } } else { $result = -3; - dol_syslog(get_class($this) . "::AddFacture Error $result"); + dol_syslog(get_class($this) . "::addWithdrawDetail Error $result"); } return $result; @@ -415,16 +418,18 @@ class BonPrelevement extends CommonObject * @param string $bic BIC used * @param string $iban IBAN used * @param string $rum RUM used + * @param string $id_prelevement_demande ID of debit or credit request * @return int >0 if OK, <0 if KO */ - public function addline(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $sourcetype = '', $bic = '', $iban = '', $rum = '') + public function addline(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $sourcetype = '', $bic = '', $iban = '', $rum = '', $id_prelevement_demande = 0) { $result = -1; $concat = getDolGlobalInt('MAIN_MODULE_PRELEVEMENT_CONCAT'); // ??? what is this for. Seems not used. if ($concat == 1) { /* - * We aggregate the lines + * @deprecated. This code can't work because code_... fields are empty. Not used. To remove. + * We aggregate the lines. */ $sql = "SELECT rowid"; $sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_lignes"; @@ -446,25 +451,27 @@ class BonPrelevement extends CommonObject } } else { /* - * No aggregate, use 1 line per invoice/salary to pay + * No aggregate, use 1 line per request of invoice/salary to pay */ $sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_lignes ("; $sql .= "fk_prelevement_bons"; $sql .= ", fk_soc"; $sql .= ", client_nom"; $sql .= ", amount"; - $sql .= ", bic"; - $sql .= ", iban"; - $sql .= ", rum"; + //$sql .= ", bic"; // no more required, we have fk_prelevement_demande + //$sql .= ", iban"; // no more required, we have fk_prelevement_demande + //$sql .= ", rum"; // no more required, we have fk_prelevement_demande + $sql .= ", fk_prelevement_demande"; $sql .= ($sourcetype == 'salary' ? ", fk_user" : ""); $sql .= ") VALUES ("; $sql .= $this->id; $sql .= ", " . (($sourcetype != 'salary') ? ((int) $client_id) : "0"); // fk_soc can't be null $sql .= ", '" . $this->db->escape($client_nom) . "'"; $sql .= ", " . ((float) price2num($amount)); - $sql .= ", '" . $this->db->escape($bic) . "'"; - $sql .= ", '" . $this->db->escape($iban) . "'"; - $sql .= ", '" . $this->db->escape($rum) . "'"; + //$sql .= ", '" . $this->db->escape($bic) . "'"; // no more required, we have fk_prelevement_demande + //$sql .= ", '" . $this->db->escape(dolEncrypt($iban)) . "'"; // no more required, we have fk_prelevement_demande + //$sql .= ", '" . $this->db->escape($rum) . "'"; // no more required, we have fk_prelevement_demande + $sql .= ", " . ((int) $id_prelevement_demande); $sql .= (($sourcetype == 'salary') ? ", " . ((int) $client_id) : ''); $sql .= ")"; if ($this->db->query($sql)) { @@ -1085,12 +1092,12 @@ class BonPrelevement extends CommonObject * @param int $executiondate Date to execute the transfer * @param int $notrigger Disable triggers * @param string $type 'direct-debit' or 'bank-transfer' - * @param array|int $dids ID(s) of existing payment request(s). - * - If $dids is 0, we use all existing requests. - * - If $dids is an int > 0, we use the existing payment request. - * - If $dids is an array, the created BonsPrelevement will include these payment requests. + * @param array|int $dids ID(s) of existing payment request(s). + * - If $dids is 0, we use all existing requests. + * - If $dids is an int > 0, we use the existing payment request. + * - If $dids is an array, the created BonsPrelevement will include these payment requests. * @param int $fk_bank_account Bank account ID the receipt is generated for. Will use the ID into the setup of module Direct Debit or Credit Transfer if 0. - * @param string $sourcetype 'invoice' or 'salary' + * @param string $sourcetype Source is 'invoice' or 'supplier_invoice' or 'salary' * @return int Return integer <0 if KO, No of invoice included into file if OK */ public function create($banque = '', $agence = '', $mode = 'real', $format = 'ALL', $executiondate = 0, $notrigger = 0, $type = 'direct-debit', $dids = 0, $fk_bank_account = 0, $sourcetype = 'invoice') @@ -1179,7 +1186,7 @@ class BonPrelevement extends CommonObject $this->thirdparty_in_error = array(); // Get all invoices to process into $factures - $factures = array(); + $factures = array(); // TODO Rename $factures... into $payment_requests... $factures_prev = array(); $factures_prev_id = array(); @@ -1243,7 +1250,7 @@ class BonPrelevement extends CommonObject /** @var array{0:int|string,1:int,2:int,3:string,4:string,5:string,6:string,7:float,8:string,9:string,10:string,11:string,12:string,13:string,14:string,15:int} $row */ // All fields: - // 0=rowid, 1=pfdrowid, 2=$socOrUser, 3=code_banque, 4=code_guichet, 5=number, 6=key, + // 0=invoice or salary id, 1=pfdrowid (id of payment request), 2=$socOrUser, 3=code_banque, 4=code_guichet, 5=number, 6=key, // 7=amount, 8=company name, 9=invoice ref, // 10=default bic, 11=default iban (=the BAN to use if no soc_rib_id set), 12=default frstrecur, 13=default_rib, 14=default rum, 15=soc_rib_id (=the BAN to use in priority) $factures[$i] = $row; @@ -1475,12 +1482,13 @@ class BonPrelevement extends CommonObject // Add lines for the direct debit or crdit transfer if (count($factures_prev) > 0) { - foreach ($factures_prev as $fac) { // Add a link in database for each invoice ro salary + foreach ($factures_prev as $fac) { // Add a link in database for each invoice or salary /* * Add standing order. This add record into llx_prelevement_lignes and llx_prelevement + * The llx_prelevement_ligne will then be read to build the XML SEPA file. * - * $fac[0] : invoice_id - * $fac[1] : ??? + * $fac[0] : invoice or salary id + * $fac[1] : id of payment request (rowid in llx_prelevement_demande) * $fac[2] : third party id * $fac[3] : banque * $fac[4] : guichet @@ -1496,7 +1504,7 @@ class BonPrelevement extends CommonObject * $fac[14] : rum * $fac[15] : soc_rib_id (id bank account preselected for direct debit or credit transfer) */ - $ri = $this->AddFacture( + $ri = $this->addWithdrawDetail( $fac[0], $fac[2], $fac[8], @@ -1509,7 +1517,8 @@ class BonPrelevement extends CommonObject $sourcetype, $fac[10], $fac[11], - $fac[14] + $fac[14], + $fac[1] ); if ($ri != 0) { @@ -1939,7 +1948,8 @@ class BonPrelevement extends CommonObject */ $sql = "SELECT soc.rowid as socid, soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,"; - $sql .= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,"; + //$sql .= " pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, "; + $sql .= " pl.client_nom as nom, pl.amount as somme, pl.fk_prelevement_demande,"; $sql .= " f.ref as reffac,"; $sql .= " p.fk_facture as idfac, p.rowid as pid,"; $sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum"; @@ -1984,7 +1994,7 @@ class BonPrelevement extends CommonObject $daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec); $iban = dolDecrypt($obj->iban); - $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->reffac, $obj->idfac, $iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type); + $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, '', '', '', $obj->somme, $obj->reffac, $obj->idfac, $iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type); $this->total += $obj->somme; $i++; @@ -2068,9 +2078,10 @@ class BonPrelevement extends CommonObject */ if (!empty($forsalary)) { $sql = "SELECT u.rowid as userId, u.address, u.zip, u.town, c.code as country_code, CONCAT(u.firstname,' ',u.lastname) as nom,"; - $sql .= " pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,"; + //$sql .= " pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, "; + $sql .= " pl.client_nom as nom, pl.amount as somme, pl.fk_prelevement_demande,"; $sql .= " s.ref as reffac,"; - $sql .= " p.fk_salary as idfac, p.rowid as pid, '' as forced_rib"; + $sql .= " p.fk_salary as idfac,"; $sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, '' as rum, '' as date_rum"; $sql .= " FROM"; $sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,"; @@ -2086,9 +2097,10 @@ class BonPrelevement extends CommonObject $sql .= " AND rib.fk_user = s.fk_user"; } else { $sql = "SELECT soc.rowid as socid, soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,"; - $sql .= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,"; + //$sql .= " pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, "; + $sql .= " pl.client_nom as nom, pl.amount as somme, pl.fk_prelevement_demande,"; $sql .= " f.ref as reffac, f.ref_supplier as fac_ref_supplier,"; - $sql .= " p.fk_facture_fourn as idfac, p.rowid as pid, p.fk_societe_rib as forced_rib"; + $sql .= " p.fk_facture_fourn as idfac,"; $sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum"; $sql .= " FROM"; $sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,"; @@ -2140,9 +2152,21 @@ class BonPrelevement extends CommonObject $rum = $obj->rum; // But if a force bank account is defined, we use it instead - if (!empty($obj->forced_rib)) { + if (!empty($obj->fk_prelevement_demande)) { + $companybankaccountid = 0; + + $sqltmp = "SELECT fk_societe_rib FROM ".MAIN_DB_PREFIX."prelevement_demande"; + $sqltmp .= " WHERE rowid = ".((int) $obj->fk_prelevement_demande); + + $resqltmp = $this->db->query($sqltmp); + + $objtmp = $this->db->fetch_object($resqltmp); + if ($objtmp) { + $companybankaccountid = (int) $objtmp->fk_societe_rib; + } + $bankaccount = new CompanyBankAccount($this->db); - $bankaccount->fetch((int) $obj->forced_rib); + $bankaccount->fetch($companybankaccountid); if ($bankaccount->id > 0) { $daterum = $bankaccount->date_rum; $iban = $bankaccount->iban; @@ -2157,7 +2181,7 @@ class BonPrelevement extends CommonObject $refobj = "SAL" . $obj->idfac; } - $fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $refobj, $obj->idfac, $iban, $bic, $daterum, $drum, $rum, $type, $obj->fac_ref_supplier); + $fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, '', '', '', $obj->somme, $refobj, $obj->idfac, $iban, $bic, $daterum, $drum, $rum, $type, $obj->fac_ref_supplier); $this->total += $obj->somme; $i++; diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index 76cd3b0b7ef..fcaf9e24ee5 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -223,7 +223,8 @@ if ($id > 0 || $ref) { if ($salaryBonPl) { $sql = "SELECT pf.rowid, p.type,"; $sql .= " f.rowid as salaryid, f.ref as ref, f.amount,"; - $sql .= " u.rowid as userid, u.firstname, u.lastname, pl.statut as status, pl.amount as amount_requested"; + $sql .= " u.rowid as userid, u.firstname, u.lastname,"; + $sql .= " pl.statut as status, pl.amount as amount_requested"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."prelevement_lignes as pl ON pl.fk_prelevement_bons = p.rowid"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."prelevement as pf ON pf.fk_prelevement_lignes = pl.rowid"; @@ -242,7 +243,8 @@ if ($salaryBonPl) { if ($object->type == 'bank-transfer') { $sql .= " f.ref_supplier,"; } - $sql .= " s.rowid as socid, s.nom as name, pl.statut as status, pl.amount as amount_requested"; + $sql .= " s.rowid as socid, s.nom as name,"; + $sql .= " pl.statut as status, pl.amount as amount_requested"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p,"; $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; $sql .= " ".MAIN_DB_PREFIX."prelevement as pf"; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 8117a2ff62c..035034cbf82 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -467,7 +467,7 @@ if (empty($reshook)) { $nbwithdrawrequestok = 0; foreach ($listofbills as $aBill) { // Note: The 2 following SQL requests are wrong but it works because we have one record into pfd for one record into pl and for into p for the same fk_facture_fourn. - // The table prelevement and prelevement_lignes and must be removed in future and merged into prelevement_demande + // The table prelevement and prelevement_lignes must be removed in future and merged into prelevement_demande // Step 1: Move field fk_... of llx_prelevement into llx_prelevement_lignes // Step 2: Move field fk_... + status into prelevement_demande. $pending = 0; diff --git a/htdocs/install/mysql/migration/23.0.0-24.0.0.sql b/htdocs/install/mysql/migration/23.0.0-24.0.0.sql index c3b736dee08..36de20f9eaa 100644 --- a/htdocs/install/mysql/migration/23.0.0-24.0.0.sql +++ b/htdocs/install/mysql/migration/23.0.0-24.0.0.sql @@ -210,6 +210,8 @@ UPDATE llx_const SET name = __ENCRYPT('ACCOUNTANCY_AUXACCOUNT_USE_SEARCH_TO_SELE ALTER TABLE llx_prelevement_bons ADD COLUMN fk_user_modif integer; +ALTER TABLE llx_prelevement_lignes ADD COLUMN fk_prelevement_demande integer DEFAULT 0; + UPDATE llx_cronjob set test = 'isModEnabled("agenda")' WHERE test = '$conf->agenda->enabled'; UPDATE llx_cronjob set test = 'isModEnabled("invoice")' WHERE test = '$conf->facture->enabled'; diff --git a/htdocs/install/mysql/tables/llx_prelevement_lignes.sql b/htdocs/install/mysql/tables/llx_prelevement_lignes.sql index 69a43589443..cad636b97f1 100644 --- a/htdocs/install/mysql/tables/llx_prelevement_lignes.sql +++ b/htdocs/install/mysql/tables/llx_prelevement_lignes.sql @@ -30,14 +30,15 @@ create table llx_prelevement_lignes client_nom varchar(255), amount double(24,8) DEFAULT 0, - code_banque varchar(128), -- deprecated - code_guichet varchar(6), -- deprecated - number varchar(255), -- deprecated - cle_rib varchar(5), -- deprecated + --code_banque varchar(128), -- deprecated + --code_guichet varchar(6), -- deprecated + --number varchar(255), -- deprecated + --cle_rib varchar(5), -- deprecated - bic varchar(11), -- 11 according to ISO 9362 - iban varchar(80), -- full iban. 34 according to ISO 13616 but we set 80 to allow to store it with encryption information - rum varchar(32), -- RUM used for the direct debit + --bic varchar(11), -- 11 according to ISO 9362 + --iban varchar(80), -- full iban. 34 according to ISO 13616 but we set 80 to allow to store it with encryption information + --rum varchar(32), -- RUM used for the direct debit + fk_prelevement_demande integer DEFAULT 0, note text, tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP From d4a45fc371f6a9e88becc801116df647bbf6dd09 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 May 2026 00:43:19 +0200 Subject: [PATCH 11/79] Trans --- htdocs/langs/en_US/companies.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 017a086f1b7..8e34ac1737b 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -408,8 +408,8 @@ SupplierCategory=Vendor category JuridicalStatus200=Independent DeleteFile=Delete file ConfirmDeleteFile=Are you sure you want to delete this file %s? -AllocateCommercial=Assign to sales representatives -UnallocateCommercial=Unassigned sales representatives +AllocateCommercial=Assign sales representatives +UnallocateCommercial=Unassign sales representatives Organization=Organization FiscalYearInformation=Fiscal Year FiscalMonthStart=Starting month of the fiscal year From ee4bdb99fb34dbd771269659ff6f34bd72b3bb7e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 May 2026 00:56:49 +0200 Subject: [PATCH 12/79] Debug v24 --- htdocs/societe/card.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 918aef66991..3e9111f446b 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1608,7 +1608,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio */ // Default bank account - if (isModEnabled('bank')) { + if (isModEnabled('bank') && getDolGlobalString('THIRDPARTY_SUGGEST_ALSO_BANK_ACCOUNT')) { print ''; print $langs->trans('DefaultBankAccount'); print ''; @@ -2492,6 +2492,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } print ''; + if (isModEnabled('bank') && getDolGlobalString('THIRDPARTY_SUGGEST_ALSO_BANK_ACCOUNT')) { + // TODO + // Allow to edit field default bank account like we can in creation mode + } // Barcode if (isModEnabled('barcode') && getDolGlobalString('BARCODE_USE_ON_THIRDPARTY')) { From 643637dc07828f617d6616ee5f7470c8be09b3aa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 May 2026 01:41:27 +0200 Subject: [PATCH 13/79] Fix missing hooks --- htdocs/compta/facture/list.php | 1 - htdocs/fourn/facture/list.php | 3 +++ htdocs/product/list.php | 3 +++ htdocs/societe/list.php | 3 +++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 63a611f47d0..4da275c7637 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -350,7 +350,6 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; // Add hook to complete $arrayfield $parameters = array('arrayfields' => &$arrayfields); $reshook = $hookmanager->executeHooks('completeArrayFields', $parameters, $object, $action); // Note that $action and $object may have been modified by hook -$sql .= $hookmanager->resPrint; // For POS context, we force some fields if ($contextpage == 'poslist') { diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 5aef3b32ba7..d9930cb6fcb 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -231,6 +231,9 @@ $arrayfields = array( ); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; +// Add hook to complete $arrayfield +$parameters = array('arrayfields' => &$arrayfields); +$reshook = $hookmanager->executeHooks('completeArrayFields', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $subtypearray = $object->getArrayOfInvoiceSubtypes(0); if (empty($subtypearray)) { diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 8c13c6db0bf..eb6166c430c 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -334,6 +334,9 @@ if (getDolGlobalString('PRODUIT_MULTIPRICES')) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; +// Add hook to complete $arrayfield +$parameters = array('arrayfields' => &$arrayfields); +$reshook = $hookmanager->executeHooks('completeArrayFields', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 6be1ae5cc07..aa540dabae7 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -347,6 +347,9 @@ $arrayfields['sales.representative'] = array('label' => $langs->trans("SalesRepr // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; +// Add hook to complete $arrayfield +$parameters = array('arrayfields' => &$arrayfields); +$reshook = $hookmanager->executeHooks('completeArrayFields', $parameters, $object, $action); // Note that $action and $object may have been modified by hook // @phpstan-ignore-next-line $object->fields = dol_sort_array($object->fields, 'position'); From c26634cc247aa1b142853d80e6a10da1e0dc7a01 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 May 2026 02:11:16 +0200 Subject: [PATCH 14/79] Debug v24 --- htdocs/core/class/extrafields.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 1c30a872aa2..068302453d3 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2832,6 +2832,9 @@ class ExtraFields $out = '<'.$tagtype.' id="trextrafieldseparator'.$key.(!empty($object->id) ? '_'.$object->id : '').'" class="trextrafieldseparator trextrafieldseparator'.$key.(!empty($object->id) ? '_'.$object->id : '').'">'; $out .= '<'.$tagtype_dyn.' '.(!empty($colspan) ? 'colspan="' . $colspan . '"' : '').'>'; + if ($mode == 'create' || $mode == 'edit') { + $out .= '
'; + } // Some js code will be injected here to manage the collapsing of extrafields // Output the picto $out .= ''; From 81ae5922952aca5cc18b8373db736746e1ea7ffd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 May 2026 02:11:46 +0200 Subject: [PATCH 15/79] Merge branch '23.0' of git@github.com:Dolibarr/dolibarr.git into develop From 41730d25b2fce90d134abbf535530b299081095e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 May 2026 02:39:53 +0200 Subject: [PATCH 16/79] Debug v24 --- htdocs/core/class/html.form.class.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 3bec8c1b63c..4d619e99abd 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2473,7 +2473,7 @@ class Form /** * Return select list of users * - * @param string|int|User $userselected User id or user object of user preselected. If 0 or < -2, we use id of current user. If -1 or '', keep unselected (if empty is allowed) + * @param string|int|User|array $userselected User id or User object of user preselected or Array of user selected. If 0 or < -4, we use id of current user. If -1 or '', keep unselected (if empty is allowed) * @param string $htmlname Field name in form * @param int<0,1>|string $show_empty 0=list with no empty value, 1=add also an empty value into list * @param int[]|null $exclude Array list of users id to exclude @@ -2503,20 +2503,26 @@ class Form // Convert $selected into an int (in case it is an object) if (is_object($userselected)) { $selected = (int) $userselected->id; - } else { + } elseif (is_numeric($userselected)) { $selected = (int) $userselected; + } elseif (is_array($userselected)) { + $selected = $userselected; + } else { + $selected = -1; } // If no preselected user defined, we take current user - if (($selected < -4 || empty($selected)) && !getDolGlobalString('SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE')) { + if ((is_numeric($selected) && ((int) $selected < -4 || empty($selected))) && !getDolGlobalString('SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE')) { $selected = $user->id; } // Convert selected int into an array - if ($selected === '') { - $selected = array(); - } elseif (!is_array($selected)) { - $selected = array($selected); + if (!is_array($selected)) { + if ($selected === -1 || $selected === '') { + $selected = array(); + } else { + $selected = array($selected); + } } // Exclude some users in $excludeUsers string From efaa4452dce04cd89bcf044ad144ad4c68f39886 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 May 2026 10:32:37 +0200 Subject: [PATCH 17/79] Test for MAIN_SECURITY_CSRF_WITH_TOKEN=3 --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 6b9ed68b005..14c95ed9ff5 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -367,7 +367,7 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( if ((GETPOSTISSET('massaction') || $tmpaction) && getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN') >= 3) { // All GET actions (except the listed exceptions that are usually post for pre-actions and not real action) and mass actions are processed as sensitive. // We exclude some action that are not sensitive so legitimate - if (GETPOSTISSET('massaction') || (strpos($tmpaction, 'display') !== 0 && !in_array($tmpaction, array('create', 'create2', 'createsite', 'createcard', 'edit', 'editcontract', 'editvalidator', 'file_manager', 'presend', 'presend_addmessage', 'preview', 'reconcile', 'specimen', 'testsetup', 'validatenewpassword', 'view')))) { + if (GETPOSTISSET('massaction') || (strpos($tmpaction, 'display') !== 0 && !in_array($tmpaction, array('create', 'create2', 'createsite', 'createcard', 'edit', 'editcontract', 'editvalidator', 'file_manager', 'presend', 'presend_addmessage', 'preview', 'reconcile', 'specimen', 'testsetup', 'undeployconfirmed', 'validatenewpassword', 'view')))) { $sensitiveget = true; } } elseif (getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN') >= 2) { From 475eecdb0340709dff9fb7b7fb6c089874991e5a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 May 2026 10:57:35 +0200 Subject: [PATCH 18/79] Doc --- dev/setup/codesniffer/ruleset.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 1996d0c423c..44a6342856e 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -151,7 +151,7 @@ - + 0 From 884e5e2df47ab84797d09ab94fcd96736641defb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 May 2026 11:02:35 +0200 Subject: [PATCH 19/79] Clean code --- htdocs/compta/deplacement/list.php | 2 +- htdocs/core/lib/agenda.lib.php | 1 - htdocs/core/lib/project.lib.php | 7 ++++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index e24375c24ef..7865114cd54 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -152,7 +152,7 @@ if ($resql) { print_barre_liste($langs->trans("TripsAndExpenses"), $page, $_SERVER["PHP_SELF"], "&socid=$socid", $sortfield, $sortorder, '', $num); $i = 0; - print '
'."\n"; + print ''."\n"; print ''; print ""; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "d.rowid", "", "&socid=$socid", '', $sortfield, $sortorder); diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 39e4def57f5..b4e1d2184f9 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -82,7 +82,6 @@ function print_actions_filter( $formactions = new FormActions($db); // Filters - //print ''; print ''; print ''; print ''; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index cde228221f2..37e859f5ad9 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2963,13 +2963,14 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks if (getDolGlobalString('PROJECT_LIMIT_YEAR_RANGE')) { //Add the year filter input - print ''; - print '
'; + print ''; + print '
'; print ''; print ''; print '\n"; - print '
'.$langs->trans("Year").''; print "
'; + print ''; + print ''; } } From 31affd0f6c971a13f0d1851863253c75d341a6e5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 May 2026 13:02:38 +0200 Subject: [PATCH 20/79] NEW Show url of blacklisted modules in tooltip --- htdocs/admin/modules.php | 2 +- htdocs/core/modules/DolibarrModules.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 0f534f30229..8794797f3a1 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -1557,7 +1557,7 @@ if ($mode == 'deploy') { print $langs->trans("YouCanSubmitFile").'


'; print ''; - print ''; + print ''; print '

'; $max = getDolGlobalString('MAIN_UPLOAD_DOC'); // In Kb diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 612352257b0..376051cf4d4 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -139,7 +139,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it */ public $rights_class; - const URL_FOR_BLACKLISTED_MODULES = 'https://ping.dolibarr.org/modules-blacklist.txt'; + const URL_FOR_BLACKLISTED_MODULES = 'https://www.dolibarr.org/modules-blacklist.php'; const KEY_ID = 0; const KEY_LABEL = 1; From fb9a3881fa85ffba2e64f06d7fa73d71fffc708c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 May 2026 13:40:41 +0200 Subject: [PATCH 21/79] Fix alert on blacklisted module when no message provided --- htdocs/admin/modules.php | 2 +- htdocs/core/modules/DolibarrModules.class.php | 13 ++++++++----- htdocs/langs/en_US/errors.lang | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 8794797f3a1..d617a8ffa12 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -308,7 +308,7 @@ if ($action == 'install' && $allowonlineinstall) { } */ - // Check if module is in the remote malware list + // Check if module is in the remote malware blacklist (at URL DolibarrModules::URL_FOR_BLACKLISTED_MODULES) if (!$error) { if (GETPOST('checkforcompliance') == 'on') { try { diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 376051cf4d4..fbf52b6eb02 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -2770,11 +2770,14 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $arrayoflines = preg_split("/[\n,]/", $result['content']); foreach ($arrayoflines as $line) { $tmpfieldsofline = explode(';', $line); - $modulekey = strtolower($tmpfieldsofline[0]); - $conf->cache['noncompliantmodules'][$modulekey]['name'] = $tmpfieldsofline[0]; - $conf->cache['noncompliantmodules'][$modulekey]['id'] = (isset($tmpfieldsofline[1]) ? $tmpfieldsofline[1] : ''); - $conf->cache['noncompliantmodules'][$modulekey]['signature'] = (isset($tmpfieldsofline[2]) ? $tmpfieldsofline[2] : ''); - $conf->cache['noncompliantmodules'][$modulekey]['message'] = $langs->trans(empty($tmpfieldsofline[3]) ? 'WarningModuleAffiliatedToAReportedCompany' : $tmpfieldsofline[3]); + $modulekey = strtolower(trim($tmpfieldsofline[0])); + if (empty($modulekey)) { + continue; + } + $conf->cache['noncompliantmodules'][$modulekey]['name'] = trim($tmpfieldsofline[0]); + $conf->cache['noncompliantmodules'][$modulekey]['id'] = (isset($tmpfieldsofline[1]) ? trim($tmpfieldsofline[1]) : ''); + $conf->cache['noncompliantmodules'][$modulekey]['signature'] = (isset($tmpfieldsofline[2]) ? trim($tmpfieldsofline[2]) : ''); + $conf->cache['noncompliantmodules'][$modulekey]['message'] = $langs->trans(empty(isset($tmpfieldsofline[3]) ? trim($tmpfieldsofline[3]) : '') ? 'WarningModuleAffiliatedToAReportedCompany' : trim($tmpfieldsofline[3])); if (!empty($tmpfieldsofline[4])) { $message2 = $langs->trans("WarningModuleAffiliatedToAPiratPlatform", '{s}'); $listofillegalurl = ''; diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 376be043648..b59a0a868af 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -431,7 +431,7 @@ WarningReadBankAlsoAllowedIfUserHasPermission=Warning, reading bank account is a WarningNoDataTransferedInAccountancyYet=Please note, there is no data in the accounting table. Please transfer your data recorded in the application to the accounting section or change the calculation mode to analyze the data recorded outside of accounting. WarningChangingThisMayBreakStopTaskScheduler=Warning, changing this value may disable the scheduler WarningAmountOfFileDiffersFromSumOfLines=Warning, amount of file (%s) differs from the sum of lines (%s) -WarningModuleAffiliatedToAReportedCompany=Warning, this module has been reported to the Dolibarr foundation as being published by a company using illegal practices (non-compliance with the rules for using the Dolibarr brand, collecting your data without your consent or deploying malware). +WarningModuleAffiliatedToAReportedCompany=Warning, this module has been reported to the Dolibarr foundation as being published by a company using illegal practices (non-compliance with the rules for using the Dolibarr brand, GPL license violation, collecting data without your consent OR deploying malware). WarningModuleAffiliatedToAPiratPlatform=Be careful when getting a module (paid or free) from a suspicious non official platform like %s WarningDNSServerNotAvailable=Warning, DNS server not available WarningSecureKeyNotSet=The value fo the securekey must not be empty From da4703812445e8d5de9f96947f4b3d4ca95aa829 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 May 2026 13:40:41 +0200 Subject: [PATCH 22/79] Fix alert on blacklisted module when no message provided --- htdocs/admin/modules.php | 2 +- htdocs/core/modules/DolibarrModules.class.php | 13 ++++++++----- htdocs/langs/en_US/errors.lang | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 3fbb0cb29d7..c651a1c4aaf 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -307,7 +307,7 @@ if ($action == 'install' && $allowonlineinstall) { } */ - // Check if module is in the remote malware list + // Check if module is in the remote malware blacklist (at URL DolibarrModules::URL_FOR_BLACKLISTED_MODULES) if (!$error) { if (GETPOST('checkforcompliance') == 'on') { try { diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 9eea62c01fd..1a1821ab76e 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -2765,11 +2765,14 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $arrayoflines = preg_split("/[\n,]/", $result['content']); foreach ($arrayoflines as $line) { $tmpfieldsofline = explode(';', $line); - $modulekey = strtolower($tmpfieldsofline[0]); - $conf->cache['noncompliantmodules'][$modulekey]['name'] = $tmpfieldsofline[0]; - $conf->cache['noncompliantmodules'][$modulekey]['id'] = (isset($tmpfieldsofline[1]) ? $tmpfieldsofline[1] : ''); - $conf->cache['noncompliantmodules'][$modulekey]['signature'] = (isset($tmpfieldsofline[2]) ? $tmpfieldsofline[2] : ''); - $conf->cache['noncompliantmodules'][$modulekey]['message'] = $langs->trans(empty($tmpfieldsofline[3]) ? 'WarningModuleAffiliatedToAReportedCompany' : $tmpfieldsofline[3]); + $modulekey = strtolower(trim($tmpfieldsofline[0])); + if (empty($modulekey)) { + continue; + } + $conf->cache['noncompliantmodules'][$modulekey]['name'] = trim($tmpfieldsofline[0]); + $conf->cache['noncompliantmodules'][$modulekey]['id'] = (isset($tmpfieldsofline[1]) ? trim($tmpfieldsofline[1]) : ''); + $conf->cache['noncompliantmodules'][$modulekey]['signature'] = (isset($tmpfieldsofline[2]) ? trim($tmpfieldsofline[2]) : ''); + $conf->cache['noncompliantmodules'][$modulekey]['message'] = $langs->trans(empty(isset($tmpfieldsofline[3]) ? trim($tmpfieldsofline[3]) : '') ? 'WarningModuleAffiliatedToAReportedCompany' : trim($tmpfieldsofline[3])); if (!empty($tmpfieldsofline[4])) { $message2 = $langs->trans("WarningModuleAffiliatedToAPiratPlatform", '{s}'); $listofillegalurl = ''; diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index ac65607c9da..70f8fc0937d 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -427,7 +427,7 @@ WarningReadBankAlsoAllowedIfUserHasPermission=Warning, reading bank account is a WarningNoDataTransferedInAccountancyYet=Please note, there is no data in the accounting table. Please transfer your data recorded in the application to the accounting section or change the calculation mode to analyze the data recorded outside of accounting. WarningChangingThisMayBreakStopTaskScheduler=Warning, changing this value may disable the scheduler WarningAmountOfFileDiffersFromSumOfLines=Warning, amount of file (%s) differs from the sum of lines (%s) -WarningModuleAffiliatedToAReportedCompany=Warning, this module has been reported to the Dolibarr foundation as being published by a company using illegal practices (non-compliance with the rules for using the Dolibarr brand, collecting your data without your consent or deploying malware). +WarningModuleAffiliatedToAReportedCompany=Warning, this module has been reported to the Dolibarr foundation as being published by a company using illegal practices (non-compliance with the rules for using the Dolibarr brand, GPL license violation, collecting data without your consent OR deploying malware). WarningModuleAffiliatedToAPiratPlatform=Be careful when getting a module (paid or free) from a suspicious non official platform like %s WarningDNSServerNotAvailable=Warning, DNS server not available From ef712b80cd4a392adf1d6bef04456143482ecacb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 May 2026 13:50:20 +0200 Subject: [PATCH 23/79] CSS --- htdocs/core/lib/project.lib.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 37e859f5ad9..eaad83d1150 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1383,7 +1383,7 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec print $taskstatic->getNomUrl(1, 'withproject', 'time'); // Label task print '
'; - print '
'.dol_escape_htmltag($taskstatic->label).'
'; + print '
'.dol_escape_htmltag($taskstatic->label).'
'; for ($k = 0; $k < $level; $k++) { print ""; } @@ -1707,7 +1707,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr print $taskstatic->getNomUrl(1, 'withproject', 'time'); // Label task print '
'; - print '
'.dol_escape_htmltag($taskstatic->label).'
'; + print '
'.dol_escape_htmltag($taskstatic->label).'
'; for ($k = 0; $k < $level; $k++) { print ""; } @@ -2104,7 +2104,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ } // Ref - print ''; + print ''; print ''; for ($k = 0; $k < $level; $k++) { print '
'; @@ -2112,7 +2112,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ print $taskstatic->getNomUrl(1, 'withproject', 'time'); // Label task print '
'; - print '
'.dol_escape_htmltag($taskstatic->label).'
'; + print '
'.dol_escape_htmltag($taskstatic->label).'
'; for ($k = 0; $k < $level; $k++) { print "
"; } @@ -2434,7 +2434,7 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & print $taskstatic->getNomUrl(1, 'withproject', 'time'); // Label task print '
'; - print '
'.dol_escape_htmltag($taskstatic->label).'
'; + print '
'.dol_escape_htmltag($taskstatic->label).'
'; for ($k = 0; $k < $level; $k++) { print ""; } From 1933712fc751056b959d7f661fee350230fd1b55 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 May 2026 14:44:11 +0200 Subject: [PATCH 24/79] Fix value show in info page --- htdocs/admin/system/security.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index aae653710b7..df8d958ebbf 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -629,7 +629,7 @@ print '
'; // File extension locked in upload by default print ''.$langs->trans("UploadExtensionRestriction").': '; -print implode(', ', explode(',', getDolGlobalString('MAIN_FILE_EXTENSION_UPLOAD_RESTRICTION'))); +print implode(', ', explode(',', getDolGlobalString('MAIN_FILE_EXTENSION_UPLOAD_RESTRICTION', implode(',', getExecutableContent())))); print '   ('.$langs->trans("Recommended").': '.implode(', ', getExecutableContent()).')'; print '
'; print '
'; From 56972376e60336318658720b3f06427d6138c513 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 May 2026 21:08:02 +0200 Subject: [PATCH 25/79] Trans --- htdocs/core/modules/facture/doc/pdf_octopus.modules.php | 5 +---- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php index 2f0405693d2..f1e35c50b4c 100644 --- a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php @@ -2067,10 +2067,7 @@ class pdf_octopus extends ModelePDFFactures $title = $outputlangs->transnoentities("InvoiceAvoir"); } if ($object->type == 3) { - $title = $outputlangs->transnoentities("InvoiceDeposit"); - } - if ($object->type == 4) { - $title = $outputlangs->transnoentities("InvoiceProForma"); + $title = $outputlangs->transnoentities("PdfInvoiceDepositTitle"); } if ($this->situationinvoice) { $outputlangs->loadLangs(array("other")); diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index b8ec54ddde1..ab1f0503fad 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -2244,10 +2244,7 @@ class pdf_sponge extends ModelePDFFactures $title = $outputlangs->transnoentities("InvoiceAvoir"); } if ($object->type == 3) { - $title = $outputlangs->transnoentities("InvoiceDeposit"); - } - if ($object->type == 4) { - $title = $outputlangs->transnoentities("InvoiceProForma"); + $title = $outputlangs->transnoentities("PdfInvoiceDepositTitle"); } if ($this->situationinvoice) { $outputlangs->loadLangs(array("other")); From ff16b3ebf612505f63aa0b3e6804ae9ac9803fb5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 May 2026 21:10:40 +0200 Subject: [PATCH 26/79] Trans --- htdocs/langs/en_US/bills.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index ff76ae8feaa..ee84a8af4c7 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -60,6 +60,7 @@ PredefinedInvoices=Predefined Invoices Invoice=Invoice PdfInvoiceTitle=Invoice PdfInvoiceSituationTitle=Invoice situation +PdfInvoiceDepositTitle=Deposit Invoices=Invoices InvoiceLine=Invoice line InvoiceCustomer=Customer invoice From 97bdffc7727e2ee2e74ed042e34d46b71da50750 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 May 2026 00:25:05 +0200 Subject: [PATCH 27/79] Debug v24 --- htdocs/comm/action/card.php | 5 ++++- htdocs/core/class/html.form.class.php | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 76a0e638f46..c1227aec42f 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1485,7 +1485,10 @@ if ($action == 'create') { // Type of event if (getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { print ''.$langs->trans("Type").''; - $default = getDolGlobalString('AGENDA_USE_EVENT_TYPE_DEFAULT', 'AC_RDV'); + $default = getDolGlobalString('AGENDA_USE_EVENT_TYPE_DEFAULT', 'AC_OTH'); + if (empty($default)) { + $default = 'AC_OTH'; + } print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"'); $selectedvalue = GETPOSTISSET("actioncode") ? GETPOST("actioncode", 'aZ09') : ($object->type_code ? $object->type_code : $default); print $formactions->select_type_actions($selectedvalue, "actioncode", "systemauto", 0, -1, 0, 1); // TODO Replace 0 with -2 in onlyautoornot diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 4d619e99abd..d64e5cfe55a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2603,7 +2603,9 @@ class Form } if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) { $sql .= " AND (u.statut <> 0"; - $sql .= " OR rowid IN (".$this->db->sanitize(implode(',', $selected)).")"; // We must always keep the selected users to avoid to loose it/them when updating + if (!empty($selected)) { + $sql .= " OR rowid IN (".$this->db->sanitize(implode(',', $selected)).")"; // We must always keep the selected users to avoid to loose it/them when updating + } $sql .= ")"; } if (getDolGlobalString('USER_HIDE_NONEMPLOYEE_IN_COMBOBOX')) { From 9d0569a8e8943ec69e6a7af2b085d177bc3cf4b6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 May 2026 12:51:01 +0200 Subject: [PATCH 28/79] Clean code --- htdocs/master.inc.php | 5 +++++ htdocs/subtotals/class/commonsubtotal.class.php | 3 --- .../core/substitutions/functions_subtotals.lib.php | 9 +++------ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 80ad932eac6..a4b925f6f18 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -114,6 +114,11 @@ if (!defined('LOG_DEBUG')) { } } +if (!defined('SUBTOTALS_SPECIAL_CODE')) { + define('SUBTOTALS_SPECIAL_CODE', 81); +} + + /* * Disable some not used PHP stream */ diff --git a/htdocs/subtotals/class/commonsubtotal.class.php b/htdocs/subtotals/class/commonsubtotal.class.php index bd8e77157bf..6fefea03d84 100644 --- a/htdocs/subtotals/class/commonsubtotal.class.php +++ b/htdocs/subtotals/class/commonsubtotal.class.php @@ -20,9 +20,6 @@ * or see https://www.gnu.org/ */ -if (!defined('SUBTOTALS_SPECIAL_CODE')) { - define('SUBTOTALS_SPECIAL_CODE', 81); -} /** * diff --git a/htdocs/subtotals/core/substitutions/functions_subtotals.lib.php b/htdocs/subtotals/core/substitutions/functions_subtotals.lib.php index 42ef175805d..25505e2e9ca 100644 --- a/htdocs/subtotals/core/substitutions/functions_subtotals.lib.php +++ b/htdocs/subtotals/core/substitutions/functions_subtotals.lib.php @@ -30,14 +30,11 @@ */ function subtotals_completesubstitutionarray_lines(&$substitutionarray, $langs, $object, $line) { - global $conf, $db; - - if (defined('SUBTOTALS_SPECIAL_CODE')) { - $substitutionarray['is_subtotals_line'] = ($line->special_code == SUBTOTALS_SPECIAL_CODE); + $substitutionarray['is_subtotals_line'] = ($line->special_code == constant('SUBTOTALS_SPECIAL_CODE')); $substitutionarray['is_not_subtotals_line'] = !$substitutionarray['is_subtotals_line']; - $substitutionarray['is_subtotals_title'] = (($line->special_code == SUBTOTALS_SPECIAL_CODE) && $line->qty > 0); - $substitutionarray['is_subtotals_subtotal'] = (($line->special_code == SUBTOTALS_SPECIAL_CODE) && $line->qty < 0); + $substitutionarray['is_subtotals_title'] = (($line->special_code == constant('SUBTOTALS_SPECIAL_CODE')) && $line->qty > 0); + $substitutionarray['is_subtotals_subtotal'] = (($line->special_code == constant('SUBTOTALS_SPECIAL_CODE')) && $line->qty < 0); $subtotal_total = 0; if (isModEnabled('multicurrency') && $object->multicurrency_code != getDolCurrency()) { $subtotal_total = $object->getSubtotalLineMulticurrencyAmount($line); // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall From 48959d7d0e36ca904b18e781a13ebb4ac6a9b0f8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 May 2026 17:35:58 +0200 Subject: [PATCH 29/79] Fix modulebuilder: Do not show extrafields page if not enabled. Do not allow special char in name of module and object. --- htdocs/modulebuilder/index.php | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 9a0de42e9a2..3cbc7eae099 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -277,11 +277,11 @@ function getLicenceHeader($user, $langs, $now) * Actions */ -if ($dirins && $action == 'initmodule' && $modulename /* && $user->hasRight("modulebuilder", "run") // already checked */) { - $modulename = ucfirst($modulename); // Force first letter in uppercase +if ($dirins && $action == 'initmodule' && $modulename) { // permissions already checked + $modulename = dol_string_nounprintableascii(dol_string_unaccent(ucwords($modulename))); // Force first letter in uppercase $destdir = '/not_set/'; - if (preg_match('/[^a-z0-9_]/i', $modulename)) { + if (preg_match('/[^a-z0-9]/i', $modulename)) { $error++; setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); } @@ -1078,15 +1078,15 @@ if ($dirins && $action == 'confirm_removefile' && !empty($module) /* && $user->h } // Init an object -if ($dirins && $action == 'initobject' && $module && $objectname /* && $user->hasRight("modulebuilder", "run") // already checked */) { +if ($dirins && $action == 'initobject' && $module && $objectname) { // Permissions already checked $warning = 0; - $objectname = ucfirst($objectname); + $objectname = dol_string_nounprintableascii(dol_string_unaccent(ucwords($objectname))); // Force first letter in uppercase $dirins = $dirread = $listofmodules[strtolower($module)]['moduledescriptorrootpath']; $moduletype = $listofmodules[strtolower($module)]['moduletype']; - if (preg_match('/[^a-z0-9_]/i', $objectname)) { + if (preg_match('/[^a-z0-9]/i', $objectname)) { $error++; setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); $tabobj = 'newobject'; @@ -3505,13 +3505,13 @@ if ($module == 'initmodule') { print '
'; print ''.$langs->trans("EditorName").''; print '
'; - print '
'; + print '
'; print '
'; print '
'; print ''.$langs->trans("EditorUrl").''; print '
'; - print '
'; + print '
'; print '
'; print ''; // End div tagtable @@ -3684,6 +3684,16 @@ if ($module == 'initmodule') { // List of setup pages $listofsetuppages = dol_dir_list($realpathofmodule.'/admin', 'files', 0, '\.php$'); foreach ($listofsetuppages as $setuppage) { + // If this is a page for extrafields setup of an object + $reg = array(); + if (preg_match('/^([a-z]+)_extrafields.php/', $setuppage['relativename'], $reg)) { + // Check that object has $isextrafieldmanaged property set. If not, we should not show this file. + $fileofclass = $realpathofmodule.'/class/'.$reg[1].'.class.php'; + if (is_readable($fileofclass) && !preg_match('/public\s+\$isextrafieldmanaged\s+=\s+1/', file_get_contents($fileofclass))) { + continue; + } + } + //var_dump($setuppage); print ''; print ' '; From fb62d76423a76501a3e45af215ff69d70264e0df Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 May 2026 17:38:27 +0200 Subject: [PATCH 30/79] spellcheck war --- htdocs/modulebuilder/index.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 3cbc7eae099..be07363333a 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -3760,7 +3760,7 @@ if ($module == 'initmodule') { print $langs->trans("Description"); print ''; if ($action == 'edit_moduledescription' && GETPOST('keydescription', 'alpha') === 'desc') { - print ''; + print ''; print ''; print ''; } else { @@ -3831,7 +3831,7 @@ if ($module == 'initmodule') { print $langs->trans("Picto"); print ''; if ($action == 'edit_modulepicto' && GETPOST('keydescription', 'alpha') === 'picto') { - print ''; + print ''; print $form->textwithpicto('', $langs->trans("Example").': fa-file, fa-globe, ... any font awesome code.
Advanced syntax is fa-fakey[_faprefix[_facolor[_fasize]]] where faprefix can be far,far, facolor can be a text like \'red\' orvalue like \'#FF0000\' and fasize is CSS font size like \'1em\''); @@ -3854,7 +3854,7 @@ if ($module == 'initmodule') { print $langs->trans("EditorName"); print ''; if ($action == 'edit_moduledescription' && GETPOST('keydescription', 'alpha') === 'editor_name') { - print ''; + print ''; print ''; print ''; } else { @@ -3867,7 +3867,7 @@ if ($module == 'initmodule') { print $langs->trans("EditorUrl"); print ''; if ($action == 'edit_moduledescription' && GETPOST('keydescription', 'alpha') === 'editor_url') { - print ''; + print ''; print ''; print ''; } else { From 11be7af8404227bec0c2675db268d172be78061f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 May 2026 21:21:24 +0200 Subject: [PATCH 31/79] Trans --- htdocs/modulebuilder/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index be07363333a..e63dd263fdc 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -3610,7 +3610,7 @@ if ($module == 'initmodule') { $h++; $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=exportimport&module='.$module.($forceddirread ? '@'.$dirread : ''); - $head2[$h][1] = $langs->trans("Export").'-'.$langs->trans("Import"); + $head2[$h][1] = $langs->trans("ImportExportProfiles"); $head2[$h][2] = 'exportimport'; $h++; From 535e24e28fbe6497da08da75fa97247ef3bfa50d Mon Sep 17 00:00:00 2001 From: hansemschnokeloch Date: Wed, 6 May 2026 22:32:21 +0200 Subject: [PATCH 32/79] Update Transifex link in CONTRIBUTING.md (#38109) --- .github/CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 52c6b416c76..e761ad819aa 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -187,7 +187,7 @@ Translations ------------ The source language (en_US) is maintained in the repository. -All other translations are managed online at [Transifex](https://www.transifex.com/dolibarr-association/dolibarr/). +All other translations are managed online at [Transifex](https://explore.transifex.com/dolibarr-association/). Translations done on transifex are available in the next major release. From 45a4fd3ed00d40b94e716d44eb6e10c526b31222 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 6 May 2026 22:33:06 +0200 Subject: [PATCH 33/79] FIX Phan (#38102) * FIX Phan * FIX phpstan * FIX Phan --- .../compta/prelevement/class/bonprelevement.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 787d5aadc91..c64277b372f 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -350,7 +350,7 @@ class BonPrelevement extends CommonObject * @param string $bic BIC used * @param string $iban IBAN used * @param string $rum RUM - * @param string $id_prelevement_demande ID of debit or credit request + * @param int $id_prelevement_demande ID of debit or credit request * @return int >0 if OK, <0 if KO */ public function addWithdrawDetail($invoice_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $type = 'debit-order', $sourcetype = '', $bic = '', $iban = '', $rum = '', $id_prelevement_demande = 0) @@ -418,7 +418,7 @@ class BonPrelevement extends CommonObject * @param string $bic BIC used * @param string $iban IBAN used * @param string $rum RUM used - * @param string $id_prelevement_demande ID of debit or credit request + * @param int $id_prelevement_demande ID of debit or credit request * @return int >0 if OK, <0 if KO */ public function addline(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $sourcetype = '', $bic = '', $iban = '', $rum = '', $id_prelevement_demande = 0) @@ -427,7 +427,7 @@ class BonPrelevement extends CommonObject $concat = getDolGlobalInt('MAIN_MODULE_PRELEVEMENT_CONCAT'); // ??? what is this for. Seems not used. if ($concat == 1) { - /* + /** * @deprecated. This code can't work because code_... fields are empty. Not used. To remove. * We aggregate the lines. */ @@ -1994,7 +1994,7 @@ class BonPrelevement extends CommonObject $daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec); $iban = dolDecrypt($obj->iban); - $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, '', '', '', $obj->somme, $obj->reffac, $obj->idfac, $iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type); + $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, '', '', '', $obj->somme, $obj->reffac, $obj->idfac, $iban, $obj->bic, $daterum, (string) $obj->drum, $obj->rum, $type); $this->total += $obj->somme; $i++; @@ -2181,7 +2181,7 @@ class BonPrelevement extends CommonObject $refobj = "SAL" . $obj->idfac; } - $fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, '', '', '', $obj->somme, $refobj, $obj->idfac, $iban, $bic, $daterum, $drum, $rum, $type, $obj->fac_ref_supplier); + $fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, '', '', '', $obj->somme, $refobj, $obj->idfac, $iban, $bic, $daterum, (string) $drum, $rum, $type, $obj->fac_ref_supplier); $this->total += $obj->somme; $i++; From 3fa5112ca8e67538355e11385fdb1fa8a1967f5f Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Wed, 6 May 2026 22:36:24 +0200 Subject: [PATCH 34/79] FIX #37649 (#38101) * Update fournisseur.orderline.class.php * Update fournisseur.commande.class.php * Update fournisseur.commande.class.php * Update fournisseur.commande.class.php * Update fournisseur.commande.class.php * Update fournisseur.commande.class.php * Update fournisseur.commande.class.php --- .../class/fournisseur.commande.class.php | 43 ++++++++++++------- .../class/fournisseur.orderline.class.php | 9 ++-- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 502a50a62b4..b1f56024031 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -17,6 +17,7 @@ * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 William Mead * Copyright (C) 2025 Noé Cendrier + * Copyright (C) 2026 Pierre Ardoin * * 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 @@ -1693,30 +1694,30 @@ class CommandeFournisseur extends CommonOrder // This include test on qty if option SUPPLIER_ORDER_WITH_NOPRICEDEFINED is not set $result = $this->addline( - $line->desc, - $line->subprice, - $line->qty, + (string) $line->desc, + (float) $line->subprice, + (float) $line->qty, $line->tva_tx, - $line->localtax1_tx, - $line->localtax2_tx, - $line->fk_product, + (float) $line->localtax1_tx, + (float) $line->localtax2_tx, + (int) $line->fk_product, 0, - $line->ref_supplier ? $line->ref_supplier : $line->ref_fourn, // $line->ref_fourn comes from field ref into table of lines. Value may be a ref that does not exists anymore, so we first try with value of product - $line->remise_percent, + (string) ($line->ref_supplier ? $line->ref_supplier : $line->ref_fourn), // $line->ref_fourn comes from field ref into table of lines. Value may be a ref that does not exists anymore, so we first try with value of product + (float) $line->remise_percent, 'HT', - 0, - $line->product_type, - $line->info_bits, + (float) $line->subprice_ttc, + (int) $line->product_type, + (int) $line->info_bits, 0, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, - $line->multicurrency_subprice, // pu_ht_devise - $line->origin, // origin - $line->origin_id, // origin_id - $line->rang, // rang - $line->special_code + (float) $line->multicurrency_subprice, // pu_ht_devise + (string) $line->origin, // origin + (int) $line->origin_id, // origin_id + (int) $line->rang, // rang + (int) $line->special_code ); if ($result < 0) { dol_syslog(get_class($this)."::create ".$this->error, LOG_WARNING); // do not use dol_print_error here as it may be a functional error @@ -2188,12 +2189,15 @@ class CommandeFournisseur extends CommonOrder $total_localtax1 = $tabprice[9]; $total_localtax2 = $tabprice[10]; $pu = $pu_ht = $tabprice[3]; + $pu_tva = $tabprice[4]; + $pu_ttc = $tabprice[5]; // MultiCurrency $multicurrency_total_ht = $tabprice[16]; $multicurrency_total_tva = $tabprice[17]; $multicurrency_total_ttc = $tabprice[18]; $pu_ht_devise = $tabprice[19]; + $multicurrency_pu_ttc = $tabprice[21]; $localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0]; $localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2]; @@ -2223,6 +2227,8 @@ class CommandeFournisseur extends CommonOrder $this->line->product_type = $product_type; $this->line->remise_percent = $remise_percent; $this->line->subprice = (float) $pu_ht; + $this->line->subprice_ttc = (float) $pu_ttc; + $this->line->rang = $rang; $this->line->info_bits = $info_bits; @@ -2246,6 +2252,7 @@ class CommandeFournisseur extends CommonOrder $this->line->fk_multicurrency = $this->fk_multicurrency; $this->line->multicurrency_code = $this->multicurrency_code; $this->line->multicurrency_subprice = (float) $pu_ht_devise; + $this->line->multicurrency_subprice_ttc = (float) $multicurrency_pu_ttc; $this->line->multicurrency_total_ht = (float) $multicurrency_total_ht; $this->line->multicurrency_total_tva = (float) $multicurrency_total_tva; $this->line->multicurrency_total_ttc = (float) $multicurrency_total_ttc; @@ -3178,6 +3185,7 @@ class CommandeFournisseur extends CommonOrder $multicurrency_total_tva = $tabprice[17]; $multicurrency_total_ttc = $tabprice[18]; $pu_ht_devise = $tabprice[19]; + $multicurrency_pu_ttc = $tabprice[21]; $localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0]; $localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2]; @@ -3219,6 +3227,7 @@ class CommandeFournisseur extends CommonOrder $this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2]; $this->line->remise_percent = $remise_percent; $this->line->subprice = (float) $pu_ht; + $this->line->subprice_ttc = (float) $pu_ttc; $this->line->info_bits = $info_bits; $this->line->total_ht = (float) $total_ht; $this->line->total_tva = (float) $total_tva; @@ -3238,11 +3247,13 @@ class CommandeFournisseur extends CommonOrder $this->line->fk_multicurrency = $this->fk_multicurrency; $this->line->multicurrency_code = $this->multicurrency_code; $this->line->multicurrency_subprice = (float) $pu_ht_devise; + $this->line->multicurrency_subprice_ttc = (float) $multicurrency_pu_ttc; $this->line->multicurrency_total_ht = (float) $multicurrency_total_ht; $this->line->multicurrency_total_tva = (float) $multicurrency_total_tva; $this->line->multicurrency_total_ttc = (float) $multicurrency_total_ttc; $this->line->subprice = (float) $pu_ht; + $this->line->subprice_ttc = (float) $pu_ttc; $this->line->price = $this->line->subprice; $this->line->remise_percent = $remise_percent; diff --git a/htdocs/fourn/class/fournisseur.orderline.class.php b/htdocs/fourn/class/fournisseur.orderline.class.php index fd0e91b3556..2a05385a435 100644 --- a/htdocs/fourn/class/fournisseur.orderline.class.php +++ b/htdocs/fourn/class/fournisseur.orderline.class.php @@ -15,7 +15,8 @@ * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2024 Solution Libre SAS * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 William Mead + * Copyright (C) 2024 William Mead + * Copyright (C) 2026 Pierre Ardoin * * 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 @@ -194,6 +195,7 @@ class CommandeFournisseurLigne extends CommonOrderLine $this->ref_fourn = $objp->ref_supplier; $this->ref_supplier = $objp->ref_supplier; $this->subprice = $objp->subprice; + $this->subprice_ttc = $objp->subprice_ttc; $this->tva_tx = $objp->tva_tx; $this->localtax1_tx = $objp->localtax1_tx; $this->localtax2_tx = $objp->localtax2_tx; @@ -252,6 +254,7 @@ class CommandeFournisseurLigne extends CommonOrderLine $this->extraparams = !empty($objp->extraparams) ? (array) json_decode($objp->extraparams, true) : array(); $this->multicurrency_subprice = $objp->multicurrency_subprice; + $this->multicurrency_subprice_ttc = $objp->multicurrency_subprice_ttc; $this->multicurrency_total_ht = $objp->multicurrency_total_ht; $this->multicurrency_total_tva = $objp->multicurrency_total_tva; $this->multicurrency_total_ttc = $objp->multicurrency_total_ttc; @@ -347,7 +350,7 @@ class CommandeFournisseurLigne extends CommonOrderLine $sql = 'INSERT INTO '.$this->db->prefix().$this->table_element; $sql .= " (fk_commande, label, description, date_start, date_end,"; $sql .= " fk_product, product_type, special_code, rang,"; - $sql .= " qty, vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, remise_percent, subprice, ref,"; + $sql .= " qty, vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, remise_percent, subprice, subprice_ttc, ref,"; $sql .= " total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_unit,"; $sql .= " fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc,"; $sql .= " fk_parent_line)"; @@ -369,7 +372,7 @@ class CommandeFournisseurLigne extends CommonOrderLine $sql .= " ".price2num($this->localtax2_tx).","; $sql .= " '".$this->db->escape($this->localtax1_type)."',"; $sql .= " '".$this->db->escape($this->localtax2_type)."',"; - $sql .= " ".((float) $this->remise_percent).", ".price2num($this->subprice, 'MU').", '".$this->db->escape($this->ref_supplier)."',"; + $sql .= " ".((float) $this->remise_percent).", ".price2num($this->subprice, 'MU').", ".price2num($this->subprice_ttc, 'MU').", '".$this->db->escape($this->ref_supplier)."',"; $sql .= " ".price2num($this->total_ht).","; $sql .= " ".price2num($this->total_tva).","; $sql .= " ".price2num($this->total_localtax1).","; From fb4e2802e2a3f506b20d79b54d2cb099c3f58e2c Mon Sep 17 00:00:00 2001 From: Marcello Galvan Date: Wed, 6 May 2026 16:53:40 -0400 Subject: [PATCH 35/79] Update SECURITY.md (#38091) fix typo oncludes > includes --- SECURITY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SECURITY.md b/SECURITY.md index d84cc15691c..6c3d91aaeff 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -66,7 +66,7 @@ Reports are processed around once a month. ONLY vulnerabilities discovered, when the following setup on test platform is used, are "valid": * The version to analyze must be the last version available in the "develop" branch. Also, reports on vulnerabilities already fixed (so already reported) in the develop branch will not be validated. -* Installation must be done properly for a production usage. This oncludes: +* Installation must be done properly for a production usage. This includes: ** creation of the install.lock in the last step of installation process. ** $dolibarr_main_prod must be set to 1 in conf.php ** $dolibarr_nocsrfcheck must be kept to the value 0 in conf.php (this is the default value) From a9556198939c4d2d540b2936f8fac2c110be9795 Mon Sep 17 00:00:00 2001 From: atm-corentin <165782689+atm-corentin@users.noreply.github.com> Date: Wed, 6 May 2026 22:55:18 +0200 Subject: [PATCH 36/79] Fix API token lookup with OAuth token table (#38082) * v22 standaloen * Fix postNewMessage() return type annotations * improvement --- htdocs/api/class/api_access.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index fce4735e554..6fa512b6d33 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -150,7 +150,7 @@ class DolibarrApiAccess implements iAuthenticate } } else { if (isModEnabled('multicompany') && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && defined("DOLENTITY")) { - $sql = "SELECT u.login, u.datec, u.api_key as use_api, oat.tokenstring as api_key, oat.entity as token_entity, rowid as token_rowid,"; + $sql = "SELECT u.login, u.datec, u.api_key as use_api, oat.tokenstring as api_key, oat.entity as token_entity, oat.rowid as token_rowid,"; $sql .= " oat.tms as date_modification,"; $sql .= " gu.entity"; $sql .= " FROM ".$this->db->prefix()."oauth_token AS oat"; @@ -161,7 +161,7 @@ class DolibarrApiAccess implements iAuthenticate $sql .= " AND gu.entity = oat.entity"; $sql .= " AND oat.service = 'dolibarr_rest_api'"; } else { - $sql = "SELECT u.login, u.datec, u.api_key as use_api, u.entity, oat.tokenstring as api_key, oat.entity as token_entity, rowid as token_rowid,"; + $sql = "SELECT u.login, u.datec, u.api_key as use_api, u.entity, oat.tokenstring as api_key, oat.entity as token_entity, oat.rowid as token_rowid,"; $sql .= " oat.tms as date_modification"; $sql .= " FROM ".$this->db->prefix()."oauth_token AS oat"; $sql .= " JOIN ".$this->db->prefix()."user AS u ON u.rowid = oat.fk_user"; From 91bffecfe36ffc58c42d66992e34fb985c32b5b0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 May 2026 09:36:02 +0200 Subject: [PATCH 37/79] Fix travis --- htdocs/modulebuilder/index.php | 4 ++-- test/phpunit/CodingPhpTest.php | 5 +++-- test/phpunit/CommonClassTest.class.php | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index e63dd263fdc..742d880f577 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -277,7 +277,7 @@ function getLicenceHeader($user, $langs, $now) * Actions */ -if ($dirins && $action == 'initmodule' && $modulename) { // permissions already checked +if ($dirins && $action == 'initmodule' && $modulename) { // Test on permission already done $modulename = dol_string_nounprintableascii(dol_string_unaccent(ucwords($modulename))); // Force first letter in uppercase $destdir = '/not_set/'; @@ -1078,7 +1078,7 @@ if ($dirins && $action == 'confirm_removefile' && !empty($module) /* && $user->h } // Init an object -if ($dirins && $action == 'initobject' && $module && $objectname) { // Permissions already checked +if ($dirins && $action == 'initobject' && $module && $objectname) { // Test on permission already done $warning = 0; $objectname = dol_string_nounprintableascii(dol_string_unaccent(ucwords($objectname))); // Force first letter in uppercase diff --git a/test/phpunit/CodingPhpTest.php b/test/phpunit/CodingPhpTest.php index 78c334287e5..67ccf462e16 100644 --- a/test/phpunit/CodingPhpTest.php +++ b/test/phpunit/CodingPhpTest.php @@ -795,9 +795,10 @@ class CodingPhpTest extends CommonClassTest && !preg_match('/not required/i', $val[0])) { $ok = false; - var_dump($file['fullname'].' '.$val[0].' '.$filecontentaction);exit; + // Uncomment this for a scan on one given file + //var_dump($file['fullname'].' '.$val[0].' '.$filecontentaction);exit; - print "File ".$file['relativename']." - Line: ".$val[0]."\n"; + print "\nError on file ".$file['relativename']." - Line: ".$val[0]."\n"; break; } } diff --git a/test/phpunit/CommonClassTest.class.php b/test/phpunit/CommonClassTest.class.php index 7e9a3118f7b..205b2c89810 100644 --- a/test/phpunit/CommonClassTest.class.php +++ b/test/phpunit/CommonClassTest.class.php @@ -236,7 +236,7 @@ abstract class CommonClassTest extends TestCase echo $line . "\n"; } } else { - echo "Error: File $logFile does not exist or is not readable.\n"; + echo "File $logFile does not exist or is not readable.\n"; } } From c48bf45f7eba3b180f968f6e238f2101296d3363 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 May 2026 09:59:49 +0200 Subject: [PATCH 38/79] NEW Add MAIN_FORCE_SYSTEM_MESSAGE Renamed hook "info_admin" into "messageOfTheDay" --- ChangeLog | 2 +- htdocs/index.php | 59 ++++++++++++++++++++++++++++++++---------------- 2 files changed, 40 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index edc1c0a139d..0984eefc439 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,7 +25,7 @@ The following changes may create regressions for some external modules, but were * Login API are off by default (API must be used with the bearer token). Must set API_ENABLE_LOGIN_API to have them enabled. * Renamed hidden var DEPOSIT_AS_CREDIT_AVAILABLE_EVEN_UNPAID into DEPOSIT_CAN_BE_CONVERTED_AS_AVAILABLE_CREDIT_EVEN_IF_NOT_YET_PAID * The substitution variable __MYCOUNTRY_ID__ has been removed (duplicate of standard __MYCOMPANY_COUNTRY_ID__). - +* Renamed hook "info_admin" into "messageOfTheDay". ***** ChangeLog for 23.0.3 compared to 23.0.2 ***** diff --git a/htdocs/index.php b/htdocs/index.php index af3a81727bf..eae58613c38 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -95,6 +95,7 @@ llxHeader('', $title); $resultboxes = FormOther::getBoxesArea($user, "0"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb) +// Show the user message of the day (MOTD) if (getDolGlobalString('MAIN_MOTD')) { $motd = preg_replace('//i', '
', getDolGlobalString('MAIN_MOTD')); @@ -113,15 +114,25 @@ if (getDolGlobalString('MAIN_MOTD')) { * Show specific warnings */ -// Specific warning to propose to upgrade invoice situation to progressive mode -/* -if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) { - $langs->loadLangs(array("admin")); - print info_admin($langs->trans("WarningExperimentalFeatureInvoiceSituationNeedToUpgradeToProgressiveMode", 'https://partners.dolibarr.org')); - //print "
"; -} -*/ +// Specific warning for legal announcement +if (getDolGlobalString('MAIN_FORCE_SYSTEM_MESSAGE')) { + $langs->loadLangs(array("other")); + $messagetoshow = $langs->trans(getDolGlobalString('MAIN_FORCE_SYSTEM_MESSAGE')); + $messagetoshow = info_admin($messagetoshow, 0, 0, 'warning', 'clearboth'); + $tmpobject = new stdClass(); + $parameters = array('type' => 'MAIN_FORCE_SYSTEM_MESSAGE'); + $reshook = $hookmanager->executeHooks('messageOfTheDay', $parameters, $tmpobject, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook == 0) { + $messagetoshow .= $hookmanager->resPrint; + } + if ($messagetoshow) { // $message is an HTML string. + print ''; + print dol_string_onlythesehtmltags($messagetoshow, 1, 0, 0, 0, array('a', 'div', 'span', 'b')); + } +} + +// Specific warning to recommend upgrade if (getDolGlobalString('MAIN_FORCE_UPGRADE_MESSAGE') || getDolGlobalString('MAIN_FORCE_UPGRADE_URL')) { $langs->loadLangs(array("other")); if (is_numeric(getDolGlobalString('MAIN_FORCE_UPGRADE_MESSAGE'))) { @@ -132,9 +143,19 @@ if (getDolGlobalString('MAIN_FORCE_UPGRADE_MESSAGE') || getDolGlobalString('MAIN if (getDolGlobalString('MAIN_FORCE_UPGRADE_URL')) { $messagetoshow .= '
'.getDolGlobalString('MAIN_FORCE_UPGRADE_URL').''; } - print info_admin($messagetoshow, 0, 0, 'warning', 'clearboth'); + $messagetoshow = info_admin($messagetoshow, 0, 0, 'warning', 'clearboth'); + print dol_string_onlythesehtmltags($messagetoshow, 1, 0, 0, 0, array('div', 'span', 'b')); } +// Specific warning to propose to upgrade invoice situation to progressive mode +/* +if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) { + $langs->loadLangs(array("admin")); + print info_admin($langs->trans("WarningExperimentalFeatureInvoiceSituationNeedToUpgradeToProgressiveMode", 'https://partners.dolibarr.org')); + //print "
"; +} +*/ + /* * Show security warnings @@ -142,14 +163,14 @@ if (getDolGlobalString('MAIN_FORCE_UPGRADE_MESSAGE') || getDolGlobalString('MAIN // Security warning if install.lock file is missing or if conf file is writable if (!getDolGlobalString('MAIN_REMOVE_INSTALL_WARNING')) { - $message = ''; + $messagetoshow = ''; // Check if install lock file is present $lockfile = DOL_DATA_ROOT.'/install.lock'; if (!empty($lockfile) && !file_exists($lockfile) && is_dir(DOL_DOCUMENT_ROOT."/install")) { $langs->load("errors"); //if (!empty($message)) $message.='
'; - $message .= info_admin($langs->transnoentities("WarningLockFileDoesNotExists", DOL_DATA_ROOT).' '.$langs->transnoentities("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, 'warning', 'clearboth'); + $messagetoshow .= info_admin($langs->transnoentities("WarningLockFileDoesNotExists", DOL_DATA_ROOT).' '.$langs->transnoentities("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, 'warning', 'clearboth'); } // Conf files must be in read only mode @@ -163,21 +184,19 @@ if (!getDolGlobalString('MAIN_REMOVE_INSTALL_WARNING')) { // @phpstan-ignore-next-line if (is_writable($conffile)) { $langs->load("errors"); - $message .= info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly").' '.$langs->transnoentities("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, 'warning', 'clearboth'); + $messagetoshow .= info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly").' '.$langs->transnoentities("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, 'warning', 'clearboth'); } } - $object = new stdClass(); - $parameters = array(); - $reshook = $hookmanager->executeHooks('infoadmin', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks + $tmpobject = new stdClass(); + $parameters = array('type' => 'MAIN_REMOVE_INSTALL_WARNING'); + $reshook = $hookmanager->executeHooks('messageOfTheDay', $parameters, $tmpobject, $action); // Note that $action and $object may have been modified by some hooks if ($reshook == 0) { - $message .= $hookmanager->resPrint; + $messagetoshow .= $hookmanager->resPrint; } - if ($message) { // $message is an HTML string. + if ($messagetoshow) { // $message is an HTML string. print ''; - print dol_string_onlythesehtmltags($message, 1, 0, 0, 0, array('div', 'span', 'b')); - //print '
'; - //print info_admin($langs->trans("WarningUntilDirRemoved",DOL_DOCUMENT_ROOT."/install")); + print dol_string_onlythesehtmltags($messagetoshow, 1, 0, 0, 0, array('div', 'span', 'b')); } } From 98c41e0f612d140b7ecf19601c9de93d23455d1a Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 7 May 2026 10:00:29 +0200 Subject: [PATCH 39/79] Qual: Ignore PhanPluginConstantVariableNull (#38087) # Qual: Ignore PhanPluginConstantVariableNull It's ok to pass variable with null. Co-authored-by: Laurent Destailleur --- htdocs/quickmemo/class/memo.class.php | 51 ++++++++++++++++----------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/htdocs/quickmemo/class/memo.class.php b/htdocs/quickmemo/class/memo.class.php index 07e4a188b7f..c291d5a003e 100644 --- a/htdocs/quickmemo/class/memo.class.php +++ b/htdocs/quickmemo/class/memo.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2023-2026 Frédéric France * Copyright (C) 2026 John BOTELLA + * Copyright (C) 2026 MDW * * 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 @@ -1237,7 +1238,7 @@ class Memo extends CommonObject * @param mixed $color the color to check * @return bool */ - static public function checkColor($color) + public static function checkColor($color) { if (!is_string($color)) { return false; @@ -1255,7 +1256,7 @@ class Memo extends CommonObject * * @return string[] */ - static public function getColorPreset() + public static function getColorPreset() { $colorsConf = getDolGlobalString('QUICKMEMO_COLORS_PRESET'); @@ -1311,7 +1312,7 @@ class Memo extends CommonObject $hookmanager->initHooks(array($staticMemo->element.'dao')); $parameters = array( - 'memoContext' =>& $memoContext + 'memoContext' => & $memoContext ); $reshook = $hookmanager->executeHooks('getMemoContext', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks @@ -1329,7 +1330,7 @@ class Memo extends CommonObject * * @return void */ - static public function completeMemoContextMapping(array &$contextTabMapping, string $tabContext, string $dolibarrContext = '') + public static function completeMemoContextMapping(array &$contextTabMapping, string $tabContext, string $dolibarrContext = '') { $dolibarrContext = trim($dolibarrContext) ?: $tabContext; @@ -1401,7 +1402,9 @@ class Memo extends CommonObject $commonCardContext = ['document', 'agenda', 'contactcard', 'stats']; // for common object $modules = ['order', 'propal', 'invoice', 'supplier_proposal', 'supplier_order', 'supplier_invoice', 'contract', 'product', 'shipping']; foreach ($modules as $module) { - if (!isModEnabled($module) && $onlyActiveModules) { continue; } + if (!isModEnabled($module) && $onlyActiveModules) { + continue; + } $moduleClean = str_replace('_', '', $module); @@ -1423,7 +1426,7 @@ class Memo extends CommonObject $staticMemo = new self($db); $hookmanager->initHooks(array($staticMemo->element.'dao')); $parameters = array( - 'contextTabMapping' =>& $contextTabMapping, + 'contextTabMapping' => & $contextTabMapping, 'onlyActiveModules' => $onlyActiveModules ); @@ -1451,9 +1454,9 @@ class Memo extends CommonObject $staticMemo = new self($db); $hookmanager->initHooks(array($staticMemo->element.'dao')); $parameters = array( - 'list' =>& $list + 'list' => & $list ); - $object = null; + $object = null; // @phan-suppress-next-line PhanPluginConstantVariableNull $reshook = $hookmanager->executeHooks('getAvailableMemoContext', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $list = $hookmanager->resArray; @@ -1462,9 +1465,15 @@ class Memo extends CommonObject // Security check $result = []; foreach ($list as $k => $v) { - if (!is_string($v)) { continue; } - if (strlen($v) > 64) { continue; } - if (preg_match('/^[a-zA-Z0-9_]+$/', $k) !== 1) { continue; } + if (!is_string($v)) { + continue; + } + if (strlen($v) > 64) { + continue; + } + if (preg_match('/^[a-zA-Z0-9_]+$/', $k) !== 1) { + continue; + } $result[] = $v; } @@ -1495,8 +1504,8 @@ class Memo extends CommonObject AND (m.private = 0 OR m.fk_user_creat = '.(int) $user->id.') '; - if ((int) $id > 0 ) { - $sql.= ' AND m.rowid = ' . (int) $id; + if ((int) $id > 0) { + $sql .= ' AND m.rowid = ' . (int) $id; } $obj = $this->db->getRow($sql); @@ -1534,11 +1543,11 @@ class Memo extends CommonObject AND (COALESCE(m.private, 0) = 0 OR m.fk_user_creat = '.(int) $user->id.') '; - if ((int) $id > 0 ) { - $sql.= ' AND m.rowid = ' . (int) $id; + if ((int) $id > 0) { + $sql .= ' AND m.rowid = ' . (int) $id; } - $sql.= ' ORDER BY COALESCE(mu.pos_z, m.pos_z) ASC'; + $sql .= ' ORDER BY COALESCE(mu.pos_z, m.pos_z) ASC'; return $sql; } @@ -1572,11 +1581,11 @@ class Memo extends CommonObject //$sql.= ' AND (m.context_tab = \''.$this->db->escape($context_tab).'\' OR m.element_type = \'\' ) '; } - if ((int) $id > 0 ) { - $sql.= ' AND m.rowid = ' . (int) $id; + if ((int) $id > 0) { + $sql .= ' AND m.rowid = ' . (int) $id; } - $sql.= " ORDER BY m.rank_tpl DESC, m.rowid ASC "; // Due to multiple type of sort panel rank_tpl is reversed higher is first and rowid ASC to keep last add is last + $sql .= " ORDER BY m.rank_tpl DESC, m.rowid ASC "; // Due to multiple type of sort panel rank_tpl is reversed higher is first and rowid ASC to keep last add is last return $sql; } @@ -1629,7 +1638,7 @@ class Memo extends CommonObject return false; } - if (defined('NOREQUIRETRAN') || empty($user) || empty($user->id) || (int) $user->socid> 0 ) { + if (defined('NOREQUIRETRAN') || empty($user) || empty($user->id) || (int) $user->socid > 0) { return false; } @@ -1727,7 +1736,7 @@ class Memo extends CommonObject * * @return stdClass */ - static public function getJsMemoDefault() + public static function getJsMemoDefault() { $memo = new stdClass(); $memo->id = null; From b9507a980cfa3c7c2185fa3f116f44fef5d21688 Mon Sep 17 00:00:00 2001 From: Sylvain Legrand Date: Thu, 7 May 2026 11:04:41 +0300 Subject: [PATCH 40/79] Fix: scope file picker click to the just-shown attach-new-file form (#38114) In FormFile::list_of_documents(), when the user clicks the "+ New" button to reveal the upload form (showhideaddbutton), the JS handler triggers jQuery("input[type='file']").click(). This selector matches every on the page, opening the OS file picker once per match. Users with multiple file inputs in the DOM (e.g. another hidden upload form, an editor's media browser, modules with their own attachers) have to dismiss the file dialog several times before being able to drag-drop or browse normally. Fix: scope the selector to the form that was just shown: - jQuery("input[type='file']").click(); + jQuery(".divattachnewfile input[type='file']").first().click(); No regression on pages with a single .divattachnewfile. Reproduces on any *document.php tab where a hidden second is present. --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 2bce5a5b04d..1af0195dfea 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1407,7 +1407,7 @@ class FormFile // Show title of list of existing files $morehtmlright = ''; if (!empty($moreoptions['showhideaddbutton']) && $conf->use_javascript_ajax) { - $tmpurlforbutton = 'javascript:console.log("open add file form");jQuery(".divattachnewfile").toggle(); if (!jQuery(".divattachnewfile").is(":hidden")) { jQuery("input[type=\'file\']").click();}void(0);'; + $tmpurlforbutton = 'javascript:console.log("open add file form");jQuery(".divattachnewfile").toggle(); if (!jQuery(".divattachnewfile").is(":hidden")) { jQuery(".divattachnewfile input[type=\'file\']").first().click();}void(0);'; // scope file picker click to the just-shown form to avoid triggering native file dialog twice when other input[type=file] exist on the page $morehtmlright .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $tmpurlforbutton, '', $permtoeditline); } From 82f2d9f5749d1dc02af7d2e9b21ecb2df40746e5 Mon Sep 17 00:00:00 2001 From: hansemschnokeloch Date: Thu, 7 May 2026 10:05:17 +0200 Subject: [PATCH 41/79] Update link for European directives in README (#38115) Fix 404 error --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8a2a5e2f823..583a62a6c18 100644 --- a/README.md +++ b/README.md @@ -205,7 +205,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Argentina invoice numbering using A,B,C... - Greece fetch customer vat details from AADE, all invoice types, MyData(external free module) - ZATCA e-invoicing QR-Code - - Compatible with [European directives](https://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE) + - Compatible with [European directives](https://commission.europa.eu/topics/taxation_en) (2006/112/CE ... 2010/45/UE) - Compatible with data privacy rules (Europe's GDPR, ...) - ... - Flexible PDF & ODT generation for invoices, proposals, orders... From 671f2fc9df47ca92c7ef6b3e9e429b1da355db11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Champlon?= <85104766+Kazimir42@users.noreply.github.com> Date: Thu, 7 May 2026 10:11:22 +0200 Subject: [PATCH 42/79] FIX : draft invoice paid when add absolute discount == remain to pay (#38104) * Fix set paid invoice on status draft when add absolute discount == remain to pay * fix --- htdocs/compta/facture/card.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index f3535de1d66..111ae3a6a40 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -676,9 +676,11 @@ if (empty($reshook)) { } if (!$error) { - $newremaintopay = $object->getRemainToPay(0); - if ($newremaintopay == 0) { - $object->setPaid($user); + if ($object->status == Facture::STATUS_VALIDATED) { + $newremaintopay = $object->getRemainToPay(0); + if ($newremaintopay == 0) { + $object->setPaid($user); + } } } } From 15938ed9195c2f1c8ff0b25f0ce43447c9ec081f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 May 2026 10:24:31 +0200 Subject: [PATCH 43/79] CI --- .../core/tpl/document_actions_post_headers.tpl.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php index 0f1b77c39b1..1a6ef709f61 100644 --- a/htdocs/core/tpl/document_actions_post_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php @@ -29,20 +29,22 @@ /** * @var Conf $conf - * @var CommonObject $object * @var DoliDB $db * @var Form $form * @var HookManager $hookmanager * @var Translate $langs * + * @var CommonObject $object * @var FormFile $formfile * @var string $action * @var string $modulepart * @var string $upload_dir * @var string $param - * @var string $moreparam = param to add to download link for the form_attach_new_file function + * @var string $moreparam Param to add to download link for the form_attach_new_file function + * @var string $sortfield + * @var string $sortorder * @var string $relativepathwithnofile - * @var int $permisstiontoadd Permission or not to add a file (can use also $permission) and permission or not to edit file name or crop file (can use also $permtoedit) + * @var int $permissiontoadd Permission or not to add a file (can use also $permission) and permission or not to edit file name or crop file (can use also $permtoedit) * @var string $savingdocmask For example dol_sanitizeFileName($object->ref).'-__file__'; * @var int $withproject */ @@ -53,13 +55,16 @@ if (empty($langs) || !is_object($langs)) { exit(1); } ' +@phan-var-force CommonObject $object +@phan-var-force string $action +@phan-var-force string $modulepart +@phan-var-force string $upload_dir @phan-var-force array $filearray @phan-var-force ?int<0,1> $permtoedit @phan-var-force ?int<0,1> $permission @phan-var-force int<0,1> $permissiontoadd @phan-var-force ?string $savingdocmask @phan-var-force ?string $param -@phan-var-force CommonObject $object '; From b32df53be744e9d5d28c870b5672f0933c3a7eb4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 May 2026 11:23:56 +0200 Subject: [PATCH 44/79] Show debug file --- htdocs/ai/admin/setup.php | 14 ++++++++++++++ htdocs/langs/en_US/admin.lang | 2 ++ 2 files changed, 16 insertions(+) diff --git a/htdocs/ai/admin/setup.php b/htdocs/ai/admin/setup.php index 8c0f28048ac..4821952b660 100644 --- a/htdocs/ai/admin/setup.php +++ b/htdocs/ai/admin/setup.php @@ -271,6 +271,13 @@ if (getDolGlobalString("AI_API_SERVICE")) { include DOL_DOCUMENT_ROOT.'/core/tpl/formlayoutai.tpl.php'; print $out; + print '   '; + if (getDolGlobalString("AI_DEBUG")) { + print ' '.$langs->trans("DebugOnInFile", 'dolibarr_ai.log').''; + } else { + print ' '.$langs->trans("DebugOff", 'dolibarr_ai.log').''; + } + print '
'; // The div print '

'; @@ -285,6 +292,13 @@ if (getDolGlobalString("AI_API_SERVICE")) { include DOL_DOCUMENT_ROOT.'/core/tpl/formlayoutai.tpl.php'; print $out; + print '   '; + if (getDolGlobalString("AI_DEBUG")) { + print ' '.$langs->trans("DebugOnInFile", 'dolibarr_ai.log').''; + } else { + print ' '.$langs->trans("DebugOff", 'dolibarr_ai.log').''; + } + print '
'; $doleditor = new DolEditor($htmlname, '', '', 100, 'dolibarr_details'); print $doleditor->Create(1); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 0f252708f94..21b5b2faccd 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2883,3 +2883,5 @@ WebHooksSupportExternalUrlOnly=Webhooks support external URL only. Set $dolibarr DetailOfLines=Detail of lines AllFeatures=All features DataWillBeRefreshedEvery=Data will be refreshed only once every %s, instead of being recalculated at each access. +DebugOnInFile=Dedicated debug file is on (%s) +DebugOff=Dedicated debug file off From 07d282daad0d305332bb837df95ae9801169424a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 May 2026 12:11:48 +0200 Subject: [PATCH 45/79] Fix spellchecker AI tool --- htdocs/ai/admin/setup.php | 2 +- htdocs/ai/ajax/generate_content.php | 4 +++- htdocs/ai/class/ai.class.php | 11 +++++++---- htdocs/core/class/doleditor.class.php | 7 ++++++- htdocs/core/class/html.formai.class.php | 17 +++++++++++------ 5 files changed, 28 insertions(+), 13 deletions(-) diff --git a/htdocs/ai/admin/setup.php b/htdocs/ai/admin/setup.php index 4821952b660..592180b24d9 100644 --- a/htdocs/ai/admin/setup.php +++ b/htdocs/ai/admin/setup.php @@ -300,7 +300,7 @@ if (getDolGlobalString("AI_API_SERVICE")) { } print '
'; - $doleditor = new DolEditor($htmlname, '', '', 100, 'dolibarr_details'); + $doleditor = new DolEditor($htmlname, '', '', 150, 'dolibarr_details'); print $doleditor->Create(1); print ''; diff --git a/htdocs/ai/ajax/generate_content.php b/htdocs/ai/ajax/generate_content.php index bbab82b0862..b3fcaad82c1 100644 --- a/htdocs/ai/ajax/generate_content.php +++ b/htdocs/ai/ajax/generate_content.php @@ -75,7 +75,9 @@ if (is_null($jsonData)) { $ai = new Ai($db); // Get parameters -$function = empty($jsonData['function']) ? 'textgeneration' : $jsonData['function']; // Default value. Can also be 'textgeneration', 'textgenerationemail', 'textgenerationwebpage', 'imagegeneration', 'videogeneration', ... +// Default value is 'textgeneration'. +// Can also be 'textgeneration', 'textgenerationemail', 'textgenerationwebpage', 'textrephraser', 'textspellchecker', 'imagegeneration', 'videogeneration', ... +$function = empty($jsonData['function']) ? 'textgeneration' : $jsonData['function']; $format = empty($jsonData['format']) ? '' : $jsonData['format']; // Can be '' for text, 'html', ... diff --git a/htdocs/ai/class/ai.class.php b/htdocs/ai/class/ai.class.php index a64decfde96..3bd792c5e5e 100644 --- a/htdocs/ai/class/ai.class.php +++ b/htdocs/ai/class/ai.class.php @@ -58,10 +58,10 @@ class Ai const AI_DEFAULT_PROMPT_FOR_WEBPAGE = 'You are a website editor. Return all HTML content inside a section tag. Do not add explanation.'; const AI_DEFAULT_PROMPT_FOR_TEXT_TRANSLATION = 'You are a translator, answer with one and only one translation with no comment and explanation.'; const AI_DEFAULT_PROMPT_FOR_TEXT_SUMMARIZE = 'You are a writer, make the answer in the same language than the original text to summarize.'; - const AI_DEFAULT_PROMPT_FOR_TEXT_REPHRASER = 'You are a writer, give only one answer with no comment and explanation and give the answer in the same language than the original text to rephrase. If there is carriage return or line feed in original message, keep them.'; + const AI_DEFAULT_PROMPT_FOR_TEXT_SPELLCHECKER = 'You are a proofreader, write your response in the same language as the original text in order to correct spelling and grammar errors. If there is carriage return or line feed in original message, keep them. Keep also any HTML or markdown formatting without adding one, just fix spelling and grammar errors. Answer with the corrected text and only the corrected text with no comment and explanation.'; + const AI_DEFAULT_PROMPT_FOR_TEXT_REPHRASER = 'You are a writer, write your response in the same language as the original text to rephrase. Give only one answer with no comment and explanation. If there is carriage return or line feed in original message, keep them. Keep also any HTML or markdown formatting without adding one.'; const AI_DEFAULT_PROMPT_FOR_EXTRAFIELD_FILLER = 'Give only one answer with no comment and explanation, I want the text to be ready to copy and paste.'; const AI_DEFAULT_PROMPT_FOR_DOC_PARSING = 'You are an assistant to analyze documents. Return your answer with a JSON string and only a JSON string, do not add any other comment.'; - const AI_DEFAULT_PROMPT_FOR_TEXT_SPELLCHECKER = 'You are the proofreader, please write your response in the same language as the original text in order to correct spelling and grammar errors.'; /** @@ -138,7 +138,7 @@ class Ai } elseif ($function == 'thread') { $this->apiEndpoint = getDolGlobalString('AI_API_'.strtoupper($this->apiService).'_URL', $arrayofai[$this->apiService]['url']); $this->apiEndpoint .= (preg_match('/\/$/', $this->apiEndpoint) ? '' : '/').'threads'; - } else { // if $function == 'docparsing', ... + } else { // if $function == 'docparsing', 'text...', ... $this->apiEndpoint = getDolGlobalString('AI_API_'.strtoupper($this->apiService).'_URL', $arrayofai[$this->apiService]['url']); $this->apiEndpoint .= (preg_match('/\/$/', $this->apiEndpoint) ? '' : '/').'chat/completions'; } @@ -165,7 +165,7 @@ class Ai } elseif ($function == 'docparsing') { $model = getDolGlobalString('AI_API_'.strtoupper($this->apiService).'_MODEL_DOCPARSING', $arrayofai[$this->apiService][$function]['default']); } else { - // else 'textgenerationemail', 'textgenerationwebpage', 'textgeneration', 'texttranslation', 'textsummarize' + // else 'textgenerationemail', 'textgenerationwebpage', 'textgeneration', 'texttranslation', 'textsummarize', 'textrephraser', 'textspellchecker', ... $model = getDolGlobalString('AI_API_'.strtoupper($this->apiService).'_MODEL_TEXT', $arrayofai[$this->apiService]['textgeneration']['default']); } } @@ -232,6 +232,9 @@ class Ai if (empty($prePrompt) && $function == 'textrephraser') { $prePrompt = self::AI_DEFAULT_PROMPT_FOR_TEXT_REPHRASER; } + if (empty($prePrompt) && $function == 'textspellchecker') { + $prePrompt = self::AI_DEFAULT_PROMPT_FOR_TEXT_SPELLCHECKER; + } if (empty($prePrompt) && $function == 'docparsing') { $prePrompt = self::AI_DEFAULT_PROMPT_FOR_DOC_PARSING; } diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 992027435b5..752c5feff91 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -396,7 +396,12 @@ class DolEditor $out .= ' entity_encoding: "raw",'."\n"; $out .= ' protect: [/<\?[\s\S]*?\?>/g],'."\n"; // protect PHP tags like CKEditor did $out .= ' paste_data_images: true,'."\n"; - $out .= ' content_style: \'p { margin: 8px 0 8px 0; line-height: 1.4em; } .mce-content-body { margin: 10px; } \','; + $fontlist = 'arial,tahoma,verdana,helvetica'; + if (getDolGlobalString('THEME_FONT_FAMILY')) { + $fontlist = getDolGlobalString('THEME_FONT_FAMILY').', '.$fontlist; + } + + $out .= ' content_style: \'p { margin: 6px 0 6px 0; line-height: 1.4em; } .mce-content-body { font-size: 0.94em; margin: 10px; font-family: '.$fontlist.' } \','; $out .= ' toolbar_mode: "sliding",'."\n"; $out .= ' browser_spellcheck: '.(getDolGlobalString('CKEDITOR_NATIVE_SPELLCHECKER') ? 'true' : 'false').','."\n"; $out .= ' language: (tinyLang && tinyLang.indexOf("en") === 0) ? "en" : tinyLang,'."\n"; diff --git a/htdocs/core/class/html.formai.class.php b/htdocs/core/class/html.formai.class.php index 6ced2ea9cf8..e3e16ec60d2 100644 --- a/htdocs/core/class/html.formai.class.php +++ b/htdocs/core/class/html.formai.class.php @@ -207,14 +207,14 @@ class FormAI extends Form }); $('#ai_summarize".$htmlContent."_select').on('change', function() { - console.log('We change #ai_summarize".$htmlContent."_select with lang '+$(this).val()); + console.log('We change #ai_summarize".$htmlContent."_select with length '+$(this).val()); if ($(this).val() != null && $(this).val() != '' && $(this).val() != '-1') { prepareCallAIGenerator($(this)); } }); $('#ai_rephraser".$htmlContent."_select').on('change', function() { - console.log('We change #ai_summarize".$htmlContent."_select with lang '+$(this).val()); + console.log('We change #ai_summarize".$htmlContent."_select with mode '+$(this).val()); if ($(this).val() != null && $(this).val() != '' && $(this).val() != '-1') { prepareCallAIGenerator($(this)); } @@ -238,10 +238,11 @@ class FormAI extends Form instructions = ''; htmlname = '".dol_escape_js($htmlContent)."'; format = '".dol_escape_js($format)."'; - functionai = $(element).data('functionai'); /* element is the html element we have manipulated in the ai tool */ + functionai = $(element).data('functionai'); /* element is the html element we have manipulated in the ai tool */ + style = $('#ai_rephraser'+htmlname+'_select').val(); texttomodify = ''; - console.log('htmlname='+htmlname+' functionai='+functionai); + console.log('htmlname='+htmlname+' functionai='+functionai+' style='+style); if ($('#'+htmlname).is('div')) { texttomodify = $('#'+htmlname).html(); /* for div */ } else { @@ -289,8 +290,12 @@ class FormAI extends Form } instructions = 'Summarize the following text '+ (unit == 'percent' ? 'by ' : 'in') + width + ' ' + unit + ': ' + texttomodify; } else if (functionai == 'textrephraser') { - style = $('#ai_rephraser'+htmlname+'_select').val(); - instructions = 'Rephrase the following text in a '+style+' style: ' + texttomodify; + if (style == 'spellchecker') { + instructions = 'Fix spelling and grammar errors in the following text : ' + texttomodify; + functionai = 'textspellchecker'; + } else { + instructions = 'Rephrase the following text in a '+style+' style: ' + texttomodify; + } } else if (functionai == 'textgenerationextrafield'){ instructions = $(element).val(); } else { From 545916c1ee0a2c41742e6a6670211556720d9413 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 May 2026 12:18:59 +0200 Subject: [PATCH 46/79] Look and field --- htdocs/core/class/html.formai.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formai.class.php b/htdocs/core/class/html.formai.class.php index e3e16ec60d2..ef9ccbca32d 100644 --- a/htdocs/core/class/html.formai.class.php +++ b/htdocs/core/class/html.formai.class.php @@ -127,7 +127,7 @@ class FormAI extends Form } if (empty($onlyenhancements) || in_array($onlyenhancements, array('texttranslation'))) { - $out .= ($out ? '
' : ''); + $out .= ($out ? '
' : ''); $out .= '
'; $out .= img_picto('', 'language', 'class="pictofixedwidth paddingrightonly"'); $out .= $formadmin->select_language("", "ai_translation".$htmlContent."_select", 0, array(), $langs->trans("TranslateByAI").'...', 0, 0, 'minwidth250 ai_translation'.$htmlContent.'_select'); @@ -136,7 +136,7 @@ class FormAI extends Form if (empty($onlyenhancements) || in_array($onlyenhancements, array('textsummarize'))) { $summarizearray = getListForAISummarize(); - $out .= ($out ? '
' : ''); + $out .= ($out ? '
' : ''); $out .= '
'; $out .= img_picto('', 'edit', 'class="pictofixedwidth paddingrightonly"'); $out .= $form->selectarray("ai_summarize".$htmlContent."_select", $summarizearray, 0, $langs->trans("SummarizeByAI").'...', 0, 0, '', 1, 0, 0, '', 'minwidth250 ai_summarize'.$htmlContent.'_select'); @@ -145,7 +145,7 @@ class FormAI extends Form if (empty($onlyenhancements) || in_array($onlyenhancements, array('textrephrase'))) { $stylearray = getListForAIRephraseStyle(); - $out .= ($out ? '
' : ''); + $out .= ($out ? '
' : ''); $out .= '
'; $out .= img_picto('', 'edit', 'class="pictofixedwidth paddingrightonly"'); $out .= $form->selectarray("ai_rephraser".$htmlContent."_select", $stylearray, 0, $langs->trans("RephraserByAI").'...', 0, 0, '', 1, 0, 0, '', 'minwidth250 ai_rephraser'.$htmlContent.'_select'); From 17896204aea0d673b30024036606e926d65aca7b Mon Sep 17 00:00:00 2001 From: Ludon89 <116293366+ludon89@users.noreply.github.com> Date: Thu, 7 May 2026 12:55:09 +0200 Subject: [PATCH 47/79] NEW Force showing forms to add/link files in "Linked files" tab (#38100) Add setup constants to force displaying the forms to add a file or link a file to a business object Co-authored-by: Laurent Destailleur --- .../tpl/document_actions_post_headers.tpl.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php index 1a6ef709f61..72ed1486694 100644 --- a/htdocs/core/tpl/document_actions_post_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php @@ -193,6 +193,13 @@ if (getDolGlobalString('MAIN_DOCUMENTS_LIST_IN_TWOCOLUMNS')) { print '
'; print '
'; } + +// Force displaying form to attach files and documents +$showHideAddButtonValue = 1; +if (getDolGlobalInt('MAIN_DOCUMENTS_SHOW_FILE_ATTACHMENT_FORM')) { + $showHideAddButtonValue = 0; +} + // List of document $formfile->list_of_documents( $filearray, @@ -216,7 +223,7 @@ $formfile->list_of_documents( 0, -1, '', - array('afteruploadtitle' => $formToUploadAFile, 'showhideaddbutton' => 1) + array('afteruploadtitle' => $formToUploadAFile, 'showhideaddbutton' => $showHideAddButtonValue) ); if (getDolGlobalString('MAIN_DOCUMENTS_LIST_IN_TWOCOLUMNS')) { @@ -226,6 +233,12 @@ if (getDolGlobalString('MAIN_DOCUMENTS_LIST_IN_TWOCOLUMNS')) { print "
"; } +// Force displaying form to link files and documents +$showHideAddButtonValue = 1; +if (getDolGlobalInt('MAIN_DOCUMENTS_SHOW_FILE_LINKING_FORM')) { + $showHideAddButtonValue = 0; +} + //List of links $formfile->listOfLinks( $object, @@ -234,7 +247,7 @@ $formfile->listOfLinks( (string) GETPOSTINT('linkid'), $param, 'formaddlink', - array('afterlinktitle' => $formToAddALink, 'showhideaddbutton' => 1) + array('afterlinktitle' => $formToAddALink, 'showhideaddbutton' => $showHideAddButtonValue) ); if (getDolGlobalString('MAIN_DOCUMENTS_LIST_IN_TWOCOLUMNS')) { From 5b657f32bd2372d48de2f780ab3aa7f84556b909 Mon Sep 17 00:00:00 2001 From: hansemschnokeloch Date: Thu, 7 May 2026 12:57:17 +0200 Subject: [PATCH 48/79] Add anonymisation to pdf author (#38116) --- htdocs/core/class/commonpeople.class.php | 16 ++++++++++++++++ .../modules/facture/doc/pdf_sponge.modules.php | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonpeople.class.php b/htdocs/core/class/commonpeople.class.php index ac427c583e8..15567ff4147 100644 --- a/htdocs/core/class/commonpeople.class.php +++ b/htdocs/core/class/commonpeople.class.php @@ -129,6 +129,22 @@ trait CommonPeople return dol_string_nohtmltag(dol_trunc($ret, $maxlen)); } + /** + * Return full name (civility+' '+name+' '+lastname) or anonymous string + * + * @param Translate $langs Language object for translation of civility (used only if option is 1) + * @param int<0,1> $option 0=No option, 1=Add civility + * @param int<-1,5> $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname, 2=Firstname, 3=Firstname if defined else lastname, 4=Lastname, 5=Lastname if defined else firstname + * @param int $maxlen Maximum length + * @return string String with full name + */ + public function getAnonymisableFullName($langs, $option = 0, $nameorder = -1, $maxlen = 0) + { + if (getDolGlobalInt('MAIN_ANONYMIZE_USER_FULLNAME') == 1) { + return '***'; + } + return $this->getFullName($langs, $option, $nameorder, $maxlen); + } /** * Return civility label of object diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index ab1f0503fad..6586473fce3 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -379,7 +379,7 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("PdfInvoiceTitle")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($mysoc->name.($user->id > 0 ? ' - '.$outputlangs->convToOutputCharset($user->getFullName($outputlangs)) : '')); + $pdf->SetAuthor($mysoc->name.($user->id > 0 ? ' - '.$outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)) : '')); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfInvoiceTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); From 217c0b6327bfcfebc4a79363f3539c78a42049bb Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 7 May 2026 12:57:59 +0200 Subject: [PATCH 49/79] Fix memo display date (#38105) Co-authored-by: Laurent Destailleur --- htdocs/quickmemo/class/memo.class.php | 10 +++++----- htdocs/quickmemo/interface.php | 9 ++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/htdocs/quickmemo/class/memo.class.php b/htdocs/quickmemo/class/memo.class.php index c291d5a003e..5a318c874ac 100644 --- a/htdocs/quickmemo/class/memo.class.php +++ b/htdocs/quickmemo/class/memo.class.php @@ -1024,14 +1024,14 @@ class Memo extends CommonObject $return .= '
'; $return .= '
'; $return .= ' '.$this->showOutputField($this->fields['fk_user_creat'], 'fk_user_creat', $this->user_creation_id).''; - $return .= ' '.dol_print_date($this->date_creation, '%d/%m/%Y %H:%M').''; + $return .= ' '.dol_print_date($this->date_creation, '%d/%m/%Y %H:%M', 'tzuserrel').''; $return .= '
'; if (!empty($this->tms) && $this->tms != $this->date_creation) { $return .= '
'; - $return .= ' '.$langs->trans('QuickMemoModified') . ' ' .dol_print_date($this->date_modification, '%d/%m/%Y %H:%M').''; + $return .= ' '.$langs->trans('QuickMemoModified') . ' ' .dol_print_date($this->date_modification, '%d/%m/%Y %H:%M', 'tzuserrel').''; if ($this->user_modification_id != $this->user_creation_id) { $return .= ' '.$langs->trans('QuickMemoBy') . ' ' .$this->showOutputField($this->fields['fk_user_modif'], 'fk_user_modif', $this->user_modification_id).''; } @@ -1042,7 +1042,7 @@ class Memo extends CommonObject if (!empty($this->date_archived) && $this->status == self::STATUS_ARCHIVED) { $return .= '
'; - $return .= ' '.$langs->trans('QuickMemoArchived') . ' ' .dol_print_date($this->date_archived, '%d/%m/%Y %H:%M').''; + $return .= ' '.$langs->trans('QuickMemoArchived') . ' ' .dol_print_date($this->date_archived, '%d/%m/%Y %H:%M', 'tzuserrel').''; if ($this->fk_user_modif != $this->fk_user_archived) { $return .= ' '.$langs->trans('QuickMemoBy') . ' ' .$this->showOutputField($this->fields['fk_user_archived'], 'fk_user_archived', $this->fk_user_archived).''; } @@ -1704,10 +1704,10 @@ class Memo extends CommonObject $memo->shared_on_element = $this->shared_on_element; $memo->private = (int) $this->private; - $memo->date_creation = dol_print_date($this->date_creation, '%d/%m/%Y %H:%M'); + $memo->date_creation = dol_print_date($this->date_creation, '%d/%m/%Y %H:%M', 'tzuserrel'); $memo->date_change = ''; if (!empty($this->tms) && ((int) $this->date_creation !== (int) $this->tms || (int) $this->fk_user_modif > 0)) { - $memo->date_change = dol_print_date($this->tms, '%d/%m/%Y %H:%M'); + $memo->date_change = dol_print_date($this->tms, '%d/%m/%Y %H:%M', 'tzuserrel'); } $memo->fk_user_creat = $this->fk_user_creat; diff --git a/htdocs/quickmemo/interface.php b/htdocs/quickmemo/interface.php index 2c37152d0d0..3011b36182b 100644 --- a/htdocs/quickmemo/interface.php +++ b/htdocs/quickmemo/interface.php @@ -876,7 +876,7 @@ function quickMemoIntefaceActionListModels($jsonResponse) $default->shared_on_element = 0; $default->private = 0; $default->user_name = $user->getFullName($langs); - $default->date_creation = dol_print_date(dol_now()); + $default->date_creation = dol_print_date(dol_now(), '', 'tzuserrel'); $default->date_change = ''; $default->user_change_name = ''; @@ -988,10 +988,10 @@ function quickMemoInterfacePopulateMemoFromQueryObj($obj) $memo->shared_on_element = $obj->shared_on_element; $memo->private = (int) $obj->private; - $memo->date_creation = dol_print_date($obj->date_creation, '%d/%m/%Y %H:%M'); + $memo->date_creation = dol_print_date($obj->date_creation, '%d/%m/%Y %H:%M', 'tzuserrel'); $memo->date_change = ''; if (!empty($obj->tms) && ((int) $obj->date_creation !== (int) $obj->tms || (int) $obj->fk_user_modif > 0)) { - $memo->date_change = dol_print_date($obj->tms, '%d/%m/%Y %H:%M'); + $memo->date_change = dol_print_date($obj->tms, '%d/%m/%Y %H:%M', 'tzuserrel'); } $memo->fk_user_creat = $obj->fk_user_creat; @@ -1041,10 +1041,9 @@ function quickMemoInterfacePopulateMemoTplFromQueryObj($obj) $memo->shared_on_element = $obj->shared_on_element; $memo->private = (int) $obj->private; - $memo->date_creation = dol_print_date($obj->date_creation, '%d/%m/%Y %H:%M'); + $memo->date_creation = dol_print_date($obj->date_creation, '%d/%m/%Y %H:%M', 'tzuserrel'); $memo->fk_user_creat = $user->id; $memo->user_name = $user->getFullName($langs); - $memo->date_creation = dol_print_date(dol_now()); $memo->date_change = ''; $memo->user_change_name = ''; From eb5e550490ccdf4871556a75a73493955f4e841b Mon Sep 17 00:00:00 2001 From: atm-lucas <121817516+atm-lucasmantegari@users.noreply.github.com> Date: Thu, 7 May 2026 12:58:22 +0200 Subject: [PATCH 50/79] Fix: reset fk_code_ventilation on invoice clone (#38084) --- htdocs/compta/facture/class/facture.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index b999211d44c..c8fdda0d2e3 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1359,6 +1359,9 @@ class Facture extends CommonInvoice } $object->lines[$i]->ref_ext = ''; // Do not clone ref_ext + + // Do not clone accountancy ventilation: a cloned invoice must reappear in "to dispatch" list + $object->lines[$i]->fk_code_ventilation = 0; } // Create clone From d8dd19027f0a4e90368efd15bb08b220eec89dcf Mon Sep 17 00:00:00 2001 From: nateogroup-antoine Date: Thu, 7 May 2026 12:59:46 +0200 Subject: [PATCH 51/79] Fix extrafield varchar/char value '0' lost on edit mode (#38111) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixed a bug that initialized the deprecated status variable without initializing the new status variable. Upon quote approval, the interface is based on “status” rather than “statut.” The approved quote still had the edit button visible. * Fix reload object if not MAIN_DISABLE_PDF_AUTOUPDATE after addline or updateline Fix reload object if not MAIN_DISABLE_PDF_AUTOUPDATE after addline or updateline * Update card.php * Fix extrafield varchar/char value '0' lost on edit mode In showOptionals() method (commonobject.class.php), when mode is 'edit', the fallback value for extrafields was retrieved using !empty(), which treats the string "0" as falsy in PHP, causing it to be replaced by an empty string in the form input. This resulted in varchar/char extrafields with a stored value of '0' being displayed as empty when editing a record, and saving the form would overwrite the correct value with ''. The fix adds a specific elseif branch for 'varchar' and 'char' types, using a strict isset() && !== '' check instead of !empty(), consistent with the existing special handling already in place for 'int' type (which already handles the '0' edge case explicitly). Types other than varchar/char/int are not affected (text, html, date, price, double, boolean, select, etc. still go through the original else branch). * Update commonobject.class.php * Update commonobject.class.php --------- Co-authored-by: Laurent Destailleur --- htdocs/core/class/commonobject.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 73686adb893..9562f562d2c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9664,6 +9664,8 @@ abstract class CommonObject } } elseif (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('int'))) { $value = (!empty($this->array_options["options_".$key]) || (isset($this->array_options["options_".$key]) && $this->array_options["options_".$key] === '0')) ? $this->array_options["options_".$key] : ''; + } elseif (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('varchar', 'char'))) { + $value = (isset($this->array_options["options_".$key]) && $this->array_options["options_".$key] !== '') ? $this->array_options["options_".$key] : ''; } else { $value = (!empty($this->array_options["options_".$key]) ? $this->array_options["options_".$key] : ''); // No GET, no POST, no default value, so we take value of object. } From 0e6d98be8b065272b971531210f030e67b71b015 Mon Sep 17 00:00:00 2001 From: daraelmin <8067223+daraelmin@users.noreply.github.com> Date: Thu, 7 May 2026 13:01:22 +0200 Subject: [PATCH 52/79] [RGPD] Add personal_data column on llx_extrafields table - First step of #8612 (#38090) * Add personal_data flag on extrafields for GDPR/privacy compliance * Add migration script to add personal_data column on llx_extrafields * Update 23.0.0-24.0.0.sql * Update llx_extrafields.sql --- htdocs/install/mysql/migration/23.0.0-24.0.0.sql | 2 ++ htdocs/install/mysql/tables/llx_extrafields.sql | 1 + 2 files changed, 3 insertions(+) diff --git a/htdocs/install/mysql/migration/23.0.0-24.0.0.sql b/htdocs/install/mysql/migration/23.0.0-24.0.0.sql index 36de20f9eaa..4d77ef010ea 100644 --- a/htdocs/install/mysql/migration/23.0.0-24.0.0.sql +++ b/htdocs/install/mysql/migration/23.0.0-24.0.0.sql @@ -513,5 +513,7 @@ UPDATE llx_socpeople SET fax = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(fax, ' ', --ALTER TABLE llx_facture ADD COLUMN retained_warranty_amount double(24,8) DEFAULT NULL AFTER retained_warranty; +-- Add personal_data flag on extrafields for GDPR/nLPD/LGPD compliance +ALTER TABLE llx_extrafields ADD COLUMN personal_data tinyint DEFAULT 0 AFTER csslist; -- end of migration diff --git a/htdocs/install/mysql/tables/llx_extrafields.sql b/htdocs/install/mysql/tables/llx_extrafields.sql index aa9e6f81cc7..142f6219ab7 100644 --- a/htdocs/install/mysql/tables/llx_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_extrafields.sql @@ -47,6 +47,7 @@ create table llx_extrafields css varchar(128), -- to store css on create/update forms cssview varchar(128), -- to store css on view form csslist varchar(128), -- to store css on list + personal_data tinyint DEFAULT 0, -- 1 if field contains personal data (GDPR/nLPD/LGPD) fk_user_author integer, -- user making creation fk_user_modif integer, -- user making last change datec datetime, -- date de creation From c0fb6bf32256ca3650d7b3036c38ab96270adb8f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 May 2026 13:07:11 +0200 Subject: [PATCH 53/79] Fix typo (fix in different direction than #38094) --- htdocs/core/tpl/objectline_title.tpl.php | 2 +- htdocs/core/tpl/objectline_view.tpl.php | 2 +- htdocs/core/tpl/subtotal_view.tpl.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php index 7d059684e29..8f9ecaf251a 100644 --- a/htdocs/core/tpl/objectline_title.tpl.php +++ b/htdocs/core/tpl/objectline_title.tpl.php @@ -116,7 +116,7 @@ print ''.$langs->trans('PriceUHT').'multicurrency_code != $conf->currency) { print ''.$langs->trans('PriceUHT'); - print ' ('.$langs->getCurrencySymbol($this->multicurrency_code).')'; + print ' ('.$langs->getCurrencySymbol($this->multicurrency_code).')'; } // Price TTC diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 2ab037ed6ca..387a86b0166 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -504,7 +504,7 @@ if ($line->special_code == 3) { print $tooltiponpriceend; print ''; if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { - print ''; + print ''; print $tooltiponpricemultiprice; print price($sign * $line->multicurrency_total_ht); print $tooltiponpriceendmultiprice; diff --git a/htdocs/core/tpl/subtotal_view.tpl.php b/htdocs/core/tpl/subtotal_view.tpl.php index cf1fe6fd56e..c8739156d72 100644 --- a/htdocs/core/tpl/subtotal_view.tpl.php +++ b/htdocs/core/tpl/subtotal_view.tpl.php @@ -161,7 +161,7 @@ if ($line->qty > 0) { ?> ?> multicurrency_code != $conf->currency) { ?> - + qty < 0) { // Base colspan if there is no module activated to display line correctly From d7bdd3256b5efa110adb23bbccc3f9c377402387 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 May 2026 13:19:07 +0200 Subject: [PATCH 54/79] Fix typo (fix in different direction than #38094) --- htdocs/core/tpl/objectline_title.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php index 8f9ecaf251a..b3498241943 100644 --- a/htdocs/core/tpl/objectline_title.tpl.php +++ b/htdocs/core/tpl/objectline_title.tpl.php @@ -207,7 +207,7 @@ print ''.$langs->trans('TotalHTShort').''; // Multicurrency if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { print ''.$langs->trans('TotalHTShort'); - print ' ('.$langs->getCurrencySymbol($this->multicurrency_code).')'; + print ' ('.$langs->getCurrencySymbol($this->multicurrency_code).')'; } if ($outputalsopricetotalwithtax) { From bd6dba76ba85a4d6f2f6a19959fb3bc0386d84dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 7 May 2026 14:13:08 +0200 Subject: [PATCH 55/79] clean code (#38081) * clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code --------- Co-authored-by: Laurent Destailleur --- htdocs/adherents/admin/website.php | 3 +-- htdocs/adherents/index.php | 6 +---- htdocs/admin/eventorganization_public.php | 4 +--- htdocs/bom/ajax/ajax.php | 4 ++-- htdocs/bom/bom_agenda.php | 20 ++++++++-------- htdocs/bom/bom_card.php | 4 ++-- htdocs/bom/bom_document.php | 19 ++++++++------- htdocs/bom/bom_list.php | 19 ++++++++------- htdocs/bom/bom_net_needs.php | 21 ++++++++--------- htdocs/bom/bom_note.php | 10 ++++---- htdocs/bom/lib/bom.lib.php | 6 ++--- htdocs/comm/index.php | 17 +++++++------- htdocs/comm/mailing/index.php | 9 +++----- htdocs/comm/propal/agenda.php | 27 +++++++++++++--------- htdocs/comm/propal/card.php | 28 ++++++++++++++++------- htdocs/comm/propal/class/propal.class.php | 12 ++++------ htdocs/comm/propal/document.php | 23 +++++++++++-------- htdocs/comm/propal/index.php | 11 ++++----- htdocs/comm/propal/list.php | 18 +++++++-------- htdocs/comm/propal/messaging.php | 13 +++++------ htdocs/comm/propal/note.php | 11 +++++---- htdocs/compta/charges/index.php | 20 +++++++--------- htdocs/don/admin/donation_extrafields.php | 4 ++-- htdocs/don/admin/website.php | 3 +-- htdocs/don/list.php | 23 ++++--------------- htdocs/don/paiement/list.php | 18 ++++++++------- htdocs/don/payment/card.php | 24 +++++++++---------- htdocs/don/stats/index.php | 17 ++++++++++---- htdocs/hrm/index.php | 19 +++++++-------- htdocs/opensurvey/index.php | 9 +++----- htdocs/projet/index.php | 4 +--- htdocs/societe/index.php | 3 +-- 32 files changed, 205 insertions(+), 224 deletions(-) diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index a67de387d6e..4a40efc74a4 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -4,7 +4,7 @@ * Copyright (C) 2006-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2024 Alexandre Spangaro - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -51,7 +51,6 @@ $langs->loadLangs(array("admin", "members")); $action = GETPOST('action', 'aZ09'); // Hook to be used by external payment modules (ie Payzen, ...) -$hookmanager = new HookManager($db); $hookmanager->initHooks(array('newpayment')); if (!$user->admin) { diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 68e8888ac19..472748ccada 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -4,7 +4,7 @@ * Copyright (C) 2004-2020 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2019 Nicolas ZABOURI - * Copyright (C) 2021-2025 Frédéric France + * Copyright (C) 2021-2026 Frédéric France * Copyright (C) 2021-2023 Waël Almoman * Copyright (C) 2024 MDW * Copyright (C) 2024 Alexandre Spangaro @@ -46,13 +46,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; // Load translation files required by the page $langs->loadLangs(array("companies", "members")); - -$hookmanager = new HookManager($db); - // Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('membersindex')); - // Security check $result = restrictedArea($user, 'adherent'); diff --git a/htdocs/admin/eventorganization_public.php b/htdocs/admin/eventorganization_public.php index 5167abaecc9..ef2eea9a11d 100644 --- a/htdocs/admin/eventorganization_public.php +++ b/htdocs/admin/eventorganization_public.php @@ -1,7 +1,7 @@ * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -83,8 +83,6 @@ if ($cancel) { include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; -$action = 'edit'; - /* * View diff --git a/htdocs/bom/ajax/ajax.php b/htdocs/bom/ajax/ajax.php index 0c6f199a9c6..36c058ec938 100644 --- a/htdocs/bom/ajax/ajax.php +++ b/htdocs/bom/ajax/ajax.php @@ -1,7 +1,7 @@ - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -86,7 +86,7 @@ if ($action == 'getWorkstationByProduct' && $user->hasRight('product', 'lire')) $error = 'NOT FOUND'; } else { $error = null; - $result['defaultWk']=$product->fk_default_workstation; + $result['defaultWk'] = $product->fk_default_workstation; } $result['error']=$error; diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php index be80f66d86a..96e63fbcf82 100644 --- a/htdocs/bom/bom_agenda.php +++ b/htdocs/bom/bom_agenda.php @@ -1,7 +1,7 @@ * Copyright (C) ---Put here your own copyright and developer email--- - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -25,21 +25,20 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; - -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - // Load translation files required by the page $langs->loadLangs(array('mrp', 'other')); @@ -84,7 +83,6 @@ if (!$sortorder) { // Initialize a technical objects $object = new BOM($db); -$extrafields = new ExtraFields($db); $diroutputmassaction = getMultidirOutput($object) . '/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('bomagenda', 'globalcard')); // Note that conf->hooks_modules contains array diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 36f2c478d75..90c9bdb0472 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2019-2025 Frédéric France + * Copyright (C) 2019-2026 Frédéric France * Copyright (C) 2023 Charlene Benke * Copyright (C) 2024-2025 MDW * @@ -30,6 +30,7 @@ require '../main.inc.php'; * The main.inc.php has been included so the following variable are now defined: * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Societe $mysoc * @var Translate $langs @@ -63,7 +64,6 @@ $hideref = (GETPOSTINT('hideref') ? GETPOSTINT('hideref') : (getDolGlobalString( // Initialize a technical objects $object = new BOM($db); -$extrafields = new ExtraFields($db); $diroutputmassaction = getMultidirOutput($object) . '/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('bomcard', 'globalcard')); // Note that conf->hooks_modules contains array diff --git a/htdocs/bom/bom_document.php b/htdocs/bom/bom_document.php index 5fbc7266b27..707873d57fd 100644 --- a/htdocs/bom/bom_document.php +++ b/htdocs/bom/bom_document.php @@ -1,6 +1,6 @@ - * Copyright (C) 2019-2025 Frédéric France + * Copyright (C) 2019-2026 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -25,6 +25,14 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -32,14 +40,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - // Load translation files required by the page $langs->loadLangs(array("mrp", "companies", "other", "mails")); @@ -75,7 +75,6 @@ if (!$sortfield) { // Initialize a technical objects $object = new BOM($db); -$extrafields = new ExtraFields($db); $diroutputmassaction = getMultidirOutput($object) . '/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('bomdocument', 'globalcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index cd29bae641b..1f0e1fe0e61 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -1,7 +1,7 @@ * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -25,20 +25,20 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - // Load translation files required by the page $langs->loadLangs(array('mrp', 'other')); @@ -73,7 +73,6 @@ $pagenext = $page + 1; // Initialize a technical objects $object = new BOM($db); -$extrafields = new ExtraFields($db); $diroutputmassaction = getMultidirOutput($object) . '/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('bomlist')); // Note that conf->hooks_modules contains array diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index a264f147732..8ed73e67725 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -1,6 +1,6 @@ - * Copyright (C) 2019-2025 Frédéric France + * Copyright (C) 2019-2026 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -25,19 +25,19 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; -require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Societe $mysoc * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; // Load translation files required by the page $langs->loadLangs(array("mrp", "other", "stocks")); @@ -45,17 +45,16 @@ $langs->loadLangs(array("mrp", "other", "stocks")); // Get parameters $id = GETPOSTINT('id'); $lineid = GETPOSTINT('lineid'); -$ref = GETPOST('ref', 'alpha'); +$ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); -$confirm = GETPOST('confirm', 'alpha'); -$cancel = GETPOST('cancel', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'bomnet_needs'; // To manage different context of search -$backtopage = GETPOST('backtopage', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); // Initialize a technical objects $object = new BOM($db); -$extrafields = new ExtraFields($db); // Initialize a technical objects for hooks $hookmanager->initHooks(array('bomnetneeds')); // Note that conf->hooks_modules contains array diff --git a/htdocs/bom/bom_note.php b/htdocs/bom/bom_note.php index 4fa2f6b9262..c802dabda5b 100644 --- a/htdocs/bom/bom_note.php +++ b/htdocs/bom/bom_note.php @@ -1,6 +1,6 @@ - * Copyright (C) 2019-2025 Frédéric France + * Copyright (C) 2019-2026 Frédéric France * * 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 @@ -24,16 +24,17 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; -require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; - /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; + // Load translation files required by the page $langs->loadLangs(array("mrp", "companies")); @@ -47,7 +48,6 @@ $backtopage = GETPOST('backtopage', 'alpha'); // Initialize a technical objects $object = new BOM($db); -$extrafields = new ExtraFields($db); // Initialize a technical objects for hooks $hookmanager->initHooks(array('bomnote', 'globalcard')); // Note that conf->hooks_modules contains array diff --git a/htdocs/bom/lib/bom.lib.php b/htdocs/bom/lib/bom.lib.php index 91ba3d8b291..5233d354586 100644 --- a/htdocs/bom/lib/bom.lib.php +++ b/htdocs/bom/lib/bom.lib.php @@ -1,6 +1,6 @@ - * Copyright (C) 2019-2025 Frédéric France + * Copyright (C) 2019-2026 Frédéric France * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify @@ -30,10 +30,8 @@ */ function bomAdminPrepareHead() { - global $langs, $conf; + global $langs, $conf, $extrafields; - global $db; - $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label('bom_bom'); $extrafields->fetch_name_optionals_label('bom_bomline'); diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 92733c42883..00abcdb2743 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -7,7 +7,7 @@ * Copyright (C) 2020 Pierre Ardoin * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2024-2026 MDW - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -31,6 +31,13 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; @@ -48,16 +55,8 @@ if (isModEnabled('intervention')) { require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; } -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ // Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array -$hookmanager = new HookManager($db); $hookmanager->initHooks(array('commercialindex')); // Load translation files required by the page diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index 667b6ebea39..e761c2c1a95 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -4,7 +4,7 @@ * Copyright (C) 2010 Regis Houssin * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -28,9 +28,6 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -38,8 +35,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; * @var Translate $langs * @var User $user */ - -$hookmanager = new HookManager($db); +require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('mailingindex')); diff --git a/htdocs/comm/propal/agenda.php b/htdocs/comm/propal/agenda.php index 4b906ce8065..d90a560adb0 100644 --- a/htdocs/comm/propal/agenda.php +++ b/htdocs/comm/propal/agenda.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -23,6 +23,14 @@ * \brief Tab of events on Proposal */ require '../../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; @@ -30,13 +38,6 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/propal.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ // Load translation files required by the page $langs->loadLangs(array("propal", "other")); @@ -80,7 +81,6 @@ if (!$sortorder) { // Initialize a technical objects $object = new Propal($db); -$extrafields = new ExtraFields($db); $diroutputmassaction = $conf->propal->multidir_output[$conf->entity] . '/temp/massgeneration/' . $user->id; $hookmanager->initHooks(array('propalagenda', 'globalcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels @@ -96,6 +96,7 @@ $permissiontoread = $user->hasRight("propal", "lire"); $permissiontoadd = $user->hasRight("propal", "creer"); // Security check +$socid = ''; if (!empty($user->socid)) { $socid = $user->socid; } @@ -150,7 +151,11 @@ if ($object->id > 0) { // Object card // ------------------------------------------------------------ - $linkback = '' . $langs->trans("BackToList") . ''; + $query = ['restore_lastsearch_values' => 1]; + if (!empty($socid) && $socid > 0) { + $query += ['socid' => $socid]; + } + $linkback = '' . $langs->trans("BackToList") . ''; $morehtmlref = '
'; // Ref customer @@ -167,7 +172,7 @@ if ($object->id > 0) { if ($action != 'classify') { $morehtmlref .= '' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project(dolBuildUrl($_SERVER['PHP_SELF'], ['id' => $object->id]), $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($object->fk_project)) { $proj = new Project($db); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 65ef049d0e4..05f06514944 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -12,7 +12,7 @@ * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Ferran Marcet * Copyright (C) 2016 Marcos García - * Copyright (C) 2018-2025 Frédéric France + * Copyright (C) 2018-2026 Frédéric France * Copyright (C) 2020 Nicolas ZABOURI * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2023 Lenin Rivas @@ -182,14 +182,14 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } if (empty($reshook)) { - $backurlforlist = DOL_URL_ROOT . '/comm/propal/list.php'; + $backurlforlist = dolBuildUrl(DOL_URL_ROOT . '/comm/propal/list.php'); if (empty($backtopage) || ($cancel && empty($id))) { if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { $backtopage = $backurlforlist; } else { - $backtopage = DOL_URL_ROOT . '/comm/propal/card.php?id=' . ((!empty($id) && $id > 0) ? $id : '__ID__'); + $backtopage = dolBuildUrl(DOL_URL_ROOT . '/comm/propal/card.php', ['id' => ((!empty($id) && $id > 0) ? $id : '__ID__')]); } } } @@ -286,7 +286,7 @@ if (empty($reshook)) { // Cancel proposal $result = $object->setCancel($user); if ($result > 0) { - header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id); + header('Location: ' . dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id])); exit(); } else { $langs->load("errors"); @@ -296,7 +296,7 @@ if (empty($reshook)) { // Delete proposal $result = $object->delete($user); if ($result > 0) { - header('Location: ' . DOL_URL_ROOT . '/comm/propal/list.php?restore_lastsearch_values=1'); + header('Location: ' . dolBuildUrl(DOL_URL_ROOT . '/comm/propal/list.php', ['restore_lastsearch_values' => 1])); exit(); } else { $langs->load("errors"); @@ -472,7 +472,7 @@ if (empty($reshook)) { } elseif ($action == 'setdate_livraison' && $usercancreate) { $result = $object->setDeliveryDate($user, dol_mktime(12, 0, 0, GETPOSTINT('date_livraisonmonth'), GETPOSTINT('date_livraisonday'), GETPOSTINT('date_livraisonyear'))); if ($result < 0) { - dol_print_error($db, $object->error); + setEventMessages($object->error, $object->errors, 'errors'); } } elseif ($action == 'setref_client' && $usercancreate) { // Positionne ref client @@ -483,8 +483,14 @@ if (empty($reshook)) { } elseif ($action == 'set_incoterms' && isModEnabled('incoterm') && $usercancreate) { // Set incoterm $result = $object->setIncoterms(GETPOSTINT('incoterm_id'), GETPOST('location_incoterms')); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } elseif ($action == 'settags' && isModEnabled('category') && $usercancreate) { // Set tags $result = $object->setCategories(GETPOST('categories', 'array')); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } elseif ($action == 'add' && $usercancreate) { // Create proposal $object->socid = $socid; @@ -1003,10 +1009,16 @@ if (empty($reshook)) { } } elseif ($action == 'addline' && GETPOST('updateallvatlinesblock', 'alpha') && GETPOST('vatforblocklines', 'alpha') !== '' && $usercancreate) { $tx_tva = GETPOST('vatforblocklines') ? GETPOST('vatforblocklines') : 0; - $object->updateSubtotalLineBlockLines($langs, $object->getRangOfLine($lineid), 'tva', $tx_tva); + $result = $object->updateSubtotalLineBlockLines($langs, $object->getRangOfLine($lineid), 'tva', $tx_tva); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } elseif ($action == 'addline' && GETPOST('updatealldiscountlinesblock', 'alpha') && GETPOST('discountforblocklines', 'alpha') !== '' && $usercancreate) { $discount = GETPOST('discountforblocklines') ? GETPOST('discountforblocklines') : 0; - $object->updateSubtotalLineBlockLines($langs, $object->getRangOfLine($lineid), 'discount', $discount); + $result = $object->updateSubtotalLineBlockLines($langs, $object->getRangOfLine($lineid), 'discount', $discount); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } include DOL_DOCUMENT_ROOT . '/core/actions_printing.inc.php'; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index af2a5f56174..9529526d22c 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -13,7 +13,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018-2025 Frédéric France + * Copyright (C) 2018-2026 Frédéric France * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2022 ATM Consulting * Copyright (C) 2022 OpenDSI @@ -3562,8 +3562,8 @@ class Propal extends CommonObject $response->warning_delay = $delay_warning / 60 / 60 / 24; $response->label = $label; $response->labelShort = $labelShort; - $response->url = DOL_URL_ROOT.'/comm/propal/list.php?search_status='.$status.'&mainmenu=commercial&leftmenu=propals'; - $response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?search_option=late&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc'; + $response->url = dolBuildUrl(DOL_URL_ROOT.'/comm/propal/list.php', ['search_status' => $status, 'mainmenu' => 'commercial', 'leftmenu' => 'propals']); + $response->url_late = dolBuildUrl(DOL_URL_ROOT.'/comm/propal/list.php', ['search_option' => 'late', 'mainmenu' => 'commercial', 'leftmenu' => 'propals', 'sortfield' => 'p.datep', 'sortorder' => 'asc']); $response->img = img_object('', "propal"); // This assignment in condition is not a bug. It allows walking the results. @@ -3979,7 +3979,7 @@ class Propal extends CommonObject if ($txttoshow) { $result .= ' '; - $result .= ''; + $result .= ''; $result .= img_picto('', 'note'); $result .= ''; $result .= ''; @@ -4025,12 +4025,10 @@ class Propal extends CommonObject $outputlangs->loadLangs(array("propale", "products")); if (!dol_strlen($modele)) { - $modele = 'azur'; + $modele = getDolGlobalString('PROPALE_ADDON_PDF', 'cyan'); if ($this->model_pdf) { $modele = $this->model_pdf; - } elseif (getDolGlobalString('PROPALE_ADDON_PDF')) { - $modele = getDolGlobalString('PROPALE_ADDON_PDF'); } } diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 0bc7f7f9c5b..b76421abec7 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -30,6 +30,13 @@ // Load Dolibarr environment require '../../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -39,13 +46,6 @@ if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ // Load translation files required by the page $langs->loadLangs(array('propal', 'compta', 'other', 'companies')); @@ -133,8 +133,11 @@ if ($object->id > 0) { // Proposal card - - $linkback = ''.$langs->trans("BackToList").''; + $query = ['restore_lastsearch_values' => 1]; + if (!empty($socid) && $socid > 0) { + $query += ['socid' => $socid]; + } + $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index 7ff7a943aaa..4438bed9e71 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2020 Tobias Sekan - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -28,10 +28,6 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -39,9 +35,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; + // Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array -$hookmanager = new HookManager($db); $hookmanager->initHooks(array('proposalindex')); // Load translation files required by the page diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 27380f64a83..96f416bfe5b 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -15,7 +15,7 @@ * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2019-2026 Alexandre Spangaro * Copyright (C) 2021 Anthony Berton - * Copyright (C) 2021-2025 Frédéric France + * Copyright (C) 2021-2026 Frédéric France * Copyright (C) 2022 Josep Lluís Amador * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 William Mead @@ -42,6 +42,14 @@ // Load Dolibarr environment require '../../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var ExtraFields $extrafields + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formpropal.class.php'; @@ -58,13 +66,6 @@ if (isModEnabled('category')) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php'; } -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ // Load translation files required by the page $langs->loadLangs(array('companies', 'propal', 'compta', 'bills', 'orders', 'products', 'sendings', 'categories')); @@ -207,7 +208,6 @@ $diroutputmassaction = $conf->propal->multidir_output[$conf->entity].'/temp/mass // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $object = new Propal($db); -$extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); diff --git a/htdocs/comm/propal/messaging.php b/htdocs/comm/propal/messaging.php index 26d865aba1d..5fe4b9c0ca7 100644 --- a/htdocs/comm/propal/messaging.php +++ b/htdocs/comm/propal/messaging.php @@ -2,7 +2,7 @@ /* Copyright (C) 2005-2016 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2025 Valentin Grimal * * This program is free software; you can redistribute it and/or modify @@ -27,12 +27,6 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/propal.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -40,6 +34,11 @@ require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/propal.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; // Load translation files required by the page $langs->load("propal"); diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index 881731f4761..83ba8ffffe0 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -111,8 +111,11 @@ if ($object->id > 0) { // Proposal card - - $linkback = ''.$langs->trans("BackToList").''; + $query = ['restore_lastsearch_values' => 1]; + if (!empty($socid) && $socid > 0) { + $query += ['socid' => $socid]; + } + $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; @@ -130,7 +133,7 @@ if ($object->id > 0) { if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project(dolBuildUrl($_SERVER['PHP_SELF'], ['id' => $object->id]), $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($object->fk_project)) { $proj = new Project($db); diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index af862991a82..1ea1dd0b71e 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -8,7 +8,7 @@ * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2026 Nick Fragoulis * * This program is free software; you can redistribute it and/or modify @@ -33,15 +33,6 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/paymentvat.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php'; -require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - - /** * @var Conf $conf * @var DoliDB $db @@ -50,8 +41,13 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; * @var Translate $langs * @var User $user */ - -$hookmanager = new HookManager($db); +require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/paymentvat.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php'; +require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('specialexpensesindex')); diff --git a/htdocs/don/admin/donation_extrafields.php b/htdocs/don/admin/donation_extrafields.php index f6a8e0bc40d..75240e2dbc7 100644 --- a/htdocs/don/admin/donation_extrafields.php +++ b/htdocs/don/admin/donation_extrafields.php @@ -1,7 +1,7 @@ * Copyright (C) 2015 Juanjo Menent - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; /** * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var HookManager $hookmanager * @var Translate $langs * @var User $user @@ -39,7 +40,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; // Load translation files required by the page $langs->loadLangs(array('companies', 'admin', 'donations')); -$extrafields = new ExtraFields($db); $form = new Form($db); // List of supported format diff --git a/htdocs/don/admin/website.php b/htdocs/don/admin/website.php index dfcf86178ac..644ab81421f 100644 --- a/htdocs/don/admin/website.php +++ b/htdocs/don/admin/website.php @@ -4,7 +4,7 @@ * Copyright (C) 2006-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2024 Alexandre Spangaro - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -50,7 +50,6 @@ $langs->loadLangs(array("admin", "donations")); $action = GETPOST('action', 'aZ09'); // Hook to be used by external payment modules (ie Payzen, ...) -$hookmanager = new HookManager($db); $hookmanager->initHooks(array('newpayment')); if (!$user->admin) { diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 3c826aa16d0..b65a4da20ea 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -5,7 +5,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2019 Thibault FOUCART * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -329,21 +329,6 @@ if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $sear llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'mod-donation page-list bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll -// Example : Adding jquery code -// print ''; - $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; @@ -602,10 +587,10 @@ while ($i < $imaxinloop) { $donationstatic->setVarsFromFetchObj($obj); - $donationstatic->id = $obj->rowid; + $donationstatic->id = (int) $obj->rowid; $donationstatic->ref = ($obj->ref ? $obj->ref : $obj->rowid); $donationstatic->date = $db->jdate($obj->datedon); - $donationstatic->status = $obj->status; + $donationstatic->status = (int) $obj->status; $donationstatic->lastname = $obj->lastname; $donationstatic->firstname = $obj->firstname; $object = $donationstatic; @@ -699,7 +684,7 @@ while ($i < $imaxinloop) { print ''.price($obj->amount).''; // Status - print ''.$donationstatic->LibStatut($obj->status, 5).''; + print ''.$donationstatic->LibStatut($donationstatic->status, 5).''; // Action column if (empty($conf->main_checkbox_left_column)) { diff --git a/htdocs/don/paiement/list.php b/htdocs/don/paiement/list.php index 53b95f19638..719f8efb7dc 100644 --- a/htdocs/don/paiement/list.php +++ b/htdocs/don/paiement/list.php @@ -5,7 +5,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2019 Thibault FOUCART * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -49,8 +49,9 @@ $action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'sclist'; $mode = GETPOST('mode', 'alpha'); +$toselect = GETPOST('toselect', 'array:int'); // Array of ids of elements selected into a list -$paiementid = GETPOSTINT('paiementid'); +$paiementid = GETPOSTINT('paiementid'); $search_ref = GETPOST("search_ref", "alpha"); $search_date_startday = GETPOSTINT('search_date_startday'); @@ -270,6 +271,7 @@ $num = $db->num_rows($resql); llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll +$arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); @@ -340,10 +342,10 @@ if ($search_all) { $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields -$massactionbutton = ''; -if ($massactionbutton) { - $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); -} +// $massactionbutton = ''; +// if ($massactionbutton) { +// $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); +// } $moreforfilter = ''; print '
'; @@ -530,7 +532,7 @@ while ($i < $imaxinloop) { print ''; if ($conf->main_checkbox_left_column) { print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + if (/* $massactionbutton || */ $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; if (in_array($obj->id_paiement, $arrayofselected)) { $selected = 1; @@ -640,7 +642,7 @@ while ($i < $imaxinloop) { if (!$conf->main_checkbox_left_column) { print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + if (/* $massactionbutton || */ $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; if (in_array($obj->id_paiement, $arrayofselected)) { $selected = 1; diff --git a/htdocs/don/payment/card.php b/htdocs/don/payment/card.php index 5d747c11d92..537f979e5e3 100644 --- a/htdocs/don/payment/card.php +++ b/htdocs/don/payment/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2019-2026 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -25,6 +25,13 @@ // Load Dolibarr environment require '../../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; require_once DOL_DOCUMENT_ROOT.'/don/class/paymentdonation.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; @@ -33,13 +40,6 @@ if (isModEnabled("bank")) { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; } -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ // Load translation files required by the page $langs->loadLangs(array("bills", "banks", "companies", "donations")); @@ -109,8 +109,8 @@ if (empty($object->id)) { $h = 0; -$head = array(); -$head[$h][0] = DOL_URL_ROOT.'/don/payment/card.php?id='.$id; +$head = []; +$head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/don/payment/card.php', ['id'=> $id]); $head[$h][1] = $langs->trans("DonationPayment"); $hselected = (string) $h; $h++; @@ -236,9 +236,9 @@ print '
'; if (empty($action)) { if ($user->hasRight('don', 'supprimer')) { if (!$disable_delete) { - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', 1); + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'delete'], true), '', 1); } else { - print dolGetButtonAction($langs->trans("CantRemovePaymentWithOneInvoicePaid"), $langs->trans('Delete'), '', $_SERVER["PHP_SELF"].'?id='.$object->id.'#', '', 1, [ 'attr' => ['classOverride' => 'butActionRefused']]); + print dolGetButtonAction($langs->trans("CantRemovePaymentWithOneInvoicePaid"), $langs->trans('Delete'), '', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id], false, '#'), '', 1, ['attr' => ['classOverride' => 'butActionRefused']]); } } } diff --git a/htdocs/don/stats/index.php b/htdocs/don/stats/index.php index 64b9aeab82e..4774e4f8cf9 100644 --- a/htdocs/don/stats/index.php +++ b/htdocs/don/stats/index.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -124,7 +124,7 @@ if (!$mesg) { $data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear); $filenameamount = $dir."/donationamount-".$year.".png"; -$fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=donationStats&file=donationamoutinyear-'.$year.'.png'; +$fileurlamount = dolBuildUrl(DOL_URL_ROOT.'/viewimage.php', ['modulepart' => 'donationStats', 'file' => 'donationamoutinyear-'.$year.'.png']); $px2 = new DolGraph(); $mesg = $px2->isGraphKo(); @@ -153,7 +153,7 @@ if (!$mesg) { $data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); $filename_avg = $dir."/donationaverage-".$year.".png"; -$fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=donationStats&file=donationaverageinyear-'.$year.'.png'; +$fileurl_avg = dolBuildUrl(DOL_URL_ROOT.'/viewimage.php', ['modulepart' => 'donationStats', 'file' => 'donationaverageinyear-'.$year.'.png']); $px3 = new DolGraph(); $mesg = $px3->isGraphKo(); @@ -290,7 +290,7 @@ foreach ($data as $val) { while (!empty($year) && $oldyear > (int) $year + 1) { $oldyear--; print ''; - print ''.$oldyear.''; + print ' $oldyear]).'">'.$oldyear.''; print '0'; print ''; @@ -306,7 +306,14 @@ foreach ($data as $val) { $greenavg = (empty($val['avg_diff']) || $val['avg_diff'] >= 0); print ''; - print ' 0 ? '&userid='.$userid : '').'">'.$year.''; + $query = ['year' => $year, 'mode' => $mode]; + if ($socid > 0) { + $query += ['socid' => $socid]; + } + if ($userid > 0) { + $query += ['userid' => $userid]; + } + print ''.$year.''; print ''.$val['nb'].''; print ''.(!empty($val['nb_diff']) && $val['nb_diff'] < 0 ? '' : '+').round(!empty($val['nb_diff']) ? $val['nb_diff'] : 0).'%'; print ''.price(price2num($val['total'], 'MT'), 1).''; diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index 239a3e67696..2fd363484b5 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -4,7 +4,7 @@ * Copyright (C) 2012-2014 Regis Houssin * Copyright (C) 2015-2016 Alexandre Spangaro * Copyright (C) 2019 Nicolas ZABOURI - * Copyright (C) 2021-2025 Frédéric France + * Copyright (C) 2021-2026 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -30,6 +30,13 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -53,20 +60,10 @@ if (isModEnabled('holiday')) { } -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - // Load translation files required by the page $langs->loadLangs(array('users', 'holiday', 'trips', 'boxes')); // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context -$hookmanager = new HookManager($db); - $hookmanager->initHooks(array('hrmindex')); // Get Parameters diff --git a/htdocs/opensurvey/index.php b/htdocs/opensurvey/index.php index ec7e5127294..711051d0075 100644 --- a/htdocs/opensurvey/index.php +++ b/htdocs/opensurvey/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2019 Nicolas ZABOURI - * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2019-2026 Frédéric France * * 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 @@ -25,9 +25,6 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; -require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; - /** * @var Conf $conf * @var DoliDB $db @@ -35,6 +32,8 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; +require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; // Load translation files required by the page $langs->load("opensurvey"); @@ -44,8 +43,6 @@ if (!$user->hasRight('opensurvey', 'read')) { accessforbidden(); } -$hookmanager = new HookManager($db); - // Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('opensurveyindex')); diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index ecf426473e0..d0219746621 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2022 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2019 Nicolas ZABOURI - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -44,8 +44,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; // Load translation files required by the page $langs->loadLangs(array('projects', 'companies')); -$hookmanager = new HookManager($db); - // Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('projectsindex')); diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index b54346765e0..30afeee4f61 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -6,7 +6,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2019 Nicolas ZABOURI - * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2024-2026 Frédéric France * * 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 @@ -46,7 +46,6 @@ $langs->load("companies"); // Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array -$hookmanager = new HookManager($db); $hookmanager->initHooks(array('thirdpartiesindex')); From ba9fa5117fb5d561709c7fc61709c9692fdb2f92 Mon Sep 17 00:00:00 2001 From: Kusco Date: Thu, 7 May 2026 14:14:11 +0200 Subject: [PATCH 56/79] Fix Display problem (#38085) Tag not closed properly --- htdocs/expensereport/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 3fc3daf0e2b..fe502c49cdc 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2104,10 +2104,11 @@ if ($action == 'create') { print ""; print '
'; + print '
'; print '
'; - print '


'; + print '

'; print '
'; From a2706032636c9bb89af4167ab5c80f84f0cc6ebc Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 7 May 2026 14:20:03 +0200 Subject: [PATCH 57/79] Qual: Fix PHPStan messages (#38053) * Qual: Fix PHPStan messages # Qual: Fix PHPStan messages Fix mostly 'variable.undefined' PHPStan notices. * Qual: Fix Phan notices * Qual: Ignore false PhanPluginUnknownObjectMethodCall positive --------- Co-authored-by: Laurent Destailleur --- htdocs/core/lib/functions.lib.php | 4 +-- htdocs/core/lib/invoice.lib.php | 4 +-- htdocs/core/modules/DolibarrModules.class.php | 4 +-- .../modules/printing/printgcp.modules.php | 36 ++++++++++--------- .../doc/doc_generic_project_odt.modules.php | 6 +++- .../task/doc/doc_generic_task_odt.modules.php | 32 ++++++++--------- .../societe/doc/doc_generic_odt.modules.php | 9 ++--- .../doc/doc_generic_usergroup_odt.modules.php | 3 +- htdocs/core/photos_resize.php | 6 ++-- htdocs/core/tpl/bloc_comment.tpl.php | 15 ++++++-- htdocs/core/tpl/bloc_showhide.tpl.php | 9 ++++- .../tpl/document_actions_post_headers.tpl.php | 16 +++++++-- .../tpl/extrafields_list_array_fields.tpl.php | 8 ++++- .../tpl/extrafields_list_print_fields.tpl.php | 8 +++-- .../tpl/extrafields_list_search_title.tpl.php | 14 +++++--- htdocs/core/tpl/list_print_total.tpl.php | 4 ++- htdocs/core/tpl/objectline_edit.tpl.php | 7 ++-- htdocs/core/tpl/objectline_title.tpl.php | 23 ++++++++---- htdocs/core/tpl/objectline_view.tpl.php | 13 ++++--- htdocs/core/tpl/originproductline.tpl.php | 2 ++ htdocs/delivery/card.php | 17 ++++----- htdocs/ecm/tpl/enablefiletreeajax.tpl.php | 5 +++ htdocs/expedition/contact.php | 6 ++-- htdocs/expedition/document.php | 5 +-- htdocs/expedition/note.php | 5 +-- htdocs/expedition/shipment.php | 5 +-- htdocs/fichinter/card.php | 2 ++ htdocs/fourn/card.php | 3 +- htdocs/fourn/commande/card.php | 17 ++++----- htdocs/fourn/commande/dispatch.php | 3 +- htdocs/fourn/contact.php | 4 ++- htdocs/fourn/facture/card.php | 3 +- htdocs/holiday/card_group.php | 3 +- htdocs/holiday/list.php | 4 +-- htdocs/holiday/month_report.php | 4 +-- htdocs/holiday/view_log.php | 8 +++-- htdocs/hrm/evaluation_card.php | 8 ++--- htdocs/install/repair.php | 17 +++++---- htdocs/install/step1.php | 18 +++------- htdocs/install/step2.php | 6 ++-- htdocs/install/upgrade.php | 3 +- htdocs/install/upgrade2.php | 4 ++- 42 files changed, 234 insertions(+), 139 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9cf2ddabd4e..1ca54af860a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2306,8 +2306,8 @@ function dolSlugify($stringtoslugify) * Returns text escaped for inclusion into javascript code * * @param int|string $stringtoescape String to escape - * @param int<0,3> $mode 0=Escape also ' and " into ', 1=Escape ' but not " for usage into 'string', 2=Escape " but not ' for usage into "string", 3=Escape ' and " with \ - * @param int $noescapebackslashn 0=Escape also \n. 1=Do not escape \n. + * @param int<0,3> $mode 0=Escape also ' and " into ', 1=Escape ' but not " for usage into 'string', 2=Escape " but not ' for usage into "string", 3=Escape ' and " with \ . + * @param int<0,1> $noescapebackslashn 0=Escape also \n. 1=Do not escape \n. * @return string Escaped string. Both ' and " are escaped into ' if they are escaped. */ function dol_escape_js($stringtoescape, $mode = 0, $noescapebackslashn = 0) diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 10f003e26c1..21c5ea1c99d 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -5,7 +5,7 @@ * Copyright (C) 2015 Juanjo Menent * Copyright (C) 2017 Charlie Benke * Copyright (C) 2017 ATM-CONSULTING - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -526,7 +526,7 @@ function getNumberInvoicesPieChart($mode) $dolgraph->setLegend($legend); - $dolgraph->SetDataColor(array_values($colorseries)); + $dolgraph->SetDataColor($colorseries); $dolgraph->setShowLegend(2); $dolgraph->setShowPercent(1); $dolgraph->SetType(array('bars', 'bars', 'bars', 'bars', 'bars', 'bars')); diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index fbf52b6eb02..0252645ccd8 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -8,7 +8,7 @@ * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2018 Josep Lluís Amador * Copyright (C) 2019-2026 Frédéric France - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * * 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 @@ -298,7 +298,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it */ public $export_help_array; /** - * @var array>|array> + * @var array>|array> * * Other example: * modBanque: []=array('-b.amount'=>'NULLIFNEG', 'b.amount'=>'NULLIFNEG') diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index 2c757a31d37..a33288de073 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -1,7 +1,7 @@ - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * * 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 @@ -130,23 +130,23 @@ class printing_printgcp extends PrintingDriver $apiService = $serviceFactory->createService($this->OAUTH_SERVICENAME_GOOGLE, $credentials, $storage, array()); '@phan-var-force OAuth\OAuth2\Service\Google $apiService'; // createService is only ServiceInterface - $token_ok = true; + $token = null; try { // Do a select into oauth_token to get existing token $token = $storage->retrieveAccessToken($this->OAUTH_SERVICENAME_GOOGLE); } catch (Exception $e) { $this->errors[] = $e->getMessage(); - $token_ok = false; + $token = null; } $expire = false; // Is token expired or will token expire in the next 30 seconds - if ($token_ok) { + if ($token !== null) { $expire = ($token->getEndOfLife() !== -9002 && $token->getEndOfLife() !== -9001 && time() > ($token->getEndOfLife() - 30)); } // Token expired so we refresh it - if ($token_ok && $expire) { + if (($token !== null) && $expire) { try { // il faut sauvegarder le refresh token car google ne le donne qu'une seule fois $refreshtoken = $token->getRefreshToken(); @@ -170,7 +170,7 @@ class printing_printgcp extends PrintingDriver 'renew' => $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?state=userinfo_email,userinfo_profile,cloud_print&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'delete' => ($storage->hasAccessToken($this->OAUTH_SERVICENAME_GOOGLE) ? $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp') : '') ); - if ($token_ok) { + if ($token !== null) { $expiredat = ''; $refreshtoken = $token->getRefreshToken(); @@ -291,21 +291,21 @@ class printing_printgcp extends PrintingDriver $apiService = $serviceFactory->createService($this->OAUTH_SERVICENAME_GOOGLE, $credentials, $storage, array()); '@phan-var-force OAuth\OAuth2\Service\Google $apiService'; // createService is only ServiceInterface // Check if we have auth token - $token_ok = true; + $token = null; try { $token = $storage->retrieveAccessToken($this->OAUTH_SERVICENAME_GOOGLE); } catch (Exception $e) { $this->errors[] = $e->getMessage(); - $token_ok = false; + $token = null; } $expire = false; // Is token expired or will token expire in the next 30 seconds - if ($token_ok) { + if ($token !== null) { $expire = ($token->getEndOfLife() !== -9002 && $token->getEndOfLife() !== -9001 && time() > ($token->getEndOfLife() - 30)); } // Token expired so we refresh it - if ($token_ok && $expire) { + if (($token !== null) && $expire) { try { // il faut sauvegarder le refresh token car google ne le donne qu'une seule fois $refreshtoken = $token->getRefreshToken(); @@ -317,6 +317,7 @@ class printing_printgcp extends PrintingDriver } } // Send a request with api + $response = ''; try { $response = $apiService->request(self::PRINTERS_SEARCH_URL); } catch (Exception $e) { @@ -435,14 +436,14 @@ class printing_printgcp extends PrintingDriver '@phan-var-force OAuth\OAuth2\Service\Google $apiService'; // createService is only ServiceInterface // Check if we have auth token and refresh it - $token_ok = true; + $token = null; try { $token = $storage->retrieveAccessToken($this->OAUTH_SERVICENAME_GOOGLE); } catch (Exception $e) { $this->errors[] = $e->getMessage(); - $token_ok = false; + $token = null; } - if ($token_ok) { + if ($token !== null) { try { // il faut sauvegarder le refresh token car google ne le donne qu'une seule fois $refreshtoken = $token->getRefreshToken(); @@ -489,22 +490,22 @@ class printing_printgcp extends PrintingDriver $apiService = $serviceFactory->createService($this->OAUTH_SERVICENAME_GOOGLE, $credentials, $storage, array()); '@phan-var-force OAuth\OAuth2\Service\Google $apiService'; // createService is only ServiceInterface // Check if we have auth token - $token_ok = true; + $token = null; try { $token = $storage->retrieveAccessToken($this->OAUTH_SERVICENAME_GOOGLE); } catch (Exception $e) { $this->errors[] = $e->getMessage(); - $token_ok = false; + $token = null; $error++; } $expire = false; // Is token expired or will token expire in the next 30 seconds - if ($token_ok) { + if ($token !== null) { $expire = ($token->getEndOfLife() !== -9002 && $token->getEndOfLife() !== -9001 && time() > ($token->getEndOfLife() - 30)); } // Token expired so we refresh it - if ($token_ok && $expire) { + if (($token !== null) && $expire) { try { // il faut sauvegarder le refresh token car google ne le donne qu'une seule fois $refreshtoken = $token->getRefreshToken(); @@ -518,6 +519,7 @@ class printing_printgcp extends PrintingDriver } // Getting Jobs // Send a request with api + $response = ''; try { $response = $apiService->request(self::PRINTERS_GET_JOBS); } catch (Exception $e) { diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index e1c3d7802e1..2f9d72ea3a3 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -5,7 +5,7 @@ * Copyright (C) 2016-2023 Charlene Benke * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2023 Gauthier VERDOL - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * * 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 @@ -896,6 +896,7 @@ class doc_generic_project_odt extends ModelePDFProjects $listlines = $odfHandler->setSegment('projectcontacts'); foreach ($contact_arrray as $contact) { + $objectdetail = null; if ($contact['source'] == 'internal') { $objectdetail = new User($this->db); $objectdetail->fetch($contact['id']); @@ -907,6 +908,9 @@ class doc_generic_project_odt extends ModelePDFProjects $soc = new Societe($this->db); $soc->fetch($contact['socid']); $contact['socname'] = $soc->name; + } else { + dol_syslog('Unexpected contact source:'.$contact['source'].'.'. getCallerInfoString(), LOG_ERR); + continue; } $contact['fullname'] = $objectdetail->getFullName($outputlangs, 1); diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 34a6e1fff43..ff16ad34b5b 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -6,7 +6,7 @@ * Copyright (C) 2016 Charlie Benke * Copyright (C) 2018-2026 Frédéric France * Copyright (C) 2023 Gauthier VERDOL - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * * 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 @@ -646,15 +646,15 @@ class doc_generic_task_odt extends ModelePDFTask } } // Check for segment - $foundtagforlines = 1; + $listlinestaskres = null; try { $listlinestaskres = $odfHandler->setSegment('tasksressources'); } catch (OdfExceptionSegmentNotFound $e) { // We may arrive here if tags for lines not present into template - $foundtagforlines = 0; + $listlinestaskres = null; dol_syslog($e->getMessage(), LOG_INFO); } - if ($foundtagforlines && (is_array($contact_array) && count($contact_array) > 0)) { + if ($listlinestaskres && (is_array($contact_array) && count($contact_array) > 0)) { foreach ($contact_array as $contact) { if ($contact['source'] == 'internal') { $objectdetail = new User($this->db); @@ -688,12 +688,12 @@ class doc_generic_task_odt extends ModelePDFTask } // Check for segment - $foundtagforlines = 1; + $listlinestasktime = null; try { $listlinestasktime = $odfHandler->setSegment('taskstimes'); } catch (OdfExceptionSegmentNotFound $e) { // We may arrive here if tags for lines not present into template - $foundtagforlines = 0; + $listlinestasktime = null; dol_syslog($e->getMessage(), LOG_INFO); } @@ -708,7 +708,7 @@ class doc_generic_task_odt extends ModelePDFTask $sql .= " ORDER BY t.element_date DESC"; $resql = $this->db->query($sql); - if ($foundtagforlines && $resql) { + if ($listlinestasktime !== null && $resql) { $num = $this->db->num_rows($resql); $i = 0; $tasks = array(); @@ -744,15 +744,15 @@ class doc_generic_task_odt extends ModelePDFTask // Replace tags of project files // Check for segment - $foundtagforlines = 1; + $listtasksfiles = null; try { $listtasksfiles = $odfHandler->setSegment('tasksfiles'); } catch (OdfExceptionSegmentNotFound $e) { // We may arrive here if tags for lines not present into template - $foundtagforlines = 0; + $listtasksfiles = null; dol_syslog($e->getMessage(), LOG_INFO); } - if ($foundtagforlines) { + if ($listtasksfiles !== null) { $upload_dir = $conf->project->dir_output.'/'.dol_sanitizeFileName($project->ref).'/'.dol_sanitizeFileName($object->ref); $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', 'name', SORT_ASC, 1); @@ -781,15 +781,15 @@ class doc_generic_task_odt extends ModelePDFTask // Replace tags of project files // Check for segment - $foundtagforlines = 1; + $listlines = null; try { $listlines = $odfHandler->setSegment('projectfiles'); } catch (OdfExceptionSegmentNotFound $e) { // We may arrive here if tags for lines not present into template - $foundtagforlines = 0; + $listlines = null; dol_syslog($e->getMessage(), LOG_INFO); } - if ($foundtagforlines) { + if ($listlines !== null) { try { $upload_dir = $conf->project->dir_output.'/'.dol_sanitizeFileName($object->ref); $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', 'name', SORT_ASC, 1); @@ -825,15 +825,15 @@ class doc_generic_task_odt extends ModelePDFTask } } // Check for segment - $foundtagforlines = 1; + $listlines = null; try { $listlines = $odfHandler->setSegment('projectcontacts'); } catch (OdfExceptionSegmentNotFound $e) { // We may arrive here if tags for lines not present into template - $foundtagforlines = 0; + $listlines = null; dol_syslog($e->getMessage(), LOG_INFO); } - if ($foundtagforlines && (is_array($contact_array) && count($contact_array) > 0)) { + if ($listlines !== null && (is_array($contact_array) && count($contact_array) > 0)) { try { foreach ($contact_array as $contact) { if ($contact['source'] == 'internal') { 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 bd851f8cab5..3ee4d69d315 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2010-2011 Laurent Destailleur * Copyright (C) 2016 Charlie Benke * Copyright (C) 2018-2025 Frédéric France - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * * 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 @@ -319,6 +319,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc $result = $this->db->query($sql); $num = $this->db->num_rows($result); + $contactstatic = null; if ($num) { require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; @@ -334,15 +335,15 @@ class doc_generic_odt extends ModeleThirdPartyDoc } } if ((is_array($contact_arrray) && count($contact_arrray) > 0)) { - $foundtagforlines = 1; + $listlines = null; try { $listlines = $odfHandler->setSegment('companycontacts'); } catch (OdfExceptionSegmentNotFound $e) { // We may arrive here if tags for lines not present into template - $foundtagforlines = 0; + $listlines = null; dol_syslog($e->getMessage(), LOG_INFO); } - if ($foundtagforlines && $contactstatic !== null) { + if ($listlines !== null && $contactstatic !== null) { foreach ($contact_arrray as $array_key => $contact_id) { $res_contact = $contactstatic->fetch($contact_id); if ((int) $res_contact > 0) { diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index dc6d4b1495a..367c377542b 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2010-2012 Laurent Destailleur * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * * 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 @@ -329,6 +329,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $result = $object->fetch_contact($arrayidcontact[0]); } + $contactobject = null; // Recipient name if (!empty($usecontact)) { // We can use the company of contact instead of thirdparty company diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index 9361ab4ce98..349852e9f95 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -3,7 +3,7 @@ * Copyright (C) 2009 Meos * Copyright (C) 2012 Regis Houssin * Copyright (C) 2016 Juanjo Menent - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Alexandre Spangaro * Copyright (C) 2024-2025 Frédéric France * @@ -38,6 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; * @var HookManager $hookmanager * @var Translate $langs * @var User $user + * @var string $dolibarr_main_data_root */ // Load translation files required by the page @@ -131,6 +132,7 @@ if (!$accessallowed) { // Define dir according to modulepart $dir = ''; +$object = null; if ($modulepart == 'produit' || $modulepart == 'product' || $modulepart == 'service' || $modulepart == 'produit|service') { require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $object = new Product($db); @@ -567,7 +569,7 @@ if (!empty($conf->use_javascript_ajax)) { print $langs->trans("DefineNewAreaToPick").'...
'; print '
'; - if (empty($conf->dol_no_mouse_hover)) { + if (empty($conf->dol_no_mouse_hover) && $object !== null) { print '
'; print ''; print '
'; diff --git a/htdocs/core/tpl/bloc_comment.tpl.php b/htdocs/core/tpl/bloc_comment.tpl.php index c63a4b0bdeb..4678964bf24 100644 --- a/htdocs/core/tpl/bloc_comment.tpl.php +++ b/htdocs/core/tpl/bloc_comment.tpl.php @@ -1,5 +1,6 @@ + * Copyright (C) 2026 MDW */ /** @@ -11,7 +12,17 @@ * * @var string $action * @var string $withproject + * @var int $withproject + * @var int $id + * @var string $idcomment */ +' +@phan-var-force string $action +@phan-var-force string $withproject +@phan-var-force int $withproject +@phan-var-force int $id +@phan-var-force string $idcomment +'; // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { @@ -71,7 +82,7 @@ print ''; // List of comments if (!empty($object->comments)) { // Default color for current user - $TColors = array($user->id => array('bgcolor'=>'efefef', 'color'=>'555')); + $TColors = array($user->id => array('bgcolor' => 'efefef', 'color' => '555')); $first = true; foreach ($object->comments as $comment) { $fk_user = $comment->fk_user_author; @@ -83,7 +94,7 @@ if (!empty($object->comments)) { $bgcolor = $userstatic->color; } $color = (colorIsLight($bgcolor)) ? '555' : 'fff'; - $TColors[$fk_user] = array('bgcolor'=>$bgcolor, 'color'=>$color); + $TColors[$fk_user] = array('bgcolor' => $bgcolor, 'color' => $color); } print '
'; if ($fk_user != $user->id) { diff --git a/htdocs/core/tpl/bloc_showhide.tpl.php b/htdocs/core/tpl/bloc_showhide.tpl.php index 162971cf061..e0fe29be516 100644 --- a/htdocs/core/tpl/bloc_showhide.tpl.php +++ b/htdocs/core/tpl/bloc_showhide.tpl.php @@ -2,7 +2,7 @@ /* Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Laurent Destailleur * Copyright (C) 2018-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 MDW * * 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 @@ -21,7 +21,14 @@ * @var CommonObject $object * * @var string $blocname + * @var string $title */ +' +@phan-var-force string $blocname +@phan-var-force string $title +@phan-var-force array $parameters +'; + // Protection to avoid direct call of template if (empty($blocname)) { print "Error, template page can't be called as URL"; diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php index 72ed1486694..35534905032 100644 --- a/htdocs/core/tpl/document_actions_post_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php @@ -5,7 +5,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2025 MDW + * Copyright (C) 2025-2026 MDW * Copyright (C) 2025 Charlene Benke * * This program is free software; you can redistribute it and/or modify @@ -54,8 +54,17 @@ if (empty($langs) || !is_object($langs)) { print "Error, template page can't be called as URL"; exit(1); } +/** + * @var array $filearray + * @var ?int<0,1> $permtoedit + * @var ?int<0,1> $permission + * @var int<0,1> $permissiontoadd + * @var ?string $savingdocmask + * @var CommonObject $object + * @var string $sortfield + * @var string $sortorder + */ ' -@phan-var-force CommonObject $object @phan-var-force string $action @phan-var-force string $modulepart @phan-var-force string $upload_dir @@ -65,6 +74,9 @@ if (empty($langs) || !is_object($langs)) { @phan-var-force int<0,1> $permissiontoadd @phan-var-force ?string $savingdocmask @phan-var-force ?string $param +@phan-var-force CommonObject $object +@phan-var-force string $sortfield +@phan-var-force string $sortorder '; diff --git a/htdocs/core/tpl/extrafields_list_array_fields.tpl.php b/htdocs/core/tpl/extrafields_list_array_fields.tpl.php index 7de6e424bb6..e4b06a25d86 100644 --- a/htdocs/core/tpl/extrafields_list_array_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_array_fields.tpl.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2025-2026 MDW */ // This tpl file is included into the init part of pages, so before action. @@ -10,13 +10,19 @@ /** * @var Conf $conf * + * @var array $arrayfields * @var string $extrafieldsobjectkey * @var string $extrafieldsobjectprefix * @var int $extrafieldspositionoffset + * @var ?CommonObject $object */ ' @phan-var-force array $arrayfields +@phan-var-force string $extrafieldsobjectkey +@phan-var-force string $extrafieldsobjectprefix +@phan-var-force int $extrafieldspositionoffset +@phan-var-force ?CommonObject $object '; // Protection to avoid direct call of template diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php index 2c41594dfcc..b22741dcf3f 100644 --- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php @@ -1,6 +1,6 @@ - * Copyright (C) 2025 MDW + * Copyright (C) 2025-2026 MDW * * 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 @@ -25,10 +25,12 @@ * * @var string $extrafieldsobjectkey * @var string $extrafieldsobjectprefix + * @var int $i */ ' @phan-var-force CommonObject $object @phan-var-force stdClass $obj +@phan-var-force int $i '; // Protection to avoid direct call of template @@ -41,6 +43,8 @@ if (empty($extrafieldsobjectkey) && is_object($object)) { $extrafieldsobjectkey = $object->table_element; } +$totalarray = array(); + // Loop to show all columns of extrafields from $obj, $extrafields and $db if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafieldsobjectkey])) { // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... if (array_key_exists('label', $extrafields->attributes[$extrafieldsobjectkey]) && is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label'])) { @@ -87,7 +91,7 @@ if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafield print 'attributes[$extrafieldsobjectkey]['type'][$key], array('stars')) ? ' title="'.dol_escape_htmltag($title).'"' : ''); + print($title && !in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$key], array('stars')) ? ' title="'.dol_escape_htmltag($title).'"' : ''); print '>'; print $cssclassview ? '' : ''; print $valuetoshow; diff --git a/htdocs/core/tpl/extrafields_list_search_title.tpl.php b/htdocs/core/tpl/extrafields_list_search_title.tpl.php index 3a54b1392e0..b04c57acf56 100644 --- a/htdocs/core/tpl/extrafields_list_search_title.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_title.tpl.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2025-2026 MDW * Copyright (C) 2025 Frédéric France * Copyright (C) 2025 Laurent Destailleur * @@ -31,17 +31,21 @@ * @var ?int $disablesortlink * @var string $sortfield * @var string $sortorder + * @var string $param */ +' +@phan-var-force ?int<0,1> $disablesortlink +@phan-var-force string $sortfield +@phan-var-force string $sortorder +@phan-var-force string $param +@phan-var-force ?array{nbfield?:int} $totalarray +'; // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; exit(1); } -' -@phan-var-force ?int<0,1> $disablesortlink -'; - if (empty($extrafieldsobjectkey) && is_object($object)) { $extrafieldsobjectkey = $object->table_element; } diff --git a/htdocs/core/tpl/list_print_total.tpl.php b/htdocs/core/tpl/list_print_total.tpl.php index 9b6e6f0c136..824d0f2a203 100644 --- a/htdocs/core/tpl/list_print_total.tpl.php +++ b/htdocs/core/tpl/list_print_total.tpl.php @@ -1,7 +1,7 @@ - * Copyright (C) 2025 MDW + * Copyright (C) 2025-2026 MDW * * 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 @@ -27,12 +27,14 @@ * @var int $num * @var ?int $limit * @var ?int $offset + * @var string $sql * @var string $sqlfields * @var string $moreinfoontotal * @var array{nbfield:int,type?:array,pos?:array,val?:array} $totalarray */ ' @phan-var-force array{nbfield:int,type?:array,pos?:array,val?:array} $totalarray +@phan-var-force string $sql @phan-var-force ?string $sqlfields @phan-var-force ?int $limit '; diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 8b9e2545f5c..a905cdc008f 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -7,7 +7,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2022 OpenDSI - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Alexandre Spangaro * Copyright (C) 2025 Lenin Rivas * @@ -51,6 +51,8 @@ * * @var string $action * @var int $dateSelector + * @var string $var + * @var int $i */ // Protection to avoid direct call of template @@ -64,6 +66,7 @@ if (empty($object) || !is_object($object)) { @phan-var-force Societe $seller @phan-var-force Societe $buyer @phan-var-force string $var +@phan-var-force int $i '; // Handle subtotals line edit @@ -116,7 +119,7 @@ $coldisplay = 0; ?> - + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2025 Lenin Rivas + * Copyright (C) 2026 MDW * * 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 @@ -34,20 +35,28 @@ * @var Conf $conf * @var User $user * - * @var int $disableedit - * @var int $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) - * @var int $outputalsopricetotalwithtax - * @var int $usemargins (0 to disable all margins columns, 1 to show according to margin setup) + * @var int<0,1> $disableedit + * @var int<0,1> $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) + * @var int<0,1> $outputalsopricetotalwithtax + * @var int<0,1> $usemargins (0 to disable all margins columns, 1 to show according to margin setup) + * @var string $action */ - // Protection to avoid direct call of template +// Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; exit(1); } -'@phan-var-force CommonObject|Facture $this - @phan-var-force CommonObject $object'; +' +@phan-var-force CommonObject|Facture $this +@phan-var-force CommonObject $object +@phan-var-force int<0,1> $disableedit +@phan-var-force int<0,1> $inputalsopricewithtax +@phan-var-force int<0,1> $outputalsopricetotalwithtax +@phan-var-force int<0,1> $usemargins +@phan-var-force string $action +'; print "\n"; diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 6c8908271db..884d5e6d624 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -7,7 +7,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2017 Juanjo Menent * Copyright (C) 2022 OpenDSI - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024-2026 Alexandre Spangaro * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2025 Lenin Rivas @@ -52,11 +52,12 @@ * @var ?Product $product_static * @var string $action * @var int $i - * @var int $forceall + * @var int<0,1> $forceall * @var int $num * @var int $senderissupplier * @var string $text * @var string $description + * @var Object $objp * @var int $dateSelector */ // Protection to avoid direct call of template @@ -128,7 +129,7 @@ $coldisplay = 0; > - +
multicurrency_subprice * (1 + ($line->tva_tx / 100)), 'MU'); // one tax } - if (empty($line->fk_remise_except)) print (isset($upinctax) ? price($sign * $upinctax) : price($sign * $line->subprice)); // if upinctax can't be known, we show subprice excl ta + if (empty($line->fk_remise_except)) { + print(isset($upinctax) ? price($sign * $upinctax) : price($sign * $line->subprice)); + } // if upinctax can't be known, we show subprice excl ta ?> multicurrency_code && $this->multicu $multicurrency_upinctax = price2num($line->multicurrency_subprice * (1 + ($line->tva_tx / 100)), 'MU'); // one tax } if (empty($line->fk_remise_except)) { - print (isset($multicurrency_upinctax) ? price($sign * $multicurrency_upinctax) : price($sign * $line->multicurrency_subprice)); // if upinctax can't be known, we show subprice excl ta + print(isset($multicurrency_upinctax) ? price($sign * $multicurrency_upinctax) : price($sign * $line->multicurrency_subprice)); // if upinctax can't be known, we show subprice excl ta } ?> diff --git a/htdocs/core/tpl/originproductline.tpl.php b/htdocs/core/tpl/originproductline.tpl.php index f49d79d4593..ba3eef890ad 100644 --- a/htdocs/core/tpl/originproductline.tpl.php +++ b/htdocs/core/tpl/originproductline.tpl.php @@ -3,6 +3,7 @@ * Copyright (C) 2017 Charlie Benke * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2026 MDW * * 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 @@ -20,6 +21,7 @@ /** * @var CommonObject $this * @var Conf $conf + * @var Translate $langs * @var CommonObjectLine $line */ // Protection to avoid direct call of template diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index c88c3263845..d7dac05c270 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -7,7 +7,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2015 Claudio Aschieri * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2025 MDW + * Copyright (C) 2025-2026 MDW * * 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 @@ -299,6 +299,7 @@ llxHeader('', $title, 'Livraison', '', 0, 0, '', '', '', 'mod-delivery page-card $form = new Form($db); $formfile = new FormFile($db); +$objectsrc = null; if ($action == 'create') { // Create. Seems to no be used @@ -371,7 +372,7 @@ if ($action == 'create') { // Thirdparty $morehtmlref .= '
'.$expedition->thirdparty->getNomUrl(1); // Project - if (isModEnabled('project')) { + if (isModEnabled('project') && $objectsrc !== null) { $langs->load("projects"); $morehtmlref .= '
'; if (0) { // @phpstan-ignore-line Do not change on shipment @@ -722,14 +723,14 @@ if ($action == 'create') { * Linked object block (of linked shipment) */ - // Show links to link elements - print '
'; + // Show links to link elements + print '
'; - // List of actions on element - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + // List of actions on element + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; - //$tmparray = $form->showLinkToObjectBlock($object, null, array('order'), 1); - $somethingshown = $form->showLinkedObjectBlock($object, ''); + //$tmparray = $form->showLinkToObjectBlock($object, null, array('order'), 1); + $somethingshown = $form->showLinkedObjectBlock($object, ''); } diff --git a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php index fe0e6ae5ecf..2144711f62f 100644 --- a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php +++ b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php @@ -2,6 +2,7 @@ /* Copyright (C) 2012 Regis Houssin * Copyright (C) 2018 Laurent Destailleur * Copyright (C) 2025 Frédéric France + * Copyright (C) 2026 MDW * * 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 @@ -23,7 +24,11 @@ /** * @var ?Conf $conf * @var Translate $langs + * @var string $param */ +' +@phan-var-force string $param +'; // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template enablefiletreeajax.tpl.php can't be called as URL"; diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index 357f59660be..8767cb9908a 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2023 Christian Foellmann * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2025 MDW + * Copyright (C) 2025-2026 MDW * * 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 @@ -54,6 +54,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $typeobject = null; +$objectsrc = null; $object = new Expedition($db); if ($id > 0 || !empty($ref)) { $object->fetch($id, $ref); @@ -94,7 +95,7 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } -if (empty($reshook)) { +if (empty($reshook) && $objectsrc !== null) { if ($action == 'addcontact' && $user->hasRight('expedition', 'creer')) { if ($result > 0 && $id > 0) { $contactid = (GETPOSTINT('userid') ? GETPOSTINT('userid') : GETPOSTINT('contactid')); @@ -106,6 +107,7 @@ if (empty($reshook)) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } else { + $mesgs = null; if ($objectsrc->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); $mesg = $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"); diff --git a/htdocs/expedition/document.php b/htdocs/expedition/document.php index fd8844ee503..1955b4b2cd9 100644 --- a/htdocs/expedition/document.php +++ b/htdocs/expedition/document.php @@ -6,7 +6,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2025 MDW + * Copyright (C) 2025-2026 MDW * * 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 @@ -75,6 +75,7 @@ if (!$sortfield) { } $object = new Expedition($db); +$objectsrc = null; if ($id > 0 || !empty($ref)) { $object->fetch($id, $ref); @@ -153,7 +154,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project - if (isModEnabled('project')) { + if (isModEnabled('project') && $objectsrc !== null) { $langs->load("projects"); $morehtmlref .= '
'; if (0) { // @phpstan-ignore-line Do not change on shipment diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php index 936c4856578..c453496bba7 100644 --- a/htdocs/expedition/note.php +++ b/htdocs/expedition/note.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2025 MDW + * Copyright (C) 2025-2026 MDW * * 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 @@ -50,6 +50,7 @@ $id = (GETPOSTINT('id') ? GETPOSTINT('id') : GETPOSTINT('facid')); // For backwa $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); +$objectsrc = null; $object = new Expedition($db); if ($id > 0 || !empty($ref)) { $object->fetch($id, $ref); @@ -122,7 +123,7 @@ if ($id > 0 || !empty($ref)) { // Thirdparty $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project - if (isModEnabled('project')) { + if (isModEnabled('project') && $objectsrc !== null) { $langs->load("projects"); $morehtmlref .= '
'; if (0) { // @phpstan-ignore-line Do not change on shipment diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 690a754f09e..b84ec12aabe 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -78,6 +78,7 @@ $result = restrictedArea($user, 'commande', $order_id); $object = new Commande($db); $shipment = new Expedition($db); $extrafields = new ExtraFields($db); +$product = null; // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); @@ -797,7 +798,7 @@ if ($order_id > 0 || !empty($ref)) { $product->load_stock('warehouseopen'); } - if ($objp->fk_product > 0 && ($type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) && isModEnabled('stock')) { + if ($objp->fk_product > 0 && ($type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) && isModEnabled('stock') && $product !== null) { print ''; if ($objp->stockable_product == Product::ENABLED_STOCK) { print $product->stock_reel; @@ -820,7 +821,7 @@ if ($order_id > 0 || !empty($ref)) { print "\n"; // Show subproducts lines - if ($objp->fk_product > 0 && getDolGlobalString('PRODUIT_SOUSPRODUITS')) { + if ($objp->fk_product > 0 && getDolGlobalString('PRODUIT_SOUSPRODUITS') && $product !== null) { // Set tree of subproducts in product->sousprods $product->get_sousproduits_arbo(); //var_dump($product->sousprods);exit; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 2e2e9a0cfe0..c13f57f4ddf 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -128,6 +128,8 @@ if (GETPOST('attribute', 'aZ09') && isset($extrafields->attributes[$object->tabl } +$classname = ''; + /* * Actions */ diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index cd50c8d6fca..6cdefe048a3 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -8,7 +8,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2021-2025 Frédéric France - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -790,6 +790,7 @@ if ($object->id > 0) { $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p"; $sql .= " WHERE p.fk_soc = ".((int) $object->id); $sql .= " AND p.entity IN (".getEntity('commande_fournisseur').")"; + $num = 0; $resql = $db->query($sql); if ($resql) { $object_count = $db->fetch_object($resql); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index a1e11254784..763713640f0 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -12,7 +12,7 @@ * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2022-2026 Charlene Benke * Copyright (C) 2023 Joachim Kueter - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Nick Fragoulis * Copyright (C) 2025-2026 Alexandre Spangaro * Copyright (C) 2026 William Mead @@ -190,6 +190,7 @@ if (isModEnabled('project')) { } $error = 0; +$classname = null; /* @@ -1710,12 +1711,12 @@ if (empty($reshook)) { $array_option, $lines[$i]->fk_unit, 0, - $element, - !empty($lines[$i]->id) ? $lines[$i]->id : $lines[$i]->rowid, - -1, - $lines[$i]->special_code, - $label - ); + $element, + !empty($lines[$i]->id) ? $lines[$i]->id : $lines[$i]->rowid, + -1, + $lines[$i]->special_code, + $label + ); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -2138,7 +2139,7 @@ if ($action == 'create') { //print ''; print ''; - if (!empty($origin) && !empty($originid) && is_object($objectsrc)) { + if (!empty($origin) && !empty($originid) && is_object($objectsrc) && $classname !== null) { print "\n"; print "\n"; print ''."\n"; diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 949da96ba33..c595dd3aae7 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -9,7 +9,7 @@ * Copyright (C) 2017-2022 Ferran Marcet * Copyright (C) 2018-2026 Frédéric France * Copyright (C) 2019-2020 Christophe Battarel - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * * 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 @@ -423,6 +423,7 @@ $sellby = 0; $qty = 0; $price = '0'; $entrepot = 0; +$product = 0; // Remove a dispatched line if ($action == 'confirm_deleteline' && $confirm == 'yes' && $permissiontoreceive) { diff --git a/htdocs/fourn/contact.php b/htdocs/fourn/contact.php index 7b4006532a3..1dc42ee1abe 100644 --- a/htdocs/fourn/contact.php +++ b/htdocs/fourn/contact.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2006 Regis Houssin * Copyright (C) 2024 Frédéric France - * Copyright (C) 2025 MDW + * Copyright (C) 2025-2026 MDW * * 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 @@ -45,6 +45,8 @@ $langs->load("companies"); llxHeader(); +$socid = 0; + // Security check if ($user->socid > 0) { $action = ''; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 9185d757493..0e148814acd 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -153,6 +153,7 @@ if (GETPOST('attribute', 'aZ09') && isset($extrafields->attributes[$object->tabl } $error = 0; +$classname = null; /* @@ -2924,7 +2925,7 @@ if ($action == 'create') { print ''; - if (!empty($objectsrc)) { + if (!empty($objectsrc) && $classname !== null) { print "\n"; print "\n"; print ''."\n"; diff --git a/htdocs/holiday/card_group.php b/htdocs/holiday/card_group.php index 5e4095031e0..fa16c6308c0 100644 --- a/htdocs/holiday/card_group.php +++ b/htdocs/holiday/card_group.php @@ -8,7 +8,7 @@ * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2020-2021 Udo Tamm * Copyright (C) 2022 Anthony Berton - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * * 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 @@ -376,6 +376,7 @@ $listhalfday = array('morning' => $langs->trans("Morning"), "afternoon" => $lang $title = $langs->trans('Leave'); $help_url = 'EN:Module_Holiday'; +$errors = array(); llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-holiday page-card_group'); diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 8fba4763aaa..a27e2773751 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -6,7 +6,7 @@ * Copyright (C) 2019-2026 Frédéric France * Copyright (C) 2024 Benjamin Falière * Copyright (C) 2024 Alexandre Spangaro - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * * 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 @@ -613,8 +613,8 @@ if (!empty($arrayfields['cp.ref']['checked'])) { print ''; } +$morefilter = ''; if (!empty($arrayfields['cp.fk_user']['checked'])) { - $morefilter = ''; if (getDolGlobalString('HOLIDAY_HIDE_FOR_NON_SALARIES')) { $morefilter = 'AND employee = 1'; } diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index 09ccab39350..1388836f3cb 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -4,7 +4,7 @@ * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2024 Alexandre Spangaro - * Copyright (C) 2025 MDW + * Copyright (C) 2025-2026 MDW * * 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 @@ -272,9 +272,9 @@ if (!empty($arrayfields['cp.ref']['checked'])) { } // Filter: Type +$arraytypeleaves = array(); if (!empty($arrayfields['cp.fk_type']['checked'])) { $typeleaves = $holidaystatic->getTypes(1, -1); - $arraytypeleaves = array(); foreach ($typeleaves as $key => $val) { $labeltoshow = ($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']); $arraytypeleaves[$val['rowid']] = $labeltoshow; diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index ef4d13f7d41..8713cd82ee5 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -4,7 +4,7 @@ * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 Alexandre Spangaro - * Copyright (C) 2025 MDW + * Copyright (C) 2025-2026 MDW * * 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 @@ -30,6 +30,10 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var User $user + */ + // Security check (access forbidden for external user too) if (!$user->hasRight('holiday', 'define_holiday') || $user->socid > 0) { accessforbidden(); @@ -259,7 +263,7 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } if (!empty($search_id)) { - $param .= '&search_status='.urlencode($search_status); + $param .= '&search_id='.urlencode($search_id); } if (!empty($search_month) && $search_month > 0) { $param .= '&search_month='.urlencode((string) ($search_month)); diff --git a/htdocs/hrm/evaluation_card.php b/htdocs/hrm/evaluation_card.php index 57b0e9552bf..dc8975821a5 100644 --- a/htdocs/hrm/evaluation_card.php +++ b/htdocs/hrm/evaluation_card.php @@ -4,7 +4,7 @@ * Copyright (C) 2021 Greg Rastklan * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024-2026 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -211,18 +211,16 @@ if (empty($reshook)) { } } else { //check if the skill is present to use it - $find = false; $keyFind = 0; foreach ($SkillrecordsForActiveUser as $k => $sr) { if ($sr->fk_skill == $line->fk_skill) { $keyFind = $k; - $find = true; break; } } //we update the skill user - if ($find) { - $updSkill = $SkillrecordsForActiveUser[$k]; + if ($keyFind) { + $updSkill = $SkillrecordsForActiveUser[$keyFind]; $updSkill->rankorder = $line->rankorder; $updSkill->update($user); diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 5f1ce57d142..89eab5a6bcc 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -31,10 +31,13 @@ include_once 'inc.php'; /** + * @var DoliDB $b * @var Conf $conf * @var Translate $langs * + * @var string $dolibarr_main_data_root * @var string $dolibarr_main_document_root + * @var string $dolibarr_main_db_character_set * @var string $dolibarr_main_db_host * @var string $dolibarr_main_db_port * @var string $dolibarr_main_db_name @@ -98,8 +101,6 @@ if (!is_object($conf)) { * View */ -$form = new Form($db); - pHeader($langs->trans("Repair"), "upgrade2", GETPOST('action', 'aZ09')); // Action to launch the repair script @@ -138,6 +139,8 @@ $conf->db->dolibarr_main_db_cryptkey = isset($dolibarr_main_db_cryptkey) ? $doli $db = getDoliDBInstance($conf->db->type, $conf->db->host, (string) $conf->db->user, (string) $conf->db->pass, (string) $conf->db->name, (int) $conf->db->port); +$form = new Form($db); + if ($db->connected) { print ''; print $langs->trans("ServerConnection")." : ".$dolibarr_main_db_host.''.$langs->trans("OK").""; @@ -2055,7 +2058,7 @@ if ($ok && GETPOST('recalculateinvoicetotal') == 'confirmed') { // Calcul de la somme des paiements reçus $sql_paiements = "SELECT SUM(amount) as somme from ".MAIN_DB_PREFIX."paiement_facture WHERE fk_facture = $obj->rowid"; $montantPaiements = $db->fetch_object($db->query($sql_paiements))->somme; - $totHt= ($obj_calcul->total_ht ? price2num($obj_calcul->total_ht, 'MT') : 0); + $totHt = ($obj_calcul->total_ht ? price2num($obj_calcul->total_ht, 'MT') : 0); $totTva = ($obj_calcul->total_tva ? price2num($obj_calcul->total_tva, 'MT') : 0); $totLocal1 = ($obj_calcul->localtax1 ? price2num($obj_calcul->localtax1, 'MT') : 0); $totLocal2 = ($obj_calcul->localtax2 ? price2num($obj_calcul->localtax2, 'MT') : 0); @@ -2068,8 +2071,8 @@ if ($ok && GETPOST('recalculateinvoicetotal') == 'confirmed') { localtax1 = $totLocal1, localtax2 = $totLocal2, total_ttc = $totTtc, - fk_statut = ".($totTtc == price2num($montantPaiements, 'MT') ? 2 : 1 ).", - paid = ".($totTtc == price2num($montantPaiements, 'MT') ? 1 : 0 )." + fk_statut = ".($totTtc == price2num($montantPaiements, 'MT') ? 2 : 1).", + paid = ".($totTtc == price2num($montantPaiements, 'MT') ? 1 : 0)." WHERE rowid = $obj->rowid"; $db->query($sql_maj); @@ -2134,7 +2137,7 @@ if ($ok && GETPOST('repair_mailing_path')) { while (($thumb = readdir($thumbs)) !== false) { $res = dol_move($origin.'/'.$file.'/'.$thumb, $destin.'/'.$file.'/'.$thumb); $msg = ($res ? ' * Migration successful' : 'Migration failed') . ' for file '.$origin.'/'.$file.'.
'; - print ($msg); + print($msg); } // dol_delete_dir($origin.'/'.$file); } @@ -2142,7 +2145,7 @@ if ($ok && GETPOST('repair_mailing_path')) { if (dol_is_file($origin.'/'.$file)) { $res = dol_move($origin.'/'.$file, $destin.'/'.$file); $msg = ($res ? ' * Migration successful' : 'Migration failed') . ' for file '.$origin.'/'.$file.'.
'; - print ($msg); + print($msg); } } } diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index b59aa394d29..8ddd10a70c9 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -5,7 +5,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2015-2016 Raphaël Doursenaud - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -252,6 +252,7 @@ if (!empty($db_prefix) && !preg_match('/^[a-z0-9]+_$/i', $db_prefix)) { $error++; } +$db = null; $main_dir = dol_sanitizePathName($main_dir); $main_data_dir = dol_sanitizePathName($main_data_dir); @@ -365,18 +366,9 @@ if (!$error) { //print ''; $error++; } -} else { - if (isset($db)) { - print $db->lasterror(); - } - if (isset($db) && !$db->connected) { - print '
'.$langs->trans("BecauseConnectionFailedParametersMayBeWrong").'

'; - } - print $langs->trans("ErrorGoBackAndCorrectParameters"); - $error++; } -if (!$error && $db->connected) { +if (!$error && $db !== null && $db->connected) { if (!empty($db_create_database)) { $result = $db->select_db($db_name); if ($result) { @@ -389,7 +381,7 @@ if (!$error && $db->connected) { } // Define $defaultCharacterSet and $defaultDBSortingCollation -if (!$error && $db->connected) { +if (!$error && $db !== null && $db->connected) { if (!empty($db_create_database)) { // If we create database, we force default value // Default values come from the database handler @@ -421,7 +413,7 @@ if (!$error && $db->connected) { // Create config file -if (!$error && $db->connected && $action == "set") { // Test on permission not required here +if (!$error && $db !== null && $db->connected && $action == "set") { // Test on permission not required here umask(0); if (is_array($_POST)) { foreach ($_POST as $key => $value) { diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index b0fd3c186b7..383cec1df67 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -47,6 +47,7 @@ require_once $dolibarr_main_document_root.'/core/lib/security.lib.php'; global $langs; $ok = 0; +$db = null; // This page can be long. We increase the time allowed. / Cette page peut etre longue. On augmente le delai autorise. @@ -104,7 +105,8 @@ if (@file_exists($forcedfile)) { dolibarr_install_syslog("--- step2: entering step2.php page"); -'@phan-var-force string $dolibarr_main_db_prefix'; // From configuraiotn file or install/inc.php +/** @var string $dolibarr_main_db_prefix */ +'@phan-var-force string $dolibarr_main_db_prefix'; // From configuration file or install/inc.php /* @@ -287,7 +289,7 @@ if ($action == "set") { // Test on permission not required. Already managed by * To do after the files *.sql * ***************************************************************************************/ - if ($ok && $createkeys) { + if ($ok && $createkeys && $db !== null) { // We always choose in mysql directory (Conversion is done by driver to translate SQL syntax) $dir = "mysql/tables/"; diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index f9ce9d7398e..04ff7f194b0 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -120,6 +120,7 @@ if (!$versionfrom && !$versionto) { pHeader('', "upgrade2", GETPOST('action', 'aZ09'), 'versionfrom='.$versionfrom.'&versionto='.$versionto, '', 'main-inside main-inside-borderbottom'); $actiondone = 0; +$db = null; // Action to launch the migrate script if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ09'))) { @@ -453,7 +454,7 @@ if ($dirmodule) { } pFooter($nonext, $setuplang); -if ($db->connected) { +if ($db !== null && $db->connected) { $db->close(); } diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 9583064287d..ac7349ab2cb 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -146,6 +146,8 @@ if ((!$versionfrom || preg_match('/version/', $versionfrom)) && (!$versionto || pHeader('', 'step5', GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'upgrade', 'versionfrom='.$versionfrom.'&versionto='.$versionto, '', 'main-inside main-inside-borderbottom'); +$db = null; + if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ09'))) { print '

Database '; print ''.$langs->trans('DataMigration').'

'; @@ -906,7 +908,7 @@ dolibarr_install_syslog("Exit ".$ret); dolibarr_install_syslog("--- upgrade2: end"); pFooter($error ? 2 : 0, $setuplang); -if ($db->connected) { +if ($db !== null && $db->connected) { $db->close(); } From c387a59c30e4055ccc84c72d2189f5c45a616e7c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 May 2026 14:39:56 +0200 Subject: [PATCH 58/79] ci --- htdocs/core/modules/action/doc/pdf_standard_actions.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/action/doc/pdf_standard_actions.class.php b/htdocs/core/modules/action/doc/pdf_standard_actions.class.php index cbe1babaf28..711ab6b837f 100644 --- a/htdocs/core/modules/action/doc/pdf_standard_actions.class.php +++ b/htdocs/core/modules/action/doc/pdf_standard_actions.class.php @@ -345,7 +345,7 @@ class pdf_standard_actions if ($obj->fk_project > 0) { $projectstatic->fetch($obj->fk_project); if ($projectstatic->ref) { - $text .= ($status ? ' - ' : '').$outputlangs->transnoentitiesnoconv("Project").": ".dol_htmlentitiesbr_decode($projectstatic->ref); + $text .= ($status ? ' - ' : '').$outputlangs->transnoentitiesnoconv("Project").": ".dol_htmlentitiesbr_decode((string) $projectstatic->ref); } } From ffb77144a605425c56013f185ba191513d697fcb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 May 2026 15:21:30 +0200 Subject: [PATCH 59/79] spellcheck war --- htdocs/societe/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 3e9111f446b..4c28f86c02e 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1325,7 +1325,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error'); - print '
'; // Chrome ignores autocomplete + print ''; // Chrome ignores autocomplete print ''; print ''; @@ -1570,7 +1570,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio if (empty($tmpcode) && !empty($modCodeClient->code_auto)) { $tmpcode = $modCodeClient->getNextValue($object, 0); } - print ''; + print ''; print ''; $s = $modCodeClient->getToolTip($langs, $object, 0); print $form->textwithpicto('', $s, 1); From 9dd384e243b20ba27a18631b66bfb7fe8036fa19 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 7 May 2026 15:29:33 +0200 Subject: [PATCH 60/79] Qual: Fix PhanContextNotObject (#38079) * Qual: Fix PhanContextNotObject # Qual: Fix PhanContextNotObject Pdf objects were passed by reference which for objects is not needed as long as the object itself is not replaced. * Qual: Update PDF generation functions - Remove reference passing for PDF object in pdfGetHeightForHtmlContent function - Use `rollbackTransaction(true)` in pdfGetHeightForHtmlContent function - Remove reference passing for PDF object in pdfWriteVATArray function - Remove reference passing for PDF object in pdfWriteAlreadyPaid function --------- Co-authored-by: Laurent Destailleur --- htdocs/core/lib/pdf.lib.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index b4a3835d98d..061cde197e3 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -15,7 +15,7 @@ * Copyright (C) 2020 Nicolas ZABOURI * Copyright (C) 2021-2022 Anthony Berton * Copyright (C) 2023-2026 Frédéric France - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * * 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 @@ -339,7 +339,7 @@ function pdf_getHeightForLogo($logo, $url = false) * @return int Height * @see getStringHeight() */ -function pdfGetHeightForHtmlContent(&$pdf, $htmlcontent) +function pdfGetHeightForHtmlContent($pdf, $htmlcontent) { // store current object $pdf->startTransaction(); @@ -375,8 +375,8 @@ function pdfGetHeightForHtmlContent(&$pdf, $htmlcontent) } } } - // restore previous object - $pdf = $pdf->rollbackTransaction(); + // restore previous object state + $pdf->rollbackTransaction(true); return $height; } @@ -744,7 +744,7 @@ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $t * @param float $page_height Height of page * @return void */ -function pdf_pagehead(&$pdf, $outputlangs, $page_height) +function pdf_pagehead($pdf, $outputlangs, $page_height) { global $conf; @@ -782,7 +782,7 @@ function pdf_pagehead(&$pdf, $outputlangs, $page_height) * @param float $posy Pos y * @return void */ -function pdfWriteAdditionnalTitle(&$pdf, $outputlangs, $page_height, $object, &$w, &$posx, &$posy) +function pdfWriteAdditionnalTitle($pdf, $outputlangs, $page_height, $object, &$w, &$posx, &$posy) { // Transaction/Signature ID + Duplicate or Temporary info include_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php'; @@ -807,7 +807,7 @@ function pdfWriteAdditionnalTitle(&$pdf, $outputlangs, $page_height, $object, &$ * @param float $tab2_hl Tab2_hl * @return void */ -function pdfWriteVATArray(&$docgenerator, &$index, &$pdf, $outputlangs, $outputlangsbis, $object, $col1x, $col2x, $largcol2, $tab2_top, $tab2_hl) +function pdfWriteVATArray($docgenerator, &$index, $pdf, $outputlangs, $outputlangsbis, $object, $col1x, $col2x, $largcol2, $tab2_top, $tab2_hl) { global $mysoc; @@ -1047,7 +1047,7 @@ function pdfWriteVATArray(&$docgenerator, &$index, &$pdf, $outputlangs, $outputl * @param float $resteapayer_origin Remain to pay * @return void */ -function pdfWriteAlreadyPaid(&$docgenerator, &$index, &$pdf, $outputlangs, $outputlangsbis, $object, $col1x, $col2x, $largcol2, $tab2_top, $tab2_hl, $deja_regle, $creditnoteamount, $depositsamount, $resteapayer, $resteapayer_origin) +function pdfWriteAlreadyPaid($docgenerator, &$index, $pdf, $outputlangs, $outputlangsbis, $object, $col1x, $col2x, $largcol2, $tab2_top, $tab2_hl, $deja_regle, $creditnoteamount, $depositsamount, $resteapayer, $resteapayer_origin) { global $mysoc; @@ -1152,7 +1152,7 @@ function pdf_getSubstitutionArray($outputlangs, $exclude = null, $object = null, * @param string $text Text to show * @return void */ -function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text) +function pdf_watermark($pdf, $outputlangs, $h, $w, $unit, $text) { // Print Draft Watermark if ($unit == 'pt') { @@ -1216,7 +1216,7 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text) * @param CommonDocGenerator $pdftemplate PDF template * @return int 0 if nothing done, 1 if a mention was printed */ -function pdfCertifMention(&$pdf, $outputlangs, $seller, $default_font_size, &$posy, $pdftemplate) +function pdfCertifMention($pdf, $outputlangs, $seller, $default_font_size, &$posy, $pdftemplate) { include_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php'; @@ -1236,7 +1236,7 @@ function pdfCertifMention(&$pdf, $outputlangs, $seller, $default_font_size, &$po * @param int $default_font_size Default font size * @return float The Y PDF position */ -function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0, $default_font_size = 10) +function pdf_bank($pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0, $default_font_size = 10) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbank.class.php'; @@ -1418,7 +1418,7 @@ function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0, * @param string $watermark Watermark text to print on page * @return int Return height of bottom margin including footer text */ -function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails = 0, $hidefreetext = 0, $page_largeur = 0, $watermark = '') +function pdf_pagefoot($pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails = 0, $hidefreetext = 0, $page_largeur = 0, $watermark = '') { global $conf, $hookmanager; @@ -1805,7 +1805,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ * @param float $default_font_size Font size * @return float The Y PDF position */ -function pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size) +function pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size) { $linkedobjects = pdf_getLinkedObjects($object, $outputlangs); // May update $object->note_public @@ -1843,7 +1843,7 @@ function pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, * @param 'L'|'C'|'R'|'J' $align text alignment ('L', 'C', 'R', 'J' (default)) * @return string */ -function pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref = 0, $hidedesc = 0, $issupplierline = 0, $align = 'J') +function pdf_writelinedesc($pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref = 0, $hidedesc = 0, $issupplierline = 0, $align = 'J') { global $hookmanager; @@ -2981,7 +2981,7 @@ function canDisplayLinkedObjectInPDF($object, $elementobject) * @param Translate $outputlangs Object lang for output * @return array> Linked objects */ -function pdf_getLinkedObjects(&$object, $outputlangs) +function pdf_getLinkedObjects($object, $outputlangs) { global $db, $hookmanager; From 0460cf48c8edaddaabd0cd3df4826c7f684042d7 Mon Sep 17 00:00:00 2001 From: hansemschnokeloch Date: Thu, 7 May 2026 17:52:55 +0200 Subject: [PATCH 61/79] Document metadata anonymisation (followup of PR #38116) (#38120) Co-authored-by: Laurent Destailleur --- htdocs/core/modules/accountancy/doc/pdf_balance.modules.php | 2 +- htdocs/core/modules/accountancy/doc/pdf_bookkeeping.modules.php | 2 +- htdocs/core/modules/accountancy/doc/pdf_ledger.modules.php | 2 +- htdocs/core/modules/action/doc/pdf_standard_actions.class.php | 2 +- htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php | 2 +- htdocs/core/modules/bank/doc/pdf_ban.modules.php | 2 +- htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php | 2 +- htdocs/core/modules/cheque/doc/pdf_blochet.class.php | 2 +- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 2 +- htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php | 2 +- htdocs/core/modules/contract/doc/pdf_strato.modules.php | 2 +- htdocs/core/modules/delivery/doc/pdf_storm.modules.php | 2 +- htdocs/core/modules/delivery/doc/pdf_typhon.modules.php | 2 +- htdocs/core/modules/expedition/doc/pdf_espadon.modules.php | 2 +- htdocs/core/modules/expedition/doc/pdf_merou.modules.php | 2 +- htdocs/core/modules/expedition/doc/pdf_rouget.modules.php | 2 +- .../expensereport/doc/pdf_standard_expensereport.modules.php | 2 +- htdocs/core/modules/facture/doc/pdf_octopus.modules.php | 2 +- htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php | 2 +- htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php | 2 +- htdocs/core/modules/member/doc/pdf_standard_member.class.php | 2 +- .../modules/movement/doc/pdf_standard_movementstock.modules.php | 2 +- htdocs/core/modules/mrp/doc/pdf_vinci.modules.php | 2 +- htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php | 2 +- htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php | 2 +- htdocs/core/modules/product/doc/pdf_standard.modules.php | 2 +- htdocs/core/modules/project/doc/pdf_baleine.modules.php | 2 +- htdocs/core/modules/project/doc/pdf_beluga.modules.php | 2 +- htdocs/core/modules/project/doc/pdf_timespent.modules.php | 2 +- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 2 +- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 2 +- htdocs/core/modules/rapport/pdf_paiement.class.php | 2 +- htdocs/core/modules/reception/doc/pdf_squille.modules.php | 2 +- htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php | 2 +- htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php | 2 +- .../modules/stocktransfer/doc/pdf_eagle_proforma.modules.php | 2 +- .../core/modules/supplier_invoice/doc/pdf_canelle.modules.php | 2 +- htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php | 2 +- htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php | 2 +- .../doc/pdf_standard_supplierpayment.modules.php | 2 +- .../core/modules/supplier_proposal/doc/pdf_aurore.modules.php | 2 +- .../core/modules/supplier_proposal/doc/pdf_zenith.modules.php | 2 +- .../core/modules/mymodule/doc/pdf_standard_myobject.modules.php | 2 +- .../doc/pdf_standard_recruitmentjobposition.modules.php | 2 +- 44 files changed, 44 insertions(+), 44 deletions(-) diff --git a/htdocs/core/modules/accountancy/doc/pdf_balance.modules.php b/htdocs/core/modules/accountancy/doc/pdf_balance.modules.php index 91fa942740a..a9fc49a2cb9 100644 --- a/htdocs/core/modules/accountancy/doc/pdf_balance.modules.php +++ b/htdocs/core/modules/accountancy/doc/pdf_balance.modules.php @@ -240,7 +240,7 @@ class pdf_balance extends ModelePdfAccountancy $pdf->SetSubject($outputlangs->transnoentities("AccountancyBalance")); } $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("AccountancyBalance")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/accountancy/doc/pdf_bookkeeping.modules.php b/htdocs/core/modules/accountancy/doc/pdf_bookkeeping.modules.php index 1b90dd3f4ce..b783b05a8a6 100644 --- a/htdocs/core/modules/accountancy/doc/pdf_bookkeeping.modules.php +++ b/htdocs/core/modules/accountancy/doc/pdf_bookkeeping.modules.php @@ -230,7 +230,7 @@ class pdf_bookkeeping extends ModelePdfAccountancy $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("AccountancyBookkeeping")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("AccountancyBookkeeping")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/accountancy/doc/pdf_ledger.modules.php b/htdocs/core/modules/accountancy/doc/pdf_ledger.modules.php index 9142d4b5cfe..5653559608c 100644 --- a/htdocs/core/modules/accountancy/doc/pdf_ledger.modules.php +++ b/htdocs/core/modules/accountancy/doc/pdf_ledger.modules.php @@ -239,7 +239,7 @@ class pdf_ledger extends ModelePdfAccountancy $pdf->SetSubject($outputlangs->transnoentities("AccountancyLedger")); } $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("AccountancyLedger")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/action/doc/pdf_standard_actions.class.php b/htdocs/core/modules/action/doc/pdf_standard_actions.class.php index 711ab6b837f..8b7173fceb5 100644 --- a/htdocs/core/modules/action/doc/pdf_standard_actions.class.php +++ b/htdocs/core/modules/action/doc/pdf_standard_actions.class.php @@ -241,7 +241,7 @@ class pdf_standard_actions $pdf->SetTitle($outputlangs->convToOutputCharset($this->title)); $pdf->SetSubject($outputlangs->convToOutputCharset($this->subject)); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeywords($outputlangs->convToOutputCharset($this->title." ".$this->subject)); // @phan-suppress-next-line PhanPluginSuspiciousParamOrder diff --git a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php index b23789bf53a..19ea0dd7bba 100644 --- a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php +++ b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php @@ -253,7 +253,7 @@ class pdf_standard_asset extends ModelePDFAsset $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("PdfTitle")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfTitle")." ".$outputlangs->convToOutputCharset((string) $object->thirdparty->name)); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/bank/doc/pdf_ban.modules.php b/htdocs/core/modules/bank/doc/pdf_ban.modules.php index 59b8c2d8620..dde34d9194a 100644 --- a/htdocs/core/modules/bank/doc/pdf_ban.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_ban.modules.php @@ -180,7 +180,7 @@ class pdf_ban extends ModeleBankAccountDoc $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("BAN")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("BAN")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index bd89a2238af..11f2c23ccf9 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -212,7 +212,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("SepaMandate")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("SepaMandate")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index 3e90d9b0e39..5ff2e06e062 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -181,7 +181,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts $pdf->SetTitle($outputlangs->transnoentities("CheckReceipt")." ".$number); $pdf->SetSubject($outputlangs->transnoentities("CheckReceipt")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->transnoentities("CheckReceipt")." ".$number); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 7256a2e7e00..05406c8c924 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -289,7 +289,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("PdfOrderTitle")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfOrderTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index a55afe8fc35..245bc3f6280 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -337,7 +337,7 @@ class pdf_eratosthene extends ModelePDFCommandes $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("PdfOrderTitle")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfOrderTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 9b5e3ed2fbb..ca83924f2ee 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -252,7 +252,7 @@ class pdf_strato extends ModelePDFContract $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("Contract")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Contract")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php index 9a1585fe3a4..d21b3b92971 100644 --- a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php @@ -274,7 +274,7 @@ class pdf_storm extends ModelePDFDeliveryOrder $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("DeliveryOrder")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("DeliveryOrder")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php index bd7e64c3e0d..df2847d7b69 100644 --- a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php @@ -250,7 +250,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("DeliveryOrder")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("DeliveryOrder")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index e9d4dd1b965..1bc6384dac9 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -288,7 +288,7 @@ class pdf_espadon extends ModelePdfExpedition $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("Shipment")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Shipment")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 1a1bd057e00..7c67b1e6e25 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -240,7 +240,7 @@ class pdf_merou extends ModelePdfExpedition $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("Shipment")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Shipment")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 404d0f62777..2e4e3c68159 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -319,7 +319,7 @@ class pdf_rouget extends ModelePdfExpedition $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("Shipment")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Shipment")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php index 8dbee85f438..3b8021e9684 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php @@ -295,7 +295,7 @@ class pdf_standard_expensereport extends ModeleExpenseReport $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("Trips")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Trips")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php index f1e35c50b4c..ba4918a2c81 100644 --- a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php @@ -449,7 +449,7 @@ class pdf_octopus extends ModelePDFFactures $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("PdfInvoiceSituationTitle")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($mysoc->name.($user->id > 0 ? ' - '.$outputlangs->convToOutputCharset($user->getFullName($outputlangs)) : '')); + $pdf->SetAuthor($mysoc->name.($user->id > 0 ? ' - '.$outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)) : '')); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfInvoiceTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index bf091a1b127..c188fe75708 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -219,7 +219,7 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("InterventionCard")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("InterventionCard")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php b/htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php index 76402eb1e74..29c83ae6010 100644 --- a/htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php +++ b/htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php @@ -256,7 +256,7 @@ class pdf_standard_evaluation extends ModelePDFEvaluation $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("Evaluation")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Evaluation")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/member/doc/pdf_standard_member.class.php b/htdocs/core/modules/member/doc/pdf_standard_member.class.php index 6b70b637c9a..4d29dda0eb5 100644 --- a/htdocs/core/modules/member/doc/pdf_standard_member.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard_member.class.php @@ -444,7 +444,7 @@ class pdf_standard_member extends CommonStickerGenerator $pdf->SetTitle($title); $pdf->SetSubject($title); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($keywords); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php b/htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php index b8f3cfae543..6259c048ca1 100644 --- a/htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php +++ b/htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php @@ -442,7 +442,7 @@ class pdf_standard_movementstock extends ModelePDFMovement $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("Stock")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Stock")." ".$outputlangs->convToOutputCharset($object->label)); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php index a3a0358902b..ac239c6dabc 100644 --- a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php +++ b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php @@ -242,7 +242,7 @@ class pdf_vinci extends ModelePDFMo $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("ManufacturingOrder")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $key_word=$outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("ManufacturingOrder"); if (isset($object->thirdparty->name) && $object->thirdparty->name !== "") { $key_word.=" ".$outputlangs->convToOutputCharset($object->thirdparty->name); diff --git a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php index eed4da190ed..c02512ad0d0 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php @@ -292,7 +292,7 @@ class pdf_standardlabel extends CommonStickerGenerator $pdf->SetTitle($title); $pdf->SetSubject($title); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($keywords); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php index b86e53985ff..dfe27e4a250 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php @@ -328,7 +328,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator $pdf->SetTitle($title); $pdf->SetSubject($title); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($keywords); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index 4145689c020..42f9bbb4464 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -207,7 +207,7 @@ class pdf_standard extends ModelePDFProduct $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("Product")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Product")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php index 81907ae1198..8c9c20835e3 100644 --- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php @@ -240,7 +240,7 @@ class pdf_baleine extends ModelePDFProjects $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("Project")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Project")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index 4d6fe64d8ac..6e1e0a27988 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -291,7 +291,7 @@ class pdf_beluga extends ModelePDFProjects $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("Project")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Project")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/project/doc/pdf_timespent.modules.php b/htdocs/core/modules/project/doc/pdf_timespent.modules.php index d4ca63ea9d8..49bf3a6014d 100644 --- a/htdocs/core/modules/project/doc/pdf_timespent.modules.php +++ b/htdocs/core/modules/project/doc/pdf_timespent.modules.php @@ -235,7 +235,7 @@ class pdf_timespent extends ModelePDFProjects $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("Project")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Project")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index cf1ab8082c2..559456be5d6 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -341,7 +341,7 @@ class pdf_azur extends ModelePDFPropales $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("PdfCommercialProposalTitle")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfCommercialProposalTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 7f6b33521eb..6ee85a70435 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -319,7 +319,7 @@ class pdf_cyan extends ModelePDFPropales $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("PdfCommercialProposalTitle")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfCommercialProposalTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index ddb9d211911..65845929753 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -389,7 +389,7 @@ class pdf_paiement extends CommonDocGenerator $pdf->SetTitle($outputlangs->transnoentities("Payments")); $pdf->SetSubject($outputlangs->transnoentities("Payments")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); //$pdf->SetKeyWords(); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index 3603140d5cf..781f4997217 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -277,7 +277,7 @@ class pdf_squille extends ModelePdfReception $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("Reception")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Reception")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php b/htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php index 6c6fd033290..6bea3a7c7f1 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php @@ -245,7 +245,7 @@ class pdf_standard_stock extends ModelePDFStock $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("Stock")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Stock")." ".$outputlangs->convToOutputCharset($object->label)); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php index 88c3dbfb835..84841021aa4 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php @@ -335,7 +335,7 @@ class pdf_eagle extends ModelePDFStockTransfer $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("StockTransfer")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("StockTransfer")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php index ea7a10f4085..a76a5c47494 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php @@ -308,7 +308,7 @@ class pdf_eagle_proforma extends ModelePDFStockTransfer $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("StockTransferSheetProforma")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("StockTransfer")); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index a7df145dca5..df23fe2eb61 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -269,7 +269,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("PdfInvoiceTitle")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfInvoiceTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index a0bca6268c3..4c24527975a 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -303,7 +303,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("Order")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 86bd6a079e7..77d8b4c22d3 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -308,7 +308,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("SupplierOrder")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("SupplierOrder")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php index 3fcd272e884..f8a2f0ce67b 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php @@ -334,7 +334,7 @@ class pdf_standard_supplierpayment extends ModelePDFSuppliersPayments $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("Invoice")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index a35b75e13c7..517768ece82 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -298,7 +298,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("CommercialAsk")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("CommercialAsk")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php index 36cc29ce044..21687b595b6 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php @@ -295,7 +295,7 @@ class pdf_zenith extends ModelePDFSupplierProposal $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("SupplierProposal")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("SupplierProposal")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index b71bd1ae94d..202bed7aa7e 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -336,7 +336,7 @@ class pdf_standard_myobject extends ModelePDFMyObject $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("PdfTitle")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); diff --git a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php index da699541caa..b759ca0a28c 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php @@ -286,7 +286,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($object->label); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs))); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$object->label." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) { $pdf->SetCompression(false); From 5e1b3c1682685d1504fe453398142b079dacfbdb Mon Sep 17 00:00:00 2001 From: Mateo Day <119622701+FrizkyTrixter@users.noreply.github.com> Date: Thu, 7 May 2026 17:34:39 -0400 Subject: [PATCH 62/79] Fix TakePOS New button confirmation after paid sale (#38089) Co-authored-by: Laurent Destailleur --- htdocs/takepos/index.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 16f37fc8a62..5073e755a27 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -721,6 +721,16 @@ function New() { console.log("New with place = , js place="+place+", invoiceid="+invoiceid); + if (invoiceid == '') { + $("#poslines").load("invoice.php?action=delete&token=&place=" + place, function () { + //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); + }); + + ClearSearch(false); + $("#idcustomer").val(""); + return; + } + $.getJSON('/takepos/ajax/ajax.php?action=getInvoice&token=&id='+invoiceid, function(data) { var r; @@ -741,7 +751,6 @@ function New() { } }); } - /** * Search products * From e1ae5f5e58334a622b4950fb557a0d79e0be793d Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 7 May 2026 23:35:21 +0200 Subject: [PATCH 63/79] Fix quick memo share BTN (#38121) --- htdocs/quickmemo/class/memo.class.php | 4 ++++ htdocs/quickmemo/js/QuickMemo.js | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/quickmemo/class/memo.class.php b/htdocs/quickmemo/class/memo.class.php index 5a318c874ac..1ab97a9c1fa 100644 --- a/htdocs/quickmemo/class/memo.class.php +++ b/htdocs/quickmemo/class/memo.class.php @@ -1660,6 +1660,10 @@ class Memo extends CommonObject ]; $jsConfVars = array_merge($defaultJsConfVars, $jsConfVars); + if (!empty($jsConfVars['elementType'])) { + $jsConfVars['shareBtnStatus'] = 1; + } + // LOAD Memo class print ''."\n"; print ''."\n"; diff --git a/htdocs/quickmemo/js/QuickMemo.js b/htdocs/quickmemo/js/QuickMemo.js index 8a55fcfc902..ccd44385ec1 100644 --- a/htdocs/quickmemo/js/QuickMemo.js +++ b/htdocs/quickmemo/js/QuickMemo.js @@ -24,6 +24,7 @@ class QuickMemo { elementType: '', context: '', token: '', + shareBtnStatus: 0, colors: ['#fff8a6', '#ffd6d6', '#d6ffd9', '#d6e6ff', '#f3d6ff', '#ffffff', '#f5f5f5'], publicFontAIcon: 'far fa-eye', privateFontAIcon: 'far fa-eye-slash', @@ -522,7 +523,9 @@ class QuickMemo { // Append buttons based on permissions if (this.param.userWriteRight) { actions.appendChild(btnPrivate); - actions.appendChild(btnShare); + if(this.param.shareBtnStatus > 0) { + actions.appendChild(btnShare); + } actions.appendChild(colorInput); actions.appendChild(btnCreateModel); } From 07ed335f674f6b0a28bcb1433c840a26731a2d60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alo=C3=AFs=20Micard?= Date: Thu, 7 May 2026 23:52:34 +0200 Subject: [PATCH 64/79] Add missing indexes in llx_product_warehouse_properties table (#38122) --- .../install/mysql/migration/23.0.0-24.0.0.sql | 8 +++++++ ...product_warehouse_properties-stock.key.sql | 23 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 htdocs/install/mysql/tables/llx_product_warehouse_properties-stock.key.sql diff --git a/htdocs/install/mysql/migration/23.0.0-24.0.0.sql b/htdocs/install/mysql/migration/23.0.0-24.0.0.sql index 4d77ef010ea..4075934b1a3 100644 --- a/htdocs/install/mysql/migration/23.0.0-24.0.0.sql +++ b/htdocs/install/mysql/migration/23.0.0-24.0.0.sql @@ -516,4 +516,12 @@ UPDATE llx_socpeople SET fax = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(fax, ' ', -- Add personal_data flag on extrafields for GDPR/nLPD/LGPD compliance ALTER TABLE llx_extrafields ADD COLUMN personal_data tinyint DEFAULT 0 AFTER csslist; + +-- Add missing index in llx_product_warehouse_properties table +ALTER TABLE llx_product_warehouse_properties ADD INDEX idx_product_warehouse_properties_fk_product (fk_product); +ALTER TABLE llx_product_warehouse_properties ADD INDEX idx_product_warehouse_properties_fk_entrepot (fk_entrepot); + +ALTER TABLE llx_product_warehouse_properties ADD CONSTRAINT fk_product_warehouse_properties_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); +ALTER TABLE llx_product_warehouse_properties ADD CONSTRAINT fk_product_warehouse_properties_fk_entrepot FOREIGN KEY (fk_entrepot) REFERENCES llx_entrepot (rowid); + -- end of migration diff --git a/htdocs/install/mysql/tables/llx_product_warehouse_properties-stock.key.sql b/htdocs/install/mysql/tables/llx_product_warehouse_properties-stock.key.sql new file mode 100644 index 00000000000..0f60c355e8b --- /dev/null +++ b/htdocs/install/mysql/tables/llx_product_warehouse_properties-stock.key.sql @@ -0,0 +1,23 @@ +-- =================================================================== +-- Copyright (C) 2026 Aloïs Micard +-- +-- 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 +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- =================================================================== + +ALTER TABLE llx_product_warehouse_properties ADD INDEX idx_product_warehouse_properties_fk_product (fk_product); +ALTER TABLE llx_product_warehouse_properties ADD INDEX idx_product_warehouse_properties_fk_entrepot (fk_entrepot); + +ALTER TABLE llx_product_warehouse_properties ADD CONSTRAINT fk_product_warehouse_properties_fk_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); +ALTER TABLE llx_product_warehouse_properties ADD CONSTRAINT fk_product_warehouse_properties_fk_entrepot FOREIGN KEY (fk_entrepot) REFERENCES llx_entrepot (rowid); \ No newline at end of file From 53c26e12f009b6a4a5ede39e1098704b8a4bf048 Mon Sep 17 00:00:00 2001 From: Thatoo Date: Thu, 7 May 2026 23:59:00 +0200 Subject: [PATCH 65/79] Update newpayment.php (#38126) * Update newpayment.php * Update newpayment.php just to make a little nice. --- htdocs/public/payment/newpayment.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 0d4b7e9ea34..5156ced2638 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1975,15 +1975,23 @@ if ($source == 'member' || $source == 'membersubscription') { $amount = max(0, (float) $amount, (float) getDolGlobalInt("MEMBER_MIN_AMOUNT")); // Amount + $caneditamount = $adht->caneditamount; + $minimumamount = !getDolGlobalString('MEMBER_MIN_AMOUNT') ? $adht->amount : max(getDolGlobalString('MEMBER_MIN_AMOUNT'), $adht->amount, $amount); + $amountformuladescriptionbytype = $adht->amountformuladescriptionbytype(1); // Load the array of amount ormula description per type + $amountformuladescription = $amountformuladescriptionbytype[$typeid]; print ''.$langs->trans("Amount"); // This place no longer allows amount edition if (getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO')) { print ' - '.img_picto('', 'url', 'class="pictofixedwidth"').$langs->trans("SeeHere").''; } - print ''; - - $caneditamount = $adht->caneditamount; - $minimumamount = !getDolGlobalString('MEMBER_MIN_AMOUNT') ? $adht->amount : max(getDolGlobalString('MEMBER_MIN_AMOUNT'), $adht->amount, $amount); + if ($amountformuladescription) { + print ''.$amountformuladescription; + print ''."\n"; + print ''; + print ''; + } else { + print ''; + } if ($caneditamount && ($action != 'dopayment' || GETPOST('reload'))) { if (GETPOSTISSET('newamount')) { @@ -1999,7 +2007,7 @@ if ($source == 'member' || $source == 'membersubscription') { print ''; } print ''; - print ''; + print ''.$langs->trans("Currency".$conf->currency); print ''."\n"; // Tag From b41e10701242dd249bee29885fa2985aedf1f454 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 8 May 2026 12:20:40 +0200 Subject: [PATCH 66/79] NEW Accountancy - Add matching on general account (#38040) * NEW Accountancy - Add matching on general account * CI * CI * CI * Add unmatching on general account * Setup and management of the chart of accounts * Apply on general ledger & fix sql error * Fix duplicate on language * CI * CI * CI * CI * CI * CI * CI * CI * CI * CI * CI --------- Co-authored-by: Laurent Destailleur --- htdocs/accountancy/admin/account.php | 39 ++- htdocs/accountancy/bookkeeping/list.php | 108 +++---- .../accountancy/bookkeeping/listbyaccount.php | 87 +++-- .../accountancy/class/bookkeeping.class.php | 7 + htdocs/accountancy/class/lettering.class.php | 303 +++++++++++++++++- htdocs/langs/en_US/accountancy.lang | 23 +- 6 files changed, 451 insertions(+), 116 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 6dcaa22dcc5..e5a5e1ba0f0 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -231,9 +231,21 @@ if (empty($reshook)) { } elseif ($action == 'enable' /* && $permissiontoadd */) { if ($accounting->fetch($id)) { $mode = GETPOSTINT('mode'); - $result = $accounting->accountActivate($id, $mode); - if ($result < 0) { - setEventMessages($accounting->error, $accounting->errors, 'errors'); + // Block the activation of matching on a centralized account + if ($mode == 1 && !empty($accounting->centralized)) { + setEventMessages($langs->trans('CentralizedAccountCannotBeMatchable'), null, 'errors'); + } else { + $result = $accounting->accountActivate($id, $mode); + if ($result < 0) { + setEventMessages($accounting->error, $accounting->errors, 'errors'); + } + // When activating centralized mode, force matchable to 0 + if ($mode == 2 && $result >= 0) { + $result = $accounting->accountDeactivate($id, 1); + if ($result < 0) { + setEventMessages($accounting->error, $accounting->errors, 'errors'); + } + } } } $action = 'update'; @@ -812,17 +824,24 @@ if ($resql) { } } - // Activated or not reconciliation on an accounting account + // Activated or not matching on an accounting account if (!empty($arrayfields['aa.reconcilable']['checked'])) { print ''; - if (empty($obj->reconcilable)) { - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); + if (!empty($obj->centralized)) { + // Centralized account: matching not possible, grayed out switch + print ''; + print img_picto('', !empty($obj->reconcilable) ? 'switch_on' : 'switch_off', '', 0, 0, 1, '', 'opacitymedium'); print ''; } else { - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; + if (empty($obj->reconcilable)) { + print ''; + print img_picto($langs->trans('Disabled'), 'switch_off'); + print ''; + } else { + print ''; + print img_picto($langs->trans('Activated'), 'switch_on'); + print ''; + } } print ''; if (!$i) { diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index f8ff40cc551..128f8a94d79 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -245,7 +245,14 @@ if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } -if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunletteringauto' && $massaction != 'preunletteringmanual' && $massaction != 'predeletebookkeepingwriting' && $massaction != 'preclonebookkeepingwriting' && $massaction != 'preassignaccountbookkeepingwriting' && $massaction != 'prereturnaccountbookkeepingwriting') { +if (!GETPOST('confirmmassaction', 'alpha') && + !in_array($massaction, [ + 'pregeneralunmatchingmanual', + 'predeletebookkeepingwriting', + 'preclonebookkeepingwriting', + 'preassignaccountbookkeepingwriting', + 'prereturnaccountbookkeepingwriting' + ])) { $massaction = ''; } @@ -592,69 +599,27 @@ if (empty($reshook)) { } } - // mass actions on lettering + // mass actions on matching if (!$error && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) { - if ($massaction == 'letteringauto' && $permissiontoadd) { + if ($massaction == 'generalmatchingmanual' && $permissiontoadd) { $lettering = new Lettering($db); - $nb_lettering = $lettering->bookkeepingLetteringAll($toselect); - if ($nb_lettering < 0) { - setEventMessages('', $lettering->errors, 'errors'); - $error += 1; - $nb_lettering = max(0, abs($nb_lettering) - 2); - } elseif ($nb_lettering == 0) { - $nb_lettering = 0; - setEventMessages($langs->trans('AccountancyNoLetteringModified'), array(), 'mesgs'); - } - if ($nb_lettering == 1) { - setEventMessages($langs->trans('AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs'); - } elseif ($nb_lettering > 1) { - setEventMessages($langs->trans('AccountancyLetteringModifiedSuccessfully', $nb_lettering), array(), 'mesgs'); - } - - if (!$error) { - header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param); - exit(); - } - } elseif ($massaction == 'letteringmanual' && $permissiontoadd) { - $lettering = new Lettering($db); - $result = $lettering->updateLettering($toselect); + $result = $lettering->updateGeneralMatching($toselect); if ($result < 0) { setEventMessages('', $lettering->errors, 'errors'); } else { - setEventMessages($langs->trans('AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs'); + setEventMessages($langs->trans($result == 0 ? 'AccountancyNoMachingModified' : 'AccountancyOneMatchingModifiedSuccessfully'), array(), 'mesgs'); header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param); exit(); } - } elseif ($action == 'unletteringauto' && $confirm == "yes" && $permissiontoadd) { + } elseif ($action == 'generalunmatchingmanual' && $confirm == 'yes' && $permissiontodelete) { $lettering = new Lettering($db); - $nb_lettering = $lettering->bookkeepingLetteringAll($toselect, true); - if ($nb_lettering < 0) { - setEventMessages('', $lettering->errors, 'errors'); - $error += 1; - $nb_lettering = max(0, abs($nb_lettering) - 2); - } elseif ($nb_lettering == 0) { - $nb_lettering = 0; - setEventMessages($langs->trans('AccountancyNoUnletteringModified'), array(), 'mesgs'); - } - if ($nb_lettering == 1) { - setEventMessages($langs->trans('AccountancyOneUnletteringModifiedSuccessfully'), array(), 'mesgs'); - } elseif ($nb_lettering > 1) { - setEventMessages($langs->trans('AccountancyUnletteringModifiedSuccessfully', $nb_lettering), array(), 'mesgs'); - } - - if (!$error) { - header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param); - exit(); - } - } elseif ($action == 'unletteringmanual' && $confirm == "yes" && $permissiontoadd) { - $lettering = new Lettering($db); - $nb_lettering = $lettering->deleteLettering($toselect); - if ($nb_lettering < 0) { + $result = $lettering->deleteGeneralMatching($toselect); + if ($result < 0) { setEventMessages('', $lettering->errors, 'errors'); } else { - setEventMessages($langs->trans('AccountancyOneUnletteringModifiedSuccessfully'), array(), 'mesgs'); + setEventMessages($langs->trans($result == 0 ? 'AccountancyNoUnmatchingModified' : 'AccountancyOneUnmatchingModifiedSuccessfully'), [], 'mesgs'); header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param); - exit(); + exit; } } } @@ -680,6 +645,7 @@ $sql .= " t.label_operation,"; $sql .= " t.debit,"; $sql .= " t.credit,"; $sql .= " t.lettering_code,"; +$sql .= " t.matching_general,"; $sql .= " t.montant as amount,"; $sql .= " t.sens,"; $sql .= " t.fk_user_author,"; @@ -834,10 +800,8 @@ if ($limit > 0 && $limit != $conf->liste_limit) { // List of mass actions available $arrayofmassactions = array(); if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) { - $arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringAuto'); - $arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringAuto'); - $arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringManual'); - $arrayofmassactions['preunletteringmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringManual'); + $arrayofmassactions['generalmatchingmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('GeneralMatchingManual'); + $arrayofmassactions['pregeneralunmatchingmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('GeneralUnmatchingManual'); } if ($user->hasRight('accounting', 'mouvements', 'creer')) { $arrayofmassactions['preclonebookkeepingwriting'] = img_picto('', 'clone', 'class="pictofixedwidth"').$langs->trans("Clone"); @@ -852,7 +816,16 @@ if ($user->hasRight('accounting', 'mouvements', 'supprimer')) { $arrayofmassactions['predeletebookkeepingwriting'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } -if (GETPOSTINT('nomassaction') || in_array($massaction, array('preunletteringauto', 'preunletteringmanual', 'predeletebookkeepingwriting', 'preclonebookkeepingwriting', 'preassignaccountbookkeepingwriting', 'prereturnaccountbookkeepingwriting'))) { +if (GETPOSTINT('nomassaction') + || in_array($massaction, + array( + 'pregeneralunmatchingmanual', + 'predeletebookkeepingwriting', + 'preclonebookkeepingwriting', + 'preassignaccountbookkeepingwriting', + 'prereturnaccountbookkeepingwriting' + ) + )) { $arrayofmassactions = array(); } $massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions); @@ -898,10 +871,8 @@ if (empty($reshook)) { print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1); -if ($massaction == 'preunletteringauto') { - print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnletteringAuto"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unletteringauto", null, '', 0, 200, 500, 1); -} elseif ($massaction == 'preunletteringmanual') { - print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnletteringManual"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unletteringmanual", null, '', 0, 200, 500, 1); +if ($massaction == 'pregeneralunmatchingmanual') { + print $form->formconfirm($_SERVER['PHP_SELF'], $langs->trans('ConfirmMassGeneralUnmatchingManual'), $langs->trans("ConfirmMassGeneralUnmatchingQuestion", count($toselect)), "generalunmatchingmanual", null, '', 0, 200, 500, 1); } elseif ($massaction == 'predeletebookkeepingwriting') { print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeleteBookkeepingWriting"), $langs->trans("ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)), "deletebookkeepingwriting", null, '', 0, 200, 500, 1); } elseif ($massaction == 'preassignaccountbookkeepingwriting') { @@ -1232,6 +1203,7 @@ while ($i < min($num, $limit)) { $line->amount = $obj->amount; $line->sens = $obj->sens; $line->lettering_code = $obj->lettering_code; + $line->matching_general = $obj->matching_general; $line->fk_user_author = $obj->fk_user_author; $line->import_key = $obj->import_key; $line->code_journal = $obj->code_journal; @@ -1444,7 +1416,19 @@ while ($i < min($num, $limit)) { // Matching code if (!empty($arrayfields['t.lettering_code']['checked'])) { - print ''.$line->lettering_code.''; + $tooltipText = ""; + $icon = ""; + $badge = ""; + if (!empty($line->matching_general)) { + $tooltipText .= $langs->trans('GeneralMatching'); + $icon .= "fa-book"; + $badge .= "badge-status4"; + } elseif (empty($line->matching_general) && !empty($line->lettering_code)) { + $tooltipText .= $langs->trans('AuxiliaryMatching'); + $icon .= "fa-user"; + $badge .= "badge-status1"; + } + print ' '.$line->lettering_code.''; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index b9c990fa85c..a37faf49678 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -600,7 +600,27 @@ if (empty($reshook)) { // others mass actions if (!$error && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) { - if ($massaction == 'letteringauto' && $permissiontoadd) { + if ($massaction == 'generalmatchingmanual' && $permissiontoadd) { + $lettering = new Lettering($db); + $result = $lettering->updateGeneralMatching($toselect); + if ($result < 0) { + setEventMessages('', $lettering->errors, 'errors'); + } else { + setEventMessages($langs->trans($result == 0 ? 'AccountancyNoMachingModified' : 'AccountancyOneMatchingModifiedSuccessfully'), array(), 'mesgs'); + header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param); + exit; + } + } elseif ($action == 'generalunmatchingmanual' && $confirm == 'yes' && $permissiontodelete) { + $lettering = new Lettering($db); + $result = $lettering->deleteGeneralMatching($toselect); + if ($result < 0) { + setEventMessages('', $lettering->errors, 'errors'); + } else { + setEventMessages($langs->trans($result == 0 ? 'AccountancyNoUnmatchingModified' : 'AccountancyOneUnmatchingModifiedSuccessfully'), array(), 'mesgs'); + header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param); + exit; + } + } elseif ($type == 'sub' && $massaction == 'letteringauto' && $permissiontoadd) { $lettering = new Lettering($db); $nb_lettering = $lettering->bookkeepingLetteringAll($toselect); if ($nb_lettering < 0) { @@ -609,39 +629,39 @@ if (empty($reshook)) { $nb_lettering = max(0, abs($nb_lettering) - 2); } elseif ($nb_lettering == 0) { $nb_lettering = 0; - setEventMessages($langs->trans('AccountancyNoLetteringModified'), array(), 'mesgs'); + setEventMessages($langs->trans('AccountancyNoMatchingModified'), array(), 'mesgs'); } if ($nb_lettering == 1) { - setEventMessages($langs->trans('AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs'); + setEventMessages($langs->trans('AccountancyOneMatchingModifiedSuccessfully'), array(), 'mesgs'); } elseif ($nb_lettering > 1) { - setEventMessages($langs->trans('AccountancyLetteringModifiedSuccessfully', $nb_lettering), array(), 'mesgs'); + setEventMessages($langs->trans('AccountancyMatchingModifiedSuccessfully', $nb_lettering), array(), 'mesgs'); } if (!$error) { header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param); exit(); } - } elseif ($massaction == 'letteringmanual' && $permissiontoadd) { + } elseif ($type == 'sub' && $massaction == 'letteringmanual' && $permissiontoadd) { $lettering = new Lettering($db); $result = $lettering->updateLettering($toselect); if ($result < 0) { setEventMessages('', $lettering->errors, 'errors'); } else { - setEventMessages($langs->trans($result == 0 ? 'AccountancyNoLetteringModified' : 'AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs'); + setEventMessages($langs->trans($result == 0 ? 'AccountancyNoMatchingModified' : 'AccountancyOneMatchingModifiedSuccessfully'), array(), 'mesgs'); header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param); exit(); } - } elseif ($type == 'sub' && $massaction == 'letteringpartial') { + } elseif ($type == 'sub' && $massaction == 'letteringpartial' && $permissiontoadd) { $lettering = new Lettering($db); $result = $lettering->updateLettering($toselect, 0, true); if ($result < 0) { setEventMessages('', $lettering->errors, 'errors'); } else { - setEventMessages($langs->trans($result == 0 ? 'AccountancyNoLetteringModified' : 'AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs'); + setEventMessages($langs->trans($result == 0 ? 'AccountancyNoMatchingModified' : 'AccountancyOneMatchingModifiedSuccessfully'), array(), 'mesgs'); header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param); exit(); } - } elseif ($action == 'unletteringauto' && $confirm == "yes" && $permissiontoadd) { + } elseif ($type == 'sub' && $action == 'unletteringauto' && $confirm == "yes" && $permissiontoadd) { $lettering = new Lettering($db); $nb_lettering = $lettering->bookkeepingLetteringAll($toselect, true); if ($nb_lettering < 0) { @@ -650,25 +670,25 @@ if (empty($reshook)) { $nb_lettering = max(0, abs($nb_lettering) - 2); } elseif ($nb_lettering == 0) { $nb_lettering = 0; - setEventMessages($langs->trans('AccountancyNoUnletteringModified'), array(), 'mesgs'); + setEventMessages($langs->trans('AccountancyNoUnmatchingModified'), array(), 'mesgs'); } if ($nb_lettering == 1) { - setEventMessages($langs->trans('AccountancyOneUnletteringModifiedSuccessfully'), array(), 'mesgs'); + setEventMessages($langs->trans('AccountancyOneUnmatchingModifiedSuccessfully'), array(), 'mesgs'); } elseif ($nb_lettering > 1) { - setEventMessages($langs->trans('AccountancyUnletteringModifiedSuccessfully', $nb_lettering), array(), 'mesgs'); + setEventMessages($langs->trans('AccountancyUnmatchingModifiedSuccessfully', $nb_lettering), array(), 'mesgs'); } if (!$error) { header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param); exit(); } - } elseif ($action == 'unletteringmanual' && $confirm == "yes" && $permissiontoadd) { + } elseif ($type == 'sub' && $action == 'unletteringmanual' && $confirm == "yes" && $permissiontoadd) { $lettering = new Lettering($db); $nb_lettering = $lettering->deleteLettering($toselect); if ($result < 0) { setEventMessages('', $lettering->errors, 'errors'); } else { - setEventMessages($langs->trans($result == 0 ? 'AccountancyNoUnletteringModified' : 'AccountancyOneUnletteringModifiedSuccessfully'), array(), 'mesgs'); + setEventMessages($langs->trans($result == 0 ? 'AccountancyNoUnmatchingModified' : 'AccountancyOneUnmatchingModifiedSuccessfully'), array(), 'mesgs'); header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param); exit(); } @@ -846,13 +866,18 @@ print $formconfirm; // List of mass actions available $arrayofmassactions = array(); if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) { - $arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringAuto'); - $arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringAuto'); - $arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringManual'); if ($type == 'sub') { - $arrayofmassactions['letteringpartial'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringPartial'); + // Auxiliary ledger matching only + $arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringAuto'); + $arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringAuto'); + $arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringManual'); + $arrayofmassactions['letteringpartial'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringPartial'); + $arrayofmassactions['preunletteringmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringManual'); + } else { + // General ledger matching only + $arrayofmassactions['generalmatchingmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('GeneralMatchingManual'); + $arrayofmassactions['pregeneralunmatchingmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('GeneralUnmatchingManual'); } - $arrayofmassactions['preunletteringmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringManual'); } if ($user->hasRight('accounting', 'mouvements', 'creer')) { $arrayofmassactions['preclonebookkeepingwriting'] = img_picto('', 'clone', 'class="pictofixedwidth"').$langs->trans("Clone"); @@ -867,7 +892,7 @@ if ($user->hasRight('accounting', 'mouvements', 'supprimer')) { $arrayofmassactions['predeletebookkeepingwriting'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } -if (GETPOSTINT('nomassaction') || in_array($massaction, array('preunletteringauto', 'preunletteringmanual', 'predeletebookkeepingwriting', 'preclonebookkeepingwriting', 'preassignaccountbookkeepingwriting', 'prereturnaccountbookkeepingwriting'))) { +if (GETPOSTINT('nomassaction') || in_array($massaction, array('preunletteringauto', 'preunletteringmanual', 'pregeneralunmatchingmanual', 'predeletebookkeepingwriting', 'preclonebookkeepingwriting', 'preassignaccountbookkeepingwriting', 'prereturnaccountbookkeepingwriting'))) { $arrayofmassactions = array(); } $massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions); @@ -927,6 +952,8 @@ if ($massaction == 'preunletteringauto') { print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnletteringAuto"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unletteringauto", null, '', 0, 200, 500, 1); } elseif ($massaction == 'preunletteringmanual') { print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnletteringManual"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unletteringmanual", null, '', 0, 200, 500, 1); +} elseif ($massaction == 'pregeneralunmatchingmanual') { + print $form->formconfirm($_SERVER['PHP_SELF'], $langs->trans('ConfirmMassGeneralUnmatchingManual'), $langs->trans('ConfirmMassGeneralUnmatchingQuestion', count($toselect)), 'generalunmatchingmanual', null, '', 0, 200, 500, 1); } elseif ($massaction == 'predeletebookkeepingwriting') { print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeleteBookkeepingWriting"), $langs->trans("ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)), "deletebookkeepingwriting", null, '', 0, 200, 500, 1); } elseif ($massaction == 'preassignaccountbookkeepingwriting') { @@ -1534,10 +1561,24 @@ while ($i < min($num, $limit)) { // Matching code if (!empty($arrayfields['t.lettering_code']['checked'])) { - print ''.dol_escape_htmltag((string) $line->lettering_code).''; - if (!$i) { - $totalarray['nbfield']++; + $tooltipText = ""; + if (!empty($line->matching_general)) { + $tooltipText .= $langs->trans('GeneralMatching'); + } elseif (empty($line->matching_general) && !empty($line->lettering_code)) { + $tooltipText .= $langs->trans('AuxiliaryMatching'); } + print ''; + if ($type == 'sub') { + // Auxiliary account matching + if (!empty($line->lettering_code)) { + // @phan-suppress-next-line PhanTypeMismatchArgumentNullable + print ' ' . dol_escape_htmltag((string) $line->lettering_code) . ''; + } + } elseif (!empty($line->matching_general) && !empty($line->lettering_code)) { + print ' ' . dol_escape_htmltag((string) $line->lettering_code) . ''; + } + print ''; + if (!$i) $totalarray['nbfield']++; } // Amount debit diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 97382861d7a..3c8cb60454b 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -976,6 +976,7 @@ class BookKeeping extends CommonObject $sql .= " t.sens,"; $sql .= " t.multicurrency_amount,"; $sql .= " t.multicurrency_code,"; + $sql .= " t.matching_general,"; $sql .= " t.lettering_code,"; $sql .= " t.date_lettering,"; $sql .= " t.fk_user_author,"; @@ -1104,6 +1105,7 @@ class BookKeeping extends CommonObject $line->sens = $obj->sens; $line->multicurrency_amount = $obj->multicurrency_amount; $line->multicurrency_code = $obj->multicurrency_code; + $line->matching_general = (bool) $obj->matching_general; $line->lettering_code = $obj->lettering_code; $line->date_lettering = $this->db->jdate($obj->date_lettering); $line->fk_user_author = $obj->fk_user_author; @@ -3946,6 +3948,11 @@ class BookKeepingLine extends CommonObjectLine */ public $sens; + /** + * @var bool + */ + public $matching_general; + /** * @var ?string */ diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php index f1124391a54..371530a1bad 100644 --- a/htdocs/accountancy/class/lettering.class.php +++ b/htdocs/accountancy/class/lettering.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2013 Olivier Geffroy - * Copyright (C) 2013-2024 Alexandre Spangaro + * Copyright (C) 2013-2026 Alexandre Spangaro * Copyright (C) 2018-2026 Frédéric France * Copyright (C) 2024-2025 MDW * @@ -158,8 +158,8 @@ class Lettering extends BookKeeping $sql .= " INNER JOIN ".MAIN_DB_PREFIX."paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_bookkeeping as bk ON (bk.fk_doc = payf.fk_bank AND bk.code_journal='".$this->db->escape($obj->code_journal)."')"; $sql .= " WHERE payfacf.fk_paiementfourn = '".$this->db->escape($obj->url_id)."' "; - $sql .= " AND facf.entity = ".$conf->entity; - $sql .= " AND code_journal IN (SELECT code FROM ".MAIN_DB_PREFIX."accounting_journal WHERE nature=4 AND entity=".$conf->entity.") "; + $sql .= " AND facf.entity = " . (int) $conf->entity; + $sql .= " AND code_journal IN (SELECT code FROM ".MAIN_DB_PREFIX."accounting_journal WHERE nature=4 AND entity=" . (int) $conf->entity . ") "; $sql .= " AND ( "; if ($object->code_compta_client != "") { $sql .= " bk.subledger_account = '".$this->db->escape($object->code_compta_client)."' "; @@ -187,8 +187,8 @@ class Lettering extends BookKeeping $sql = 'SELECT bk.rowid, facf.ref, facf.ref_supplier '; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn facf "; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_bookkeeping as bk ON( bk.fk_doc = facf.rowid AND facf.rowid IN (".$this->db->sanitize(implode(',', $ids_fact))."))"; - $sql .= " WHERE bk.code_journal IN (SELECT code FROM ".MAIN_DB_PREFIX."accounting_journal WHERE nature=3 AND entity=".$conf->entity.") "; - $sql .= " AND facf.entity = ".$conf->entity; + $sql .= " WHERE bk.code_journal IN (SELECT code FROM ".MAIN_DB_PREFIX."accounting_journal WHERE nature=3 AND entity=". (int) $conf->entity.") "; + $sql .= " AND facf.entity = " . (int) $conf->entity; $sql .= " AND ( "; if ($object->code_compta_client != "") { $sql .= " bk.subledger_account = '".$this->db->escape($object->code_compta_client)."' "; @@ -219,7 +219,7 @@ class Lettering extends BookKeeping $sql .= " INNER JOIN ".MAIN_DB_PREFIX."paiement as pay ON payfac.fk_paiement=pay.rowid"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_bookkeeping as bk ON (bk.fk_doc = pay.fk_bank AND bk.code_journal='".$this->db->escape($obj->code_journal)."')"; $sql .= " WHERE payfac.fk_paiement = '".$this->db->escape($obj->url_id)."' "; - $sql .= " AND bk.code_journal IN (SELECT code FROM ".MAIN_DB_PREFIX."accounting_journal WHERE nature=4 AND entity=".$conf->entity.") "; + $sql .= " AND bk.code_journal IN (SELECT code FROM ".MAIN_DB_PREFIX."accounting_journal WHERE nature=4 AND entity=". (int) $conf->entity.") "; $sql .= " AND fac.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy $sql .= " AND ( "; if ($object->code_compta_client != "") { @@ -247,7 +247,7 @@ class Lettering extends BookKeeping $sql = 'SELECT bk.rowid, fac.ref, fac.ref_supplier '; $sql .= " FROM ".MAIN_DB_PREFIX."facture fac "; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_bookkeeping as bk ON( bk.fk_doc = fac.rowid AND fac.rowid IN (".$this->db->sanitize(implode(',', $ids_fact))."))"; - $sql .= " WHERE code_journal IN (SELECT code FROM ".MAIN_DB_PREFIX."accounting_journal WHERE nature=2 AND entity=".$conf->entity.") "; + $sql .= " WHERE code_journal IN (SELECT code FROM ".MAIN_DB_PREFIX."accounting_journal WHERE nature=2 AND entity=". (int) $conf->entity.") "; $sql .= " AND fac.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy $sql .= " AND ( "; if ($object->code_compta_client != "") { @@ -299,6 +299,8 @@ class Lettering extends BookKeeping */ public function updateLettering($ids = array(), $notrigger = 0, $partial = false) { + global $langs; + $now = dol_now(); $error = 0; $affected_rows = 0; @@ -309,9 +311,10 @@ class Lettering extends BookKeeping $this->db->begin(); // Check partial / normal lettering case + $idlist = implode(',', array_map('intval', $ids)); $sql = "SELECT ab.lettering_code, GROUP_CONCAT(DISTINCT ab.rowid SEPARATOR ',') AS bookkeeping_ids"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab"; - $sql .= " WHERE ab.rowid IN (" . $this->db->sanitize(implode(',', $ids)) . ")"; + $sql .= " WHERE ab.rowid IN (" . $this->db->sanitize($idlist) . ")"; $sql .= " GROUP BY ab.lettering_code"; $sql .= " ORDER BY ab.lettering_code DESC"; @@ -331,7 +334,8 @@ class Lettering extends BookKeeping } elseif (!$partial && preg_match('/^[a-z]+$/', $obj->lettering_code)) { // Delete partial lettering code if set normal lettering $sql2 = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET"; - $sql2 .= " lettering_code = NULL"; + $sql2 .= " matching_general = 0"; + $sql2 .= ", lettering_code = NULL"; $sql2 .= ", date_lettering = NULL"; $sql2 .= " WHERE entity IN (" . getEntity('accountancy') . ")"; $sql2 .= " AND lettering_code = '" . $this->db->escape($obj->lettering_code) . "'"; @@ -353,11 +357,13 @@ class Lettering extends BookKeeping if (!$error && !empty($ids)) { // Get next code + $idlist = implode(',', array_map('intval', $ids)); $sql = "SELECT DISTINCT ab2.lettering_code"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab2 ON ab2.subledger_account = ab.subledger_account"; - $sql .= " WHERE ab.rowid IN (" . $this->db->sanitize(implode(',', $ids)) . ")"; + $sql .= " WHERE ab.rowid IN (" . $this->db->sanitize($idlist) . ")"; $sql .= " AND ab2.lettering_code != ''"; + $sql .= " AND ab2.matching_general = 0"; $sql .= " ORDER BY ab2.lettering_code DESC"; dol_syslog(__METHOD__ . " - Get next code", LOG_DEBUG); @@ -381,8 +387,12 @@ class Lettering extends BookKeeping // Test amount integrity if (!$error && !$partial) { - $sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE "; - $sql .= " rowid IN (" . $this->db->sanitize(implode(',', $ids)) . ") AND lettering_code IS NULL AND subledger_account != ''"; + $idlist = implode(',', array_map('intval', $ids)); + $sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred"; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping"; + $sql .= " WHERE rowid IN (" . $this->db->sanitize($idlist) . ")"; + $sql .= " AND lettering_code IS NULL"; + $sql .= " AND subledger_account != ''"; dol_syslog(__METHOD__ . " - Test amount integrity", LOG_DEBUG); $resql = $this->db->query($sql); @@ -402,10 +412,14 @@ class Lettering extends BookKeeping // Update lettering code if (!$error) { + $idlist = implode(',', array_map('intval', $ids)); $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET"; $sql .= " lettering_code='" . $this->db->escape($letter) . "'"; $sql .= ", date_lettering = '" . $this->db->idate($now) . "'"; // todo correct date it's false - $sql .= " WHERE rowid IN (" . $this->db->sanitize(implode(',', $ids)) . ") AND lettering_code IS NULL AND subledger_account != ''"; + $sql .= ", matching_general = 0"; + $sql .= " WHERE rowid IN (" . $this->db->sanitize($idlist) . ")"; + $sql .= " AND lettering_code IS NULL"; + $sql .= " AND subledger_account != ''"; dol_syslog(__METHOD__ . " - Update lettering code", LOG_DEBUG); $resql = $this->db->query($sql); @@ -441,10 +455,12 @@ class Lettering extends BookKeeping { $error = 0; + $idlist = implode(',', array_map('intval', $ids)); $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET"; - $sql .= " lettering_code = NULL"; + $sql .= " matching_general = 0"; + $sql .= ", lettering_code = NULL"; $sql .= ", date_lettering = NULL"; - $sql .= " WHERE rowid IN (".$this->db->sanitize(implode(',', $ids)).")"; + $sql .= " WHERE rowid IN (" . $this->db->sanitize($idlist) . ")"; $sql .= " AND subledger_account != ''"; dol_syslog(get_class($this)."::update", LOG_DEBUG); @@ -498,6 +514,263 @@ class Lettering extends BookKeeping } } + /** + * Update the matching on general account + * @param int[] $ids ids array + * @return int + */ + public function updateGeneralMatching(array $ids = []) + { + global $conf, $langs; + + $now = dol_now(); + $error = 0; + $affected_rows = 0; + + // Generate a string with n char 'A' (for manual/auto matching) + $letter = str_repeat('A', getDolGlobalInt('ACCOUNTING_LETTERING_NBLETTERS', 3)); + + // Check for unreconcilable accounts + $pcgId = getDolGlobalInt('CHARTOFACCOUNTS'); + $idlist = implode(',', array_map('intval', $ids)); + $sql = "SELECT DISTINCT numero_compte"; + $sql .= " FROM " . $this->db->prefix() . "accounting_bookkeeping AS ab"; + $sql .= " LEFT JOIN ("; + $sql .= " SELECT aa.rowid, aa.account_number"; + $sql .= " FROM " . $this->db->prefix() . "accounting_account AS aa"; + $sql .= " INNER JOIN " . $this->db->prefix() . "accounting_system AS asys ON asys.pcg_version = aa.fk_pcg_version"; + $sql .= " WHERE asys.rowid = ".(int) $pcgId." AND aa.reconcilable"; + $sql .= " ) AS reconciliable_accounts ON reconciliable_accounts.account_number = ab.numero_compte"; + $sql .= " WHERE ab.rowid IN (" . $this->db->sanitize($idlist) . ")"; + $sql .= " AND reconciliable_accounts.rowid IS NULL"; + + $resql = $this->db->query($sql); + if ($resql) { + while ($obj = $this->db->fetch_object($resql)) { + $this->errors[] = $langs->trans( + 'ErrorAccountNotReconcilable', + $obj->numero_compte, + dol_buildpath('accountancy/admin/account.php', 1) . '?search_account=' . $obj->numero_compte, + $langs->transnoentitiesnoconv('Chartofaccounts') + ); + return -1; + } + $this->db->free($resql); + } else { + $this->errors[] = 'Error' . $this->db->lasterror(); + return -1; + } + + // Get fiscal year & verify all selected rows belong to the same fiscal year + $idlist = implode(',', array_map('intval', $ids)); + $sql = "SELECT fy.rowid, fy.date_start, fy.date_end, COUNT(DISTINCT fy.rowid) AS nb_fiscalyears"; + $sql .= " FROM " . $this->db->prefix() . "accounting_bookkeeping AS ab"; + $sql .= " INNER JOIN " . $this->db->prefix() . "accounting_fiscalyear AS fy"; + $sql .= " ON ab.doc_date BETWEEN fy.date_start AND fy.date_end"; + $sql .= " AND fy.entity = " . (int) $conf->entity; + $sql .= " WHERE ab.rowid IN (" . $this->db->sanitize($idlist) . ")"; + $sql .= " GROUP BY fy.rowid, fy.date_start, fy.date_end"; + + dol_syslog(__METHOD__ . " - Get fiscal year", LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) { + $this->errors[] = 'Error ' . $this->db->lasterror(); + return -1; + } + + $fiscalYearRows = []; + while ($obj = $this->db->fetch_object($resql)) { + $fiscalYearRows[] = $obj; + } + $this->db->free($resql); + + // No fiscal year found for any of the selected rows + if (empty($fiscalYearRows)) { + $this->errors[] = $langs->trans('ErrorFiscalYearNotFound'); + return -1; + } + + // Cross-fiscal-year matching is forbidden + if (count($fiscalYearRows) > 1) { + $periods = array_map( + /** @param object $row */ + function ($row) { + return dol_print_date($this->db->jdate($row->date_start), 'day') . ' – ' . dol_print_date($this->db->jdate($row->date_end), 'day'); + }, + $fiscalYearRows + ); + $this->errors[] = $langs->transnoentitiesnoconv('ErrorMatchingCrossFiscalYear', implode(', ', $periods)); + return -1; + } + + $fiscalYear = $fiscalYearRows[0]; + $fiscalYearStart = $this->db->jdate($fiscalYear->date_start); + $fiscalYearEnd = $this->db->jdate($fiscalYear->date_end); + + // Get next code + $idlist = implode(',', array_map('intval', $ids)); + $sql = "SELECT DISTINCT ab2.lettering_code"; + $sql .= " FROM " . $this->db->prefix() . "accounting_bookkeeping AS ab"; + $sql .= " LEFT JOIN " . $this->db->prefix() . "accounting_bookkeeping AS ab2 ON ab2.numero_compte = ab.numero_compte"; + $sql .= " WHERE ab.rowid IN (" . $this->db->sanitize($idlist) . ")"; + $sql .= " AND ab2.lettering_code != ''"; + $sql .= " AND ab2.matching_general = 1"; + $sql .= " AND ab2.doc_date BETWEEN '" . $this->db->idate($fiscalYearStart) . "' AND '" . $this->db->idate($fiscalYearEnd) . "'"; + $sql .= " ORDER BY ab2.lettering_code DESC"; + + dol_syslog(__METHOD__ . " - Get next code", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + while ($obj = $this->db->fetch_object($resql)) { + if (!empty($obj->lettering_code) && preg_match('/^[A-Z]+$/', $obj->lettering_code)) { + $letter = $obj->lettering_code; + $letter++; + break; + } + } + $this->db->free($resql); + } else { + $this->errors[] = 'Error' . $this->db->lasterror(); + $error++; + } + + // Test amount integrity + if (!$error) { + $idlist = implode(',', array_map('intval', $ids)); + $sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred"; + $sql .= " FROM " . $this->db->prefix() . "accounting_bookkeeping"; + $sql .= " WHERE rowid IN (" . $this->db->sanitize($idlist) . ")"; + $sql .= " AND lettering_code IS NULL"; + + dol_syslog(__METHOD__ . " - Test amount integrity", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + if ($obj = $this->db->fetch_object($resql)) { + if (!(round(abs($obj->deb), 2) === round(abs($obj->cred), 2))) { + $this->errors[] = 'Total not exacts ' . round(abs($obj->deb), 2) . ' vs ' . round(abs($obj->cred), 2); + $error++; + } + } + $this->db->free($resql); + } else { + $this->errors[] = 'Erreur sql' . $this->db->lasterror(); + $error++; + } + } + + // Update matching code + if (!$error) { + $idlist = implode(',', array_map('intval', $ids)); + $sql = "UPDATE " . $this->db->prefix() . "accounting_bookkeeping SET"; + $sql .= " lettering_code='" . $this->db->escape($letter) . "'"; + $sql .= ", date_lettering = '" . $this->db->idate($now) . "'"; + $sql .= ", matching_general = 1"; + $sql .= " WHERE rowid IN (" . $this->db->sanitize($idlist) . ")"; + $sql .= " AND lettering_code IS NULL"; + + dol_syslog(__METHOD__ . " - Update gl lettering code", LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) { + $error++; + $this->errors[] = "Error " . $this->db->lasterror(); + } else { + $affected_rows = $this->db->affected_rows($resql); + } + } + + // Commit or rollback + if ($error) { + $this->db->rollback(); + foreach ($this->errors as $errmsg) { + dol_syslog(get_class($this) . "::update " . $errmsg, LOG_ERR); + $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); + } + return -1 * $error; + } else { + $this->db->commit(); + return $affected_rows; + } + } + + /** + * Delete matching code on general account + * Deletes all lines sharing the same lettering_code+numero_compte in the same fiscal year + * + * @param int[] $ids ids array + * @return int Nb of affected rows or -1 if error + */ + public function deleteGeneralMatching(array $ids = []) + { + global $conf; + + $error = 0; + + // Step 1: collect all (lettering_code, numero_compte, fiscal year) from selected ids + $idlist = implode(',', array_map('intval', $ids)); + $sql = "SELECT DISTINCT ab.lettering_code, ab.numero_compte, fy.date_start, fy.date_end"; + $sql .= " FROM " . $this->db->prefix() . "accounting_bookkeeping AS ab"; + $sql .= " INNER JOIN " . $this->db->prefix() . "accounting_fiscalyear AS fy"; + $sql .= " ON ab.doc_date BETWEEN fy.date_start AND fy.date_end"; + $sql .= " AND fy.entity = " . (int) $conf->entity; + $sql .= " WHERE ab.rowid IN (" . $this->db->sanitize($idlist) . ")"; + $sql .= " AND ab.matching_general = 1"; + $sql .= " AND ab.lettering_code IS NOT NULL AND ab.lettering_code != ''"; + + dol_syslog(__METHOD__ . " - Collect lettering groups to delete", LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) { + $this->errors[] = 'Error ' . $this->db->lasterror(); + return -1; + } + + $groups = []; + while ($obj = $this->db->fetch_object($resql)) { + $groups[] = [ + 'code' => $obj->lettering_code, + 'compte' => $obj->numero_compte, + 'date_start' => $obj->date_start, + 'date_end' => $obj->date_end, + ]; + } + $this->db->free($resql); + + if (empty($groups)) { + return 0; // Nothing to delete (lines not matched or already unmatched) + } + + // Step 2: for each group, delete all lines sharing the same code+account+fiscal year + $affected = 0; + foreach ($groups as $group) { + $sql = "UPDATE " . $this->db->prefix() . "accounting_bookkeeping SET"; + $sql .= " lettering_code = NULL"; + $sql .= ", date_lettering = NULL"; + $sql .= ", matching_general = 0"; + $sql .= " WHERE numero_compte = '" . $this->db->escape($group['compte']) . "'"; + $sql .= " AND lettering_code = '" . $this->db->escape($group['code']) . "'"; + $sql .= " AND matching_general = 1"; + $sql .= " AND doc_date BETWEEN '" . $this->db->escape($group['date_start']) . "' AND '" . $this->db->escape($group['date_end']) . "'"; + + dol_syslog(__METHOD__ . " - Delete gl matching group " . $group['code'] . "/" . $group['compte'], LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) { + $error++; + $this->errors[] = 'Error ' . $this->db->lasterror(); + break; + } + $affected += $this->db->affected_rows($resql); + } + + if ($error) { + foreach ($this->errors as $errmsg) { + dol_syslog(get_class($this) . "::deleteGeneralMatching " . $errmsg, LOG_ERR); + $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); + } + return -1 * $error; + } + + return $affected; + } + /** * Lettering bookkeeping lines * diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 062829a0db9..aae949f4fd8 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -227,6 +227,8 @@ Sens=Direction AccountingDirectionHelp=For an accounting account of a customer, use Credit to record a payment you have received
For an accounting account of a supplier, use Debit to record a payment you made LetteringCode=Matching code Lettering=Matching +GeneralMatching=General account matching +AuxiliaryMatching=Auxiliary account matching Codejournal=Journal JournalLabel=Journal label NumPiece=Piece number @@ -521,15 +523,18 @@ Formula=Formula LetteringAuto=Auto matching LetteringManual=Manual matching LetteringPartial=Partial matching +GeneralMatchingManual=Manual matching on general account +GeneralUnmatchingManual=Manual unmatching on general account Unlettering=Unmatching UnletteringAuto=Auto unmatching UnletteringManual=Manual unmatching -AccountancyNoLetteringModified=No matching modified -AccountancyOneLetteringModifiedSuccessfully=One matching successfully modified -AccountancyLetteringModifiedSuccessfully=%s matching successfully modified -AccountancyNoUnletteringModified=No unmatching modified -AccountancyOneUnletteringModifiedSuccessfully=One unmatching successfully modified -AccountancyUnletteringModifiedSuccessfully=%s unmatching successfully modified +AccountancyNoMatchingModified=No matching modified +AccountancyOneMatchingModifiedSuccessfully=One matching successfully modified +AccountancyMatchingModifiedSuccessfully=%s matching successfully modified +AccountancyNoUnmatchingModified=No unmatching modified +AccountancyOneUnmatchingModifiedSuccessfully=One unmatching successfully modified +AccountancyUnmatchingModifiedSuccessfully=%s unmatching successfully modified +CentralizedAccountCannotBeMatchable=This account is a centralizing account and cannot be set as matchable ## Closure AccountancyClosureStep1=Validate and lock the movements AccountancyClosureStep2=Close the fiscal period @@ -545,6 +550,8 @@ AccountancyClosureInsertAccountingReversalSuccessfully=Bookkeeping entries for " ConfirmMassUnletteringAuto=Bulk auto matching confirmation ConfirmMassUnletteringManual=Bulk manual unmatching confirmation ConfirmMassUnletteringQuestion=Are you sure you want to unmatch the %s selected record(s)? +ConfirmMassGeneralUnmatchingManual=Bulk general unmatching confirmation +ConfirmMassGeneralUnmatchingQuestion=Are you sure you want to unmatch the %s selected record(s)? ConfirmMassDeleteBookkeepingWriting=Bulk delete confirmation ConfirmMassDeleteBookkeepingWritingQuestion=This will delete the transaction from the accounting (all line entries related to the same transaction will be deleted). Are you sure you want to delete the %s selected entries? AccountancyClosureConfirmClose=Are you sure you want to close the current fiscal period ? You understand that closing the fiscal period is an irreversible action and will permanently block any modification or deletion of entries over this period. @@ -576,6 +583,10 @@ ErrorBookkeepingDocDateIsOnAClosedFiscalPeriod=The bookkeeping doc date is insid Error_BOOKKEEPING_ADDON_NotDefined=Error, the rule for bookkeeping numbering ref is not defined into general setup of Accountancy module ErrorBookkeepingTryInsertNotBalancedTransactionAndCanceled=You tried to insert a non balanced transaction in the book for %s (Payment ID: %s). Action is canceled ProductUsage=Product or service usage +ErrorDocDateNotFound=No bookkeeping doc date found +ErrorAccountNotReconcilable=Account %s is not reconcilable. Use the %s page to set reconcilable accounts +ErrorFiscalYearNotFound=No fiscal year found for the selected journal entries. +ErrorMatchingCrossFiscalYear=Cross-fiscal-year matching is not allowed. The selected entries span multiple fiscal years: %s. ## Import ImportAccountingEntries=Accounting entries ImportAccountingEntriesFECFormat=Accounting entries - FEC format From 0aef7e9468b2baedef2bb9e71667fc6636ee1980 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 May 2026 20:05:33 +0200 Subject: [PATCH 67/79] NEW A page can force its value for MAIN_SECURITY_CSRF_WITH_TOKEN --- htdocs/core/class/conf.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index e62ea152ab6..0b749fef636 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -1358,7 +1358,7 @@ class Conf extends stdClass // Value 1 makes CSRF check for all POST parameters only // Value 2 makes also CSRF check for GET requests with action = a sensitive requests like action=del, action=remove... // Value 3 makes also CSRF check for all GET requests with a param action or massaction (except some non sensitive values) - $this->global->MAIN_SECURITY_CSRF_WITH_TOKEN = 3; + $this->global->MAIN_SECURITY_CSRF_WITH_TOKEN = (defined('MAIN_SECURITY_CSRF_WITH_TOKEN') ? constant('MAIN_SECURITY_CSRF_WITH_TOKEN') : 3); // Note: Set MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL=1 to have a renewal of token at each page call instead of each session (not recommended) } From 85384fb523a796269374538ab956375820604418 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 9 May 2026 01:16:35 +0200 Subject: [PATCH 68/79] Fix sanitize fields in API put and post for extrafields --- htdocs/adherents/class/api_members.class.php | 2 +- .../class/api_memberstypes.class.php | 4 +- .../class/api_subscriptions.class.php | 2 +- htdocs/api/class/api.class.php | 77 +++++++++++++++++-- htdocs/api/class/api_objectlinks.class.php | 5 +- htdocs/bom/class/api_boms.class.php | 2 +- .../categories/class/api_categories.class.php | 2 +- .../action/class/api_agendaevents.class.php | 2 +- .../comm/mailing/class/api_mailings.class.php | 2 +- .../comm/propal/class/api_proposals.class.php | 2 +- htdocs/commande/class/api_orders.class.php | 2 +- .../bank/class/api_bankaccounts.class.php | 2 +- .../facture/class/api_invoices.class.php | 2 +- htdocs/contrat/class/api_contracts.class.php | 2 +- htdocs/core/class/commoninvoice.class.php | 36 +++++++++ htdocs/core/class/commonobject.class.php | 36 --------- htdocs/don/class/api_donations.class.php | 2 +- .../expedition/class/api_shipments.class.php | 2 +- .../class/api_expensereports.class.php | 2 +- .../class/api_interventions.class.php | 2 +- .../class/api_supplier_invoices.class.php | 2 +- .../fourn/class/api_supplier_orders.class.php | 2 +- htdocs/holiday/class/api_holidays.class.php | 2 +- .../class/api_knowledgemanagement.class.php | 2 +- .../template/class/api_mymodule.class.php | 15 ++-- htdocs/mrp/class/api_mos.class.php | 2 +- .../class/api_partnerships.class.php | 2 +- htdocs/product/class/api_products.class.php | 2 +- .../stock/class/api_productlots.class.php | 2 +- .../stock/class/api_stockmovements.class.php | 5 +- .../stock/class/api_warehouses.class.php | 2 +- htdocs/projet/class/api_projects.class.php | 2 +- .../reception/class/api_receptions.class.php | 2 +- htdocs/societe/class/api_contacts.class.php | 6 +- .../societe/class/api_thirdparties.class.php | 12 +-- .../class/api_supplier_proposals.class.php | 16 +++- htdocs/ticket/class/api_tickets.class.php | 2 +- htdocs/user/class/api_users.class.php | 8 +- 38 files changed, 172 insertions(+), 102 deletions(-) diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 5125d008ffa..946df849cf1 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -434,7 +434,7 @@ class Members extends DolibarrApi } if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $member->array_options[$index] = $this->_checkValForAPI($field, $val, $member); + $member->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $member); } continue; } diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php index b42d7410dae..2231f781885 100644 --- a/htdocs/adherents/class/api_memberstypes.class.php +++ b/htdocs/adherents/class/api_memberstypes.class.php @@ -166,7 +166,7 @@ class MembersTypes extends DolibarrApi continue; } - $membertype->$field = $value; + $membertype->$field = $this->_checkValForAPI($field, $value, $membertype); } if ($membertype->create(DolibarrApiAccess::$user) < 0) { throw new RestException(500, 'Error creating member type', array_merge(array($membertype->error), $membertype->errors)); @@ -210,7 +210,7 @@ class MembersTypes extends DolibarrApi } if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $membertype->array_options[$index] = $this->_checkValForAPI($field, $val, $membertype); + $membertype->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $membertype); } continue; } diff --git a/htdocs/adherents/class/api_subscriptions.class.php b/htdocs/adherents/class/api_subscriptions.class.php index b00f10a9123..d553fb6ec99 100644 --- a/htdocs/adherents/class/api_subscriptions.class.php +++ b/htdocs/adherents/class/api_subscriptions.class.php @@ -244,7 +244,7 @@ class Subscriptions extends DolibarrApi if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $subscription->array_options[$index] = $this->_checkValForAPI($field, $val, $subscription); + $subscription->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $subscription); } continue; } diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 790c00a1772..3ab7d9099ea 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -109,34 +109,35 @@ class DolibarrApi } if ($object->fields[$field]['type'] == 'select') { // Check values are in the list of possible 'options' - // TODO + return sanitizeVal($value, 'alphanohtml'); } if ($object->fields[$field]['type'] == 'sellist' || $object->fields[$field]['type'] == 'checkbox') { - // TODO + return sanitizeVal($value, 'alphanohtml'); } if ($object->fields[$field]['type'] == 'boolean' || $object->fields[$field]['type'] == 'radio') { - // TODO + return sanitizeVal($value, 'alphanohtml'); } if ($object->fields[$field]['type'] == 'email') { return sanitizeVal($value, 'email'); } if ($object->fields[$field]['type'] == 'password') { - return sanitizeVal($value, 'none'); + return sanitizeVal($value, 'password'); } // Others will use 'alphanohtml' } - // In case of a field with unknown type (legacy code), we use its name to have a chance to sanitize it + // In case of a field with unknown type (legacy code), we use other tricks to guess a more accurate type + + // We try to use its name to have a chance to sanitize it if (preg_match('/^fk_/i', $field)) { // We accept only integer return sanitizeVal($value, 'int'); } - if (in_array($field, array('note', 'note_private', 'note_public', 'desc', 'description'))) { return sanitizeVal($value, 'restricthtml'); - } else { - return sanitizeVal($value, 'alphanohtml'); } + + return sanitizeVal($value, 'alphanohtml'); } else { // Example when $field = 'extrafields' and $value = content of $object->array_options $newarrayvalue = array(); foreach ($value as $tmpkey => $tmpvalue) { @@ -147,6 +148,66 @@ class DolibarrApi } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore + /** + * Check and convert a string depending on its type/name. + * + * @param string $field Field name + * @param string|string[] $value Value to check/clean + * @param Object $object Object + * @return string|array Value cleaned + */ + protected function _checkValExtrafieldsForAPI($field, $value, $object) + { + global $extrafields; + + // phpcs:enable + if (!is_array($value)) { + // Sanitize the value using its type declared into ->fields of $object + $typeOfExtraField = ''; + if (!empty($extrafields->attributes) && !empty($extrafields->attributes[$object->table_element]) + && !empty($extrafields->attributes[$object->table_element]['type']) + && !empty($extrafields->attributes[$object->table_element]['type'][$field])) { + $typeOfExtraField = $extrafields->attributes[$object->table_element]['type'][$field]; + } + + if ($typeOfExtraField) { + if (strpos($typeOfExtraField, 'int') || strpos($typeOfExtraField, 'double') || in_array($typeOfExtraField, array('real', 'price', 'stock'))) { + return sanitizeVal($value, 'int'); + } + if ($object->array_options[$field]['type'] == 'html') { + return sanitizeVal($value, 'restricthtml'); + } + if ($object->array_options[$field]['type'] == 'select') { + // TODO Check values are in the list of possible 'options' + return sanitizeVal($value, 'alphanohtml'); + } + if ($typeOfExtraField == 'sellist' || $typeOfExtraField == 'checkbox') { + return sanitizeVal($value, 'alphanohtml'); + } + if ($typeOfExtraField == 'boolean' || $typeOfExtraField == 'radio') { + return sanitizeVal($value, 'alphanohtml'); + } + if ($typeOfExtraField == 'email') { + return sanitizeVal($value, 'email'); + } + if ($typeOfExtraField == 'password') { + return sanitizeVal($value, 'password'); + } + // Others will use 'alphanohtml' + } + + return sanitizeVal($value, 'alphanohtml'); + } else { // Example when $field = 'extrafields' and $value = content of $object->array_options + $newarrayvalue = array(); + foreach ($value as $tmpkey => $tmpvalue) { + $newarrayvalue[$tmpkey] = $this->_checkValExtrafieldsForAPI($tmpkey, $tmpvalue, $object); + } + + return $newarrayvalue; + } + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Filter properties that will be returned on object diff --git a/htdocs/api/class/api_objectlinks.class.php b/htdocs/api/class/api_objectlinks.class.php index 43d114a8bcf..0b53f632523 100644 --- a/htdocs/api/class/api_objectlinks.class.php +++ b/htdocs/api/class/api_objectlinks.class.php @@ -94,7 +94,6 @@ class ObjectLinks extends DolibarrApi */ private function _setObjectLinkField($field, $value) { - $clean_field = $this->_checkValForAPI($field, $value, $this->objectlink); /** @@ -106,9 +105,9 @@ class ObjectLinks extends DolibarrApi ); if (in_array($field, $intFields)) { - $this->objectlink->$field = (int) $clean_field; + $this->objectlink->$field = (int) $clean_field; // Clean by _checkValForAPI previously } else { - $this->objectlink->$field = (string) $clean_field; + $this->objectlink->$field = (string) $clean_field; // Clean by _checkValForAPI previously } } diff --git a/htdocs/bom/class/api_boms.class.php b/htdocs/bom/class/api_boms.class.php index 8eefef37428..cd524fd93de 100644 --- a/htdocs/bom/class/api_boms.class.php +++ b/htdocs/bom/class/api_boms.class.php @@ -261,7 +261,7 @@ class Boms extends DolibarrApi if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->bom->array_options[$index] = $this->_checkValForAPI($field, $val, $this->bom); + $this->bom->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->bom); } continue; } diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 4a9f63b7694..b25fc415b0a 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -252,7 +252,7 @@ class Categories extends DolibarrApi if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->category->array_options[$index] = $this->_checkValForAPI($field, $val, $this->category); + $this->category->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->category); } continue; } diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 371082df46f..663a65b60c2 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -316,7 +316,7 @@ class AgendaEvents extends DolibarrApi if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->actioncomm->array_options[$index] = $this->_checkValForAPI($field, $val, $this->actioncomm); + $this->actioncomm->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->actioncomm); } continue; } diff --git a/htdocs/comm/mailing/class/api_mailings.class.php b/htdocs/comm/mailing/class/api_mailings.class.php index c8b8f7dc870..c66042274d7 100644 --- a/htdocs/comm/mailing/class/api_mailings.class.php +++ b/htdocs/comm/mailing/class/api_mailings.class.php @@ -466,7 +466,7 @@ class Mailings extends DolibarrApi } if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->mailing->array_options[$index] = $this->_checkValForAPI($field, $val, $this->mailing); + $this->mailing->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->mailing); } continue; } diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 5ac333a9d9e..241603931f2 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -931,7 +931,7 @@ class Proposals extends DolibarrApi } if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->propal->array_options[$index] = $this->_checkValForAPI($field, $val, $this->propal); + $this->propal->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->propal); } continue; } diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index e40e3a9f313..0d4dbf4147b 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -869,7 +869,7 @@ class Orders extends DolibarrApi } if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->commande->array_options[$index] = $this->_checkValForAPI($field, $val, $this->commande); + $this->commande->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->commande); } continue; } diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 593373cbfd3..a929a046064 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -357,7 +357,7 @@ class BankAccounts extends DolibarrApi if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $account->array_options[$index] = $this->_checkValForAPI($field, $val, $account); + $account->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $account); } continue; } diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index c8ae898c90b..731315823ff 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -912,7 +912,7 @@ class Invoices extends DolibarrApi } if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->invoice->array_options[$index] = $this->_checkValForAPI($field, $val, $this->invoice); + $this->invoice->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->invoice); } continue; } diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php index c1a2a89d624..b37a95ebc23 100644 --- a/htdocs/contrat/class/api_contracts.class.php +++ b/htdocs/contrat/class/api_contracts.class.php @@ -777,7 +777,7 @@ class Contracts extends DolibarrApi if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->contract->array_options[$index] = $this->_checkValForAPI($field, $val, $this->contract); + $this->contract->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->contract); } continue; } diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index de65e9f7f28..f979fdf3967 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -202,6 +202,11 @@ abstract class CommonInvoice extends CommonObject */ public $situation_cycle_ref; + /** + * @var int Populated by setRetainedWarrantyPaymentTerms() + */ + public $retained_warranty_fk_cond_reglement; + /** * ! Closing after partial payment: CLOSECODE_DISCOUNTVAT, CLOSECODE_BADDEBT, CLOSECODE_BANKCHARGE, CLOSECODE_OTHER * ! Closing when no payment: CLOSECODE_ABANDONED, CLOSECODE_REPLACED @@ -577,6 +582,37 @@ abstract class CommonInvoice extends CommonObject return $listofopendirectdebitorcredittransfer; } + /** + * Change the retained warranty payments terms + * + * @param int $id Id of new payment terms + * @return int >0 if OK, <0 if KO + */ + public function setRetainedWarrantyPaymentTerms($id) + { + dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms('.$id.')'); + if ($this->status >= 0 || $this->element == 'societe') { + $fieldname = 'retained_warranty_fk_cond_reglement'; + + $sql = 'UPDATE '.$this->db->prefix().$this->table_element; + $sql .= " SET ".$this->db->sanitize($fieldname)." = ".((int) $id); + $sql .= ' WHERE rowid='.((int) $this->id); + + if ($this->db->query($sql)) { + $this->retained_warranty_fk_cond_reglement = $id; + return 1; + } else { + dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms Error '.$sql.' - '.$this->db->error()); + $this->error = $this->db->error(); + return -1; + } + } else { + dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms, status of the object is incompatible'); + $this->error = 'Status of the object is incompatible '.$this->status; + return -2; + } + } + /** * Return list of payments * diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 9562f562d2c..e663ff06648 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -915,11 +915,6 @@ abstract class CommonObject public $deposit_percent; - /** - * @var int Populated by setRetainedWarrantyPaymentTerms() - */ - public $retained_warranty_fk_cond_reglement; - /** * @var int Populated by setWarehouse() */ @@ -3268,37 +3263,6 @@ abstract class CommonObject } } - /** - * Change the retained warranty payments terms - * - * @param int $id Id of new payment terms - * @return int >0 if OK, <0 if KO - */ - public function setRetainedWarrantyPaymentTerms($id) - { - dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms('.$id.')'); - if ($this->status >= 0 || $this->element == 'societe') { - $fieldname = 'retained_warranty_fk_cond_reglement'; - - $sql = 'UPDATE '.$this->db->prefix().$this->table_element; - $sql .= " SET ".$this->db->sanitize($fieldname)." = ".((int) $id); - $sql .= ' WHERE rowid='.((int) $this->id); - - if ($this->db->query($sql)) { - $this->retained_warranty_fk_cond_reglement = $id; - return 1; - } else { - dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms Error '.$sql.' - '.$this->db->error()); - $this->error = $this->db->error(); - return -1; - } - } else { - dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms, status of the object is incompatible'); - $this->error = 'Status of the object is incompatible '.$this->status; - return -2; - } - } - /** * Define delivery address * @deprecated diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index a2737c5e0b7..b78a93db3c5 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -266,7 +266,7 @@ class Donations extends DolibarrApi if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->don->array_options[$index] = $this->_checkValForAPI($field, $val, $this->don); + $this->don->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->don); } continue; } diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php index 975b78f7bdc..b1e7075e513 100644 --- a/htdocs/expedition/class/api_shipments.class.php +++ b/htdocs/expedition/class/api_shipments.class.php @@ -516,7 +516,7 @@ class Shipments extends DolibarrApi if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->shipment->array_options[$index] = $this->_checkValForAPI($field, $val, $this->shipment); + $this->shipment->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->shipment); } continue; } diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index 33d8a419cb0..c359adbbcc0 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -527,7 +527,7 @@ class ExpenseReports extends DolibarrApi if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->expensereport->array_options[$index] = $this->_checkValForAPI($field, $val, $this->expensereport); + $this->expensereport->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->expensereport); } continue; } diff --git a/htdocs/fichinter/class/api_interventions.class.php b/htdocs/fichinter/class/api_interventions.class.php index 09dbb630179..4b5f9a2ba30 100644 --- a/htdocs/fichinter/class/api_interventions.class.php +++ b/htdocs/fichinter/class/api_interventions.class.php @@ -331,7 +331,7 @@ class Interventions extends DolibarrApi } if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->fichinter->array_options[$index] = $this->_checkValForAPI($field, $val, $this->fichinter); + $this->fichinter->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->fichinter); } continue; } diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index eb07670e182..5475a431168 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -302,7 +302,7 @@ class SupplierInvoices extends DolibarrApi } if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->invoice->array_options[$index] = $this->_checkValForAPI($field, $val, $this->invoice); + $this->invoice->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->invoice); } continue; } diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php index 74dde9ebe83..1fa88b2bf88 100644 --- a/htdocs/fourn/class/api_supplier_orders.class.php +++ b/htdocs/fourn/class/api_supplier_orders.class.php @@ -320,7 +320,7 @@ class SupplierOrders extends DolibarrApi } if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->order->array_options[$index] = $this->_checkValForAPI($field, $val, $this->order); + $this->order->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->order); } continue; } diff --git a/htdocs/holiday/class/api_holidays.class.php b/htdocs/holiday/class/api_holidays.class.php index 62ab6628582..2e630bc88bc 100644 --- a/htdocs/holiday/class/api_holidays.class.php +++ b/htdocs/holiday/class/api_holidays.class.php @@ -282,7 +282,7 @@ class Holidays extends DolibarrApi if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->holiday->array_options[$index] = $this->_checkValForAPI($field, $val, $this->holiday); + $this->holiday->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->holiday); } continue; } diff --git a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php index 205a4c822f0..018b5ff65c4 100644 --- a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php +++ b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php @@ -322,7 +322,7 @@ class KnowledgeManagement extends DolibarrApi if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->knowledgerecord->array_options[$index] = $this->_checkValForAPI($field, $val, $this->knowledgerecord); + $this->knowledgerecord->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->knowledgerecord); } continue; } diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index e2ed9a20d6c..2074351fc21 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -239,8 +239,10 @@ class MyModuleApi extends DolibarrApi } if ($field == 'array_options' && is_array($value)) { + $this->myobject->fetch_optionals(); // To force the load of the extrafields definition by fetch_name_optionals_label() + foreach ($value as $index => $val) { - $this->myobject->array_options[$index] = $this->_checkValForAPI('extrafields', $val, $this->myobject); + $this->myobject->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->myobject); } continue; } @@ -300,19 +302,12 @@ class MyModuleApi extends DolibarrApi if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->myobject->array_options[$index] = $this->_checkValForAPI('extrafields', $val, $this->myobject); + $this->myobject->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->myobject); } continue; } - if ($field == 'array_options' && is_array($value)) { - foreach ($value as $index => $val) { - $this->myobject->array_options[$index] = $this->_checkValForAPI($field, $val, $this->myobject); - } - continue; - } - - $this->myobject->$field = $this->_checkValForAPI($field, $value, $this->myobject); + $this->myobject->$field = $this->_checkValForAPI((string) $field, $value, $this->myobject); } // Clean data diff --git a/htdocs/mrp/class/api_mos.class.php b/htdocs/mrp/class/api_mos.class.php index 379b3fdcf8f..d81cefe56b4 100644 --- a/htdocs/mrp/class/api_mos.class.php +++ b/htdocs/mrp/class/api_mos.class.php @@ -284,7 +284,7 @@ class Mos extends DolibarrApi if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->mo->array_options[$index] = $this->_checkValForAPI($field, $val, $this->mo); + $this->mo->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->mo); } continue; } diff --git a/htdocs/partnership/class/api_partnerships.class.php b/htdocs/partnership/class/api_partnerships.class.php index 821b5379f97..ad81930c6c7 100644 --- a/htdocs/partnership/class/api_partnerships.class.php +++ b/htdocs/partnership/class/api_partnerships.class.php @@ -259,7 +259,7 @@ class Partnerships extends DolibarrApi } if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->partnership->array_options[$index] = $this->_checkValForAPI($field, $val, $this->partnership); + $this->partnership->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->partnership); } continue; } diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index a2df15f53fd..b85f18609f7 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -423,7 +423,7 @@ class Products extends DolibarrApi } if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->product->array_options[$index] = $this->_checkValForAPI($field, $val, $this->product); + $this->product->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->product); } continue; } diff --git a/htdocs/product/stock/class/api_productlots.class.php b/htdocs/product/stock/class/api_productlots.class.php index b9e1a82b8b0..6e922e11dce 100644 --- a/htdocs/product/stock/class/api_productlots.class.php +++ b/htdocs/product/stock/class/api_productlots.class.php @@ -290,7 +290,7 @@ class Productlots extends DolibarrApi if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->productlot->array_options[$index] = $this->_checkValForAPI($field, $val, $this->productlot); + $this->productlot->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->productlot); } continue; } diff --git a/htdocs/product/stock/class/api_stockmovements.class.php b/htdocs/product/stock/class/api_stockmovements.class.php index 284d9030df0..d72c697649a 100644 --- a/htdocs/product/stock/class/api_stockmovements.class.php +++ b/htdocs/product/stock/class/api_stockmovements.class.php @@ -269,11 +269,12 @@ class StockMovements extends DolibarrApi foreach($request_data as $field => $value) { if ($field == 'id') continue; - $this->stockmovement->$field = $value; + $this->stockmovement->$field = $this->_checkValForAPI($field, $value, $this->stockmovement); } - if($this->stockmovement->update($id, DolibarrApiAccess::$user)) + if ($this->stockmovement->update($id, DolibarrApiAccess::$user)) { return $this->get ($id); + } return false; }*/ diff --git a/htdocs/product/stock/class/api_warehouses.class.php b/htdocs/product/stock/class/api_warehouses.class.php index d910223e065..673cfa82ff7 100644 --- a/htdocs/product/stock/class/api_warehouses.class.php +++ b/htdocs/product/stock/class/api_warehouses.class.php @@ -299,7 +299,7 @@ class Warehouses extends DolibarrApi if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->warehouse->array_options[$index] = $this->_checkValForAPI($field, $val, $this->warehouse); + $this->warehouse->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->warehouse); } continue; } diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index ec19295a425..ae6c1f4218d 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -738,7 +738,7 @@ class Projects extends DolibarrApi } if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->project->array_options[$index] = $this->_checkValForAPI($field, $val, $this->project); + $this->project->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->project); } continue; } diff --git a/htdocs/reception/class/api_receptions.class.php b/htdocs/reception/class/api_receptions.class.php index 5dc1cccdd51..f9feeab4795 100644 --- a/htdocs/reception/class/api_receptions.class.php +++ b/htdocs/reception/class/api_receptions.class.php @@ -506,7 +506,7 @@ class Receptions extends DolibarrApi if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->reception->array_options[$index] = $this->_checkValForAPI($field, $val, $this->reception); + $this->reception->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->reception); } continue; } diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index 17cf3cdccc4..ccca2e968eb 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -361,8 +361,10 @@ class Contacts extends DolibarrApi continue; } if ($field == 'array_options' && is_array($value)) { + $this->contact->fetch_optionals(); // To force the load of the extrafields definition by fetch_name_optionals_label() + foreach ($value as $index => $val) { - $this->contact->array_options[$index] = $this->_checkValForAPI('extrafields', $val, $this->contact); + $this->contact->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->contact); } continue; } @@ -430,7 +432,7 @@ class Contacts extends DolibarrApi } if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->contact->array_options[$index] = $this->_checkValForAPI($field, $val, $this->contact); + $this->contact->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->contact); } continue; } diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 599567772cb..6b77c33ab42 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -331,8 +331,10 @@ class Thirdparties extends DolibarrApi continue; } if ($field == 'array_options' && is_array($value)) { + $this->company->fetch_optionals(); // To force the load of the extrafields definition by fetch_name_optionals_label() + foreach ($value as $index => $val) { - $this->company->array_options[$index] = $this->_checkValForAPI('extrafields', $val, $this->company); + $this->company->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->company); } continue; } @@ -393,7 +395,7 @@ class Thirdparties extends DolibarrApi } if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->company->array_options[$index] = $this->_checkValForAPI($field, $val, $this->company); + $this->company->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->company); } continue; } @@ -1650,7 +1652,7 @@ class Thirdparties extends DolibarrApi $notification->socid = $id; foreach ($request_data as $field => $value) { - $notification->$field = $value; + $notification->$field = $this->_checkValForAPI($field, $value, $notification); } $event = $notification->event; @@ -1727,7 +1729,7 @@ class Thirdparties extends DolibarrApi if ($field === 'fk_action') { throw new RestException(500, 'Error creating Thirdparty Notification, request_data contains fk_action key'); } - $notification->$field = $value; + $notification->$field = $this->_checkValForAPI($field, $value, $notification); } $event = $notification->event; @@ -1824,7 +1826,7 @@ class Thirdparties extends DolibarrApi } foreach ($request_data as $field => $value) { - $notification->$field = $value; + $notification->$field = $this->_checkValForAPI($field, $value, $notification); } if ($notification->update(DolibarrApiAccess::$user) < 0) { diff --git a/htdocs/supplier_proposal/class/api_supplier_proposals.class.php b/htdocs/supplier_proposal/class/api_supplier_proposals.class.php index 5c3fc674400..4ffc996fe85 100644 --- a/htdocs/supplier_proposal/class/api_supplier_proposals.class.php +++ b/htdocs/supplier_proposal/class/api_supplier_proposals.class.php @@ -139,8 +139,17 @@ class SupplierProposals extends DolibarrApi continue; } - $this->supplier_proposal->$field = $value; + if ($field == 'array_options' && is_array($value)) { + $this->supplier_proposal->fetch_optionals(); // To force the load of the extrafields definition by fetch_name_optionals_label() + + foreach ($value as $index => $val) { + $this->supplier_proposal->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->supplier_proposal); + } + continue; + } + $this->supplier_proposal->$field = $this->_checkValForAPI($field, $value, $this->supplier_proposal); } + /*if (isset($request_data["lines"])) { $lines = array(); foreach ($request_data["lines"] as $line) { @@ -148,6 +157,7 @@ class SupplierProposals extends DolibarrApi } $this->propal->lines = $lines; }*/ + if ($this->supplier_proposal->create(DolibarrApiAccess::$user) < 0) { throw new RestException(500, "Error creating supplier proposal", array_merge(array($this->supplier_proposal->error), $this->supplier_proposal->errors)); } @@ -189,11 +199,11 @@ class SupplierProposals extends DolibarrApi } if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->supplier_proposal->array_options[$index] = $val; + $this->supplier_proposal->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->supplier_proposal); } continue; } - $this->supplier_proposal->$field = $value; + $this->supplier_proposal->$field = $this->_checkValForAPI($field, $value, $this->supplier_proposal); } // update end of validity date diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index f8bda2a9911..3de87b261cf 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -575,7 +575,7 @@ class Tickets extends DolibarrApi } if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->ticket->array_options[$index] = $this->_checkValForAPI($field, $val, $this->ticket); + $this->ticket->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->ticket); } continue; } diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 2aa0c822092..c4624cca026 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -461,7 +461,7 @@ class Users extends DolibarrApi } if ($field == 'array_options' && is_array($value)) { foreach ($value as $index => $val) { - $this->useraccount->array_options[$index] = $this->_checkValForAPI($field, $val, $this->useraccount); + $this->useraccount->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->useraccount); } continue; } @@ -1090,7 +1090,7 @@ class Users extends DolibarrApi $notification->fk_user = $id; foreach ($request_data as $field => $value) { - $notification->$field = $value; + $notification->$field = $this->_checkValForAPI($field, $value, $notification); } $event = $notification->event; @@ -1165,7 +1165,7 @@ class Users extends DolibarrApi if ($field === 'fk_action') { throw new RestException(500, 'Error creating User Notification, request_data contains fk_action key'); } - $notification->$field = $value; + $notification->$field = $this->_checkValForAPI($field, $value, $notification); } $event = $notification->event; @@ -1260,7 +1260,7 @@ class Users extends DolibarrApi } foreach ($request_data as $field => $value) { - $notification->$field = $value; + $notification->$field = $this->_checkValForAPI($field, $value, $notification); } if ($notification->update(DolibarrApiAccess::$user) < 0) { From 4deb854a29b9014edb62f732c6bdbf6b2942c135 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 9 May 2026 01:30:48 +0200 Subject: [PATCH 69/79] CSS --- htdocs/expedition/dispatch.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/htdocs/expedition/dispatch.php b/htdocs/expedition/dispatch.php index 353af3cce8d..f2320c49163 100644 --- a/htdocs/expedition/dispatch.php +++ b/htdocs/expedition/dispatch.php @@ -33,6 +33,13 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ require_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_order/modules_commandefournisseur.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; @@ -45,14 +52,6 @@ if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - // Load translation files required by the page $langs->loadLangs(array("sendings", "companies", "bills", 'orders', 'stocks', 'other', 'propal', 'receptions')); @@ -745,13 +744,15 @@ if ($object->id > 0 || !empty($object->ref)) { $tmpproduct = $conf->cache['product'][$objp->fk_product]; } - $linktoprod = $tmpproduct->getNomUrl(1); - $linktoprod .= ' - '.$objp->label."\n"; + $linktoprod = '
'; + $linktoprod .= $tmpproduct->getNomUrl(1); + $linktoprod .= '
'.dolPrintHTML($objp->label)."\n"; + $linktoprod .= '
'; if ($is_mod_batch_enabled) { if ($objp->tobatch) { // Product - print ''; + print ''; print $linktoprod; print ""; print ''; From 65390a970caaaa5be5859e97153881952f048963 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 9 May 2026 04:30:04 +0200 Subject: [PATCH 70/79] clean code --- htdocs/fourn/class/fournisseur.product.class.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index cdc2a52ffeb..bc8224e585f 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -832,7 +832,7 @@ class ProductFournisseur extends Product public function list_product_fournisseur_price($prodid, $sortfield = '', $sortorder = '', $limit = 0, $offset = 0, $socid = 0) { // phpcs:enable - $sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id, p.ref as product_ref, p.tosell as status, p.tobuy as status_buy, "; + $sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id, p.ref as product_ref, p.tosell as status, p.tobuy as status_buy, p.tobatch as status_batch,"; $sql .= " pfp.rowid as product_fourn_pri_id, pfp.entity, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_product as product_fourn_id, pfp.fk_supplier_price_expression,"; $sql .= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.info_bits, pfp.delivery_time_days, pfp.supplier_reputation,"; $sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code, pfp.datec, pfp.tms,"; @@ -863,6 +863,7 @@ class ProductFournisseur extends Product $prodfourn->product_fourn_price_id = $record["product_fourn_pri_id"]; $prodfourn->status = $record["status"]; $prodfourn->status_buy = $record["status_buy"]; + $prodfourn->status_batch = $record["status_batch"]; $prodfourn->product_fourn_id = $record["product_fourn_id"]; $prodfourn->product_fourn_entity = $record["entity"]; $prodfourn->ref_supplier = $record["ref_fourn"]; @@ -1466,11 +1467,11 @@ class ProductFournisseur extends Product * @param int $type Type of product * @return string Label of status */ - public function getLibStatut($mode = 0, $type = 0) // must be compatible with getLibStatut of inherited Product + /* public function getLibStatut($mode = 0, $type = 0) // must be compatible with getLibStatut of inherited Product { return $this->LibStatut($this->status, $mode); } - + */ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return the status @@ -1480,6 +1481,7 @@ class ProductFournisseur extends Product * @param int $type Type of product * @return string Label of status */ + /* public function LibStatut($status, $mode = 0, $type = 0) { // phpcs:enable @@ -1500,6 +1502,7 @@ class ProductFournisseur extends Product return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } + */ /** * Private function to log price history From 9459c59bd53ec4bc1d467600b9a331cfd962fab8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 9 May 2026 04:34:07 +0200 Subject: [PATCH 71/79] css --- htdocs/theme/eldy/global.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 46293f6378e..7b9887cc42a 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5757,7 +5757,7 @@ div.info, div.warning, div.error, div.green, div.neutral, section.neutral { border-radius: 5px; } -div.fiche div.info, div.fiche div.warning, div.fiche div.neutral { +div.fiche div.info, div.fiche div.warning, div.fiche div.neutral, div.fiche div.green { box-shadow: 1px 1px 6px #d4d4d4; margin: 1em 0em 1.2em 0em; } From 85f0da5448c3c1788b7a3ec5f4704811bc8ce452 Mon Sep 17 00:00:00 2001 From: Franck sefu Date: Sat, 9 May 2026 23:05:44 +0200 Subject: [PATCH 72/79] Update llx_20_c_departements.sql and llx_10_c_regions.sql by adding provinces of DRC (#38134) --- .../install/mysql/data/llx_10_c_regions.sql | 5 +++ .../mysql/data/llx_20_c_departements.sql | 32 +++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql index f3de623a7d8..d94911e5287 100644 --- a/htdocs/install/mysql/data/llx_10_c_regions.sql +++ b/htdocs/install/mysql/data/llx_10_c_regions.sql @@ -77,6 +77,7 @@ -- Peru -- Portugal -- Romania -> only for Departments/Counties +-- République démocratique du Congo -> only for Departments/Counties -- San Salvador -- Slovakia -- Slovenia @@ -472,6 +473,10 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 2 INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 25, 15002, 'PT9', NULL, 'Azores-Madeira'); +-- République démocratique du Congo Region (id country=73) +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 73, 7301, '', 0, 'République démocratique du Congo'); + + -- Romania Regions (id country=188) INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 188, 18801, '', 0, 'Romania'); diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index 3e4ebe34089..16c3697a168 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -70,6 +70,7 @@ -- Panama -- Peru -- Portugal +-- République démocratique du Congo -- Romania -- San Salvador -> El Salvador -- Slovenia (need to check code SI-Id) @@ -1177,6 +1178,34 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (15001, 'PT-VR', NULL, NULL, 'VILA REAL', 'Vila Real'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (15001, 'PT-VI', NULL, NULL, 'VISEU', 'Viseu'); +-- République démocratique du Congo Provinces & Territories (id country=73) +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'KN', '', 0, '', 'Kinshasa'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'BC', '', 0, '', 'Kongo Central'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'KG', '', 0, '', 'Kwango'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'KL', '', 0, '', 'Kwilu'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'MN', '', 0, '', 'Mai-Ndombe'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'KS', '', 0, '', 'Kasaï'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'KC', '', 0, '', 'Kasaï-Central'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'KE', '', 0, '', 'Kasaï-Oriental'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'LO', '', 0, '', 'Lomami'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'SA', '', 0, '', 'Sankuru'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'MA', '', 0, '', 'Maniema'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'SK', '', 0, '', 'South Kivu'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'NK', '', 0, '', 'North Kivu'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'IT', '', 0, '', 'Ituri'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'HU', '', 0, '', 'Haut-Uele'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'TO', '', 0, '', 'Tshopo'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'BU', '', 0, '', 'Bas-Uele'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'NU', '', 0, '', 'Nord-Ubangi'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'MO', '', 0, '', 'Mongala'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'SU', '', 0, '', 'Sud-Ubangi'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'EQ', '', 0, '', 'Équateur'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'TU', '', 0, '', 'Tshuapa'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'TA', '', 0, '', 'Tanganyika'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'HL', '', 0, '', 'Haut-Lomami'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'LU', '', 0, '', 'Lualaba'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ( 7301, 'HK', '', 0, '', 'Haut-Katanga'); + -- Romania Provinces (id country=188) INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (18801, 'AB', '', 0, '', 'Alba'); @@ -1829,6 +1858,9 @@ INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('VE-S', 23209, '', 0, 'VE-S', 'Táchira', 1); +-- RDC Communes (id country=61) -- https://fr.wikipedia.org/wiki/Communes_du_Burundi +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (7301, 'KS', '', 0, '', 'Kinshasa'); + -- Burundi Communes (id country=61) -- https://fr.wikipedia.org/wiki/Communes_du_Burundi INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (6101, 'BI0001', '', 0, '', 'Bubanza'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (6101, 'BI0002', '', 0, '', 'Gihanga'); From dbd4f02e75ac0cba932da4e088b812b566f252cc Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 9 May 2026 23:35:40 +0200 Subject: [PATCH 73/79] NEW Intervention - Add drag & drop file (#38138) --- htdocs/fichinter/card.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index c13f57f4ddf..307911801c7 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -12,7 +12,7 @@ * Copyright (C) 2023 Benjamin Grembi * Copyright (C) 2023-2024 William Mead * Copyright (C) 2024-2026 MDW - * Copyright (C) 2024 Alexandre Spangaro + * Copyright (C) 2024-2026 Alexandre Spangaro * Copyright (C) 2025 Pierre Ardoin * * This program is free software; you can redistribute it and/or modify @@ -37,6 +37,13 @@ // Load Dolibarr environment require '../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/fichinter/modules_fichinter.php'; @@ -56,14 +63,6 @@ if (getDolGlobalString('FICHEINTER_ADDON') && is_readable(DOL_DOCUMENT_ROOT."/co require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - // Load translation files required by the page $langs->loadLangs(array('bills', 'companies', 'interventions', 'stocks')); @@ -1245,7 +1244,7 @@ if ($action == 'create') { $head = fichinter_prepare_head($object); - print dol_get_fiche_head($head, 'card', $langs->trans("InterventionCard"), -1, $object->picto); + print dol_get_fiche_head($head, 'card', $langs->trans("InterventionCard"), -1, $object->picto, 0, '', '', 0, '', 1); $formconfirm = ''; From a4cb6450023792d341f11b8806f4589bbae43e1f Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 9 May 2026 23:37:21 +0200 Subject: [PATCH 74/79] QUAL - Intervention - Uniformize title of tab contact (#38137) --- htdocs/core/lib/fichinter.lib.php | 2 +- htdocs/langs/en_US/interventions.lang | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/lib/fichinter.lib.php b/htdocs/core/lib/fichinter.lib.php index 9fb1ea40106..9a017fe4e77 100644 --- a/htdocs/core/lib/fichinter.lib.php +++ b/htdocs/core/lib/fichinter.lib.php @@ -50,7 +50,7 @@ function fichinter_prepare_head($object) if (!getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB')) { $nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external')); $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/fichinter/contact.php', ['id' => $object->id]); - $head[$h][1] = $langs->trans('InterventionContact'); + $head[$h][1] = $langs->trans('ContactsAddresses'); if ($nbContact > 0) { $head[$h][1] .= ''.$nbContact.''; } diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index 2e3e1d1f510..3813f87d8b5 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -10,7 +10,6 @@ ActionsOnFicheInter=Actions on intervention LastInterventions=Latest %s interventions AllInterventions=All interventions CreateDraftIntervention=Create draft -InterventionContact=Intervention contact DeleteIntervention=Delete intervention ValidateIntervention=Validate intervention SignIntervention=Sign intervention From 9b16054fb82ed994bae9e3cf34186038fede26a1 Mon Sep 17 00:00:00 2001 From: daraelmin <8067223+daraelmin@users.noreply.github.com> Date: Sat, 9 May 2026 23:40:04 +0200 Subject: [PATCH 75/79] Fix Phan warning on retained_warranty_fk_cond_reglement and Facture (#38139) * Fix Phan warning on retained_warranty_fk_cond_reglement ans Facture Precommit throw error : htdocs/compta/facture/card.php#L4545 card.php: PhanUndeclaredProperty: Reference to undeclared property \Expedition->retained_warranty_fk_cond_reglement * Add property_exists() check for retained_warranty_fk_cond_reglement to fix Phan warning * Update card.php * Update card.php --------- Co-authored-by: Laurent Destailleur --- htdocs/compta/facture/card.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a4234934cde..8234f55de4d 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -491,6 +491,7 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } } elseif ($action == 'setretainedwarrantyconditions' && $usercancreate) { + /** @var Facture $object */ $object->fetch($id); $object->retained_warranty_fk_cond_reglement = 0; // To clean property $result = $object->setRetainedWarrantyPaymentTerms(GETPOSTINT('retained_warranty_fk_cond_reglement')); @@ -3777,8 +3778,8 @@ if ($action == 'create') { $classname = ucfirst($subelement); $objectsrc = new $classname($db); - '@phan-var-force Commande|Propal|Contrat|Expedition $objectsrc'; - /** @var Commande|Propal|Contrat|Expedition $objectsrc */ + '@phan-var-force Commande|Propal|Contrat|Expedition|Facture $objectsrc'; + /** @var Commande|Propal|Contrat|Expedition|Facture $objectsrc */ $objectsrc->fetch($originid); if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) { $objectsrc->fetch_lines(); @@ -4541,10 +4542,9 @@ if ($action == 'create') { $retained_warranty_fk_cond_reglement = GETPOSTINT('retained_warranty_fk_cond_reglement'); if (empty($retained_warranty_fk_cond_reglement)) { $retained_warranty_fk_cond_reglement = getDolGlobalString('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID'); - if (!empty($objectsrc->retained_warranty_fk_cond_reglement)) { // use previous situation value - $retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement; - } else { - $retained_warranty_fk_cond_reglement = getDolGlobalString('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID'); + if ($objectsrc instanceOf Facture && !empty($objectsrc->retained_warranty_fk_cond_reglement)) { // use previous situation value + // Facture->retained_warranty_fk_cond_reglement (does not exist on Expedition) + $retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement; // @phan-suppress-current-line PhanUndeclaredProperty } } print $form->getSelectConditionsPaiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1); From ef7189dede9bcc415dd0d275771e02ec9a667534 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 10 May 2026 00:15:06 +0200 Subject: [PATCH 76/79] NEW Contract - Add statistics (#38136) * NEW Contract - Add statistics * Some fixes * Add auguria menu * CI * CI * CI * CI --------- Co-authored-by: Laurent Destailleur --- htdocs/contrat/class/contratstats.class.php | 290 +++++++++++++++ htdocs/contrat/stats/index.php | 387 ++++++++++++++++++++ htdocs/core/menus/init_menu_auguria.sql | 1 + htdocs/core/menus/standard/eldy.lib.php | 1 + htdocs/langs/en_US/contracts.lang | 8 +- 5 files changed, 686 insertions(+), 1 deletion(-) create mode 100644 htdocs/contrat/class/contratstats.class.php create mode 100644 htdocs/contrat/stats/index.php diff --git a/htdocs/contrat/class/contratstats.class.php b/htdocs/contrat/class/contratstats.class.php new file mode 100644 index 00000000000..4b570d6678a --- /dev/null +++ b/htdocs/contrat/class/contratstats.class.php @@ -0,0 +1,290 @@ + + * Copyright (c) 2005-2013 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2012 Marcos García + * Copyright (C) 2020 Maxime DEMAREST + * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW + * Copyright (C) 2025 Charlene Benke + * Copyright (C) 2026 Alexandre Spangaro + * + * 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 + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/commande/class/contratstats.class.php + * \ingroup contracts + * \brief File of class to manage contract statistics + */ +include_once DOL_DOCUMENT_ROOT.'/core/class/stats.class.php'; +include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; +include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + + +/** + * Class to manage contract statistics + */ +class ContratStats extends Stats +{ + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element; + + /** + * @var int ID + */ + public $socid; + + /** + * @var int ID + */ + public $userid; + + /** + * @var string To store the FROM part of the main table of the SQL request + */ + public $from; + + /** + * @var string To store the FROM part of the lines table of the SQL request + */ + public $from_line; + + /** + * @var string To store the field + */ + public $field; + + /** + * @var string To store the field of the line table of the SQL request + */ + public $field_line; + + /** + * @var string To store the FROM part of the categorie table of the SQL request + */ + public $categ_link; + + /** + * @var string To store the WHERE part of the main table of the SQL request + */ + public $where = ''; + + /** + * @var string To store the join + */ + public $join; + + + /** + * Constructor + * + * @param DoliDB $db Database handler + * @param int $socid Id third party for filter. This value must be forced during the new to external user company if user is an external user. + * @param string $mode Option ('customer', 'supplier') + * @param int $userid Id user for filter (creation user) + * @param int $typentid Id typent of thirdpary for filter + * @param int $categid Id category of thirdpary for filter + */ + public function __construct($db, $socid, $mode, $userid = 0, $typentid = 0, $categid = 0) + { + global $user, $conf; + + $this->db = $db; + + $this->socid = ($socid > 0 ? $socid : 0); + $this->userid = $userid; + $this->cachefilesuffix = $mode; + $this->join = ''; + + $object = new Contrat($this->db); + $this->from = MAIN_DB_PREFIX.$object->table_element." as c"; + $this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as cd"; + $this->field = 'total_ht'; + $this->field_line = 'total_ht'; + //$this->where .= " c.fk_statut > 0"; // Not draft and not cancelled + $this->categ_link = MAIN_DB_PREFIX.'categorie_societe'; + + //$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity; + $this->where .= ($this->where ? ' AND ' : '').'c.entity IN ('.getEntity('contract').')'; + + if ($this->socid) { + $this->where .= " AND c.fk_soc = ".((int) $this->socid); + } + if ($this->userid > 0) { + $this->where .= ' AND c.fk_user_author = '.((int) $this->userid); + } + + if ($typentid) { + $this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = c.fk_soc'; + $this->where .= ' AND s.fk_typent = '.((int) $typentid); + } + + if ($categid) { + $this->where .= ' AND EXISTS (SELECT rowid FROM '.$this->categ_link.' as cats WHERE cats.fk_soc = c.fk_soc AND cats.fk_categorie = '.((int) $categid).')'; + } + } + + /** + * Return contracts number by month for a year + * + * @param int $year Year to scan + * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month + * @return array,array{0:int<1,12>,1:int}> Array with number by month + */ + public function getNbByMonth($year, $format = 0) + { + global $user; + + $sql = "SELECT date_format(c.date_contrat,'%m') as dm, COUNT(*) as nb"; + $sql .= " FROM ".$this->db->sanitize($this->from, 0, 1, 1); + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); + } + $sql .= $this->join; + $sql .= " WHERE c.date_contrat BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'"; + $sql .= " AND ".$this->where; + $sql .= " GROUP BY dm"; + $sql .= $this->db->order('dm', 'DESC'); + + $res = $this->_getNbByMonth($year, $sql, $format); + return $res; + } + + /** + * Return contracts number per year + * + * @return array Array of nb each year + * + */ + public function getNbByYear() + { + global $user; + + $sql = "SELECT date_format(c.date_contrat,'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->db->sanitize($this->field).")"; + $sql .= " FROM ".$this->db->sanitize($this->from, 0, 1, 1); + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); + } + $sql .= $this->join; + $sql .= " WHERE ".$this->where; + $sql .= " GROUP BY dm"; + $sql .= $this->db->order('dm', 'DESC'); + + return $this->_getNbByYear($sql); + } + + /** + * Return the contracts amount by month for a year + * + * @param int $year Year to scan + * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month + * @return array,array{0:int<1,12>,1:int|float}> Array with amount by month + */ + public function getAmountByMonth($year, $format = 0) + { + global $user; + + $sql = "SELECT date_format(c.date_contrat,'%m') as dm, count(cd.".$this->db->sanitize($this->field).")"; + $sql .= " FROM ".$this->db->sanitize($this->from, 0, 1, 1); + $sql .= " INNER JOIN ".$this->db->sanitize($this->from_line, 0, 1, 1). " ON c.rowid = cd.fk_contrat"; + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); + } + $sql .= $this->join; + $sql .= " WHERE c.date_contrat BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'"; + $sql .= " AND ".$this->where; + $sql .= " GROUP BY dm"; + $sql .= $this->db->order('dm', 'DESC'); + + $res = $this->_getAmountByMonth($year, $sql, $format); + return $res; + } + + /** + * Return the contracts amount average by month for a year + * + * @param int $year year for stats + * @return array,array{0:int<1,12>,1:int|float}> Array with number by month + */ + public function getAverageByMonth($year) + { + global $user; + + $sql = "SELECT date_format(c.date_contrat,'%m') as dm, AVG(c.".$this->db->sanitize($this->field).")"; + $sql .= " FROM ".$this->db->sanitize($this->from, 0, 1, 1); + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); + } + $sql .= $this->join; + $sql .= " WHERE c.date_contrat BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'"; + $sql .= " AND ".$this->where; + $sql .= " GROUP BY dm"; + $sql .= $this->db->order('dm', 'DESC'); + + return $this->_getAverageByMonth($year, $sql); + } + + /** + * Return nb, total and average + * + * @return array Array of values + */ + public function getAllByYear() + { + global $user; + + $sql = "SELECT date_format(c.date_contrat,'%Y') as year, COUNT(*) as nb, SUM(c.".$this->db->sanitize($this->field).") as total, AVG(".$this->db->sanitize($this->field).") as avg"; + $sql .= " FROM ".$this->db->sanitize($this->from, 0, 1, 1); + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); + } + $sql .= $this->join; + $sql .= " WHERE ".$this->where; + $sql .= " GROUP BY year"; + $sql .= $this->db->order('year', 'DESC'); + + return $this->_getAllByYear($sql); + } + + /** + * Return nb, amount of predefined product for year + * + * @param int $year Year to scan + * @param int $limit Limit + * @return array,array{0:int<1,12>,1:int|float}> Array of values + */ + public function getAllByProduct($year, $limit = 10) + { + global $user; + + $sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg"; + $sql .= " FROM ".$this->db->sanitize($this->from, 0, 1, 1); + $sql .= " INNER JOIN ".$this->db->sanitize($this->from_line, 0, 1, 1)." ON c.rowid = tl.fk_commande"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."product as product ON tl.fk_product = product.rowid"; + if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) { + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); + } + $sql .= $this->join; + $sql .= " WHERE ".$this->where; + $sql .= " AND c.date_contrat BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'"; + $sql .= " GROUP BY product.ref"; + $sql .= $this->db->order('nb', 'DESC'); + //$sql.= $this->db->plimit(20); + + return $this->_getAllByProduct($sql, $limit); + } +} diff --git a/htdocs/contrat/stats/index.php b/htdocs/contrat/stats/index.php new file mode 100644 index 00000000000..633815170e0 --- /dev/null +++ b/htdocs/contrat/stats/index.php @@ -0,0 +1,387 @@ + + * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2012 Marcos García + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2020 Maxime DEMAREST + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 Charlene Benke + * Copyright (C) 2026 Alexandre Spangaro + * + * 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 + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/contrat/stats/index.php + * \ingroup contrat + * \brief Page with customers contract statistics + */ + +// Load Dolibarr environment +require '../../main.inc.php'; +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ +require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; +require_once DOL_DOCUMENT_ROOT.'/contrat/class/contratstats.class.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; + +$WIDTH = DolGraph::getDefaultGraphSizeForStats('width'); +$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height'); + +$mode = GETPOSTISSET("mode") ? GETPOST("mode", 'aZ09') : 'customer'; + +$hookmanager->initHooks(array('contratstats', 'globalcard')); + +$usercanreadcustumerstatistic = $user->hasRight('commande', 'lire'); +$usercanreadsupplierstatistic = $user->hasRight('fournisseur', 'commande', 'lire'); +if (getDolGlobalInt('MAIN_NEED_EXPORT_PERMISSION_TO_READ_STATISTICS')) { + $usercanreadcustumerstatistic = $user->hasRight('commande', 'commande', 'export'); + $usercanreadsupplierstatistic = $user->hasRight('fournisseur', 'commande', 'export'); +} +if ($mode == 'customer' && !$usercanreadcustumerstatistic) { + accessforbidden(); +} +if ($mode == 'supplier' && !$usercanreadsupplierstatistic) { + accessforbidden(); +} + +if ($mode == 'supplier') { + $object_status = GETPOST('object_status', 'array:int'); + $object_status = implode(',', $object_status); +} else { + $object_status = GETPOST('object_status', 'intcomma'); +} + + +$typent_id = GETPOSTINT('typent_id'); +$categ_id = GETPOSTINT('categ_id'); + +$userid = GETPOSTINT('userid'); +$socid = GETPOSTINT('socid'); +// Security check +if ($user->socid > 0) { + $action = ''; + $socid = $user->socid; +} + +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + +$nowyear = (int) dol_print_date(dol_now('gmt'), "%Y", 'gmt'); +$year = GETPOSTINT('year') > 0 ? GETPOSTINT('year') : $nowyear; +$startyear = $year - (!getDolGlobalInt('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalInt('MAIN_STATS_GRAPHS_SHOW_N_YEARS')))); +$endyear = $year; + +// Load translation files required by the page +$langs->loadLangs(array('contracts', 'companies', 'other', 'suppliers')); + + +/* + * View + */ + +$form = new Form($db); +$formcompany = new FormCompany($db); +$formother = new FormOther($db); + +$picto = 'contract'; +$title = $langs->trans("ContractsStatistics"); +$dir = $conf->contract->dir_temp; + + + +llxHeader('', $title, '', '', 0, 0, '', '', '', 'mod-contract page-stats'); + +print load_fiche_titre($title, '', $picto); + +dol_mkdir($dir); + +$stats = new ContratStats($db, $socid, $mode, ($userid > 0 ? $userid : 0), ($typent_id > 0 ? $typent_id : 0), ($categ_id > 0 ? $categ_id : 0)); + +if ($object_status != '' && $object_status >= -1) { + $stats->where .= ' AND c.statut IN ('.$db->sanitize($object_status).')'; +} + + + +// Build graphic number of object +$data = $stats->getNbByMonthWithPrevYear($endyear, $startyear); + +//var_dump($data); +// $data = array(array('Lib',val1,val2,val3),...) + + +$fileurlnb = ''; +if (!$user->hasRight('societe', 'client', 'voir')) { + $filenamenb = $dir.'/contractsnbinyear-'.$user->id.'-'.$year.'.png'; + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=contractstats&file=contractsnbinyear-'.$user->id.'-'.$year.'.png'; +} else { + $filenamenb = $dir.'/contractsnbinyear-'.$year.'.png'; + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=contractstats&file=contractsnbinyear-'.$year.'.png'; +} + +$px1 = new DolGraph(); +$mesg = $px1->isGraphKo(); +if (!$mesg) { + $px1->SetData($data); + $i = $startyear; + $legend = array(); + while ($i <= $endyear) { + $legend[] = $i; + $i++; + } + $px1->SetLegend($legend); + $px1->SetMaxValue($px1->GetCeilMaxValue()); + $px1->SetMinValue(min(0, $px1->GetFloorMinValue())); + $px1->SetWidth($WIDTH); + $px1->SetHeight($HEIGHT); + $px1->SetYLabel($langs->trans("NbOfContracts")); + $px1->SetShading(3); + $px1->SetHorizTickIncrement(1); + $px1->mode = 'depth'; + $px1->SetTitle($langs->trans("NumberOfContractsByMonth")); + + $px1->draw($filenamenb, $fileurlnb); +} + +// Build graphic amount of object +$data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear); +//var_dump($data); +// $data = array(array('Lib',val1,val2,val3),...) + +$fileurlamount = ''; +if (!$user->hasRight('societe', 'client', 'voir')) { + $filenameamount = $dir.'/contractsamountinyear-'.$user->id.'-'.$year.'.png'; + $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=contractstats&file=contractsamountinyear-'.$user->id.'-'.$year.'.png'; +} else { + $filenameamount = $dir.'/contractsamountinyear-'.$year.'.png'; + $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=contractstats&file=contractsamountinyear-'.$year.'.png'; +} + +$px2 = new DolGraph(); +$mesg = $px2->isGraphKo(); +if (!$mesg) { + $px2->SetData($data); + $i = $startyear; + $legend = array(); + while ($i <= $endyear) { + $legend[] = $i; + $i++; + } + $px2->SetLegend($legend); + $px2->SetMaxValue($px2->GetCeilMaxValue()); + $px2->SetMinValue(min(0, $px2->GetFloorMinValue())); + $px2->SetWidth($WIDTH); + $px2->SetHeight($HEIGHT); + $px2->SetYLabel($langs->trans("AmountOfServices")); + $px2->SetShading(3); + $px2->SetHorizTickIncrement(1); + $px2->mode = 'depth'; + $px2->SetTitle($langs->trans("AmountOfServicesByMonthHT")); + + $px2->draw($filenameamount, $fileurlamount); +} + + + + + +// Show array +$data = $stats->getAllByYear(); +$arrayyears = array(); +foreach ($data as $val) { + if (!empty($val['year'])) { + $arrayyears[$val['year']] = $val['year']; + } +} +if (!count($arrayyears)) { + $arrayyears[$nowyear] = $nowyear; +} + +$h = 0; +$head = array(); +$head[$h][0] = DOL_URL_ROOT.'/contrat/stats/index.php?mode='.$mode; +$head[$h][1] = $langs->trans("ByMonthYear"); +$head[$h][2] = 'byyear'; +$h++; + +$type = 'contract_stats'; + + +complete_head_from_modules($conf, $langs, null, $head, $h, $type); + +print dol_get_fiche_head($head, 'byyear', '', -1); + + +print '
'; + + +// Show filter box +print ''; +print ''; +print ''; + +print ''; +print ''; +// Company +print ''; +// ThirdParty Type +print ''; +// Category +$cat_type = 0; +$cat_label = ''; +if ($mode == 'customer') { + $cat_type = Categorie::TYPE_CUSTOMER; + $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Customer")); +} +if ($mode == 'supplier') { + $cat_type = Categorie::TYPE_SUPPLIER; + $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Supplier")); +} +print ''; +// User +print ''; +// Year +print ''; +print ''; +print '
'.$langs->trans("Filter").'
'.$langs->trans("ThirdParty").''; +$filter = ''; +if ($mode == 'customer') { + $filter = '(s.client:IN:1,2,3)'; +} +if ($mode == 'supplier') { + $filter = '(s.fournisseur:=:1)'; +} +print img_picto('', 'company', 'class="pictofixedwidth"'); +print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, 'widthcentpercentminusx maxwidth300'); +print '
'.$langs->trans("ThirdPartyType").''; +$sortparam_typent = (!getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. +print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam_typent, '', 1); +if ($user->admin) { + print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); +} +print '
'.$cat_label.''; +print img_picto('', 'category', 'class="pictofixedwidth"'); +print $formother->select_categories($cat_type, $categ_id, 'categ_id', 0, 1, 'widthcentpercentminusx maxwidth300'); +print '
'.$langs->trans("CreatedBy").''; +print img_picto('', 'user', 'class="pictofixedwidth"'); +print $form->select_dolusers($userid, 'userid', 1, null, 0, '', '', '0', 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300'); +// Status +print '
'.$langs->trans("Status").''; + +$liststatus = array( + Contrat::STATUS_DRAFT => $langs->trans("ContractStatusDraft"), + Contrat::STATUS_VALIDATED => $langs->trans("ContractStatusValidated"), + Contrat::STATUS_CLOSED => $langs->trans("ContractStatusClosed"), +); +print $form->selectarray('object_status', $liststatus, GETPOST('object_status', 'intcomma'), -4); + + +print '
'.$langs->trans("Year").''; +if (!in_array($year, $arrayyears)) { + $arrayyears[$year] = $year; +} +if (!in_array($nowyear, $arrayyears)) { + $arrayyears[$nowyear] = $nowyear; +} +arsort($arrayyears); +print img_picto('', 'calendar', 'class="pictofixedwidth"'); +print $form->selectarray('year', $arrayyears, $year, 0, 0, 0, '', 0, 0, 0, '', 'width75'); +print '
'; +print ''; +print '

'; + + +print '
'; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +$oldyear = 0; +foreach ($data as $val) { + $year = $val['year']; + while (!empty($year) && $oldyear > (int) $year + 1) { // If we have empty year + $oldyear--; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + $oldyear = $year; +} + +print '
'.$langs->trans("Year").''.$langs->trans("NbOfContracts").'%'.$langs->trans("AmountTotal").'%'.$langs->trans("AmountAverage").'%
0 ? '&userid='.$userid : '').'">'.$oldyear.'000
0 ? '&userid='.$userid : '').'">'.$year.''.$val['nb'].''.(isset($val['nb_diff']) ? round($val['nb_diff']) : "0").'%'.price(price2num($val['total'], 'MT'), 1).''.(isset($val['total_diff']) ? round($val['total_diff']) : "0").'%'.price(price2num($val['avg'], 'MT'), 1).''.(isset($val['avg_diff']) ? round($val['avg_diff']) : "0").'%
'; +print '
'; + + +print '
'; + + +// Show graphs +print '
'; +if ($mesg) { + print $mesg; +} else { + print $px1->show(); + print "
\n"; + print $px2->show(); +} +print '
'; + + +print '
'; +print '
'; + +print dol_get_fiche_end(); + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 529e081e4ae..75bd7d841d7 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -200,6 +200,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("contract") && $leftmenu=="contracts"', __HANDLER__, 'left', 1405__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&search_status=4', 'MenuRunningServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("contract") && $leftmenu=="contracts"', __HANDLER__, 'left', 1406__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&search_status=4%26filter=expired', 'MenuExpiredServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("contract") && $leftmenu=="contracts"', __HANDLER__, 'left', 1407__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&search_status=5', 'MenuClosedServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("contract")', __HANDLER__, 'left', 1409__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/stats/index.php?mainmenu=commercial&leftmenu=contracts', 'Statistics', 1, 'contracts', '(getDolGlobalString("MAIN_NEED_EXPORT_PERMISSION_TO_READ_STATISTICS") ? $user->hasRight("contrat", "export") : $user->hasRight("contrat", "lire"))', '', 2, 4, __ENTITY__); -- Commercial - Interventions insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("intervention")', __HANDLER__, 'left', 1500__+MAX_llx_menu__, 'commercial', 'ficheinter', 5__+MAX_llx_menu__, '/fichinter/list.php?mainmenu=commercial&leftmenu=ficheinter', 'Interventions', 0, 'interventions', '$user->rights->ficheinter->lire', '', 2, 8, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 8c12564b2e9..8c429beb101 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1509,6 +1509,7 @@ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $left $newmenu->add("/contrat/services_list.php?leftmenu=contracts&search_status=4%26filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->hasRight('contrat', 'lire')); $newmenu->add("/contrat/services_list.php?leftmenu=contracts&search_status=5", $langs->trans("MenuClosedServices"), 2, $user->hasRight('contrat', 'lire')); } + $newmenu->add("/contrat/stats/index.php", $langs->trans("Statistics"), 1, $user->hasRight('contrat', 'lire')); } // Interventions diff --git a/htdocs/langs/en_US/contracts.lang b/htdocs/langs/en_US/contracts.lang index bbf25bb2f0c..aeefc77dc60 100644 --- a/htdocs/langs/en_US/contracts.lang +++ b/htdocs/langs/en_US/contracts.lang @@ -103,7 +103,13 @@ ConfirmCloneContract=Are you sure you want to clone the contract %s? LowerDateEndPlannedShort=Lower planned end date of active services SendContractRef=Contract information __REF__ OtherContracts=Other contracts -##### Types de contacts ##### +##### Statistics ##### +ContractsStatistics=Contract's statistics +NbOfContracts=Nb of contracts +NumberOfContractsByMonth=Number of contracts by month +AmountOfServices=Number of services +AmountOfServicesByMonthHT=Number of services (excl. tax) by month +##### Types of contacts ##### TypeContact_contrat_internal_SALESREPSIGN=Sales representative signing contract TypeContact_contrat_internal_SALESREPFOLL=Sales representative following-up contract TypeContact_contrat_external_BILLING=Billing customer contact From bfd620b73e88777280376bc1c8bf0dada04d74f3 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 10 May 2026 00:26:46 +0200 Subject: [PATCH 77/79] Qual: Fix Phan notices (#38069) * Qual: Fix Phan notices # Qual: Fix Phan notices Fix notices related to PhanUndeclaredProperty * Qual: Update Phan baseline * Qual: Fix Phan notice that occurred after merge --- dev/tools/phan/baseline.txt | 6 +- htdocs/core/actions_sendmails.inc.php | 6 +- htdocs/projet/tasks/time.php | 9 ++- .../tasks/tpl/linkedobjectblock.tpl.php | 4 +- .../class/html.formlistwebportal.class.php | 55 +++++++++++-------- 5 files changed, 49 insertions(+), 31 deletions(-) diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index c0b4c86a907..01f2013ba02 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -9,8 +9,8 @@ */ return [ // # Issue statistics: - // PhanUndeclaredProperty : 390+ occurrences - // PhanUndeclaredGlobalVariable : 50+ occurrences + // PhanUndeclaredProperty : 380+ occurrences + // PhanUndeclaredGlobalVariable : 45+ occurrences // PhanTypeMismatchArgument : 35+ occurrences // PhanTypeMismatchProperty : 20+ occurrences // PhanTypeInvalidDimOffset : 10+ occurrences @@ -38,7 +38,6 @@ return [ 'htdocs/commande/list.php' => ['PhanUndeclaredProperty'], 'htdocs/commande/list_det.php' => ['PhanTypeInvalidDimOffset'], 'htdocs/compta/bank/class/account.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/compta/bank/line.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/compta/bank/various_payment/card.php' => ['PhanUndeclaredProperty'], 'htdocs/compta/bank/various_payment/document.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/compta/facture/class/facture-rec.class.php' => ['PhanUndeclaredProperty'], @@ -220,7 +219,6 @@ return [ 'htdocs/variants/tpl/productattributevalueline_view.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/webhook/class/target.class.php' => ['PhanUndeclaredMethod'], 'htdocs/webhook/target_card.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/webportal/class/html.formlistwebportal.class.php' => ['PhanUndeclaredProperty'], 'htdocs/webservices/server_project.php' => ['PhanUndeclaredProperty'], ], // 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed. diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index af892b9d58e..58ecf64bfa3 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2013 Juanjo Menent * @@ -155,11 +155,13 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO $sendtosocid = $thirdparty->id; } } elseif ($object->element == 'member' || $object->element == 'user') { + '@phan-var-force Adherent|User $object'; $thirdparty = $object; if ($object->socid > 0) { $sendtosocid = $object->socid; } } elseif ($object->element == 'expensereport') { + '@phan-var-force ExpenseReport $object'; $tmpuser = new User($db); $tmpuser->fetch($object->fk_user_author); $thirdparty = $tmpuser; @@ -167,11 +169,13 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO $sendtosocid = $object->socid; } } elseif ($object->element == 'societe') { + '@phan-var-force Societe $object'; $thirdparty = $object; if (is_object($thirdparty) && $thirdparty->id > 0) { $sendtosocid = $thirdparty->id; } } elseif ($object->element == 'contact') { + '@phan-var-force Contact $object'; $contact = $object; if ($contact->id > 0) { $contact->fetch_thirdparty(); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 206f66a1167..59e7904b4a8 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -7,7 +7,7 @@ * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2019-2021 Christophe Battarel * Copyright (C) 2023 Gauthier VERDOL - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2024 Vincent de Grandpré * Copyright (C) 2024 Solution Libre SAS * Copyright (C) 2026 Joachim Kueter @@ -504,6 +504,11 @@ if ($action == 'confirm_generateinvoice' && $user->hasRight('facture', 'creer')) foreach ($toselect as $key => $value) { // Get userid, timepent $object->fetchTimeSpent($value); // $value is ID of 1 line in timespent table + if (!array_key_exists($object->timespent_fk_user, $arrayoftasks)) { + $arrayoftasks[$object->timespent_fk_user] = [ + (int) $object->timespent_fk_product => ['timespent' => 0, 'totalvaluetodivideby3600' => 0] + ]; + } $arrayoftasks[$object->timespent_fk_user][(int) $object->timespent_fk_product]['timespent'] += $object->timespent_duration; $arrayoftasks[$object->timespent_fk_user][(int) $object->timespent_fk_product]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm); } @@ -2463,7 +2468,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print ''; if ($action == 'editline' && GETPOSTINT('lineid') == $task_time->rowid) { print img_picto('', 'service'); - print $form->select_produits($task_time->fk_product, 'fk_product', 1, 0, $projectstatic->thirdparty->price_level, 1, 2, '', 1, array(), $projectstatic->thirdparty->id, 'None', 0, 'maxwidth500', ($user->hasRight('produit', 'lire') ? 0 : 1), '', null, 1); + print $form->select_produits($task_time->fk_product, 'fk_product', 1, 0, $projectstatic->thirdparty->price_level, 1, 2, '', 1, array(), $projectstatic->thirdparty->id, 'None', 0, 'maxwidth500', ($user->hasRight('produit', 'lire') ? 0 : 1), '', null, 1); } elseif (!empty($task_time->fk_product)) { $product = new Product($db); $resultFetch = $product->fetch($task_time->fk_product); diff --git a/htdocs/projet/tasks/tpl/linkedobjectblock.tpl.php b/htdocs/projet/tasks/tpl/linkedobjectblock.tpl.php index 1c28eccda55..067abf6a5f7 100644 --- a/htdocs/projet/tasks/tpl/linkedobjectblock.tpl.php +++ b/htdocs/projet/tasks/tpl/linkedobjectblock.tpl.php @@ -3,7 +3,7 @@ * Copyright (C) 2014 Marcos García * Copyright (C) 2019 Laurent Destailleur * Copyright (C) 2024 Charlene Benke - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2025 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -41,6 +41,7 @@ $langs = $GLOBALS['langs']; * @var CommonObject $object */ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; +// Note - at this time there does not seem to be a list of linked objects '@phan-var-force CommonObject[] $linkedObjectBlock'; /** @var Task[] $linkedObjectBlock */ @@ -48,7 +49,6 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("tasks"); $linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date,ref', 'desc', 0, 0, 1); -'@phan-var-force CommonObject[] $linkedObjectBlock'; // Repeat because type lost after dol_sort_array) /** @var Task[] $linkedObjectBlock */ $total = 0; diff --git a/htdocs/webportal/class/html.formlistwebportal.class.php b/htdocs/webportal/class/html.formlistwebportal.class.php index b996d79185c..b642525092d 100644 --- a/htdocs/webportal/class/html.formlistwebportal.class.php +++ b/htdocs/webportal/class/html.formlistwebportal.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2023-2024 Lionel Vessiller * Copyright (C) 2023-2024 Patrice Andreani * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2026 MDW * Copyright (C) 2026 Charlene Benke * * This program is free software; you can redistribute it and/or modify @@ -580,16 +580,22 @@ class FormListWebPortal if (!empty($field_spec['arrayofkeyval']) && is_array($field_spec['arrayofkeyval'])) { $out = $this->form->selectarray('search_' . $field_key, $field_spec['arrayofkeyval'], (isset($this->search[$field_key]) ? $this->search[$field_key] : ''), $field_spec['notnull'], 0, 0, '', 1, 0, 0, '', ''); } elseif (preg_match('/^(date|timestamp|datetime)/', $field_spec['type'])) { - $postDateStart = dol_mktime(0, 0, 0, - (int) isset($this->search[$field_key . '_dtstartmonth']) ? $this->search[$field_key . '_dtstartmonth'] : 0, - (int) isset($this->search[$field_key . '_dtstartday']) ? $this->search[$field_key . '_dtstartday'] : 0, - (int) isset($this->search[$field_key . '_dtstartyear']) ? $this->search[$field_key . '_dtstartyear'] : 0 - ); - $postDateEnd = dol_mktime(0, 0, 0, - (int) isset($this->search[$field_key . '_dtendmonth']) ? $this->search[$field_key . '_dtendmonth'] : 0, - (int) isset($this->search[$field_key . '_dtendday']) ? $this->search[$field_key . '_dtendday'] : 0, - (int) isset($this->search[$field_key . '_dtendyear']) ? $this->search[$field_key . '_dtendyear'] : 0 - ); + $postDateStart = dol_mktime( + 0, + 0, + 0, + (int) isset($this->search[$field_key . '_dtstartmonth']) ? $this->search[$field_key . '_dtstartmonth'] : 0, + (int) isset($this->search[$field_key . '_dtstartday']) ? $this->search[$field_key . '_dtstartday'] : 0, + (int) isset($this->search[$field_key . '_dtstartyear']) ? $this->search[$field_key . '_dtstartyear'] : 0 + ); + $postDateEnd = dol_mktime( + 0, + 0, + 0, + (int) isset($this->search[$field_key . '_dtendmonth']) ? $this->search[$field_key . '_dtendmonth'] : 0, + (int) isset($this->search[$field_key . '_dtendday']) ? $this->search[$field_key . '_dtendday'] : 0, + (int) isset($this->search[$field_key . '_dtendyear']) ? $this->search[$field_key . '_dtendyear'] : 0 + ); $out = '
'; $out .= $this->form->inputDate('search_' . $field_key . '_dtstart', $postDateStart ? $postDateStart : '', $langs->trans('From')); @@ -617,10 +623,13 @@ class FormListWebPortal // specific to get invoice status (depends on payment) if ($this->element == 'invoice') { + $invoice = $this->object; // Copy to help static analysis + /** @var Facture $invoice */ + '@phan-var-force Facture $invoice'; $discount = new DiscountAbsolute($this->db); // Store company - $idCompany = (int) $this->object->socid; + $idCompany = (int) $invoice->socid; if (!isset($this->companyStaticList[$idCompany])) { $companyStatic = new Societe($this->db); $companyStatic->fetch($idCompany); @@ -629,19 +638,18 @@ class FormListWebPortal $companyStatic = $this->companyStaticList[$idCompany]; // paid sum - $payment = $this->object->getSommePaiement(); - $totalcreditnotes = $this->object->getSumCreditNotesUsed(); - $totaldeposits = $this->object->getSumDepositsUsed(); + $payment = $invoice->getSommePaiement(); + $totalcreditnotes = $invoice->getSumCreditNotesUsed(); + $totaldeposits = $invoice->getSumDepositsUsed(); // remain to pay $totalpay = $payment + $totalcreditnotes + $totaldeposits; - $remaintopay = price2num($this->object->total_ttc - $totalpay); - if ($this->object->status == Facture::STATUS_CLOSED && $this->object->close_code == 'discount_vat') { // If invoice closed with discount for anticipated payment + $remaintopay = price2num($invoice->total_ttc - $totalpay); + if ($invoice->status == Facture::STATUS_CLOSED && $invoice->close_code == 'discount_vat') { // If invoice closed with discount for anticipated payment $remaintopay = 0; } - if ($this->object->type == Facture::TYPE_CREDIT_NOTE && $this->object->paye == 1) { - // @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal - $remaincreditnote = $discount->getAvailableDiscounts($companyStatic, '', 'rc.fk_facture_source=' . $this->object->id); + if ($invoice->type == Facture::TYPE_CREDIT_NOTE && $invoice->paye == 1) { + $remaincreditnote = $discount->getAvailableDiscounts($companyStatic, null, 'rc.fk_facture_source=' . $invoice->id); $remaintopay = -$remaincreditnote; } @@ -688,8 +696,11 @@ class FormListWebPortal $filedir = $conf->{$element}->multidir_output[$this->object->entity] . '/' . dol_sanitizeFileName($this->object->ref); $out = $this->form->getDocumentsLink($element, $filename, $filedir); } elseif ($field_key == 'signature_link') { - if ($this->object->fk_statut == Propal::STATUS_VALIDATED) { - $out = $this->form->getSignatureLink('proposal', $this->object); + $webobject = $this->object; // Intermediate var to help with typing. + /** @var WebPortalPropal|WebPortalOrder|WebPortalInvoice $webobject */ + '@phan-var-force WebPortalPropal|WebPortalOrder|WebPortalInvoice $webobject'; + if ($webobject->fk_statut == Propal::STATUS_VALIDATED) { + $out = $this->form->getSignatureLink('proposal', $webobject); } } else { $out = $this->form->showOutputFieldForObject($this->object, $field_spec, $field_key, $this->object->$field_key, ''); From c627626805494b375b370bc8e868ee1d48bbd44c Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 10 May 2026 00:50:19 +0200 Subject: [PATCH 78/79] QUAL - Replace user permission checks with $permissionto(xxx) (#38135) Co-authored-by: Laurent Destailleur --- htdocs/fichinter/card.php | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 307911801c7..bd45e1d6e8a 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -12,7 +12,7 @@ * Copyright (C) 2023 Benjamin Grembi * Copyright (C) 2023-2024 William Mead * Copyright (C) 2024-2026 MDW - * Copyright (C) 2024-2026 Alexandre Spangaro + * Copyright (C) 2024-2026 Alexandre Spangaro * Copyright (C) 2025 Pierre Ardoin * * This program is free software; you can redistribute it and/or modify @@ -44,6 +44,7 @@ require '../main.inc.php'; * @var Translate $langs * @var User $user */ + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/fichinter/modules_fichinter.php'; @@ -577,7 +578,7 @@ if (empty($reshook)) { if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - } elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('ficheinter', 'supprimer')) { + } elseif ($action == 'confirm_delete' && $confirm == 'yes' && $permissiontodelete) { $result = $object->delete($user); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -866,7 +867,6 @@ if (empty($reshook)) { // Actions to build doc $upload_dir = $conf->ficheinter->dir_output; - $permissiontoadd = $user->hasRight('ficheinter', 'creer'); include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; if ($action == 'update_extras' && $permissiontoeditextra) { @@ -1399,8 +1399,8 @@ if ($action == 'create') { $morehtmlref = '
'; // Ref customer - $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->hasRight('ficheinter', 'creer'), 'string', '', 0, 1); - $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->hasRight('ficheinter', 'creer'), 'string', '', null, null, '', 1); + $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $permissiontoadd, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $permissiontoadd, 'string', '', null, null, '', 1); // Thirdparty $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); // Project @@ -1460,9 +1460,9 @@ if ($action == 'create') { // Description (must be a textarea and not html must be allowed (used in list view) print ''; - print $form->editfieldkey("Description", 'description', $object->description, $object, $user->hasRight('ficheinter', 'creer'), 'textarea'); + print $form->editfieldkey("Description", 'description', $object->description, $object, $permissiontoadd, 'textarea'); print ''; - print $form->editfieldval("Description", 'description', $object->description, $object, $user->hasRight('ficheinter', 'creer'), 'textarea:8'); + print $form->editfieldval("Description", 'description', $object->description, $object, $permissiontoadd, 'textarea:8'); print ''; print ''; @@ -1643,7 +1643,7 @@ if ($action == 'create') { print "\n"; } // Icon to edit and delete - if ($object->status == 0 && $user->hasRight('ficheinter', 'creer')) { + if ($object->status == 0 && $permissiontoadd) { print ''; print 'rowid.'#'.$objp->rowid.'">'; print img_edit(); @@ -1673,7 +1673,7 @@ if ($action == 'create') { } // Line in update mode - if ($object->status == 0 && $action == 'editline' && $user->hasRight('ficheinter', 'creer') && GETPOSTINT('line_id') == $objp->rowid) { + if ($object->status == 0 && $action == 'editline' && $permissiontoadd && GETPOSTINT('line_id') == $objp->rowid) { print ''; // No. @@ -1736,7 +1736,7 @@ if ($action == 'create') { $db->free($resql); // Add new line - if ($object->status == 0 && $user->hasRight('ficheinter', 'creer') && $action != 'editline' && (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '2')) { + if ($object->status == 0 && $permissiontoadd && $action != 'editline' && (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '2')) { if (!$num) { print '
'; print ''; @@ -1861,7 +1861,7 @@ if ($action == 'create') { $url_button[] = array( 'lang' => 'subtotals', 'enabled' => (isModEnabled('intervention') && $object->status == Fichinter::STATUS_DRAFT), - 'perm' => (bool) $user->hasRight('intervention', 'creer'), + 'perm' => (bool) $permissiontoadd, 'label' => $langs->trans('AddTitleLine'), 'url' => '/fichinter/card.php?id='.$object->id.'&action=add_title_line&token='.newToken() ); @@ -1869,7 +1869,7 @@ if ($action == 'create') { $url_button[] = array( 'lang' => 'subtotals', 'enabled' => (isModEnabled('intervention') && $object->status == Fichinter::STATUS_DRAFT), - 'perm' => (bool) $user->hasRight('intervention', 'creer'), + 'perm' => (bool) $permissiontoadd, 'label' => $langs->trans('AddSubtotalLine'), 'url' => '/fichinter/card.php?id='.$object->id.'&action=add_subtotal_line&token='.newToken() ); @@ -1878,7 +1878,7 @@ if ($action == 'create') { // Validate if ($object->status == Fichinter::STATUS_DRAFT && (count($object->lines) > 0 || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '1')) { - if ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('ficheinter', 'creer')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('ficheinter', 'ficheinter_advance', 'validate'))) { + if ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $permissiontoadd) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('ficheinter', 'ficheinter_advance', 'validate'))) { print ''; } else { print '
'.$langs->trans("Validate").'
'; @@ -1886,7 +1886,7 @@ if ($action == 'create') { } // Modify - if ($object->status == Fichinter::STATUS_VALIDATED && ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('ficheinter', 'creer')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('ficheinter', 'ficheinter_advance', 'unvalidate')))) { + if ($object->status == Fichinter::STATUS_VALIDATED && ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $permissiontoadd) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('ficheinter', 'ficheinter_advance', 'unvalidate')))) { print '
'; if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') || getDolGlobalString('FICHINTER_DISABLE_DETAILS') == '2') { print $langs->trans("Modify"); @@ -1898,7 +1898,7 @@ if ($action == 'create') { // Reopen if ($object->status >= Fichinter::STATUS_CLOSED) { - if ($user->hasRight('ficheinter', 'creer')) { + if ($permissiontoadd) { print ''; } else { print ''; @@ -1917,7 +1917,7 @@ if ($action == 'create') { } // Create intervention model - if ($object->status == Fichinter::STATUS_DRAFT && $user->hasRight('ficheinter', 'creer') && (count($object->lines) > 0)) { + if ($object->status == Fichinter::STATUS_DRAFT && $permissiontoadd && (count($object->lines) > 0)) { print ''; @@ -1979,7 +1979,7 @@ if ($action == 'create') { } // Clone - if ($user->hasRight('ficheinter', 'creer')) { + if ($permissiontoadd) { print ''; } @@ -2003,7 +2003,7 @@ if ($action == 'create') { $filedir = $conf->ficheinter->dir_output."/".$filename; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed = $user->hasRight('ficheinter', 'lire'); - $delallowed = $user->hasRight('ficheinter', 'creer'); + $delallowed = $permissiontoadd; print $formfile->showdocuments('ficheinter', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); // Show links to link elements From ef4f323df550602758864846a7ca281581511002 Mon Sep 17 00:00:00 2001 From: daraelmin <8067223+daraelmin@users.noreply.github.com> Date: Sun, 10 May 2026 00:57:16 +0200 Subject: [PATCH 79/79] NEW: Add personal_data flag in extrafields admin UI - next step of #8612 (#38133) * Add personal_data flag on extrafields for GDPR/privacy compliance * Add migration script to add personal_data column on llx_extrafields * Update 23.0.0-24.0.0.sql * Update llx_extrafields.sql * Add checkbox personal_data * Getpost personal_data action * Revert "Getpost personal_data action" This reverts commit 43b38aaa8011d124341890ff2390df8cee9e8968. * GETPOSTINT personal_data * Edit personal_data * Add personal_data flag in extrafields admin UI * langs * Trailing space * Missing $showintooltip in update --------- Co-authored-by: Laurent Destailleur --- htdocs/core/actions_extrafields.inc.php | 6 ++- htdocs/core/class/extrafields.class.php | 54 ++++++++++++------- htdocs/core/tpl/admin_extrafields_add.tpl.php | 2 + .../core/tpl/admin_extrafields_edit.tpl.php | 6 ++- .../core/tpl/admin_extrafields_view.tpl.php | 5 +- htdocs/langs/en_US/admin.lang | 2 + htdocs/langs/fr_FR/admin.lang | 2 + 7 files changed, 55 insertions(+), 22 deletions(-) diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index ec6552157b9..65b2ac4c432 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -247,7 +247,8 @@ if ($action == 'add') { array('css' => $css, 'cssview' => $cssview, 'csslist' => $csslist), GETPOST("ai_prompt"), (GETPOST('emptyonclone', 'alpha') ? 1 : 0), - (GETPOST('showintooltip', 'int') ? 1 : 0) + (GETPOST('showintooltip', 'int') ? 1 : 0), + GETPOSTINT('personal_data') ); if ($result > 0) { setEventMessages($langs->trans('SetupSaved'), null, 'mesgs'); @@ -434,7 +435,8 @@ if ($action == 'update') { array('css' => $css, 'cssview' => $cssview, 'csslist' => $csslist), GETPOST("ai_prompt"), (GETPOST('emptyonclone', 'alpha') ? 1 : 0), - (GETPOST('showintooltip', 'int') ? 1 : 0) + (GETPOST('showintooltip', 'int') ? 1 : 0), + GETPOSTINT('personal_data') ); if ($result > 0) { setEventMessages($langs->trans('SetupSaved'), null, 'mesgs'); diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 068302453d3..67d9a3f4591 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -47,7 +47,7 @@ class ExtraFields public $db; /** - * @var array,type:array,size:array,default:array,computed:array,unique:array,required:array,param:array,perms:array,list:array,pos:array,totalizable:array,help:array,printable:array,enabled:array,langfile:array,css:array,csslist:array,cssview:array,hidden:array,mandatoryfieldsofotherentities:array,alwayseditable:array>,emptyonclone:array>,loaded?:int,count:int,aiprompt:array}> New array to store extrafields definition Note: count set as present to avoid static analysis notices + * @var array,type:array,size:array,default:array,computed:array,unique:array,required:array,param:array,perms:array,list:array,pos:array,totalizable:array,help:array,printable:array,enabled:array,langfile:array,css:array,csslist:array,cssview:array,hidden:array,mandatoryfieldsofotherentities:array,alwayseditable:array>,personal_data:array>,emptyonclone:array>,loaded?:int,count:int,aiprompt:array}> New array to store extrafields definition Note: count set as present to avoid static analysis notices */ public $attributes = array(); @@ -164,9 +164,11 @@ class ExtraFields * @param string $aiprompt Ai prompt value * @param int<0,1> $emptyonclone Is attribute to be emptied after object clone * @param int<0,1> $showintooltip Is attribute to be show on tooltip + * @param int<0,1> $personal_data Is attribute a personal data (RGPD,nLPD/LGPD) + * * @return int Return integer <=0 if KO, >0 if OK */ - public function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array(), $aiprompt = "", $emptyonclone = 0, $showintooltip = 0) + public function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array(), $aiprompt = "", $emptyonclone = 0, $showintooltip = 0, $personal_data = 0) { if (empty($attrname)) { return -1; @@ -202,7 +204,7 @@ class ExtraFields $err1 = $this->errno; if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate') { // Add declaration of field into table - $result2 = $this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams, $aiprompt, $emptyonclone, $showintooltip); + $result2 = $this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams, $aiprompt, $emptyonclone, $showintooltip, $personal_data); $err2 = $this->errno; if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS') @@ -243,9 +245,11 @@ class ExtraFields * @param int<0,1> $printable Is extrafield displayed on PDF * @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>Css on list, 'cssview'=>...) * @param int<0,1> $emptyonclone Is attribute to be emptied after object clone + * @param int<0,1> $showintooltip Show in tooltip + * @param int<0,1> $personal_data Is attribute a personal data (RGPD,nLPD/LGPD) * @return int Return integer <=0 if KO, >0 if OK */ - public function updateExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array(), $emptyonclone = 0) + public function updateExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array(), $emptyonclone = 0, $showintooltip = 0, $personal_data = 0) { if (empty($attrname)) { return -1; @@ -271,13 +275,13 @@ class ExtraFields // Create field into database except for separator type which is not stored in database if ($type != 'separate') { dol_syslog(get_class($this).'::thisupdate', LOG_DEBUG); - $result = $this->update($attrname, $label, $type, $size, $elementtype, $unique, $required, $pos, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams, '', $emptyonclone); + $result = $this->update($attrname, $label, $type, $size, $elementtype, $unique, $required, $pos, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams, '', $emptyonclone, $showintooltip, $personal_data); } $err1 = $this->errno; if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate') { // Add declaration of field into table dol_syslog(get_class($this).'::thislabel', LOG_DEBUG); - $result2 = $this->update_label($attrname, $label, $type, $size, $elementtype, $unique, $required, $pos, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams, '', $emptyonclone); + $result2 = $this->update_label($attrname, $label, $type, $size, $elementtype, $unique, $required, $pos, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams, '', $emptyonclone, $showintooltip, $personal_data); $err2 = $this->errno; if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS')) { $this->error = ''; @@ -432,10 +436,11 @@ class ExtraFields * @param string $aiprompt Ai prompt value * @param int<0,1> $emptyonclone Is attribute to be emptied after object clone * @param int<0,1> $showintooltip Is attribute to be show on tooltip + * @param int<0,1> $personal_data Is attribute a personal data (RGPD,nLPD/LGPD) * @return int Return integer <=0 if KO, >0 if OK * @throws Exception */ - private function create_label($attrname, $label = '', $type = '', $pos = 0, $size = '', $elementtype = '', $unique = 0, $required = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array(), $aiprompt = "", $emptyonclone = 0, $showintooltip = 0) + private function create_label($attrname, $label = '', $type = '', $pos = 0, $size = '', $elementtype = '', $unique = 0, $required = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array(), $aiprompt = "", $emptyonclone = 0, $showintooltip = 0, $personal_data = 0) { // phpcs:enable global $conf, $user; @@ -466,6 +471,9 @@ class ExtraFields if (empty($alwayseditable)) { $alwayseditable = 0; } + if (empty($personal_data)) { + $personal_data = 0; + } if (empty($emptyonclone)) { $emptyonclone = 0; } @@ -526,7 +534,8 @@ class ExtraFields $sql .= " cssview,"; $sql .= " aiprompt,"; $sql .= " emptyonclone,"; - $sql .= " showintooltip"; + $sql .= " showintooltip,"; + $sql .= " personal_data"; $sql .= " )"; $sql .= " VALUES('".$this->db->escape($attrname)."',"; $sql .= " '".$this->db->escape($label)."',"; @@ -556,7 +565,8 @@ class ExtraFields $sql .= " ".($cssview ? "'".$this->db->escape($cssview)."'" : "null").","; $sql .= " '".$this->db->escape($aiprompt)."',"; $sql .= " ".((int) $emptyonclone).' ,'; - $sql .= " ".((int) $showintooltip); + $sql .= " ".((int) $showintooltip).' ,'; + $sql .= " ".((int) $personal_data); $sql .= ')'; if ($this->db->query($sql)) { @@ -704,10 +714,11 @@ class ExtraFields * @param string $aiprompt Ai prompt value * @param int<0,1> $emptyonclone Is attribute to be emptied after object clone * @param int<0,1> $showintooltip Is attribute to be show on tooltip + * @param int<0,1> $personal_data Is attribute a personal data (RGPD,nLPD/LGPD) * @return int >0 if OK, <=0 if KO * @throws Exception */ - public function update($attrname, $label, $type, $length, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = array(), $alwayseditable = 0, $perms = '', $list = '', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array(), $aiprompt = "", $emptyonclone = 0, $showintooltip = 0) + public function update($attrname, $label, $type, $length, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = array(), $alwayseditable = 0, $perms = '', $list = '', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array(), $aiprompt = "", $emptyonclone = 0, $showintooltip = 0, $personal_data = 0) { global $action, $hookmanager; @@ -789,7 +800,7 @@ class ExtraFields if (is_object($hookmanager)) { $hookmanager->initHooks(array('extrafieldsdao')); - $parameters = array('field_desc' => &$field_desc, 'table' => $table, 'attr_name' => $attrname, 'label' => $label, 'type' => $type, 'length' => $length, 'unique' => $unique, 'required' => $required, 'pos' => $pos, 'param' => $param, 'alwayseditable' => $alwayseditable, 'emptyonclone' => $emptyonclone, 'perms' => $perms, 'list' => $list, 'help' => $help, 'default' => $default, 'computed' => $computed, 'entity' => $entity, 'langfile' => $langfile, 'enabled' => $enabled, 'totalizable' => $totalizable, 'printable' => $printable, 'showintooltip' => $showintooltip); + $parameters = array('field_desc' => &$field_desc, 'table' => $table, 'attr_name' => $attrname, 'label' => $label, 'type' => $type, 'length' => $length, 'unique' => $unique, 'required' => $required, 'pos' => $pos, 'param' => $param, 'alwayseditable' => $alwayseditable, 'emptyonclone' => $emptyonclone, 'perms' => $perms, 'list' => $list, 'help' => $help, 'default' => $default, 'computed' => $computed, 'entity' => $entity, 'langfile' => $langfile, 'enabled' => $enabled, 'totalizable' => $totalizable, 'printable' => $printable, 'showintooltip' => $showintooltip, 'personal_data' => $personal_data); $reshook = $hookmanager->executeHooks('updateExtrafields', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { @@ -805,7 +816,7 @@ class ExtraFields if ($result > 0 || $type == 'separate') { if ($label) { dol_syslog(get_class($this).'::update_label', LOG_DEBUG); - $result = $this->update_label($attrname, $label, $type, $length, $elementtype, $unique, $required, $pos, $param, $alwayseditable, $perms, $list, $help, $default, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams, $aiprompt, $emptyonclone, $showintooltip); + $result = $this->update_label($attrname, $label, $type, $length, $elementtype, $unique, $required, $pos, $param, $alwayseditable, $perms, $list, $help, $default, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams, $aiprompt, $emptyonclone, $showintooltip, $personal_data); } if ($result > 0) { $sql = ''; @@ -865,14 +876,15 @@ class ExtraFields * @param string $aiprompt Ai prompt value * @param int<0,1> $emptyonclone Is attribute to be emptied after object clone * @param int<0,1> $showintooltip Is attribute to be show on tooltip + * @param int<0,1> $personal_data Is attribute a personal data (RGPD,nLPD/LGPD) * @return int Return integer <=0 if KO, >0 if OK * @throws Exception */ - private function update_label($attrname, $label, $type, $size, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = array(), $alwayseditable = 0, $perms = '', $list = '0', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array(), $aiprompt = "", $emptyonclone = 0, $showintooltip = 0) + private function update_label($attrname, $label, $type, $size, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = array(), $alwayseditable = 0, $perms = '', $list = '0', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array(), $aiprompt = "", $emptyonclone = 0, $showintooltip = 0, $personal_data = 0) { // phpcs:enable global $conf, $user; - dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list.", ".$default.", ".$computed.", ".$entity.", ".$langfile.", ".$enabled.", ".$totalizable.", ".$printable.", ".$aiprompt.", ".$showintooltip); + dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list.", ".$default.", ".$computed.", ".$entity.", ".$langfile.", ".$enabled.", ".$totalizable.", ".$printable.", ".$aiprompt.", ".$showintooltip.", ".$personal_data); // Clean parameters if ($elementtype == 'thirdparty') { @@ -900,6 +912,9 @@ class ExtraFields if (empty($alwayseditable)) { $alwayseditable = 0; } + if (empty($personal_data)) { + $personal_data = 0; + } if (empty($emptyonclone)) { $emptyonclone = 0; } @@ -976,7 +991,8 @@ class ExtraFields $sql .= " cssview,"; $sql .= " aiprompt,"; $sql .= " showintooltip,"; - $sql .= " emptyonclone"; + $sql .= " emptyonclone,"; + $sql .= " personal_data"; $sql .= ") VALUES ("; $sql .= "'".$this->db->escape($attrname)."',"; $sql .= " ".($entity === '' ? $conf->entity : $entity).","; @@ -1006,7 +1022,8 @@ class ExtraFields $sql .= " ".($cssview ? "'".$this->db->escape($cssview)."'" : "null").","; $sql .= " '".$this->db->escape($aiprompt)."',"; $sql .= " ".((int) $showintooltip)." ,"; - $sql .= " ".((int) $emptyonclone); + $sql .= " ".((int) $emptyonclone)." ,"; + $sql .= " ".((int) $personal_data); $sql .= ")"; $resql2 = $this->db->query($sql); @@ -1061,8 +1078,8 @@ class ExtraFields $array_name_label = array(); // We should not have several time this request. If we have, there is some optimization to do by calling a simple $extrafields->fetch_optionals() in top of code and not into subcode - $sql = "SELECT rowid, name, label, type, size, elementtype, fieldunique, fieldrequired, param, pos, alwayseditable, emptyonclone, perms, langs, list, printable, showintooltip, totalizable, fielddefault, fieldcomputed, entity, enabled, help, aiprompt,"; - $sql .= " css, cssview, csslist"; + $sql = "SELECT rowid, name, label, type, size, elementtype, fieldunique, fieldrequired, param, pos, alwayseditable, emptyonclone, perms, langs, list, printable, showintooltip, totalizable, fielddefault, fieldcomputed, entity, enabled, help, aiprompt"; + $sql .= " , css, cssview, csslist, personal_data"; $sql .= " FROM ".$this->db->prefix()."extrafields"; //$sql.= " WHERE entity IN (0,".$conf->entity.")"; // Filter is done later if ($elementtype && $elementtype != 'all') { @@ -1119,6 +1136,7 @@ class ExtraFields $this->attributes[$tab->elementtype]['css'][$tab->name] = $tab->css; $this->attributes[$tab->elementtype]['cssview'][$tab->name] = $tab->cssview; $this->attributes[$tab->elementtype]['csslist'][$tab->name] = $tab->csslist; + $this->attributes[$tab->elementtype]['personal_data'][$tab->name] = $tab->personal_data; $this->attributes[$tab->elementtype]['loaded'] = 1; $count++; diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 887ba6cdd32..430615dfcfe 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -267,6 +267,8 @@ print $formadmin->selectTypeOfFields('type', GETPOST('type', 'alpha'));
+ + diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index e894a8b1da0..0ca66787961 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -54,6 +54,7 @@ if (empty($conf) || !is_object($conf)) { $langs->load("modulebuilder"); +$langs->load("admin"); $listofexamplesforlink = 'Societe:societe/class/societe.class.php
Contact:contact/class/contact.class.php
Product:product/class/product.class.php
Project:projet/class/project.class.php
...'; @@ -203,6 +204,7 @@ $enabled = $extrafields->attributes[$elementtype]['enabled'][$attrname]; $css = $extrafields->attributes[$elementtype]['css'][$attrname]; $cssview = $extrafields->attributes[$elementtype]['cssview'][$attrname]; $csslist = $extrafields->attributes[$elementtype]['csslist'][$attrname]; +$personal_data = $extrafields->attributes[$elementtype]['personal_data'][$attrname]; $param_chain = ''; if (is_array($param)) { @@ -345,6 +347,9 @@ if (in_array($type, array_keys($typewecanchangeinto))) { + + + @@ -359,7 +364,6 @@ if (in_array($type, array_keys($typewecanchangeinto))) { - diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php index 4ba760668c9..1a03125c228 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -95,6 +95,7 @@ print ''; print ''; print ''; print ''; +print ''; print ''; print ''; print ''; @@ -165,6 +166,8 @@ if (isset($extrafields->attributes[$elementtype]['type']) && is_array($extrafiel print '\n"; // Can always be editable ? print '\n"; + // Personal data ? + print '\n"; // Will be emptied on clone ? print '\n"; // Visible @@ -213,7 +216,7 @@ if (isset($extrafields->attributes[$elementtype]['type']) && is_array($extrafiel print ""; } } else { - $colspan = 17; + $colspan = 18; if (isModEnabled('multicompany')) { $colspan++; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 21b5b2faccd..03172ca4c32 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2067,6 +2067,8 @@ AssetNumberingModules=Assets numbering module AlwaysEditable=Editable for any status EmptyOnClone=Empty on clone EmptyOnCloneDesc=Value will be emptied after cloning an object +IsPersonalData=Contains personal data +IsPersonalDataDesc=Check this if this field contains personal data PermissionOnField=Permission on the field MAIN_APPLICATION_TITLE=Force visible name of application (warning: setting your own name here may break autofill login feature when using DoliDroid mobile application) NbMajMin=Minimum number of uppercase characters diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index d1265b9d64e..42a44485cef 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -2043,6 +2043,8 @@ AssetNumberingModules=Module de numérotation des assets AlwaysEditable=Modifiable pour tout état EmptyOnClone=Valeur nulle au clonage EmptyOnCloneDesc=La valeur sera vidée après le clonage d'un objet +IsPersonalData=Contient des données personnelles +IsPersonalDataDesc=Cochez cette case si ce champ contient des données personnelles PermissionOnField=Autorisation sur le champ MAIN_APPLICATION_TITLE=Forcer la valeur visible du nom de l'application (attention : positionner ici son propre nom rendra inopérante la fonction de remplissage automatique de l'identifiant lorsque vous utilisez l'application mobile DoliDroid) NbMajMin=Nombre minimal de caractères majuscules
textwithpicto($langs->trans("AlwaysEditable"), $langs->trans("EditableWhenDraftOnly")); ?>>
textwithpicto($langs->trans("EmptyOnClone"), $langs->trans("EmptyOnCloneDesc")); ?>>
textwithpicto($langs->trans("IsPersonalData"), $langs->trans("IsPersonalDataDesc")); ?>>
textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc").'

'.$langs->trans("ItCanBeAnExpression")); ?>
textwithpicto($langs->trans("AlwaysEditable"), $langs->trans("EditableWhenDraftOnly")); ?>>
textwithpicto($langs->trans("IsPersonalData"), $langs->trans("IsPersonalDataDesc")); ?>>
textwithpicto($langs->trans("EmptyOnClone"), $langs->trans("EmptyOnCloneDesc")); ?>>
textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")); ?>
textwithpicto($langs->trans("DisplayExtraOnTooltip"), $langs->trans("DisplayExtraOnTooltipDesc")); ?> >
'.$langs->trans("ComputedFormula").''.$langs->trans("Unique").''.$langs->trans("Mandatory").''.$form->textwithpicto($langs->trans("AlwaysEditable"), $langs->trans("EditableWhenDraftOnly")).''.$form->textwithpicto($langs->trans("IsPersonalData"), $langs->trans("IsPersonalDataDesc")).''.$form->textwithpicto($langs->trans("EmptyOnClone"), $langs->trans("EmptyOnCloneDesc")).''.$form->textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc").'

'.$langs->trans("ItCanBeAnExpression")).'
'.$form->textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")).''.yn($extrafields->attributes[$elementtype]['required'][$key])."'.yn($extrafields->attributes[$elementtype]['alwayseditable'][$key])."'.yn($extrafields->attributes[$elementtype]['personal_data'][$key])."'.yn($extrafields->attributes[$elementtype]['emptyonclone'][$key])."