From 0625eef99a5873f8ce415f17447672207a637b46 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Sep 2025 00:21:29 +0200 Subject: [PATCH 1/9] Fix conditions on module missing --- htdocs/mrp/index.php | 97 ++++++++++++++++++++++---------------------- 1 file changed, 49 insertions(+), 48 deletions(-) diff --git a/htdocs/mrp/index.php b/htdocs/mrp/index.php index aa1b37d12eb..d1be1668e84 100644 --- a/htdocs/mrp/index.php +++ b/htdocs/mrp/index.php @@ -68,7 +68,7 @@ print '
'; * Statistics */ -if ($conf->use_javascript_ajax) { +if ($conf->use_javascript_ajax && isModEnabled('mrp')) { $sql = "SELECT COUNT(t.rowid) as nb, status"; $sql .= " FROM ".MAIN_DB_PREFIX."mrp_mo as t"; $sql .= " GROUP BY t.status"; @@ -218,56 +218,57 @@ if ($resql) { * Last modified MOs */ +if (isModEnabled('mrp')) { + $sql = "SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status"; + $sql .= " FROM ".MAIN_DB_PREFIX."mrp_mo as a"; + $sql .= " WHERE a.entity IN (".getEntity('mo').")"; + $sql .= $db->order("a.tms", "DESC"); + $sql .= $db->plimit($max, 0); -$sql = "SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status"; -$sql .= " FROM ".MAIN_DB_PREFIX."mrp_mo as a"; -$sql .= " WHERE a.entity IN (".getEntity('mo').")"; -$sql .= $db->order("a.tms", "DESC"); -$sql .= $db->plimit($max, 0); - -$resql = $db->query($sql); -if ($resql) { - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - - $num = $db->num_rows($resql); - if ($num) { - $i = 0; - while ($i < $num) { - $obj = $db->fetch_object($resql); - - $staticmo->id = $obj->rowid; - $staticmo->ref = $obj->ref; - $staticmo->date_modification = $obj->datem; - $staticmo->status = $obj->status; - - print ''; - print ''; - print ''; - print ''; - print ''; - $i++; - } - } else { - print ''; - print ''; + $resql = $db->query($sql); + if ($resql) { + print '
'; + print '
'.$langs->trans("LatestMOModified", $max); - $lastmodified = ''; - $lastmodified .= '...'; - $lastmodified .= ''; - print $lastmodified; - print ''; - //print ''.img_picto($langs->trans("FullList"), 'mrp'); - print '
'.$staticmo->getNomUrl(1, 32).''.dol_print_date($db->jdate($obj->datem), 'dayhour').''.$staticmo->getLibStatut(3).'
'.$langs->trans("None").'
'; + print ''; + print ''; + print ''; print ''; + + $num = $db->num_rows($resql); + if ($num) { + $i = 0; + while ($i < $num) { + $obj = $db->fetch_object($resql); + + $staticmo->id = $obj->rowid; + $staticmo->ref = $obj->ref; + $staticmo->date_modification = $obj->datem; + $staticmo->status = $obj->status; + + print ''; + print ''; + print ''; + print ''; + print ''; + $i++; + } + } else { + print ''; + print ''; + print ''; + } + print "
'.$langs->trans("LatestMOModified", $max); + $lastmodified = ''; + $lastmodified .= '...'; + $lastmodified .= ''; + print $lastmodified; + print ''; + //print ''.img_picto($langs->trans("FullList"), 'mrp'); + print '
'.$staticmo->getNomUrl(1, 32).''.dol_print_date($db->jdate($obj->datem), 'dayhour').''.$staticmo->getLibStatut(3).'
'.$langs->trans("None").'
"; + print "
"; + } else { + dol_print_error($db); } - print "
"; - print "
"; -} else { - dol_print_error($db); } print ''; From f39fde3f434695a09244a42952c47354c1c116fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Sep 2025 02:24:28 +0200 Subject: [PATCH 2/9] Fix corrupted type of vat -1. --- htdocs/core/class/html.form.class.php | 6 +++--- htdocs/install/mysql/migration/repair.sql | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 3a20568546c..6785540205d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6843,7 +6843,7 @@ class Form $tmparray = array(); $tmparray['rowid'] = $obj->rowid; - $tmparray['type_vat'] = $obj->type_vat; + $tmparray['type_vat'] = ($obj->type_vat <= 0 ? 0 : $obj->type_vat); // Some version have type_vat corrupted with value -1 $tmparray['code'] = $obj->code; $tmparray['txtva'] = $obj->taux; $tmparray['nprtva'] = $obj->recuperableonly; @@ -6957,7 +6957,8 @@ class Form } else { $code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente } - if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) { // If option to have vat for end customer for services is on + + if ($societe_vendeuse == $mysoc && getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) { // If option to have vat for end customer for services is on require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; // If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries // If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country @@ -7006,7 +7007,6 @@ class Form } $num = count($arrayofvatrates); - if ($num > 0) { // Define the rate to pre-select (if defaulttx not forced so is -1 or '') if ($defaulttx < 0 || dol_strlen($defaulttx) == 0) { diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 8262a3e1c98..937cc8a7d63 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -683,3 +683,5 @@ ALTER TABLE llx_product_attribute_combination_price_level ADD UNIQUE INDEX uk_pr -- delete a constant that should not be set DELETE FROM llx_const WHERE name = 'INVOICE_USE_RETAINED_WARRANTY' AND value = -1; + +UPDATE llx_c_tva SET type_vat = 0 WHERE type_vat < 0; From d4f39889f5d10825bafeeae1e9073dc9726d8295 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Sep 2025 02:44:02 +0200 Subject: [PATCH 3/9] FIX #34678 --- htdocs/expensereport/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index cf4bed06196..3b009d3e849 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2448,7 +2448,8 @@ if ($action == 'create') { // VAT $selectedvat = price2num($line->vatrate).(!empty($line->vat_src_code) ? ' ('.$line->vat_src_code.')' : ''); print ''; - print $form->load_tva('vatrate', (GETPOSTISSET("vatrate") ? GETPOST("vatrate") : $selectedvat), $mysoc, '', 0, 0, '', false, 1, 2); + // We must use null, null for seller and buyer as we don't know them for expense report. + print $form->load_tva('vatrate', (GETPOSTISSET("vatrate") ? GETPOST("vatrate") : $selectedvat), null, null, 0, 0, '', false, 1, 2); print ''; // Unit price @@ -2634,6 +2635,7 @@ if ($action == 'create') { // If option to have no default VAT on expense report is on, we force MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none'; } + // We must use null, null for seller and buyer as we don't know them for expense report. print $form->load_tva('vatrate', (!empty($vatrate) ? $vatrate : $defaultvat), null, null, 0, 0, '', false, 1); print ''; From c5451242e713cf17d9e6f2f0846516d0a2b08858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Benke?= <1179011+defrance@users.noreply.github.com> Date: Wed, 17 Sep 2025 14:46:32 +0200 Subject: [PATCH 4/9] Add default values for database configuration (#35366) warning error yet correct on old version --- htdocs/install/fileconf.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index 86cd4af0f5c..a6eb8cd2b52 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -287,6 +287,12 @@ if (!empty($force_install_noedit)) { if (!isset($dolibarr_main_db_host)) { $dolibarr_main_db_host = "localhost"; } + if (!isset($dolibarr_main_db_port)) { + $dolibarr_main_db_port = ""; + } + if (!isset($dolibarr_main_db_user)) { + $dolibarr_main_db_user = ""; + } ?> From 69c65c5f4d05e614e40dbf1f4419a5e9e8f6d346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 17 Sep 2025 14:47:51 +0200 Subject: [PATCH 5/9] fix CI v22 (#35370) * fix CI v22 * Update cron_run_jobs.php * Update files.lib.php --------- Co-authored-by: Laurent Destailleur --- htdocs/core/lib/files.lib.php | 10 +++++----- scripts/cron/cron_run_jobs.php | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index b827cf5d2c3..ffbb161b9d7 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2431,11 +2431,11 @@ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uplo /** * Delete files into database index using search criteria. * - * @param string $dir Directory name (full real path without ending /) - * @param string $file File name - * @param string $mode How file was created ('uploaded', 'generated', ...) - * @param Object $object object used for entity - * @return int Return integer <0 if KO, 0 if nothing done, >0 if OK + * @param string $dir Directory name (full real path without ending /) + * @param string $file File name + * @param string $mode How file was created ('uploaded', 'generated', ...) + * @param ?CommonObject $object object used for entity + * @return int Return integer <0 if KO, 0 if nothing done, >0 if OK */ function deleteFilesIntoDatabaseIndex($dir, $file, $mode = 'uploaded', $object = null) { diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index bc78483ebd1..2f029104626 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -3,7 +3,7 @@ /* * Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013-2015 Laurent Destailleur * Copyright (C) 2024 Frédéric France * Copyright (C) 2025 MDW * @@ -221,8 +221,8 @@ if (is_array($object->lines) && (count($object->lines) > 0)) { // Loop over job foreach ($object->lines as $line) { - /** @var CronJob $line */ - '@phan-var-force CronJob $line'; + /** @var Cronjob $line */ + '@phan-var-force Cronjob $line'; dol_syslog("cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label, LOG_DEBUG); echo "cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label; From ce466110311f117ece886d044aaf79eb6ba0bf28 Mon Sep 17 00:00:00 2001 From: Bahfir Abbes Date: Wed, 17 Sep 2025 15:11:09 +0200 Subject: [PATCH 6/9] Fix:prevent handling update action by generic include of actions_addupdatedelete.inc.php (#35369) * Fix:prevent handling update action by generic include of actions_addupdatedelete.inc.php Fix: To prevent handling update action by generic post update action in inventories at /core/actions_addupdatedelete.inc.php, we need to unset $action variable, otherwise $object fileds are filled with with empty values. * Update inventory.php --------- Co-authored-by: Laurent Destailleur --- htdocs/product/inventory/inventory.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index a0835b81ffb..26921839b6e 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -285,6 +285,7 @@ if (empty($reshook)) { } else { $db->rollback(); } + $action = ''; } // Save quantity found during inventory (when we click on Save button on inventory page) From ea00719449762b2eb53196c55fe7b5e887a56827 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Wed, 17 Sep 2025 15:55:33 +0200 Subject: [PATCH 7/9] Fix default sort order in bom list --- htdocs/bom/bom_list.php | 7 ++----- htdocs/workstation/workstation_list.php | 3 +-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 80c98a3fc68..4faf0ce8fa1 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -84,8 +84,7 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen // Default sort order (if not yet defined by previous GETPOST) if (!$sortfield) { - reset($object->fields); // Reset is required to avoid key() to return null. - $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition. + $sortfield = "t.ref"; // Set here default search field. By default 1st field in definition. } if (!$sortorder) { $sortorder = "ASC"; @@ -750,9 +749,7 @@ while ($i < $imaxinloop) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } - if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall'; - } elseif ($key == 'ref') { + if ($key == 'ref') { $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall'; } diff --git a/htdocs/workstation/workstation_list.php b/htdocs/workstation/workstation_list.php index 1785b4d4e7d..9b7ccb16ff4 100644 --- a/htdocs/workstation/workstation_list.php +++ b/htdocs/workstation/workstation_list.php @@ -87,8 +87,7 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen // Default sort order (if not yet defined by previous GETPOST) if (!$sortfield) { - reset($object->fields); // Reset is required to avoid key() to return null. - $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition. + $sortfield = "t.ref"; // Set here default search field. By default 1st field in definition. } if (!$sortorder) { $sortorder = "ASC"; From bf5a0c9ce7e4334d4e032b73899af333c0f85f7a Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Wed, 17 Sep 2025 18:16:48 +0200 Subject: [PATCH 8/9] fix: php 8 warning (#35363) * fix: php 8 warning * fix: php 8 warning * fix: php 8 warning --------- Co-authored-by: Laurent Destailleur --- htdocs/admin/mails_templates.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index a7413028b3d..035058e730f 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -1158,7 +1158,8 @@ if ($num) { $fieldsforcontent[] = 'content_lines'; } - $parameters = array('fieldsforcontent' => &$fieldsforcontent, 'tabname' => $tabname[$id]); + $tabname=isset($tabname[$id]) ? $tabname[$id] :''; + $parameters = array('fieldsforcontent' => &$fieldsforcontent, 'tabname' => $tabname); $hookmanager->executeHooks('editEmailTemplateFieldsForContent', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks foreach ($fieldsforcontent as $tmpfieldlist) { From 7920cf8596af87f00885dafce74bdba71da7004c Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Wed, 17 Sep 2025 18:19:52 +0200 Subject: [PATCH 9/9] Fix option SERVICE_ARE_ECOMMERCE_200238EC (#35372) --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7062a87a78e..a90cf42b46f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6440,7 +6440,7 @@ class Form } if (!empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) { // If option to have vat for end customer for services is on require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; - if (!isInEEC($societe_vendeuse) && (!is_object($societe_acheteuse) || (isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()))) { + if (is_object($societe_vendeuse) && is_object($societe_acheteuse) && isInEEC($societe_vendeuse) && isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()) { // We also add the buyer country code if (is_numeric($type)) { if ($type == 1) { // We know product is a service