From 0804ebe08a00eb1690505d3299e95a008548f28b Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Thu, 14 Aug 2025 00:14:04 +0200 Subject: [PATCH 1/8] Fix type --- 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 b98463057eb..cd810b12208 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8070,7 +8070,7 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart = ' // Here, $object->id, $object->ref and $modulepart are required. if (in_array($modulepart, array('societe', 'thirdparty')) && $object instanceOf Societe) { // Special case for thirdparty, where the ref is a company name that is not unique so path on disk is using the ID instead of the ref - $path = dol_sanitizeFileName($object->id); + $path = dol_sanitizeFileName((string) $object->id); } else { $path = dol_sanitizeFileName(empty($object->ref) ? (string) ((is_object($object) && property_exists($object, 'id')) ? $object->id : '') : $object->ref); } From 90bc3d74e7f72372bdd4e2ced1a387b82e28c61a Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Thu, 14 Aug 2025 13:50:53 +0200 Subject: [PATCH 2/8] FIX mailing destination list title (#34929) * Fix mailing destination list title * Some more fix on checkbox column * $conf->main_checkbox_left_column is available in V21.0.3 * Right selector has less option the left selector. --------- Co-authored-by: Laurent Destailleur --- htdocs/comm/mailing/cibles.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index ed5e64a5a39..4b1056238c2 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -857,7 +857,7 @@ if ($object->fetch($id) >= 0) { print ''; // Action column - if (empty($conf->main_checkbox_left_column)) { + if (!$conf->main_checkbox_left_column) { print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; @@ -914,7 +914,7 @@ if ($object->fetch($id) >= 0) { print ''; // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if ($conf->main_checkbox_left_column) { print ''; print ''; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined @@ -998,9 +998,16 @@ if ($object->fetch($id) >= 0) { print ''; // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if (!$conf->main_checkbox_left_column) { print ''; 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 ''; + } if ($obj->status == $object::STATUS_DRAFT) { // If status of target line is not sent yet if ($user->hasRight('mailing', 'creer')) { print ''.img_delete($langs->trans("RemoveRecipient")).''; From 7f6409504886d334c65574e222c3445e289cdbcf Mon Sep 17 00:00:00 2001 From: hermans Date: Thu, 14 Aug 2025 18:52:32 +0700 Subject: [PATCH 3/8] Bug fix on fourniseur commande kanban view (#34945) * bug fix for: https://github.com/Dolibarr/dolibarr/issues/34939 * Bug fix for: Dolibarr Issue #34939 * Revert "bug fix for: https://github.com/Dolibarr/dolibarr/issues/34939" This reverts commit bd4c1ccc41319a37ef9e70cec61c80a5efbbd4e8. * Revert "Bug fix for: Dolibarr Issue #34939" This reverts commit 8e46f863b943095b06ab3ae7dea248f12ea2c6e6. --- htdocs/fourn/commande/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 17e43f5f1c5..34300056957 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1773,6 +1773,7 @@ if ($resql) { $objectstatic->note_public = $obj->note_public; $objectstatic->note_private = $obj->note_private; $objectstatic->statut = $obj->fk_statut; + $objectstatic->status = $obj->fk_statut; if ($mode == 'kanban') { if ($i == 0) { From 1fb37db6f6005cd7c76abefcd7560eb05c671ca2 Mon Sep 17 00:00:00 2001 From: hermans Date: Fri, 15 Aug 2025 22:26:39 +0700 Subject: [PATCH 4/8] Bug Fix for issue 34898, default warehause and obj->endbrowid not exist on receipt.class (#34959) * bug fix for: https://github.com/Dolibarr/dolibarr/issues/34939 * Bug fix for: Dolibarr Issue #34939 * Revert "bug fix for: https://github.com/Dolibarr/dolibarr/issues/34939" This reverts commit bd4c1ccc41319a37ef9e70cec61c80a5efbbd4e8. * Revert "Bug fix for: Dolibarr Issue #34939" This reverts commit 8e46f863b943095b06ab3ae7dea248f12ea2c6e6. * Bug fix for issue https://github.com/Dolibarr/dolibarr/issues/34898 * fix bug on reception setClosed: ->edbrowid is not exist * Fix missing variable for obj->endbrowid in etDraft,valid,setClosed * fix white space * remove white space --- htdocs/commande/class/commande.class.php | 1 + htdocs/reception/class/reception.class.php | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index a1af5aa5897..06467ac3855 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3422,6 +3422,7 @@ class Commande extends CommonOrder $sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").","; $sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").","; $sql .= " model_pdf=".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null").","; + $sql .= " fk_warehouse=".($this->warehouse_id > 0 ? $this->warehouse_id : "null").","; $sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null"); $sql .= " WHERE rowid=".((int) $this->id); diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index fda0c0a4cec..d032ce057bc 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -631,6 +631,7 @@ class Reception extends CommonObject if ($qty == 0 || ($qty < 0 && !getDolGlobalInt('RECEPTION_ALLOW_NEGATIVE_QTY'))) { continue; } + dol_syslog(get_class($this)."::valid movement index ".$i." ed.rowid=".$obj->rowid); //var_dump($this->lines[$i]); @@ -1748,7 +1749,8 @@ class Reception extends CommonObject if ($qty <= 0) { continue; } - dol_syslog(get_class($this)."::valid movement index ".$i." ed.rowid=".$obj->rowid." edb.rowid=".$obj->edbrowid); + + dol_syslog(get_class($this)."::valid movement index ".$i." ed.rowid=".$obj->rowid); $mouvS = new MouvementStock($this->db); $mouvS->origin = &$this; @@ -1905,7 +1907,6 @@ class Reception extends CommonObject if ($qty <= 0) { continue; } - dol_syslog(get_class($this)."::reopen reception movement index ".$i." ed.rowid=".$obj->rowid); //var_dump($this->lines[$i]); @@ -2038,6 +2039,10 @@ class Reception extends CommonObject $qty = $obj->qty; + if ($qty <= 0) { + continue; + } + dol_syslog(get_class($this)."::reopen reception movement index ".$i." ed.rowid=".$obj->rowid); //var_dump($this->lines[$i]); From 63924e2f94b58718d42d00efd4d14d161c00963d Mon Sep 17 00:00:00 2001 From: hermans <938767+hermans@users.noreply.github.com> Date: Tue, 19 Aug 2025 16:41:03 +0700 Subject: [PATCH 5/8] Fix facture haader title on dolibar-21 (#34993) * Fix facture haader title on dolibar-21 * fix error - No space found after comma in argument list --------- Co-authored-by: hermans --- htdocs/compta/facture/stats/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index c2e5db0de9c..31bda4e46dd 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -99,7 +99,6 @@ $form = new Form($db); $formcompany = new FormCompany($db); $formother = new FormOther($db); -llxHeader(); $picto = 'bill'; $title = $langs->trans("BillsStatistics"); @@ -111,6 +110,7 @@ if ($mode == 'supplier') { $dir = $conf->fournisseur->facture->dir_temp; } +llxHeader('', $title); print load_fiche_titre($title, '', $picto); From c34f3c07fdefc984677f76701d04eb08835f9c06 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Tue, 19 Aug 2025 11:51:53 +0200 Subject: [PATCH 6/8] css --- htdocs/product/stock/product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 7ff452a2242..2fa11c0b6e4 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -676,7 +676,7 @@ if ($id > 0 || $ref) { // AWP - print ''; + print ''; print $form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc")); print ''; print ''; From f722602402b8c3edec8783f5a87974894fde28c7 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Wed, 20 Aug 2025 16:02:46 +0200 Subject: [PATCH 7/8] Fix comparison on version to show the warning to upgrade database --- htdocs/admin/system/about.php | 2 +- htdocs/admin/system/filecheck.php | 11 ++++++----- htdocs/core/lib/admin.lib.php | 18 +++++++++-------- htdocs/install/check.php | 4 ++-- test/phpunit/AdminLibTest.php | 32 +++++++++++++++++++++++++++++++ 5 files changed, 51 insertions(+), 16 deletions(-) diff --git a/htdocs/admin/system/about.php b/htdocs/admin/system/about.php index aa552c5d052..3708d83e7df 100644 --- a/htdocs/admin/system/about.php +++ b/htdocs/admin/system/about.php @@ -210,7 +210,7 @@ print '
'; $showpromotemessage = 1; if ($showpromotemessage) { $tmp = versiondolibarrarray(); - if (is_numeric($tmp[2])) { // Not alpha, beta or rc + if (is_numeric($tmp[2]) && !isset($tmp[3])) { // Not alpha, beta or rc print '
'; print '
'; diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 01e67514e49..84d436a2d45 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -27,9 +27,6 @@ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; - /** * @var Conf $conf * @var DoliDB $db @@ -38,6 +35,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.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'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; + $langs->load("admin"); @@ -70,12 +71,12 @@ print ''.$langs->trans("VersionProgram").'trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, getDolGlobalString('MAIN_VERSION_LAST_INSTALL'))); } } else { // Compare version with last upgrade database version - if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_UPGRADE) { + if (in_array(versioncompare(versiondolibarrarray(), preg_split('/[\-\.]/', getDolGlobalString('MAIN_VERSION_LAST_UPGRADE'))), array(-2, -1, 1, 2))) { print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, getDolGlobalString('MAIN_VERSION_LAST_UPGRADE'))); } } diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 68bc8f95d53..5709d9da464 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -52,8 +52,10 @@ function versiontostring($versionarray) } /** - * Compare 2 versions (stored into 2 arrays). - * To check if Dolibarr version is lower than (x,y,z), do "if versioncompare(versiondolibarrarray(), array(x.y.z)) <= 0" + * Compare 2 versions (stored into 2 arrays), to know if a version (a,b,c) is lower than (x,y,z) + * To check using a string version do a preg_split('/[\.\-]/', strinversion) to convert the string into an array. + * To check with Dolibarr version use versiondolibarrarray() to get the array of Dolibarr current version + * * For example: if (versioncompare(versiondolibarrarray(),array(4,0,-5)) >= 0) is true if version is 4.0 alpha or higher. * For example: if (versioncompare(versiondolibarrarray(),array(4,0,0)) >= 0) is true if version is 4.0 final or higher. * For example: if (versioncompare(versiondolibarrarray(),array(4,0,1)) >= 0) is true if version is 4.0.1 or higher. @@ -61,9 +63,9 @@ function versiontostring($versionarray) * * @param array $versionarray1 Array of version (vermajor,verminor,patch) * @param array $versionarray2 Array of version (vermajor,verminor,patch) - * @return int<-4,4> -4,-3,-2,-1 if versionarray1versionarray2 (value depends on level of difference) + * @return int<-4,4> -4,-3,-2,-1 if versionarray1versionarray2 (value depends on level of difference) * @see versiontostring() */ function versioncompare($versionarray1, $versionarray2) @@ -118,7 +120,7 @@ function versioncompare($versionarray1, $versionarray2) } } //print join('.',$versionarray1).'('.count($versionarray1).') / '.join('.',$versionarray2).'('.count($versionarray2).') => '.$ret.'
'."\n"; - return $ret; + return $ret; // return level=1 if difference is on the main version, level=2 on minor version, level=3 on maintenance version, level=4 on development phase version } @@ -136,12 +138,12 @@ function versionphparray() /** * Return version Dolibarr * - * @return array,string> Tableau de version (vermajeur,vermineur,autre) + * @return array,string> Array of version (vermajor,verminor,vermaintenance,other) * @see versioncompare() */ function versiondolibarrarray() { - return explode('.', DOL_VERSION); + return preg_split('/[\-\.]/', DOL_VERSION); } diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 2e9e89c8dc9..59b8c618549 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -402,13 +402,13 @@ if (!file_exists($conffile)) { // Current version is $conf->global->MAIN_VERSION_LAST_UPGRADE // Version to install is DOL_VERSION - $dolibarrlastupgradeversionarray = preg_split('/[\.-]/', isset($conf->global->MAIN_VERSION_LAST_UPGRADE) ? $conf->global->MAIN_VERSION_LAST_UPGRADE : (isset($conf->global->MAIN_VERSION_LAST_INSTALL) ? $conf->global->MAIN_VERSION_LAST_INSTALL : '')); + $dolibarrlastupgradeversionarray = preg_split('/[\.-]/', getDolGlobalString('MAIN_VERSION_LAST_UPGRADE', getDolGlobalString('MAIN_VERSION_LAST_INSTALL'))); $dolibarrversiontoinstallarray = versiondolibarrarray(); } // Show title if (getDolGlobalString('MAIN_VERSION_LAST_UPGRADE') || getDolGlobalString('MAIN_VERSION_LAST_INSTALL')) { - print $langs->trans("VersionLastUpgrade").': '.(!getDolGlobalString('MAIN_VERSION_LAST_UPGRADE') ? $conf->global->MAIN_VERSION_LAST_INSTALL : $conf->global->MAIN_VERSION_LAST_UPGRADE).' - '; + print $langs->trans("VersionLastUpgrade").': '.getDolGlobalString('MAIN_VERSION_LAST_UPGRADE', getDolGlobalString('MAIN_VERSION_LAST_INSTALL')).' - '; print $langs->trans("VersionProgram").': '.DOL_VERSION.''; //print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired")); print '
'; diff --git a/test/phpunit/AdminLibTest.php b/test/phpunit/AdminLibTest.php index a65234cecf0..2362afb5ae7 100644 --- a/test/phpunit/AdminLibTest.php +++ b/test/phpunit/AdminLibTest.php @@ -76,6 +76,38 @@ class AdminLibTest extends CommonClassTest print __METHOD__." result=".$result."\n"; $this->assertEquals(0, $result); + // Upgrade required + $v1 = '21.0.0-beta'; $v2 = '21.0.0-rc'; + $versioncompared = abs(versioncompare(preg_split('/[\.\-]/', $v1), preg_split('/[\.\-]/', $v2))); + $upgraderequired = in_array($versioncompared, array(-4, -2, -1, 1, 2, 4)); + $this->assertEquals(true, $upgraderequired, 'Error with v1='.$v1.' v2='.$v2.' versioncompared='.$versioncompared); + + $v1 = '21.0.0-beta'; $v2 = '21.0.0'; + $versioncompared = abs(versioncompare(preg_split('/[\.\-]/', $v1), preg_split('/[\.\-]/', $v2))); + $upgraderequired = in_array($versioncompared, array(-4, -2, -1, 1, 2, 4)); + $this->assertEquals(true, $upgraderequired, 'Error with v1='.$v1.' v2='.$v2.' versioncompared='.$versioncompared); + + $v1 = '21.1.1'; $v2 = '21.0.1'; + $versioncompared = abs(versioncompare(preg_split('/[\.\-]/', $v1), preg_split('/[\.\-]/', $v2))); + $upgraderequired = in_array($versioncompared, array(-4, -2, -1, 1, 2, 4)); + $this->assertEquals(true, $upgraderequired, 'Error with v1='.$v1.' v2='.$v2.' versioncompared='.$versioncompared); + + $v1 = '22.0.1'; $v2 = '21.0.1'; + $versioncompared = abs(versioncompare(preg_split('/[\.\-]/', $v1), preg_split('/[\.\-]/', $v2))); + $upgraderequired = in_array($versioncompared, array(-4, -2, -1, 1, 2, 4)); + $this->assertEquals(true, $upgraderequired, 'Error with v1='.$v1.' v2='.$v2.' versioncompared='.$versioncompared); + + // Upgrade not required + $v1 = '21.0.0'; $v2 = '21.0.0'; + $versioncompared = abs(versioncompare(preg_split('/[\.\-]/', $v1), preg_split('/[\.\-]/', $v2))); + $upgraderequired = in_array($versioncompared, array(-4, -2, -1, 1, 2, 4)); + $this->assertEquals(false, $upgraderequired, 'Error with v1='.$v1.' v2='.$v2.' versioncompared='.$versioncompared); + + $v1 = '21.0.1'; $v2 = '21.0.0'; + $versioncompared = abs(versioncompare(preg_split('/[\.\-]/', $v1), preg_split('/[\.\-]/', $v2))); + $upgraderequired = in_array($versioncompared, array(-4, -2, -1, 1, 2, 4)); + $this->assertEquals(false, $upgraderequired, 'Error with v1='.$v1.' v2='.$v2.' versioncompared='.$versioncompared); + return $result; } From e351f7bcd52d33061d695a38ea7e60a84dfb3d8b Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Wed, 20 Aug 2025 16:26:29 +0200 Subject: [PATCH 8/8] FIX a Fatal error when a trigger files is not correctly named. --- htdocs/core/class/interfaces.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php index 5f413215bee..72ceaaaee0b 100644 --- a/htdocs/core/class/interfaces.class.php +++ b/htdocs/core/class/interfaces.class.php @@ -185,6 +185,10 @@ class Interfaces if (empty($modName)) { continue; } + if (!class_exists($modName)) { + dol_syslog(get_class($this)."::run_triggers action=".$action." A trigger file was found with a name interfaces_*_*_".preg_replace('/^interface/', '', strtolower($modName)).".class.php, but the class ".$modName." seems to not exists even after the include of this interface file. Surely a bug in the trigger file or in its name.", LOG_ERR); + continue; + } $objMod = new $modName($this->db); '@phan-var-force DolibarrTriggers $objMod';