From 50afc9682b5f460a9666d899d6a82b129d4506d6 Mon Sep 17 00:00:00 2001 From: lvessiller-opendsi Date: Mon, 6 Oct 2025 13:56:50 +0200 Subject: [PATCH 01/29] FIX create invoice from order using API and multi-entity (#35654) * FIX create invoice from order using API and multi-entity * FIX API not allow to access order in other entity on creating invoice from order * Update api_invoices.class.php --------- Co-authored-by: Laurent Destailleur --- htdocs/compta/facture/class/api_invoices.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 3dfa5f70603..95a234d4991 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -315,6 +315,7 @@ class Invoices extends DolibarrApi * @return int * @throws RestException 400 * @throws RestException 401 + * @throws RestException 403 Access not allowed for login * @throws RestException 404 * @throws RestException 405 */ @@ -332,6 +333,9 @@ class Invoices extends DolibarrApi if (empty($orderid)) { throw new RestException(400, 'Order ID is mandatory'); } + if (!DolibarrApi::_checkAccessToResource('commande', $orderid)) { + throw new RestException(403, 'Access not allowed on order for login '.DolibarrApiAccess::$user->login); + } $order = new Commande($this->db); $result = $order->fetch($orderid); From 5de1fcca2f936c7d53fcd451be91081a5ced545d Mon Sep 17 00:00:00 2001 From: lvessiller-opendsi Date: Fri, 17 Oct 2025 15:48:40 +0200 Subject: [PATCH 02/29] FIX extra-field list depend on parent extra-filed list on direct edit (#35803) --- htdocs/core/js/lib_head.js.php | 35 ++++++++++++++++++++++++ htdocs/core/tpl/extrafields_view.tpl.php | 26 +----------------- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index f75018fbdaf..a4df9ad3389 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1173,4 +1173,39 @@ $(document).ready(function() { } }); + +// Code to manage the js for combo list with dependencies (called by extrafields_view.tpl.php) +function showOptions(child_list, parent_list) { + var parentInput = $("select[name="+parent_list+"]"); + if (parentInput.length === 0) { // when parent extra-field is in view mode and the child is edited directly on card (on line edit) + parentInput = $("input[name="+parent_list+"]"); + } + if (parentInput.length > 0) { + var val = parentInput.val(); + var parentVal = parent_list + ":" + val; + if (val > 0) { + $("select[name=\""+child_list+"\"] option[parent]").prop("disabled", true).hide(); // hide not work with select2 element so disabled it + $("select[name=\""+child_list+"\"] option[parent=\""+parentVal+"\"]").prop('disabled', false).show(); // show not work with select2 element so enabled it + } else { + $("select[name=\""+child_list+"\"] option").prop("disabled", false).show(); // show not work with select2 element so enabled it + } + } +} +function setListDependencies() { + console.log("setListDependencies"); + jQuery("select option[parent]").parent().each(function() { + var child_list = $(this).attr("name"); + var parent = $(this).find("option[parent]:first").attr("parent"); + var infos = parent.split(":"); + var parent_list = infos[0]; + showOptions(child_list, parent_list); + + /* Activate the handler to call showOptions on each future change */ + $("select[name=\""+parent_list+"\"]").change(function() { + showOptions(child_list, parent_list); + }); + }); +} + + // End of lib_head.js.php diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index cc0ee2b0f93..a328c9fe610 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -257,6 +257,7 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l } else { //var_dump($tmpkeyextra.'-'.$value.'-'.$object->table_element); print $extrafields->showOutputField($tmpkeyextra, $value, '', $object->table_element); + print ''; // it's needed when to get parent value when extra-field list depend on parent extra-field list } print ''; @@ -271,31 +272,6 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l print ' '."\n"; From 3be9f0e9cc8d0ae719d788cae5e9fdb73d860457 Mon Sep 17 00:00:00 2001 From: Ryad ABANI <91743099+RyAbn@users.noreply.github.com> Date: Wed, 22 Oct 2025 00:45:15 +0200 Subject: [PATCH 03/29] FIX: notification email not sent : NOTIFICATION_EMAIL_FROM is replaced with MAIN_MAIL_EMAIL_FROM if it's empty (#35881) Co-authored-by: Ryad ABANI --- htdocs/core/class/notify.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index c50c8faa1ab..5897b18fa83 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -649,7 +649,7 @@ class Notify if (getDolGlobalString('MAIN_APPLICATION_TITLE')) { $application = getDolGlobalString('MAIN_APPLICATION_TITLE'); } - $from = getDolGlobalString('NOTIFICATION_EMAIL_FROM'); + $from = getDolGlobalString('NOTIFICATION_EMAIL_FROM', getDolGlobalString('MAIN_MAIL_EMAIL_FROM')); $object_type = ''; $link = ''; $num = 0; From 6df379c62ab12c548848ea872c659f9d23f03d3c Mon Sep 17 00:00:00 2001 From: atm-lena <52402938+atm-lena@users.noreply.github.com> Date: Wed, 22 Oct 2025 17:42:58 +0200 Subject: [PATCH 04/29] FIX MAIN_SEE_SUBORDONATES sql request errror (#35896) Co-authored-by: atm-lena --- htdocs/core/lib/security.lib.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index a47234838fa..23562a4e44a 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -972,7 +972,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl $sql .= " AND (sc.fk_user = ".((int) $user->id); if (getDolGlobalInt('MAIN_SEE_SUBORDINATES')) { $userschilds = $user->getAllChildIds(); - $sql .= " OR sc.fk_user IN (".$db->sanitize(implode(',', $userschilds)).")"; + if (!empty($userschilds)) $sql .= " OR sc.fk_user IN (".$db->sanitize(implode(',', $userschilds)).")"; } $sql .= ")"; $sql .= " AND sc.fk_soc = s.rowid"; @@ -1082,9 +1082,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl $sql .= " AND (sc.fk_user = ".((int) $user->id); if (getDolGlobalInt('MAIN_SEE_SUBORDINATES')) { $userschilds = $user->getAllChildIds(); - foreach ($userschilds as $key => $value) { - $sql .= ' OR sc.fk_user = '.((int) $value); - } + if (!empty($userschilds)) $sql .= " OR sc.fk_user IN (".$db->sanitize(implode(',', $userschilds)).")"; } $sql .= ')'; } else { From 6e5f044e31aeabfcc3ed1bbe3f6a6fba03797772 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 23 Oct 2025 16:36:42 +0200 Subject: [PATCH 05/29] FIX check if service is activated only for api product (#35911) --- htdocs/api/index.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/api/index.php b/htdocs/api/index.php index 9b78fe060ef..62cbf753ebb 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -244,6 +244,8 @@ if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $ $modulenameforenabled = 'supplier_proposal'; } elseif ($module == 'ficheinter') { $modulenameforenabled = 'intervention'; + } elseif ($module == 'product' && !isModEnabled('product') && isModEnabled('service')) { + $modulenameforenabled = 'service'; } dol_syslog("Found module file ".$file." - module=".$module." - modulenameforenabled=".$modulenameforenabled." - moduledirforclass=".$moduledirforclass); From 24335dd8c7abefa27e61e710adc6819c74697848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 25 Oct 2025 20:39:27 +0200 Subject: [PATCH 06/29] fix unicity check for "code_compta_client" (#35951) --- htdocs/societe/class/societe.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 75c48472322..7fd6fb6829a 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1314,10 +1314,13 @@ class Societe extends CommonObject $array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL', 'TVA_INTRA', 'ACCOUNTANCY_CODE_CUSTOMER', 'ACCOUNTANCY_CODE_SUPPLIER'); foreach ($array_to_check as $key) { $keymin = strtolower($key); + $keyfield_db = $keymin; if ($key == 'ACCOUNTANCY_CODE_CUSTOMER') { $keymin = 'code_compta_client'; + $keyfield_db = 'code_compta'; } elseif ($key == 'ACCOUNTANCY_CODE_SUPPLIER') { $keymin = 'code_compta_fournisseur'; + $keyfield_db = 'code_compta_fournisseur'; } $i = (int) preg_replace('/[^0-9]/', '', $key); $vallabel = $this->$keymin; @@ -1379,7 +1382,7 @@ class Societe extends CommonObject } elseif ($key == 'ACCOUNTANCY_CODE_CUSTOMER' && !empty($this->client)) { // Check for unicity if ($vallabel && getDolGlobalString('SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_UNIQUE')) { - if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) { + if ($this->id_prof_exists($keyfield_db, $vallabel, ($this->id > 0 ? $this->id : 0))) { $langs->loadLangs(array("errors", 'compta')); $error++; $this->errors[] = $langs->trans('CustomerAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')'; @@ -1395,7 +1398,7 @@ class Societe extends CommonObject } elseif ($key == 'ACCOUNTANCY_CODE_SUPPLIER' && !empty($this->fournisseur)) { // Check for unicity if ($vallabel && getDolGlobalString('SOCIETE_ACCOUNTANCY_CODE_SUPPLIER_UNIQUE')) { - if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) { + if ($this->id_prof_exists($keyfield_db, $vallabel, ($this->id > 0 ? $this->id : 0))) { $langs->loadLangs(array("errors", 'compta')); $error++; $this->errors[] = $langs->trans('SupplierAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')'; From 6333f32c9cef1ad78fb626ea238a4979a3ce9a8e Mon Sep 17 00:00:00 2001 From: jonathan-stimactiv <141750461+jonathan-stimactiv@users.noreply.github.com> Date: Sat, 25 Oct 2025 23:08:33 +0200 Subject: [PATCH 07/29] FIX: #35922 Lines of orders - Status filter unexpected beahavior (#35924) --- htdocs/commande/list_det.php | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index aa059a02bbf..2e56fb6260b 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -481,17 +481,14 @@ if ($search_status != '') { $sql .= ' AND c.fk_statut = '.((int) $search_status); // draft, validated, in process or canceled } } - if ($search_status == -2) { // To process + if ($search_status == -2) { // "validated + in progress" //$sql.= ' AND c.fk_statut IN (1,2,3) AND c.facture = 0'; - $sql .= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected + $sql .= " AND c.fk_statut IN (1,2)"; } - if ($search_status == -3) { // To bill + if ($search_status == -3) { // "validated + in progress + shipped" //$sql.= ' AND c.fk_statut in (1,2,3)'; //$sql.= ' AND c.facture = 0'; // invoice not created - $sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed - } - if ($search_status == -4) { // "validate and in progress" - $sql .= ' AND (c.fk_statut IN (1,2))'; // validated, in process + $sql .= ' AND c.fk_statut IN (1,2,3)'; // validated, in process or closed } } @@ -692,9 +689,6 @@ if ($resql) { if ($search_status == -3) { $title .= ' - '.$langs->trans('StatusOrderValidated').', '.(!isModEnabled('shipping') ? '' : $langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill'); } - if ($search_status == -4) { - $title .= ' - '.$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort"); - } $num = $db->num_rows($resql); From 7b4def5e99de95dca7a13bb7fea00cf421d0ad03 Mon Sep 17 00:00:00 2001 From: atm-lucas <121817516+atm-lucasmantegari@users.noreply.github.com> Date: Tue, 28 Oct 2025 00:55:41 +0100 Subject: [PATCH 08/29] Display warnings invoice situation (#35972) --- htdocs/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/index.php b/htdocs/index.php index fa02051eb36..68fce7df62d 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -118,7 +118,7 @@ if (getDolGlobalString('MAIN_MOTD')) { */ // Specific warning to propose to upgrade invoice situation to progressive mode -if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) { +if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1 && (float) DOL_VERSION >= 22.0) { $langs->loadLangs(array("admin")); print info_admin($langs->trans("WarningExperimentalFeatureInvoiceSituationNeedToUpgradeToProgressiveMode", 'https://partners.dolibarr.org')); //print "
"; From 2524ab424c2550d66a05ef927bc5e5623953b846 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 28 Oct 2025 02:03:40 +0100 Subject: [PATCH 09/29] FIX avoid php warning (#35953) --- htdocs/core/tpl/passwordforgotten.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index d01fb3a5f99..26bf6e5e6b8 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -192,7 +192,7 @@ if (!empty($captcha)) { } // List of directories where we can find captcha handlers - $dirModCaptcha = array_merge(array('main' => '/core/modules/security/captcha/'), is_array($conf->modules_parts['captcha']) ? $conf->modules_parts['captcha'] : array()); + $dirModCaptcha = array_merge(array('main' => '/core/modules/security/captcha/'), ((isset($conf->modules_parts['captcha']) && is_array($conf->modules_parts['captcha'])) ? $conf->modules_parts['captcha'] : array())); $fullpathclassfile = ''; foreach ($dirModCaptcha as $dir) { $fullpathclassfile = dol_buildpath($dir."modCaptcha".ucfirst($captcha).'.class.php', 0, 2); From 68fc03caae6f07a090856f6b915118844d1c3861 Mon Sep 17 00:00:00 2001 From: atm-adrien <67913809+atm-adrien@users.noreply.github.com> Date: Wed, 29 Oct 2025 17:05:43 +0100 Subject: [PATCH 10/29] FIX : Situation percent set as 0 when adding line on situation invoices (#35999) --- htdocs/compta/facture/card.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 14ed1d3846b..cf8015dbd45 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2526,7 +2526,7 @@ if (empty($reshook)) { } // Insert line - $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $date_start, $date_end, 0, $info_bits, 0, $price_base_type, $pu_ttc, $type, min($rank, count($object->lines) + 1), $special_code, '', 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, GETPOST('progress'), 0, $fk_unit, $pu_ht_devise); + $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $date_start, $date_end, 0, $info_bits, 0, $price_base_type, $pu_ttc, $type, min($rank, count($object->lines) + 1), $special_code, '', 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, GETPOSTINT('progress'), 0, $fk_unit, $pu_ht_devise); if ($result > 0) { // Define output language and generate document diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 98d0146fa4e..db4ee380edd 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3875,7 +3875,7 @@ class Facture extends CommonInvoice if (empty($fk_prev_id)) { $fk_prev_id = 'null'; } - if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '' || $situation_percent == null) { + if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '' || $situation_percent === null) { // INVOICE_USE_SITUATION = 2 - Lines situation percent on new lines must be 0 (No cumulative) if ($this->type == Facture::TYPE_SITUATION && getDolGlobalInt('INVOICE_USE_SITUATION') == 2 && (int) $situation_percent < 100) { $situation_percent = 0; From 3f2f676e582003b26a85aa1faaa568c7b8a4a2cb Mon Sep 17 00:00:00 2001 From: atm-corentin <165782689+atm-corentin@users.noreply.github.com> Date: Wed, 29 Oct 2025 22:12:42 +0100 Subject: [PATCH 11/29] Fix : Add 'printFieldListGroupBy' hook to stockatdate.php for module flexibility (#35996) * Refactor stock SQL query logic to enhance readability, support hook extensibility, and maintain DRY principles. * Pass `$object` and `$action` to hookmanager in stock listing queries for improved hook extensibility. --- htdocs/product/stock/stockatdate.php | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 3080bb1262b..4903231365c 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -287,7 +287,7 @@ if (!empty($search_fk_warehouse)) { } // Add fields from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; @@ -296,7 +296,7 @@ if (!empty($search_fk_warehouse)) { } // Add fields from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListJoin', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListJoin', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; if ($productid > 0) { @@ -314,8 +314,24 @@ if ($search_ref) { if ($search_nom) { $sql .= natural_search('p.label', $search_nom); } -$sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.pmp, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; -$sql .= ' p.tms, p.duration, p.tobuy, p.stock'; + +$sqlGroupBy = ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.pmp, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; +$sqlGroupBy .= ' p.tms, p.duration, p.tobuy, p.stock'; + +$parameters = array('sqlGroupBy' => $sqlGroupBy); +$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + +if ($reshook == 0) { + // Allows the hook to add things (old behavior) + $sql .= $hookmanager->resPrint; + // Allows the hook to REPLACE the clause (new behavior) + if (!empty($hookmanager->resArray['sqlGroupBy'])) { + $sqlGroupBy = $hookmanager->resArray['sqlGroupBy']; + } +} + +$sql .= $sqlGroupBy; + // Add where from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook From 57e1c2275378ef431cf0bc63ce3dd4fca73f2662 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 Oct 2025 00:20:13 +0100 Subject: [PATCH 12/29] Fix log of upgrade2 --- htdocs/install/upgrade2.php | 57 +++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index eda4ef3c9bd..81532701b77 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -87,8 +87,8 @@ $error = 0; // This page can be long. We increase the allowed delay, but this does not work when we are in safe_mode. $err = error_reporting(); error_reporting(0); -if (getDolGlobalString('MAIN_OVERRIDE_TIME_LIMIT')) { - @set_time_limit((int) $conf->global->MAIN_OVERRIDE_TIME_LIMIT); +if (getDolGlobalInt('MAIN_OVERRIDE_TIME_LIMIT')) { + @set_time_limit(getDolGlobalInt('MAIN_OVERRIDE_TIME_LIMIT')); } else { @set_time_limit(600); } @@ -201,6 +201,53 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $conf->setValues($db); + // Reforce log activation (samecode than into the inc.php) + $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1; + $conf->modules['syslog'] = 'syslog'; + $conf->global->SYSLOG_LEVEL = constant('LOG_DEBUG'); + if (!defined('SYSLOG_HANDLERS')) { + define('SYSLOG_HANDLERS', '["mod_syslog_file"]'); + } + if (!defined('SYSLOG_FILE')) { // To avoid warning on systems with constant already defined + if (@is_writable('/tmp')) { + define('SYSLOG_FILE', '/tmp/dolibarr_install.log'); + } elseif (!empty($_ENV["TMP"]) && @is_writable($_ENV["TMP"])) { + define('SYSLOG_FILE', $_ENV["TMP"].'/dolibarr_install.log'); + } elseif (!empty($_ENV["TEMP"]) && @is_writable($_ENV["TEMP"])) { + define('SYSLOG_FILE', $_ENV["TEMP"].'/dolibarr_install.log'); + } elseif (@is_writable('../../../../') && @file_exists('../../../../startdoliwamp.bat')) { + define('SYSLOG_FILE', '../../../../dolibarr_install.log'); // For DoliWamp + } elseif (@is_writable('../../')) { + define('SYSLOG_FILE', '../../dolibarr_install.log'); // For others + } + //print 'SYSLOG_FILE='.SYSLOG_FILE;exit; + } + if (defined('SYSLOG_FILE')) { + $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE'); + } + if (!defined('SYSLOG_FILE_NO_ERROR')) { + define('SYSLOG_FILE_NO_ERROR', 1); + } + // We init log handler for install + $handlers = array('mod_syslog_file'); + foreach ($handlers as $handler) { + $file = DOL_DOCUMENT_ROOT.'/core/modules/syslog/'.$handler.'.php'; + if (!file_exists($file)) { + throw new Exception('Missing log handler file '.$handler.'.php'); + } + + require_once $file; + $loghandlerinstance = new $handler(); + if (!$loghandlerinstance instanceof LogHandler) { + throw new Exception('Log handler does not extend LogHandler'); + } + + if (empty($conf->loghandlers[$handler])) { + $conf->loghandlers[$handler] = $loghandlerinstance; + } + } + + $listofentities = array(1); // Create the global $hookmanager object @@ -4317,7 +4364,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo $user = new User($db); // To avoid error during migration } - dolibarr_install_syslog("upgrade2::migrate_reload_modules force=".$force.", listofmodule=".implode(',', array_keys($listofmodule))); + dolibarr_install_syslog("upgrade2::migrate_reload_modules force=".$force.", listofmodule=".implode(',', array_keys($listofmodule)), LOG_NOTICE); $reloadactionformodules = array( 'MAIN_MODULE_AGENDA' => array('class' => 'modAgenda', 'remove' => 1), @@ -4387,7 +4434,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo $moduletoreloadshort = $reg[1]; } - dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module ".$moduletoreloadshort." with mode ".$reloadmode." (generic code)"); + dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module ".$moduletoreloadshort." with mode ".$reloadmode." (generic code)", LOG_NOTICE); $res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/mod'.$moduletoreloadshort.'.class.php'; if ($res) { @@ -4399,7 +4446,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo $mod->delete_menus(); // We must delete to be sure it is inserted with new values $mod->init($reloadmode); } else { - dolibarr_install_syslog('Failed to include '.DOL_DOCUMENT_ROOT.'/core/modules/mod'.$moduletoreloadshort.'.class.php'); + dolibarr_install_syslog('Failed to include '.DOL_DOCUMENT_ROOT.'/core/modules/mod'.$moduletoreloadshort.'.class.php', LOG_ERR); $res = @dol_include_once(strtolower($moduletoreloadshort).'/core/modules/mod'.$moduletoreloadshort.'.class.php'); if ($res) { From 6145bcc4495ee1e325ad883f41cbfa5ff4dac6b7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 Oct 2025 16:59:09 +0100 Subject: [PATCH 13/29] FIX Error 500 on api if cache is on and directory does not exists --- htdocs/api/class/api.class.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 5781871d098..e041389a066 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -59,6 +59,18 @@ class DolibarrApi $this->db = $db; $production_mode = getDolGlobalBool('API_PRODUCTION_MODE'); + + if ($production_mode) { + // Create the directory Defaults::$cacheDirectory if it does not exists. If dir does not exists, using production_mode generates an error 500. + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + if (!dol_is_dir(Defaults::$cacheDirectory)) { + dol_mkdir(Defaults::$cacheDirectory, DOL_DATA_ROOT); + } + if (getDolGlobalString('MAIN_API_DEBUG')) { + dol_syslog("Debug API construct::cacheDirectory=".Defaults::$cacheDirectory, LOG_DEBUG, 0, '_api'); + } + } + $this->r = new Restler($production_mode, $refreshCache); $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); From 6540c1cb1fe5ac8aaff52d14e3d661eed4d3aea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 31 Oct 2025 23:38:36 +0100 Subject: [PATCH 14/29] fix missing property declaration (#36026) --- htdocs/admin/remotestore/class/externalModules.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/admin/remotestore/class/externalModules.class.php b/htdocs/admin/remotestore/class/externalModules.class.php index 410b1912238..885c77ce1cd 100644 --- a/htdocs/admin/remotestore/class/externalModules.class.php +++ b/htdocs/admin/remotestore/class/externalModules.class.php @@ -105,6 +105,11 @@ class ExternalModules */ public $githubFileError; + /** + * @var string + */ + public $error; + /** * @var int // number of online providers */ From f5b56e5ea3c2c1fd909f9fdfdfb3da48edbca81b Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 1 Nov 2025 00:26:54 +0100 Subject: [PATCH 15/29] Fix : resource list was inaccessible if only one resource (#36042) --- htdocs/resource/list.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 236383bbed5..e1c2f243a8d 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -85,6 +85,8 @@ if (empty($sortfield)) { $sortfield = "t.ref"; } +$search_all = trim(GETPOST('search_all', 'alphanohtml')); + // Load variable for pagination $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; @@ -349,7 +351,7 @@ if (!$resql) { $num = $db->num_rows($resql); // Direct jump if only one record found -if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && !$page) { +if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) { $obj = $db->fetch_object($resql); $id = $obj->rowid; header("Location: ".dol_buildpath('/resource/card.php', 1).'?id='.$id); From e3fc45b6c83ce052dc5f17f63897cfc8e8b837c8 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 1 Nov 2025 00:28:44 +0100 Subject: [PATCH 16/29] Fix : missing left column actions on resource list (#36040) --- htdocs/resource/list.php | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index e1c2f243a8d..b4111084195 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -454,6 +454,13 @@ print ''."\n"; // Fields title search print ''; +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} if (!empty($arrayfields['t.ref']['checked'])) { print ''; +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); +} if (!empty($arrayfields['t.ref']['checked'])) { print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], "t.ref", "", $param, "", $sortfield, $sortorder); } @@ -590,7 +601,22 @@ while ($i < $imaxinloop) { $objectstatic->max_users = $obj->max_users; $objectstatic->url = $obj->url; - print ''; + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } if (!empty($arrayfields['t.ref']['checked'])) { print ''; From dc024fef270e1045b08436c0f14aa95d60af6f81 Mon Sep 17 00:00:00 2001 From: Florian Mortgat <50440633+atm-florianm@users.noreply.github.com> Date: Sat, 1 Nov 2025 00:29:43 +0100 Subject: [PATCH 17/29] FIX 20.0 ajax_constantonoff + FormSetup were ignoring custom css class (cssClass / $morecss) (#36039) --- htdocs/core/class/html.formsetup.class.php | 6 +++--- htdocs/core/lib/ajax.lib.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index 0def5ee7882..7f4cc9fbf39 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -899,9 +899,9 @@ class FormSetupItem $out .= $this->generateInputFieldColor(); } elseif ($this->type == 'yesno') { if (!empty($conf->use_javascript_ajax)) { - $out .= ajax_constantonoff($this->confKey); + $out .= ajax_constantonoff($this->confKey, array(), null, 0, 0, 0, 2, 0, 0, '', '', $this->cssClass); } else { - $out .= $this->form->selectyesno($this->confKey, $this->fieldValue, 1); + $out .= $this->form->selectyesno($this->confKey, $this->fieldValue, 1, false, 0, 0, $this->cssClass); } } elseif (preg_match('/emailtemplate:/', $this->type)) { $out .= $this->generateInputFieldEmailTemplate(); @@ -1212,7 +1212,7 @@ class FormSetupItem $out .= $this->generateOutputFieldColor(); } elseif ($this->type == 'yesno') { if (!empty($conf->use_javascript_ajax)) { - $out .= ajax_constantonoff($this->confKey, array(), $this->entity); // TODO possibility to add $input parameter + $out .= ajax_constantonoff($this->confKey, array(), $this->entity, 0, 0, 0, 2, 0, 0, '', '', $this->cssClass); // TODO possibility to add $input parameter } else { if ($this->fieldValue == 1) { $out .= $langs->trans('yes'); diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index eb20504f512..994b3352c93 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -697,8 +697,8 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof '."\n"; $out .= ''; - $out .= ''.($revertonoff ? img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort)).''; - $out .= ''.($revertonoff ? img_picto($langs->trans("Disabled"), 'switch_off'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort)).''; + $out .= ''.($revertonoff ? img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort)).''; + $out .= ''.($revertonoff ? img_picto($langs->trans("Disabled"), 'switch_off'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort)).''; $out .= "\n"; } From ca4619f76908ae3958b437c141334d85e97f4a36 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 1 Nov 2025 00:35:50 +0100 Subject: [PATCH 18/29] Fix #36019 : bank account count was wrong on thirdparty card (#36044) --- htdocs/core/lib/company.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index a74a890e013..f58272066db 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -216,7 +216,7 @@ function societe_prepare_head(Societe $object) $sql .= " FROM ".MAIN_DB_PREFIX."societe_rib as n"; $sql .= " WHERE n.fk_soc = ".((int) $object->id); if (!isModEnabled('stripe')) { - $sql .= " AND n.stripe_card_ref IS NULL"; + $sql .= " AND (n.stripe_card_ref IS NULL OR n.stripe_card_ref ='')"; } else { $sql .= " AND (n.stripe_card_ref IS NULL OR (n.stripe_card_ref IS NOT NULL AND n.status = ".((int) $servicestatus)."))"; } From 5f23325eb237bb860533cd53b678c7bbcc9a0535 Mon Sep 17 00:00:00 2001 From: atm-adrien <67913809+atm-adrien@users.noreply.github.com> Date: Sat, 1 Nov 2025 01:05:32 +0100 Subject: [PATCH 19/29] FIX : Allow decimals on services duration (#36031) --- htdocs/product/class/product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index c7d525901a3..b95d71e72f0 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3018,8 +3018,8 @@ class Product extends CommonObject $this->duration = $obj->duration; $matches = []; - preg_match('/(\d+)(\w+)/', $obj->duration, $matches); - $this->duration_value = !empty($matches[1]) ? (int) $matches[1] : 0; + preg_match('/([\d.]+)(\w+)/', $obj->duration, $matches); + $this->duration_value = !empty($matches[1]) ? (float) $matches[1] : 0; $this->duration_unit = !empty($matches[2]) ? (string) $matches[2] : null; $this->canvas = $obj->canvas; $this->net_measure = $obj->net_measure; From aa894391795611e4e109a23ea2823f93b021f6e1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 1 Nov 2025 03:01:00 +0100 Subject: [PATCH 20/29] FIX muticompany compatibility (wrong sharing name) (#36013) --- htdocs/knowledgemanagement/knowledgerecord_agenda.php | 2 +- htdocs/knowledgemanagement/knowledgerecord_card.php | 2 +- htdocs/knowledgemanagement/knowledgerecord_contact.php | 2 +- htdocs/knowledgemanagement/knowledgerecord_document.php | 2 +- htdocs/knowledgemanagement/knowledgerecord_note.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/knowledgemanagement/knowledgerecord_agenda.php b/htdocs/knowledgemanagement/knowledgerecord_agenda.php index 63707b92f5b..9d8a11c55aa 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_agenda.php +++ b/htdocs/knowledgemanagement/knowledgerecord_agenda.php @@ -98,7 +98,7 @@ if ($id > 0 || !empty($ref)) { //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); -restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft); +restrictedArea($user, $object->module, $object->id, $object->table_element.'&'.$object->element, $object->element, '', 'rowid', $isdraft); $permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_addupdatedelete.inc.php diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php index 354bdff5580..b6579447311 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_card.php +++ b/htdocs/knowledgemanagement/knowledgerecord_card.php @@ -96,7 +96,7 @@ $upload_dir = $conf->knowledgemanagement->multidir_output[isset($object->entity) //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); -restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft); +restrictedArea($user, $object->module, $object->id, $object->table_element.'&'.$object->element, $object->element, '', 'rowid', $isdraft); //if (empty($conf->knowledgemanagement->enabled)) accessforbidden(); //if (empty($permissiontoread)) accessforbidden(); diff --git a/htdocs/knowledgemanagement/knowledgerecord_contact.php b/htdocs/knowledgemanagement/knowledgerecord_contact.php index 468f66660f4..342c1547c12 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_contact.php +++ b/htdocs/knowledgemanagement/knowledgerecord_contact.php @@ -63,7 +63,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'inclu //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); -restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft); +restrictedArea($user, $object->module, $object->id, $object->table_element.'&'.$object->element, $object->element, '', 'rowid', $isdraft); $permission = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); diff --git a/htdocs/knowledgemanagement/knowledgerecord_document.php b/htdocs/knowledgemanagement/knowledgerecord_document.php index 16d7fbde906..a22c031ff5f 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_document.php +++ b/htdocs/knowledgemanagement/knowledgerecord_document.php @@ -88,7 +88,7 @@ if ($id > 0 || !empty($ref)) { //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); -restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft); +restrictedArea($user, $object->module, $object->id, $object->table_element.'&'.$object->element, $object->element, '', 'rowid', $isdraft); $permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php diff --git a/htdocs/knowledgemanagement/knowledgerecord_note.php b/htdocs/knowledgemanagement/knowledgerecord_note.php index 5e00656e9a7..1f2aec596dd 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_note.php +++ b/htdocs/knowledgemanagement/knowledgerecord_note.php @@ -68,7 +68,7 @@ $permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'wr //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); -restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft); +restrictedArea($user, $object->module, $object->id, $object->table_element.'&'.$object->element, $object->element, '', 'rowid', $isdraft); /* From 17bb284e0ca7b4c05b3ae70fc7406bd25f77a35b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 1 Nov 2025 03:28:51 +0100 Subject: [PATCH 21/29] FIX missing "printFieldListValue" hook (#35990) * FIX missing "printFieldListValue" hook * FIX add action paramter * FIX remove duplicate object --- htdocs/compta/paiement/list.php | 5 +++++ htdocs/fourn/paiement/list.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 85c57d35385..453fb7eb552 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -665,6 +665,11 @@ while ($i < min($num, $limit)) { } } + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$objp, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Status if (!empty($arrayfields['p.statut']['checked'])) { print ''; if (!$i) { From a0da0850a3783eed055d1b2c51154ce7c22e59fa Mon Sep 17 00:00:00 2001 From: PsyCrow <93346975+PsyCrow-code@users.noreply.github.com> Date: Sat, 1 Nov 2025 10:47:52 -0600 Subject: [PATCH 22/29] Add isextrafieldmanaged property to salary class (#36047) FIX #36046 enabling extrafieldmanaged to enable deletion of records from the llx_salay_extrafields table --- htdocs/salaries/class/salary.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 3f527c3e311..5ca7058d74d 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -197,6 +197,7 @@ class Salary extends CommonObject $this->db = $db; $this->element = 'salary'; $this->table_element = 'salary'; + $this->isextrafieldmanaged = 1; $this->fields['ref_ext']['visible'] = getDolGlobalInt('MAIN_LIST_SHOW_REF_EXT'); } From a199a7ded9b035ca34c9e2a79649bd4c51ea1796 Mon Sep 17 00:00:00 2001 From: atm-corentin <165782689+atm-corentin@users.noreply.github.com> Date: Sat, 1 Nov 2025 17:48:50 +0100 Subject: [PATCH 23/29] Fix : performance issues on select bom (#36017) * optimize SQL query in BOM dropdown by joining product table directly and removing redundant Product object creation * Change JOIN to INNER JOIN in SQL query --------- Co-authored-by: Laurent Destailleur --- htdocs/core/class/html.form.class.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a01fd60f567..8ac4ef6e2e1 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2994,8 +2994,9 @@ class Form $out .= ''; + // Reconstruct the selected date + $clonedate = dol_mktime(0, 0, 0, GETPOSTINT('clonedatemonth'), GETPOSTINT('clonedateday'), GETPOSTINT('clonedateyear')); - $formquestion = array( - array( - 'type' => 'date', - 'name' => 'clonedate', - 'label' => '' . $langs->trans("Docdate") . '', - 'value' => $input1 - ) - ); - - if (getDolGlobalString('ACCOUNTING_CLONING_ENABLE_INPUT_JOURNAL')) { - $formquestion[] = array( - 'type' => 'text', - 'name' => 'code_journal', - 'label' => '' . $langs->trans("Codejournal") . '', - 'value' => $input2 - ); - } - - print $form->formconfirm( - $_SERVER["PHP_SELF"], - $langs->trans("ConfirmMassCloneBookkeepingWriting"), - $langs->trans("ConfirmMassCloneBookkeepingWritingQuestion", count($toselect)), - "clonebookkeepingwriting", - $formquestion, - '', 0, 300, 1000, 1 - ); - } - - if ($action == 'preclonebookkeepingwriting' && $confirm == "yes" && $permissiontoadd) { $result = $object->newClone($piece_num, $journal_code, $clonedate); if ($result == -1) { @@ -492,7 +462,7 @@ if (empty($reshook)) { if (!$error) { $db->commit(); - header("Location: " . $_SERVER['PHP_SELF'] . "?piece_num=" . $object->getNextNumMvt() - 1); + header("Location: " . $_SERVER['PHP_SELF'] . "?piece_num=" . ($object->getNextNumMvt() - 1)); exit(); } else { $db->rollback(); @@ -606,6 +576,44 @@ if ($action == 'create') { print load_fiche_titre($langs->trans("UpdateMvts"), $backlink); }*/ + if ($action == 'clonebookkeepingwriting' && $confirm != 'yes' && $permissiontoadd) { + $piece_num = GETPOST('piece_num', 'alpha'); + $formaccounting = new FormAccounting($db); + + $form = new Form($db); + $input1 = $form->selectDate('', 'clonedate', 0, 0, 0, "", 1, 1); + $input2 = $formaccounting->select_journal($journal_code, 'code_journal', 0, 0, 1, 1); + + $formquestion = array( + array( + 'type' => 'other', + 'name' => 'clonedate', + 'label' => '' . $langs->trans("Docdate") . '', + 'value' => $input1 + ) + ); + + $formquestion[] = array('type' => 'hidden', 'name' => 'piece_num', 'value' => $piece_num); + + if (getDolGlobalString('ACCOUNTING_CLONING_ENABLE_INPUT_JOURNAL')) { + $formquestion[] = array( + 'type' => 'text', + 'name' => 'code_journal', + 'label' => '' . $langs->trans("Codejournal") . '', + 'value' => $input2 + ); + } + + print $form->formconfirm( + $_SERVER["PHP_SELF"], + $langs->trans("ConfirmMassCloneBookkeepingWriting"), + $langs->trans("ConfirmMassCloneBookkeepingWritingQuestion", 1), + "clonebookkeepingwriting", + $formquestion, + '', 0, 300, 1000, 0 + ); + } + $head = array(); $h = 0; $head[$h][0] = DOL_URL_ROOT."/accountancy/bookkeeping/card.php".'?piece_num='.((int) $object->piece_num).($mode ? '&mode='.$mode : '').($type ? '&type='.$type : '').'&backtopage='.urlencode($backtopage); From 7ebb809547e338aadac2fd80d44c345998aa4833 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Nov 2025 14:48:56 +0100 Subject: [PATCH 26/29] Fix url or module provider --- htdocs/admin/modulehelp.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index 3175d49ad1f..3b9062e1f18 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -376,10 +376,12 @@ if ($mode == 'desc') { } $editor_url = $objMod->editor_url; if (!preg_match('/^http/', $editor_url)) { - $editor_url = 'http://'.$editor_url; + $editor_url = 'https://'.$editor_url; } + $editor_url_to_show = preg_replace('/(utm_[a-z_]+|origin)=[a-z0-9_]+/i', '', $editor_url); + $editor_url_to_show = preg_replace('/[\/\?]+$/', '', $editor_url_to_show); if (!empty($objMod->editor_url) && !preg_match('/dolibarr\.org/i', $objMod->editor_url)) { - $textexternal .= ($objMod->editor_name != 'dolibarr' ? ' - ' : '').img_picto('', 'globe').' '.$objMod->editor_url.''; + $textexternal .= ($objMod->editor_name != 'dolibarr' ? ' - ' : '').img_picto('', 'globe').' '.$editor_url_to_show.''; } $text .= $textexternal; } else { From 34d95eeac118211e700bc07b7e22db744ce1da00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 2 Nov 2025 21:33:21 +0100 Subject: [PATCH 27/29] fix parameter of getpost in inventory.php (#36070) --- htdocs/product/inventory/inventory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 26921839b6e..a7bffa59e55 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -1194,7 +1194,7 @@ if ($resql) { if ($permissiontoupdatestock) { print ''.img_delete().''; } - $qty_tmp = price2num(GETPOST("id_".$obj->rowid."_input_tmp", 'MS')) >= 0 ? GETPOST("id_".$obj->rowid."_input_tmp") : $qty_view; + $qty_tmp = price2num(GETPOST("id_".$obj->rowid."_input_tmp"), 'MS') >= 0 ? GETPOST("id_".$obj->rowid."_input_tmp") : $qty_view; print ''; print ''; } else { From 6978cecc0df2721e81ac897270dd67bbf61b1338 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 3 Nov 2025 01:32:39 +0100 Subject: [PATCH 28/29] FIX Accountancy - Problem with general setup (#36067) * FIX Accountancy - Problem with general setup * FIX --- htdocs/accountancy/admin/index.php | 167 +++++++++++++++++------------ 1 file changed, 97 insertions(+), 70 deletions(-) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 833923415b9..34345a692ca 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -176,78 +176,102 @@ if ($action == 'updatemode') { } } -if ($action == 'update2') { +if ($action == 'update') { $error = 0; - if (!$error) { - foreach ($list as $constname) { - $constvalue = GETPOST($constname, 'alpha'); - if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { - $error++; - } - } - if ($error) { - setEventMessages($langs->trans("Error"), null, 'errors'); - } + foreach ($list as $constname) { + $constvalue = GETPOST($constname, 'alpha'); - // option in section binding - foreach ($list_binding as $constname) { - $constvalue = GETPOST($constname, 'alpha'); - - if ($constname == 'ACCOUNTING_DATE_START_BINDING') { - $constvalue = dol_mktime(0, 0, 0, GETPOSTINT($constname.'month'), GETPOSTINT($constname.'day'), GETPOSTINT($constname.'year')); - } - - if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { - $error++; - } - } - - // options in section other - if (GETPOSTISSET('ACCOUNTING_LETTERING_NBLETTERS')) { - if (!dolibarr_set_const($db, 'ACCOUNTING_LETTERING_NBLETTERS', GETPOST('ACCOUNTING_LETTERING_NBLETTERS'), 'chaine', 0, '', $conf->entity)) { - $error++; - } - } - - // Export options - $modelcsv = GETPOSTINT('ACCOUNTING_EXPORT_MODELCSV'); - - if (!empty($modelcsv)) { - if (!dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) { - $error++; - } - //if ($modelcsv==AccountancyExport::$EXPORT_TYPE_QUADRATUS || $modelcsv==AccountancyExport::$EXPORT_TYPE_CIEL) { - // dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', 'txt', 'chaine', 0, '', $conf->entity); - //} - } else { + if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { $error++; } + } - foreach ($main_option as $constname) { - $constvalue = GETPOST($constname, 'alpha'); + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} - if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { +if ($action == 'update_binding') { + $error = 0; + + foreach ($list_binding as $constname) { + $constvalue = GETPOST($constname, 'alpha'); + + if ($constname == 'ACCOUNTING_DATE_START_BINDING') { + $constvalue = dol_mktime(0, 0, 0, GETPOSTINT($constname.'month'), GETPOSTINT($constname.'day'), GETPOSTINT($constname.'year')); + } + + if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { + $error++; + } + } + + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + +if ($action == 'update_advanced') { + $error = 0; + + if (GETPOSTISSET('ACCOUNTING_LETTERING_NBLETTERS')) { + if (!dolibarr_set_const($db, 'ACCOUNTING_LETTERING_NBLETTERS', GETPOST('ACCOUNTING_LETTERING_NBLETTERS'), 'chaine', 0, '', $conf->entity)) { + $error++; + } + } + + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + +if ($action == 'update_export') { + $error = 0; + + // Export options + $modelcsv = GETPOSTINT('ACCOUNTING_EXPORT_MODELCSV'); + + if (!$error) { + // reload + $configuration = $accountancyexport->getTypeConfig(); + $listparam = $configuration['param']; + } + + if (!empty($modelcsv)) { + if (!dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) { + $error++; + } + //if ($modelcsv==AccountancyExport::$EXPORT_TYPE_QUADRATUS || $modelcsv==AccountancyExport::$EXPORT_TYPE_CIEL) { + // dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', 'txt', 'chaine', 0, '', $conf->entity); + //} + } else { + $error++; + } + + foreach ($main_option as $constname) { + $constvalue = GETPOST($constname, 'alpha'); + + if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { + $error++; + } + } + + foreach ($listparam[$modelcsv] as $key => $value) { + $constante = $key; + + if (strpos($constante, 'ACCOUNTING') !== false) { + $constvalue = GETPOST($key, 'alpha'); + if (!dolibarr_set_const($db, $constante, $constvalue, 'chaine', 0, '', $conf->entity)) { $error++; } } - - foreach ($listparam[$modelcsv] as $key => $value) { - $constante = $key; - - if (strpos($constante, 'ACCOUNTING') !== false) { - $constvalue = GETPOST($key, 'alpha'); - if (!dolibarr_set_const($db, $constante, $constvalue, 'chaine', 0, '', $conf->entity)) { - $error++; - } - } - } - - if (!$error) { - // reload - $configuration = $accountancyexport->getTypeConfig(); - $listparam = $configuration['param']; - } } if (!$error) { @@ -456,19 +480,19 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1) { print ''; - print '


