From b67c468eaf73e8b611f2e266e30fc5564acb1f9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Aliot?= Date: Wed, 15 Jul 2026 20:41:31 +0200 Subject: [PATCH 01/11] FIX #37026 Chart of accounts export drops root and cross-chart accounts (#39159) * FIX #37026 Chart of accounts export drops root and cross-chart accounts The "Chart of accounts" export dataset joined the parent account with an old style comma join plus aa2.active = 1 and ac.pcg_version = aa2.fk_pcg_version. That inner join silently dropped every account that has no parent (root accounts), whose parent is inactive, or whose parent belongs to another chart. The last case is common with a custom chart derived from a base one (the derived accounts keep their base parents), which is what the reporter saw: only the self consistent base chart came through instead of the active custom chart. Use an explicit INNER JOIN on accounting_system for the chart and a LEFT JOIN on the parent account keyed on the parent rowid only, so accounts are exported whatever their parent is. On a standard install this brings the export from 3087 to 3171 accounts (84 root or cross-chart accounts were missing). Signed-off-by: Gregory Aliot * Update modAccounting.class.php * Complete the sentence left dangling in the parent join comment Signed-off-by: Gregory Aliot --------- Signed-off-by: Gregory Aliot Co-authored-by: Gregory Aliot Co-authored-by: Laurent Destailleur --- htdocs/core/modules/modAccounting.class.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index a630b1f9fd3..ff926618558 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -250,10 +250,11 @@ class modAccounting extends DolibarrModules $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'accounting_account as aa'; - $this->export_sql_end[$r] .= ' ,'.MAIN_DB_PREFIX.'accounting_system as ac'; - $this->export_sql_end[$r] .= ' ,'.MAIN_DB_PREFIX.'accounting_account as aa2'; - $this->export_sql_end[$r] .= ' WHERE ac.pcg_version = aa.fk_pcg_version AND aa.entity IN ('.getEntity('accounting').')'; - $this->export_sql_end[$r] .= ' AND aa2.rowid = aa.account_parent AND aa2.active = 1 AND ac.pcg_version = aa2.fk_pcg_version AND aa2.entity IN ('.getEntity('accounting').')'; + $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'accounting_system as ac ON ac.pcg_version = aa.fk_pcg_version'; + // LEFT JOIN on the parent account: keep accounts that have no parent (root accounts) or whose parent is + // inactive or belongs to another chart (common when a custom chart is derived from a base one). + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'accounting_account as aa2 ON aa2.rowid = aa.account_parent AND aa2.entity IN ('.getEntity('accounting').')'; + $this->export_sql_end[$r] .= ' WHERE aa.entity IN ('.getEntity('accounting').')'; // Imports From acf69ceeeef4e706d8aedc58574c89f28cdf4337 Mon Sep 17 00:00:00 2001 From: TowyTowy <85077986+TowyTowy@users.noreply.github.com> Date: Wed, 15 Jul 2026 20:42:56 +0200 Subject: [PATCH 02/11] FIX getWeekNumbersOfMonth() drops the last week when the month ends on a Monday (#39185) getWeekNumbersOfMonth() looped with "for ($day = 1; $day < $nb_days; ...)", so the last day of the month was never inspected. When that last day is a Monday it starts a new ISO week that no earlier day of the month belongs to, so its week number was silently missing from the returned array. This surfaces in the project "time spent per month" view (htdocs/projet/activity/permonth.php), which builds one column per week from this list: for such months the final week column is dropped. Over 2015-2035, 35 months are affected (e.g. 2015-08 returned weeks 31-35 but omitted 36, the week of Monday 2015-08-31). Fix: iterate up to and including the last day ($day <= $nb_days). Signed-off-by: TowyTowy Co-authored-by: Claude --- htdocs/core/lib/date.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 6d4585c41c9..d2d88114820 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -1178,7 +1178,7 @@ function getWeekNumbersOfMonth($month, $year) { $nb_days = cal_days_in_month(CAL_GREGORIAN, $month, $year); $TWeek = array(); - for ($day = 1; $day < $nb_days; $day++) { + for ($day = 1; $day <= $nb_days; $day++) { $week_number = getWeekNumber($day, $month, $year); $TWeek[$week_number] = $week_number; } From 4c63b7a5e3be33705b0857b2646a1755a22151b1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Jul 2026 00:26:08 +0200 Subject: [PATCH 03/11] ci --- htdocs/core/class/html.formsetup.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index 126ab45f0e9..0905c245308 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -1581,7 +1581,7 @@ class FormSetupItem /** * Set type of input as a simple title. No data to store * - * @param ?array $fieldOptions A table of field options + * @param ?array $fieldOptions A table of field options * @return self */ public function setAsSelect($fieldOptions) From 070fbcdd28e744f4b83751b2bda37c87e4264ff5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Jul 2026 00:57:15 +0200 Subject: [PATCH 04/11] Fix regression --- htdocs/fourn/class/paiementfourn.class.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index bfb158a3532..af58de7c5c2 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -207,13 +207,11 @@ class PaiementFourn extends Paiement $invoice_multicurrency_code = $this->multicurrency_code[$key] ?? ''; $invoice_multicurrency_tx = $this->multicurrency_tx[$key] ?? ''; if (empty($invoice_multicurrency_code) || empty($invoice_multicurrency_tx)) { - $tmparray = MultiCurrency::getInvoiceRate($key, 'facture_fourn'); - if ($tmparray !== false) { - if (empty($invoice_multicurrency_code)) { - $invoice_multicurrency_code = $tmparray['invoice_multicurrency_code']; - } + $rate = MultiCurrency::getInvoiceRate($key, 'facture_fourn'); + if ($rate !== false) { if (empty($invoice_multicurrency_tx)) { - $invoice_multicurrency_tx = $tmparray['invoice_multicurrency_tx']; + //$invoice_multicurrency_tx = $tmparray['invoice_multicurrency_tx']; + $invoice_multicurrency_tx = $rate; } } } From c7dbdd0338273608bed4e194c49a9ca5deabf986 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Jul 2026 00:59:28 +0200 Subject: [PATCH 05/11] Restore good code after merge of a regression --- htdocs/fourn/class/paiementfourn.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index b80028d4e1a..7b9426790c8 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -210,11 +210,13 @@ class PaiementFourn extends Paiement $invoice_multicurrency_code = $this->multicurrency_code[$key] ?? ''; $invoice_multicurrency_tx = $this->multicurrency_tx[$key] ?? ''; if (empty($invoice_multicurrency_code) || empty($invoice_multicurrency_tx)) { - $rate = MultiCurrency::getInvoiceRate($key, 'facture_fourn'); - if ($rate !== false) { + $tmparray = MultiCurrency::getInvoiceRate($key, 'facture_fourn'); + if ($tmparray !== false) { + if (empty($invoice_multicurrency_code)) { + $invoice_multicurrency_code = $tmparray['invoice_multicurrency_code']; + } if (empty($invoice_multicurrency_tx)) { - //$invoice_multicurrency_tx = $tmparray['invoice_multicurrency_tx']; - $invoice_multicurrency_tx = $rate; + $invoice_multicurrency_tx = $tmparray['invoice_multicurrency_tx']; } } } From da6ef26c8e32411e5cabc39d89ae4349c79ebc52 Mon Sep 17 00:00:00 2001 From: ATM-NicolasV <92087862+ATM-NicolasV@users.noreply.github.com> Date: Thu, 16 Jul 2026 01:03:35 +0200 Subject: [PATCH 06/11] Fix empty SET clause in insertExtraFields UPDATE when no target column matches (#39184) When an object is created from another element whose extrafields do not exist on the target element (e.g. an invoice created from a shipment: the source line extrafields are copied into array_options but none match facturedet), the top-level empty($this->array_options) guard passes but the filtered column set is empty. When an extrafields row already exists for the object, the UPDATE branch then built "UPDATE llx_..._extrafields SET WHERE fk_object = X" with an empty SET clause, producing a MariaDB syntax error ("near 'WHERE fk_object = ...'") and aborting the creation of the invoice. Guard the UPDATE branch: when there is no column of the target element to update, commit and return without running the query (the existing row is already correct). This keeps the multicompany data-loss fix (UPDATE instead of DELETE+INSERT, #34022) untouched. Co-authored-by: Claude Opus 4.8 (1M context) Co-authored-by: Laurent Destailleur --- htdocs/core/class/commonobject.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f6088b69482..68734355249 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7001,6 +7001,15 @@ abstract class CommonObject // if the extrafields row already exists for the object, we update it if ($this->db->getRow("SELECT 1 FROM {$extrafieldsTable} WHERE fk_object = ".((int) $this->id))) { array_shift($sqlColumnValues); // drop the 'fk_object' column because its value won't change + if (empty($sqlColumnValues)) { + // No column of the target element to update. This happens when the object was created from + // another element whose extrafields do not exist on this element (e.g. invoice created from a + // shipment: the source line extrafields are copied into array_options but none match facturedet). + // The existing row is already correct, so there is nothing to update: avoid an empty "SET" clause + // that would produce an invalid SQL statement. + $this->db->commit(); + return 1; + } $sqlColumnValueString = implode( ',', /** From 34c78e21b6945abf896a0b6d8f5e7204a4fc8015 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Thu, 16 Jul 2026 01:29:56 +0200 Subject: [PATCH 07/11] fix: avoid Access refused to xxx.xxx.xxx.xxx by SQL or Script injection protection in main.inc.php:analyseVarsForSqlAndScriptsInjection type=1 (#39188) Co-authored-by: Laurent Destailleur --- htdocs/comm/propal/card.php | 2 +- htdocs/commande/card.php | 2 +- htdocs/compta/facture/card.php | 2 +- htdocs/compta/facture/prelevement.php | 4 ++-- htdocs/contrat/agenda.php | 2 +- htdocs/contrat/card.php | 2 +- htdocs/contrat/document.php | 2 +- htdocs/contrat/messaging.php | 2 +- htdocs/fourn/commande/card.php | 2 +- htdocs/fourn/facture/card.php | 2 +- htdocs/fourn/facture/contact.php | 2 +- htdocs/fourn/facture/document.php | 2 +- htdocs/fourn/facture/info.php | 2 +- htdocs/fourn/facture/note.php | 2 +- htdocs/mrp/mo_agenda.php | 2 +- htdocs/mrp/mo_card.php | 2 +- htdocs/mrp/mo_document.php | 2 +- htdocs/mrp/mo_movements.php | 2 +- htdocs/mrp/mo_note.php | 2 +- htdocs/mrp/mo_production.php | 2 +- htdocs/product/stock/stocktransfer/stocktransfer_card.php | 2 +- htdocs/product/stock/stocktransfer/stocktransfer_contact.php | 2 +- htdocs/supplier_proposal/card.php | 2 +- 23 files changed, 24 insertions(+), 24 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index b343affbd48..f2e8fab115d 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2549,7 +2549,7 @@ if ($action == 'create') { // Thirdparty $morehtmlref .= '
'.$soc->getNomUrl(1, 'customer'); if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $soc->id > 0) { - $morehtmlref .= ' ('.$langs->trans("OtherProposals").')'; + $morehtmlref .= ' ('.$langs->trans("OtherProposals").')'; } // Project if (isModEnabled('project')) { diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index ed32b693aff..c46ea4b63d3 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2479,7 +2479,7 @@ if ($action == 'create' && $usercancreate) { // Thirdparty $morehtmlref .= '
'.$soc->getNomUrl(1, 'customer'); if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; + $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; } // Project if (isModEnabled('project')) { diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 333d2838723..c7f91cd1972 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4658,7 +4658,7 @@ if ($action == 'create') { // Thirdparty $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; + $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } // Project if (isModEnabled('project')) { diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 65c33a88632..78f086792d5 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -377,11 +377,11 @@ if ($object->id > 0) { $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if ($type == 'bank-transfer') { if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; + $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } } else { if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; + $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } } // Project diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php index 4a14558c0e9..aeafff41770 100644 --- a/htdocs/contrat/agenda.php +++ b/htdocs/contrat/agenda.php @@ -185,7 +185,7 @@ if ($object->id > 0) { // Thirdparty $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' ('.$langs->trans("OtherContracts").')'; + $morehtmlref .= ' ('.$langs->trans("OtherContracts").')'; } // Project if (isModEnabled('project')) { diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 01363b6c8ea..dbeee468d1f 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1412,7 +1412,7 @@ if ($action == 'create') { // Thirdparty $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' ('.$langs->trans("OtherContracts").')'; + $morehtmlref .= ' ('.$langs->trans("OtherContracts").')'; } // Project if (isModEnabled('project')) { diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 28a1c9455e2..baa1498f635 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -144,7 +144,7 @@ if ($object->id) { // Thirdparty $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' ('.$langs->trans("OtherContracts").')'; + $morehtmlref .= ' ('.$langs->trans("OtherContracts").')'; } // Project if (isModEnabled('project')) { diff --git a/htdocs/contrat/messaging.php b/htdocs/contrat/messaging.php index 335146bfce3..7f451d5a4ba 100644 --- a/htdocs/contrat/messaging.php +++ b/htdocs/contrat/messaging.php @@ -182,7 +182,7 @@ $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_ // Thirdparty $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' ('.$langs->trans("OtherContracts").')'; + $morehtmlref .= ' ('.$langs->trans("OtherContracts").')'; } // Project if (isModEnabled('project')) { diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index d568cc3b30b..a672de3dc76 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2134,7 +2134,7 @@ if ($action == 'create') { } $morehtmlref .= $object->thirdparty->getNomUrl(1, 'supplier'); if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; + $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; } } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index a9a7d52913d..10e3f31a7b0 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -3245,7 +3245,7 @@ if ($action == 'create') { // Thirdparty $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'supplier'); if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' '; + $morehtmlref .= ' '; } // Project if (isModEnabled('project')) { diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index 6eca82f4e11..722912d328a 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -150,7 +150,7 @@ if ($id > 0 || !empty($ref)) { // Thirdparty $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' '; + $morehtmlref .= ' '; } // Project if (isModEnabled('project')) { diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index 69841806aab..6abcf62a515 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -114,7 +114,7 @@ if ($object->id > 0) { // Thirdparty $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' '; + $morehtmlref .= ' '; } // Project if (isModEnabled('project')) { diff --git a/htdocs/fourn/facture/info.php b/htdocs/fourn/facture/info.php index 20dd24d7276..bb26712c967 100644 --- a/htdocs/fourn/facture/info.php +++ b/htdocs/fourn/facture/info.php @@ -80,7 +80,7 @@ $morehtmlref .= $form->editfieldval("RefSupplierBill", 'ref_supplier', $object-> // Thirdparty $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' '; + $morehtmlref .= ' '; } // Project if (isModEnabled('project')) { diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index 41b2b1f4d34..7fec65689dc 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -110,7 +110,7 @@ if ($object->id > 0) { // Thirdparty $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' '; + $morehtmlref .= ' '; } // Project if (isModEnabled('project')) { diff --git a/htdocs/mrp/mo_agenda.php b/htdocs/mrp/mo_agenda.php index 0ff1e32c411..e658602c461 100644 --- a/htdocs/mrp/mo_agenda.php +++ b/htdocs/mrp/mo_agenda.php @@ -160,7 +160,7 @@ if ($object->id > 0) { if (is_object($object->thirdparty)) { $morehtmlref .= $object->thirdparty->getNomUrl(1, 'customer'); if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; + $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; } } // Project diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 7f1ccf1729e..53e1c454281 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -616,7 +616,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (is_object($object->thirdparty)) { $morehtmlref .= $object->thirdparty->getNomUrl(1, 'customer'); if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; + $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; } } // Project diff --git a/htdocs/mrp/mo_document.php b/htdocs/mrp/mo_document.php index 6afe0f35686..48061ea4299 100644 --- a/htdocs/mrp/mo_document.php +++ b/htdocs/mrp/mo_document.php @@ -133,7 +133,7 @@ if ($object->id) { if (is_object($object->thirdparty)) { $morehtmlref .= $object->thirdparty->getNomUrl(1, 'customer'); if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; + $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; } } // Project diff --git a/htdocs/mrp/mo_movements.php b/htdocs/mrp/mo_movements.php index 923a28df591..0f87b1afa58 100644 --- a/htdocs/mrp/mo_movements.php +++ b/htdocs/mrp/mo_movements.php @@ -336,7 +336,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (is_object($object->thirdparty)) { $morehtmlref .= $object->thirdparty->getNomUrl(1, 'customer'); if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; + $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; } } // Project diff --git a/htdocs/mrp/mo_note.php b/htdocs/mrp/mo_note.php index 9d24201da2e..b38459b0778 100644 --- a/htdocs/mrp/mo_note.php +++ b/htdocs/mrp/mo_note.php @@ -109,7 +109,7 @@ if ($id > 0 || !empty($ref)) { if (is_object($object->thirdparty)) { $morehtmlref .= $object->thirdparty->getNomUrl(1, 'customer'); if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; + $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; } } // Project diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 073dacf2a61..6e021ecbfd0 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -637,7 +637,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (is_object($object->thirdparty)) { $morehtmlref .= $object->thirdparty->getNomUrl(1, 'customer'); if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; + $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; } } diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_card.php b/htdocs/product/stock/stocktransfer/stocktransfer_card.php index 9456b6d1597..ff2906e25e8 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_card.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_card.php @@ -625,7 +625,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Thirdparty $morehtmlref .= empty($object->thirdparty) ? '' : $object->thirdparty->getNomUrl(1, 'customer'); if (!getDolGlobalInt('MAIN_DISABLE_OTHER_LINK') && !empty($object->thirdparty) && $object->thirdparty->id > 0) { - $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; + $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; } // Project if (isModEnabled('project')) { diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_contact.php b/htdocs/product/stock/stocktransfer/stocktransfer_contact.php index 8f599eb71de..448f2944806 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_contact.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_contact.php @@ -132,7 +132,7 @@ if ($object->id > 0) { // Thirdparty $morehtmlref .= empty($object->thirdparty) ? '' : $object->thirdparty->getNomUrl(1, 'customer'); if (!getDolGlobalInt('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; + $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; } // Project if (isModEnabled('project')) { diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 9965572677e..e80d45fa0f0 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1608,7 +1608,7 @@ if ($action == 'create') { // Thirdparty $morehtmlref .= $object->thirdparty->getNomUrl(1, 'supplier'); if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { - $morehtmlref .= ' ('.$langs->trans("OtherProposals").')'; + $morehtmlref .= ' ('.$langs->trans("OtherProposals").')'; } // Project if (isModEnabled('project')) { From 3dd16ec3c2477be6748a7e7ab3a6213fdcb9fd2c Mon Sep 17 00:00:00 2001 From: nikube <63295277+nikube@users.noreply.github.com> Date: Thu, 16 Jul 2026 04:18:11 +0200 Subject: [PATCH 08/11] FIX Mass action "Reverse movement" bypasses the MAIN_LIMIT_FOR_MASS_ACTIONS limit (#39091) * FIX Mass reverse of stock movements bypasses the MAIN_LIMIT_FOR_MASS_ACTIONS limit The confirm_reverse handler did not check the error raised by the generic mass action limit control (TooManyRecordForMassAction), so selecting more records than the limit still executed the reverse after the error message was displayed. The reverse was also triggered when relaunching a search while the confirmation form was open, because the protection only reset $massaction, not $action. * FIX phan: initialize $error at the start of the confirm_reverse handler The new !$error guard lets phan narrow $error to falsy types inside the block, so the $error++ in the query-error branch was reported as PhanTypeInvalidUnaryOperandIncOrDec. Initialize $error to 0 at the start of the handler (and drop the redundant init inside the loop setup where present). * FIX coding rule: comment on the $action test that only cancels the pending action CodingPhpTest requires a permission check or an explicit comment on every test of $action in the Actions section. --------- Co-authored-by: Nicolas Zaou --- htdocs/product/stock/movement_list.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index a0972cf4665..2c2b12c3713 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -250,6 +250,9 @@ if (empty($reshook)) { if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) { $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation + if ($action == 'confirm_reverse') { // Test on permission not required here, we only cancel a pending action + $action = 'list'; // Protection to avoid the reverse if we force a new search during the reverse confirmation + } } // Mass actions @@ -616,8 +619,9 @@ if ($action == "transfert_stock" && $permissiontoadd && !$cancel) { } // reverse movement of stock -if ($action == 'confirm_reverse' && $confirm == "yes" && $permissiontoadd) { +if (!$error && $action == 'confirm_reverse' && $confirm == "yes" && $permissiontoadd) { $toselect = array_map('intval', $toselect); + $error = 0; $db->begin(); @@ -629,7 +633,6 @@ if ($action == 'confirm_reverse' && $confirm == "yes" && $permissiontoadd) { if ($resql) { $num = $db->num_rows($resql); $i = 0; - $error =0; while ($i < $num) { $obj = $db->fetch_object($resql); @@ -1146,7 +1149,7 @@ $modelmail = "movementstock"; $objecttmp = new MouvementStock($db); $trackid = 'mov'.$warehouse->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; -if ($massaction == 'prereverse') { +if ($massaction == 'prereverse' && count($toselect) <= getDolGlobalInt('MAIN_LIMIT_FOR_MASS_ACTIONS', 1000)) { print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassReverse"), $langs->trans("ConfirmMassReverseQuestion", count($toselect)), "confirm_reverse", null, '', 0, 200, 500, 1, 'Yes'); } From bd419519ff0bc9f78071e8e7ebcf612551d2277c Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Thu, 16 Jul 2026 13:06:00 +0200 Subject: [PATCH 09/11] Fix extrafield hidden field not ecaped value (#39148) Co-authored-by: Laurent Destailleur --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 83e40cece85..cf190bb67c5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8971,7 +8971,7 @@ abstract class CommonObject } elseif (($mode == 'edit') && !in_array(abs($visibility), array(1, 3, 4))) { // We need to make sure, that the values of hidden extrafields are also part of $_POST. Otherwise, they would be empty after an update of the object. See also getOptionalsFromPost $ef_name = 'options_' . $key; - $ef_value = $this->array_options[$ef_name]; + $ef_value = dol_htmlentities($this->array_options[$ef_name], ENT_QUOTES | ENT_SUBSTITUTE); $out .= '' . "\n"; continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list and <> 4 = not visible at the creation } elseif ($mode == 'view' && empty($visibility)) { From f70ccfa84200bbb4d8e732c2dd39204230222ec6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Jul 2026 13:10:41 +0200 Subject: [PATCH 10/11] Add a TODO --- htdocs/core/class/commonobject.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7fcdeb0b79a..1da7bc7eb97 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9242,10 +9242,12 @@ abstract class CommonObject if (($mode == 'create') && !in_array(abs($visibility), array(1, 3))) { continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list } elseif (($mode == 'edit') && !in_array(abs($visibility), array(1, 3, 4))) { - // We need to make sure, that the values of hidden extrafields are also part of $_POST. Otherwise, they would be empty after an update of the object. See also getOptionalsFromPost + // We need to make sure, that the values of hidden extrafields are also part of $_POST. + // Otherwise, they would be empty after an update of the object. See also getOptionalsFromPost + // TODO: We should not have this hidden field, and action='update' should be done only if field was POSTED by form. $ef_name = 'options_' . $key; - $ef_value = dol_htmlentities($this->array_options[$ef_name], ENT_QUOTES | ENT_SUBSTITUTE); - $out .= '' . "\n"; + $ef_value = $this->array_options[$ef_name]; + $out .= '' . "\n"; continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list and <> 4 = not visible at the creation } elseif ($mode == 'view' && empty($visibility)) { continue; From 5f75ee865a8b6e321c4d2ff383809f31d4ed3b3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Aliot?= Date: Thu, 16 Jul 2026 13:14:59 +0200 Subject: [PATCH 11/11] FIX #37540 DST distorts working day count in num_public_holiday (#39158) The day loop of num_public_holiday() advanced with dol_time_plus_duree($timestampStart, 1, 'd'). On 21.0 and 22.0 that function only forces UTC when MAIN_DATE_IN_MEMORY_ARE_GMT is set, so by default it adds a wall-clock day in the server timezone. When the range crosses a DST boundary (last Sunday of March in Europe), the GMT timestamp advances by only 23 hours, the same GMT day is evaluated twice, one day is counted as holiday twice and the working day after the boundary is never examined. For a leave request from Sat 28/03/2026 to Mon 30/03/2026 with a server in Europe/Paris: 3 days between, 3 holidays counted (Sunday twice), 0 working days instead of 1. Advance by exactly 86400 seconds instead. Inputs of this function are GMT dates (enforced by the modulo check at the top of the function), so a GMT day is always exactly 86400 seconds, in every timezone and conf. This matches the behaviour that 23.0 and develop get by default since dol_time_plus_duree() switched to UTC by default there. Signed-off-by: Gregory Aliot Co-authored-by: Gregory Aliot --- htdocs/core/lib/date.lib.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index d2d88114820..9b07c05d7ab 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -1003,7 +1003,12 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', } // Increase number of days (on go up into loop) - $timestampStart = dol_time_plus_duree($timestampStart, 1, 'd'); + // Advance by exactly one GMT day. Do not use dol_time_plus_duree() here: when dates in memory + // are not GMT, it adds a wall-clock day in the server timezone, so crossing a DST boundary + // moves the GMT timestamp by only 23 hours, the same GMT day is then evaluated twice and the + // holiday count is wrong. Inputs of this function are GMT dates (checked above), so a day + // is always exactly 86400 seconds. + $timestampStart += 86400; //var_dump($jour.' '.$mois.' '.$annee.' '.$timestampStart); $i++;