'; + print '

'; } // Show form main options print $formSetup->generateOutput(true); -print '


'; +print '

'; print '
'; print ''; -print ''; +print ''; print ''; // Binding params @@ -577,7 +601,8 @@ print '
'; print '
'; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print ''; print ''; @@ -527,6 +534,10 @@ $totalarray['nbfield'] = 0; // Fields title label print '
'; + 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->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''.$objectstatic->getNomUrl(5).''; diff --git a/htdocs/fourn/paiement/list.php b/htdocs/fourn/paiement/list.php index 308ac2125e6..9b56692e715 100644 --- a/htdocs/fourn/paiement/list.php +++ b/htdocs/fourn/paiement/list.php @@ -608,6 +608,11 @@ while ($i < min($num, $limit)) { $totalarray['val']['amount'] += $objp->amount; } + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$objp, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Buttons print '
'; print ''; -print '
'; +print '
'; +print ''; // Show numbering options print '

'; @@ -700,7 +725,7 @@ print '

'; // Advanced params print '
'; print ''; -print ''; +print ''; print ''; print '
'; @@ -790,11 +815,16 @@ print '
'; print '
'; +print '
'; print '

'; // Export options +print '
'; +print ''; +print ''; +print ''; print "\n".''."\n"; -// Main Options - print ''; print ''; print ''; @@ -903,7 +931,6 @@ if ($num2) { print '
'; - print ''; // End of page From 3deaf8731b8a9295caed84821cc7a11c8a8e456b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 Nov 2025 13:44:25 +0100 Subject: [PATCH 29/29] FIX Clear filter --- .../knowledgerecord_list.php | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index ef8e79d9fe8..f2368f8e0c8 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -26,14 +26,6 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php'; -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.'/knowledgemanagement/class/knowledgerecord.class.php'; -require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -41,6 +33,13 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php'; +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.'/knowledgemanagement/class/knowledgerecord.class.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; // Load translation files required by the page $langs->loadLangs(array("knowledgemanagement", "other")); @@ -154,12 +153,12 @@ $permissiontovalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $pe if (empty($conf->knowledgemanagement->enabled)) { accessforbidden('Module not enabled'); } -$socid = 0; +//$socid = 0; if ($user->socid > 0) { // Protection if external user //$socid = $user->socid; accessforbidden(); } -$result = restrictedArea($user, 'knowledgemanagement', 0, '', 'knowledgerecord'); +restrictedArea($user, 'knowledgemanagement', 0, '', 'knowledgerecord'); //if (!$permissiontoread) accessforbidden(); @@ -195,6 +194,7 @@ if (empty($reshook)) { $search[$key.'_dtend'] = ''; } } + $search_all = ''; $toselect = array(); $search_array_options = array(); } @@ -400,7 +400,6 @@ if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $s llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'mod-knowledgemanagement page-list bodyforlist'); - $arrayofselected = is_array($toselect) ? $toselect : array(); $param = '';
'.$langs->trans('ExportOptions').'