From d1d221a10c4872f7a8c03695b26ad0b9200ca487 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Fri, 11 Jul 2025 14:12:53 +0200 Subject: [PATCH 01/11] Debug v22 --- htdocs/adherents/list.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 2c073942703..40f16558b20 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -1292,14 +1292,14 @@ while ($i < $imaxinloop) { } // Technical ID if (!empty($arrayfields['d.rowid']['checked'])) { - print ''.$obj->rowid.''; + print ''.dolPrintHTML($obj->rowid).''; if (!$i) { $totalarray['nbfield']++; } } // Ref if (!empty($arrayfields['d.ref']['checked'])) { - print ""; + print ''; print $memberstatic->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1); print "\n"; if (!$i) { @@ -1309,7 +1309,7 @@ while ($i < $imaxinloop) { // Title/Civility if (!empty($arrayfields['d.civility']['checked'])) { print ""; - print dol_escape_htmltag($obj->civility); + print dolPrintHTML($obj->civility); print "\n"; if (!$i) { $totalarray['nbfield']++; @@ -1348,13 +1348,13 @@ while ($i < $imaxinloop) { } // Company if (!empty($arrayfields['d.company']['checked'])) { - print ''; + print ''; print $companynametoshow; print "\n"; } // Login if (!empty($arrayfields['d.login']['checked'])) { - print ''.$obj->login."\n"; + print ''.dolPrintHTML($obj->login)."\n"; if (!$i) { $totalarray['nbfield']++; } @@ -1382,7 +1382,7 @@ while ($i < $imaxinloop) { // Address if (!empty($arrayfields['d.address']['checked'])) { print ''; - print dol_escape_htmltag($obj->address); + print dolPrintHTML($obj->address); print ''; if (!$i) { $totalarray['nbfield']++; @@ -1391,7 +1391,7 @@ while ($i < $imaxinloop) { // Zip if (!empty($arrayfields['d.zip']['checked'])) { print ''; - print dol_escape_htmltag($obj->zip); + print dolPrintHTML($obj->zip); print ''; if (!$i) { $totalarray['nbfield']++; @@ -1400,7 +1400,7 @@ while ($i < $imaxinloop) { // Town if (!empty($arrayfields['d.town']['checked'])) { print ''; - print dol_escape_htmltag($obj->town); + print dolPrintHTML($obj->town); print ''; if (!$i) { $totalarray['nbfield']++; @@ -1409,7 +1409,7 @@ while ($i < $imaxinloop) { // State / County / Departement if (!empty($arrayfields['state.nom']['checked'])) { print ""; - print dol_escape_htmltag($obj->state_name); + print dolPrintHTML($obj->state_name); print "\n"; if (!$i) { $totalarray['nbfield']++; @@ -1418,8 +1418,8 @@ while ($i < $imaxinloop) { // Country if (!empty($arrayfields['country.code_iso']['checked'])) { $tmparray = getCountry($obj->country, 'all'); - print ''; - print dol_escape_htmltag($tmparray['label']); + print ''; + print dolPrintHTML($tmparray['label']); print ''; if (!$i) { $totalarray['nbfield']++; @@ -1523,8 +1523,8 @@ while ($i < $imaxinloop) { } // Import key if (!empty($arrayfields['d.import_key']['checked'])) { - print ''; - print dol_escape_htmltag($obj->import_key); + print ''; + print dolPrintHTML($obj->import_key); print "\n"; if (!$i) { $totalarray['nbfield']++; From 87370eb0baecd6723c79984b0b845a028681fcb5 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Tue, 15 Jul 2025 05:42:06 +0200 Subject: [PATCH 02/11] Sec: Remove all functions that accept callable params. --- htdocs/core/lib/functions.lib.php | 22 ++++++-- htdocs/install/upgrade.php | 10 ++++ htdocs/install/upgrade2.php | 91 +++++++++++++++++++++++++++---- test/phpunit/SecurityTest.php | 12 ++++ 4 files changed, 119 insertions(+), 16 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e3a05e66ece..5674c20027d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10709,14 +10709,14 @@ function verifCond($strToEvaluate, $onlysimplestring = '1') /** * Replace eval function to add more security. - * This function is called by verifCond() or trans() and transnoentitiesnoconv(). + * This function is called by verifCond() for example. * * @param string $s String to evaluate * @param int<0,1> $returnvalue 0=No return (deprecated, used to execute eval($a=something)). 1=Value of eval is returned (used to eval($something)). * @param int<0,1> $hideerrors 1=Hide errors - * @param string $onlysimplestring '0' (deprecated, do not use it anymore)=Accept all chars, - * '1' (most common use)=Accept only simple string with char 'a-z0-9\s^$_+-.*>&|=!?():"\',/@';', - * '2' (used for example for the compute property of extrafields)=Accept also '<[]' + * @param string $onlysimplestring '0' (deprecated, do not use it anymore) = Accept all chars, + * '1' (most common use) = Accept only simple string with char 'a-z0-9\s^$_+-.*>&|=!?():"\',/@';', + * '2' (used for example for the compute property of extrafields) = Accept also '<[]' * @return void|string Nothing or return result of eval (even if type can be int, it is safer to assume string and find all potential typing issues as abs(dol_eval(...)). * @see verifCond(), checkPHPCode() to see sanitizing rules that should be very close. * @phan-suppress PhanPluginUnsafeEval @@ -10860,16 +10860,28 @@ function dol_eval($s, $returnvalue = 1, $hideerrors = 1, $onlysimplestring = '1' $forbiddenphpstrings = array_merge($forbiddenphpstrings, array('_ENV', '_SESSION', '_COOKIE', '_GET', '_POST', '_REQUEST', 'ReflectionFunction')); // We list all forbidden function as keywords we don't want to see (we don't mind it if is "kewyord(" or just "keyword", we don't want "keyword" at all) + // We must exclude all functions that allow to execute another function. This includes all function that has a parameter with type "callable" to avoid things + // like we can do with array_map and its callable parameter: dol_eval('json_encode(array_map(implode("",["ex","ec"]), ["id"]))', 1, 1, '0') $forbiddenphpfunctions = array(); // @phpcs:ignore $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("base64"."_"."decode", "rawurl"."decode", "url"."decode", "str"."_rot13", "hex"."2bin")); // name of forbidden functions are split to avoid false positive $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("override_function", "session_id", "session_create_id", "session_regenerate_id")); $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("get_defined_functions", "get_defined_vars", "get_defined_constants", "get_declared_classes")); $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("function", "call_user_func", "call_user_func_array")); + + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("array_all", "array_any", "array_diff_ukey", "array_filter", "array_find", "array_find_key", "array_map", "array_reduce", "array_intersect_uassoc", "array_intersect_ukey", "array_walk", "array_walk_recursive")); + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("usort", "uasort", "uksort", "preg_replace_callback", "preg_replace_callback_array", "header_register_callback")); + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("set_error_handler", "set_exception_handler", "libxml_set_external_entity_loader", "register_shutdown_function", "register_tick_function", "unregister_tick_function")); + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("spl_autoload_register", "spl_autoload_unregister", "iterator_apply", "session_set_save_handler")); + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("forward_static_call", "forward_static_call_array", "register_postsend_function")); + + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("ob_start")); + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("require", "include", "require_once", "include_once")); $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("exec", "passthru", "shell_exec", "system", "proc_open", "popen")); $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_eval", "executeCLI", "verifCond")); // native dolibarr functions - $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("eval", "create_function", "assert", "mb_ereg_replace")); // function with eval capabilities + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("eval", "create_function", "assert", "mb_ereg_replace", "mb_ereg_replace_callback")); // function with eval capabilities + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("readline_completion_function", "readline_callback_handler_install")); $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_compress_dir", "dol_decode", "dol_delete_file", "dol_delete_dir", "dol_delete_dir_recursive", "dol_copy", "archiveOrBackupFile")); // more dolibarr functions $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("fopen", "file_put_contents", "fputs", "fputscsv", "fwrite", "fpassthru", "mkdir", "rmdir", "symlink", "touch", "unlink", "umask")); $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("require", "include")); diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index 4a09cff906f..47bcc99438b 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -40,6 +40,11 @@ define('ALLOWED_IF_UPGRADE_UNLOCK_FOUND', 1); include_once 'inc.php'; + +/** + * @var string $conffile + */ + if (!file_exists($conffile)) { print 'Error: Dolibarr config file was not found. This may means that Dolibarr is not installed yet. Please call the page "/install/index.php" instead of "/install/upgrade.php").'; } @@ -48,6 +53,11 @@ require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php'; global $langs; +/** + * @var Conf $conf + * @var Translate $langs + */ + $grant_query = ''; $step = 2; $ok = 0; diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 107f68e4a89..5d21b8a59b9 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -43,6 +43,11 @@ define('ALLOWED_IF_UPGRADE_UNLOCK_FOUND', 1); include_once 'inc.php'; + +/** + * @var string $conffile + */ + if (!file_exists($conffile)) { print 'Error: Dolibarr config file was not found. This may means that Dolibarr is not installed yet. Please call the page "/install/index.php" instead of "/install/upgrade.php").'; } @@ -59,13 +64,17 @@ require_once $dolibarr_main_document_root.'/core/lib/files.lib.php'; global $langs; +/** + * @var Conf $conf + * @var Translate $langs + */ + $grant_query = ''; $step = 2; $error = 0; -// Cette page peut etre longue. On augmente le delai autorise. -// Ne fonctionne que si on est pas en safe_mode. +// 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')) { @@ -230,17 +239,23 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $db->begin(); foreach ($listofentities as $entity) { + dol_syslog("Process upgrade2 for entity ".$entity); + // Set $conf context for entity $conf->setEntityValues($db, $entity); + // Reset forced setup after the setValues if (defined('SYSLOG_FILE')) { $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE'); } - $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1; + + $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1; // Add also log into conf->logbuffer. $versiontoarray = array(); $versionranarray = array(); + dol_syslog("Process upgrade2 d for entity ".$entity); + if (!$error) { if (count($listofentities) > 1) { print '*** '.$langs->trans("Entity").' '.$entity.''."\n"; @@ -257,10 +272,11 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $versiontoarray = explode('.', $versionto); $versionranarray = explode('.', DOL_VERSION); - $afterversionarray = explode('.', '2.0.0'); $beforeversionarray = explode('.', '2.7.9'); if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { + dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray)); + // Script pour V2 -> V2.1 migrate_paiements($db, $langs, $conf); @@ -324,6 +340,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $beforeversionarray = explode('.', '2.8.9'); //print $versionto.' '.versioncompare($versiontoarray,$afterversionarray).' '.versioncompare($versiontoarray,$beforeversionarray); if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { + dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray)); + migrate_price_facture($db, $langs, $conf); // Code of this function works for 2.8+ because need a field tva_tx migrate_relationship_tables($db, $langs, $conf, 'co_exp', 'fk_commande', 'commande', 'fk_expedition', 'shipping'); @@ -349,6 +367,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $afterversionarray = explode('.', '2.8.9'); $beforeversionarray = explode('.', '2.9.9'); if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { + dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray)); + migrate_element_time($db, $langs, $conf); migrate_customerorder_shipping($db, $langs, $conf); @@ -369,6 +389,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $afterversionarray = explode('.', '3.0.9'); $beforeversionarray = explode('.', '3.1.9'); if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { + dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray)); + migrate_rename_directories($db, $langs, $conf, '/rss', '/externalrss'); migrate_actioncomm_element($db, $langs, $conf); @@ -378,6 +400,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $afterversionarray = explode('.', '3.1.9'); $beforeversionarray = explode('.', '3.2.9'); if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { + dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray)); + migrate_price_contrat($db, $langs, $conf); migrate_mode_reglement($db, $langs, $conf); @@ -389,6 +413,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $afterversionarray = explode('.', '3.2.9'); $beforeversionarray = explode('.', '3.3.9'); if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { + dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray)); + migrate_categorie_association($db, $langs, $conf); } @@ -399,6 +425,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $afterversionarray = explode('.', '3.6.9'); // target is after this $beforeversionarray = explode('.', '3.7.9'); // target is before this if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { + dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray)); + migrate_event_assignement($db, $langs, $conf); } @@ -413,6 +441,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $afterversionarray = explode('.', '3.9.9'); $beforeversionarray = explode('.', '4.0.9'); if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { + dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray)); + migrate_rename_directories($db, $langs, $conf, '/fckeditor', '/medias'); } @@ -420,6 +450,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $afterversionarray = explode('.', '4.0.9'); $beforeversionarray = explode('.', '5.0.9'); if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { + dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray)); + // Migrate to add entity value into llx_societe_remise migrate_remise_entity($db, $langs, $conf); @@ -436,6 +468,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ // Only if the transverse mode is not used if (empty($multicompany_transverse_mode)) { + dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray)); + // Migrate to add entity value into llx_user_rights migrate_user_rights_entity($db, $langs, $conf); @@ -449,6 +483,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $afterversionarray = explode('.', '6.0.9'); $beforeversionarray = explode('.', '7.0.9'); if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { + dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray)); + // Migrate contact association migrate_event_assignement_contact($db, $langs, $conf); @@ -459,6 +495,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $afterversionarray = explode('.', '7.0.9'); $beforeversionarray = explode('.', '8.0.9'); if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { + dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray)); + migrate_rename_directories($db, $langs, $conf, '/contracts', '/contract'); } @@ -473,6 +511,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $afterversionarray = explode('.', '10.0.9'); $beforeversionarray = explode('.', '11.0.9'); if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { + dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray)); + migrate_users_socialnetworks(); migrate_members_socialnetworks(); migrate_contacts_socialnetworks(); @@ -483,6 +523,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $afterversionarray = explode('.', '13.0.9'); $beforeversionarray = explode('.', '14.0.9'); if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { + dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray)); + migrate_export_import_profiles('export'); migrate_export_import_profiles('import'); } @@ -491,6 +533,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $afterversionarray = explode('.', '15.0.9'); $beforeversionarray = explode('.', '16.0.9'); if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { + dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray)); + migrate_user_photospath(); migrate_user_photospath2(); } @@ -499,6 +543,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $afterversionarray = explode('.', '16.0.9'); $beforeversionarray = explode('.', '17.0.9'); if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { + dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray)); + migrate_contractdet_rank(); } @@ -506,6 +552,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $afterversionarray = explode('.', '17.0.9'); $beforeversionarray = explode('.', '18.0.9'); if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { + dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray)); + migrate_contractdet_rank(); } @@ -521,20 +569,27 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $afterversionarray = explode('.', '19.0.9'); $beforeversionarray = explode('.', '20.0.9'); if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { + dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray)); + migrate_invoice_export_models(); } // Scripts for 21.0 $afterversionarray = explode('.', '20.0.9'); $beforeversionarray = explode('.', '21.0.9'); + + if (versioncompare($versiontoarray, $afterversionarray) >= 0 && versioncompare($versiontoarray, $beforeversionarray) <= 0) { + dol_syslog("Run migrate_... versionto is between ".json_encode($afterversionarray)." and ".json_encode($beforeversionarray)); + migrate_productlot_path(); } } - // Code executed only if migration is LAST ONE. Must always be done. if (versioncompare($versiontoarray, $versionranarray) >= 0 || versioncompare($versiontoarray, $versionranarray) <= -3) { + dol_syslog("Run migrate_... if migration is LAST ONE"); + // Reload modules (this must be always done and only into last targeted version, because code to reload module may need table structure of last version) $listofmodule = array( 'MAIN_MODULE_ACCOUNTING' => 'newboxdefonly', @@ -579,6 +634,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ if ($result < 0) { $error++; } + // Reload menus (this must be always and only into last targeted version) $result = migrate_reload_menu($db, $langs, $conf); if ($result < 0) { @@ -4400,7 +4456,7 @@ function migrate_reload_menu($db, $langs, $conf) /** * Migrate file from old path to new one for lot path * - * @return void + * @return int Return integer <0 if KO, >0 if OK */ function migrate_productlot_path() { @@ -4415,10 +4471,14 @@ function migrate_productlot_path() print ''.$langs->trans('MigrationProductLotPath')."
\n"; - $sql = "SELECT rowid , entity, batch, fk_product from ".MAIN_DB_PREFIX."product_lot"; + $sql = "SELECT rowid, entity, batch, fk_product from ".MAIN_DB_PREFIX."product_lot"; $resql = $db->query($sql); + if ($resql) { $modulepart="product_batch"; + + $lot = new Productlot($db); + while ($obj = $db->fetch_object($resql)) { $entity = (empty($obj->entity) ? 1 : $obj->entity); if ($entity > 1) { @@ -4427,16 +4487,23 @@ function migrate_productlot_path() $dir = $conf->productbatch->multidir_output[$entity]; } - $lot = new Productlot($db); - $res = $lot->fetch($obj->rowid, $obj->fk_product, $obj->batch); + if ($dir) { + $lot->id = $obj->rowid; + $lot->ref = $obj->id; // No ref for the moment + $lot->batch = $obj->batch; + $lot->entity = $obj->entity; + $lot->fk_product = $obj->fk_product; + + $savref = $lot->ref; - if ($dir && $res > 0) { $lot->ref = $obj->batch; $origin = $dir . '/' . get_exdir(0, 0, 0, 1, $lot, $modulepart); - $lot->fetch($obj->rowid, $obj->fk_product, $obj->batch); + $lot->ref = $savref; // So restore the id $destin = $dir . '/' . get_exdir(0, 0, 0, 1, $lot, $modulepart); + //var_dump($origin.' -> '.$destin.' '.$lot->batch.' dir origin is '.dol_is_dir($origin));exit; + if (dol_is_dir($origin) && !dol_is_dir($destin)) { dol_move_dir($origin, $destin, 0); } @@ -4444,6 +4511,8 @@ function migrate_productlot_path() } } print ''; + + return 1; } /** diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index 0c1e0ec21c2..6b856ad8e4e 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -666,6 +666,18 @@ class SecurityTest extends CommonClassTest print "result = ".$result."\n"; $this->assertStringContainsString('Bad string syntax to evaluate', $result, 'The string was not detected as evil'); + $result = dol_eval('json_encode(array_map(implode("",["ex","ec"]), ["id"]))', 1, 1, '1'); // result of dol_eval may be an object Closure + print "result4a = ".json_encode($result)."\n"; + $this->assertStringContainsString('Bad string syntax to evaluate', json_encode($result), 'The string was not detected as evil, it should due to the [ char and method "2"'); + + $result = dol_eval('json_encode(array_map(implode("",["ex","ec"]), ["id"]))', 1, 1, '2'); // result of dol_eval may be an object Closure + print "result4b = ".json_encode($result)."\n"; + $this->assertStringContainsString('Bad string syntax to evaluate', json_encode($result), 'The string was not detected as evil, it should due to the use of array_map'); + + $result = dol_eval('json_encode(array_map(implode("",array("ex","ec"), array("id")))', 1, 1, '1'); // result of dol_eval may be an object Closure + print "result4c = ".json_encode($result)."\n"; + $this->assertStringContainsString('Bad string syntax to evaluate', json_encode($result), 'The string was not detected as evil, it should due to the use of array_map'); + $result = dol_eval('$a=function() { }; $a', 1, 1, '0'); // result of dol_eval may be an object Closure print "result5 = ".json_encode($result)."\n"; $this->assertStringContainsString('Bad string syntax to evaluate', json_encode($result), 'The string was not detected as evil'); From 659f758d61f434c526c4f4267d4c7da0afdc2a1b Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Tue, 15 Jul 2025 06:13:10 +0200 Subject: [PATCH 03/11] Fix table webhook history (#34737) * Fix name of option for supplier * Update functions.lib.php (#34718) Add __MYCOMPANY_URL__ & __MYCOMPANY_PHONEMOBILE__ in getCommonSubstitutionArray * Fix bad value fourn paiement process (#34722) * Fix bad value fourn paiement process * best fix * fix takepos console error (#34709) * fix console error * exit early --------- Co-authored-by: Laurent Destailleur * Fix CI * Clean code * Fix table wenhook history --------- Co-authored-by: ldestailleur Co-authored-by: Deefaze <6393617+Deefaze@users.noreply.github.com> Co-authored-by: Francis Appels --- htdocs/core/modules/modCron.class.php | 6 ++---- htdocs/install/mysql/migration/21.0.0-22.0.0.sql | 4 ++++ .../mysql/tables/llx_webhook_history-webhook.sql | 4 ++-- htdocs/takepos/index.php | 10 +++++++++- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/modCron.class.php b/htdocs/core/modules/modCron.class.php index 366b8a6ab31..f8aae14f3ab 100644 --- a/htdocs/core/modules/modCron.class.php +++ b/htdocs/core/modules/modCron.class.php @@ -39,8 +39,6 @@ class modCron extends DolibarrModules */ public function __construct($db) { - global $langs, $conf; - $this->db = $db; $this->numero = 2300; @@ -141,8 +139,8 @@ class modCron extends DolibarrModules 'url'=>'/cron/list.php?leftmenu=admintools', 'langs'=>'cron', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>500, - 'enabled'=>'$conf->cron->enabled && preg_match(\'/^(admintools|all)/\', $leftmenu)', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->rights->cron->read', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules + 'enabled'=>'isModEnabled("cron") && preg_match(\'/^(admintools|all)/\', $leftmenu)', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms'=>'$user->hasRight("cron", "read")', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules 'target'=>'', 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both $r++; diff --git a/htdocs/install/mysql/migration/21.0.0-22.0.0.sql b/htdocs/install/mysql/migration/21.0.0-22.0.0.sql index 69db5c89317..1286c42a87d 100644 --- a/htdocs/install/mysql/migration/21.0.0-22.0.0.sql +++ b/htdocs/install/mysql/migration/21.0.0-22.0.0.sql @@ -296,3 +296,7 @@ ALTER TABLE llx_mrp_mo ADD COLUMN extraparams varchar(255) DEFAULT NULL; UPDATE llx_actioncomm set code = 'AC_PAYMENT_STRIPE_IPN_SEPA_KO' where code = 'AC_IPN' and label like 'Payment error (SEPA%'; ALTER TABLE llx_blockedlog ADD COLUMN debuginfo mediumtext; + +ALTER TABLE llx_webhook_history ADD COLUMN trigger_code text NOT NULL; +ALTER TABLE llx_webhook_history ADD COLUMN error_message text; +ALTER TABLE llx_webhook_history MODIFY COLUMN url varchar(255); diff --git a/htdocs/install/mysql/tables/llx_webhook_history-webhook.sql b/htdocs/install/mysql/tables/llx_webhook_history-webhook.sql index 6fcc304858a..da1077845fe 100644 --- a/htdocs/install/mysql/tables/llx_webhook_history-webhook.sql +++ b/htdocs/install/mysql/tables/llx_webhook_history-webhook.sql @@ -21,8 +21,8 @@ CREATE TABLE llx_webhook_history( trigger_code varchar(128) NOT NULL, trigger_data text NOT NULL, fk_target integer NOT NULL, - url integer NOT NULL, - error_messsage text, + url varchar(255) NOT NULL, + error_message text, --note_public text, note_private text, date_creation datetime NOT NULL, diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index e67ee97f16f..88ca39aef2a 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -711,7 +711,15 @@ function New() { * return void */ function Search2(keyCodeForEnter, moreorless) { - var eventKeyCode = window.event.keyCode; + var eventKeyCode = null; + + if (window.event && window.event.keyCode) { + eventKeyCode = window.event.keyCode; + } + if (eventKeyCode === null && keyCodeForEnter !== '') { + // No key code available, exit early if a key code is required + return; + } console.log("Search2 Call ajax search to replace products keyCodeForEnter="+keyCodeForEnter+", eventKeyCode="+eventKeyCode); From 4fd04e7dc232666a26ca8f00ea900cb6385f7d83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= <81741011+altairis-noe@users.noreply.github.com> Date: Tue, 15 Jul 2025 06:20:06 +0200 Subject: [PATCH 04/11] FIX: we should ensure Commande::$lines array contains OrderLine objects (#34727) --- htdocs/commande/class/commande.class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index efd729d3715..5d20515005c 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1068,10 +1068,15 @@ class Commande extends CommonOrder for ($i = 0; $i < $num; $i++) { $line = $this->lines[$i]; - // Test and convert into object this->lines[$i]. When coming from REST API, we may still have an array + // Test and convert into OrderLine object this->lines[$i]. When coming from REST API, we may still have an array //if (! is_object($line)) $line=json_decode(json_encode($line), false); // convert recursively array into object. if (!is_object($line)) { - $line = (object) $line; + $lineobj = new OrderLine($this->db); + foreach ($line as $key => $val) { + $lineobj->$key = $val; + } + $line = $lineobj; + $this->lines[$i] = $line; } // Reset fk_parent_line for no child products and special product From 74b37cdd5050d8a683bcc0d1c934d76840540ed7 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Tue, 15 Jul 2025 06:29:22 +0200 Subject: [PATCH 05/11] Debug v22 --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 91178873230..ae69d06e801 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2317,7 +2317,7 @@ if ($id > 0) { $canbedisabled = 0; } } - if ($id == DICT_TYPE_CONTAINER && in_array($obj->code, array('banner', 'blogpost', 'menu', 'page', 'other', 'service', 'library'))) { + if ($id == DICT_TYPE_CONTAINER && $obj->module == 'system') { $iserasable = 0; $canbedisabled = 0; if (in_array($obj->code, array('banner'))) { From b38ebb236a6982a61519582579175de7bb261582 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Tue, 15 Jul 2025 06:59:31 +0200 Subject: [PATCH 06/11] Doc --- htdocs/compta/paiement/class/paiement.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index ad461f0e919..795af8254ee 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -296,7 +296,8 @@ class Paiement extends CommonObject /** * Create payment of invoices into database. * It uses this->amounts and ->multicurrency_amounts to get the list of detail of payment for each invoices for the payment. - * For payment of a customer invoice, amounts are positive, for payment of credit note, amounts are negative + * For payment of a customer invoice, amounts are positive, for payment of credit note, amounts are negative. + * Can also close the invoice if remain to pay is 0. * This will set also ->amount and ->multicurrency_amount at end. * * @param User $user Object user From 92ce005080d61e4008041b230cf48a07ab876915 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Tue, 15 Jul 2025 12:39:42 +0300 Subject: [PATCH 07/11] fix translation for non latin languages (#34744) * fix translation for non latin languages * fix translation for non latin languages * fix translation for non latin languages --- htdocs/core/modules/accountancy/doc/pdf_balance.modules.php | 2 +- htdocs/core/modules/accountancy/doc/pdf_bookkeeping.modules.php | 2 +- htdocs/core/modules/accountancy/doc/pdf_ledger.modules.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/accountancy/doc/pdf_balance.modules.php b/htdocs/core/modules/accountancy/doc/pdf_balance.modules.php index 15d7af0417c..4e0fba6d882 100644 --- a/htdocs/core/modules/accountancy/doc/pdf_balance.modules.php +++ b/htdocs/core/modules/accountancy/doc/pdf_balance.modules.php @@ -502,7 +502,7 @@ class pdf_balance extends ModelePdfAccountancy $curY, $nexY, $default_font_size, - $langs->trans('GrandTotals'), + $langs->transnoentities('GrandTotals'), $tab_top_newpage, $totalDebit, $totalCredit, diff --git a/htdocs/core/modules/accountancy/doc/pdf_bookkeeping.modules.php b/htdocs/core/modules/accountancy/doc/pdf_bookkeeping.modules.php index ba2c1465a15..cf2edf9a12a 100644 --- a/htdocs/core/modules/accountancy/doc/pdf_bookkeeping.modules.php +++ b/htdocs/core/modules/accountancy/doc/pdf_bookkeeping.modules.php @@ -511,7 +511,7 @@ class pdf_bookkeeping extends ModelePdfAccountancy $curY, $nexY, $default_font_size, - $langs->trans('GrandTotals'), + $langs->transnoentities('GrandTotals'), $tab_top_newpage, $totalDebit, $totalCredit, diff --git a/htdocs/core/modules/accountancy/doc/pdf_ledger.modules.php b/htdocs/core/modules/accountancy/doc/pdf_ledger.modules.php index 0d10bb36917..0e86d35a264 100644 --- a/htdocs/core/modules/accountancy/doc/pdf_ledger.modules.php +++ b/htdocs/core/modules/accountancy/doc/pdf_ledger.modules.php @@ -512,7 +512,7 @@ class pdf_ledger extends ModelePdfAccountancy $curY, $nexY, $default_font_size, - $langs->trans('GrandTotals'), + $langs->transnoentities('GrandTotals'), $tab_top_newpage, $totalDebit, $totalCredit, From 6ff0ef499048145335a46bd915348226e9a09e69 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 15 Jul 2025 11:41:20 +0200 Subject: [PATCH 08/11] FIX Fiscal year - Translation error on status (#34743) --- htdocs/core/class/fiscalyear.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index 83e451cff8b..c6440f3dfea 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -119,8 +119,6 @@ class Fiscalyear extends CommonObject $this->db = $db; $this->ismultientitymanaged = 1; - $this->labelStatusShort = array(self::STATUS_OPEN => 'Opened', self::STATUS_CLOSED => 'Closed'); - $this->labelStatus = array(self::STATUS_OPEN => 'Opened', self::STATUS_CLOSED => 'Closed'); } /** From e52ddc0181af8dc8e417e042223d0e137f52bf72 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 15 Jul 2025 11:43:29 +0200 Subject: [PATCH 09/11] Fix display on page treasury accounting (#34741) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix name of option for supplier * Update functions.lib.php (#34718) Add __MYCOMPANY_URL__ & __MYCOMPANY_PHONEMOBILE__ in getCommonSubstitutionArray * Fix bad value fourn paiement process (#34722) * Fix bad value fourn paiement process * best fix * fix takepos console error (#34709) * fix console error * exit early --------- Co-authored-by: Laurent Destailleur * Fix CI * Clean code * Comment * PHPStan > Update baseline (#34734) Co-authored-by: Dolibot * FIX: we should ensure Commande::$lines array contains OrderLine objects (#34727) * Uniformize position of button with other page & remove useless column * Remove useless column * FIX Fiscal year - Translation error on status * Revert "FIX Fiscal year - Translation error on status" This reverts commit a6f96ac0a9bece0f7d2182229ed7e6c744460fdd. --------- Co-authored-by: ldestailleur Co-authored-by: Deefaze <6393617+Deefaze@users.noreply.github.com> Co-authored-by: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Co-authored-by: Francis Appels Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Dolibot Co-authored-by: NoƩ Cendrier <81741011+altairis-noe@users.noreply.github.com> --- dev/build/phpstan/phpstan-baseline.neon | 6 ------ htdocs/accountancy/journal/treasuryjournal.php | 3 +-- htdocs/core/class/html.formaccounting.class.php | 1 - htdocs/core/lib/geturl.lib.php | 2 +- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index d1ffd383538..74d995243e1 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -9060,12 +9060,6 @@ parameters: count: 2 path: ../../../htdocs/core/customreports.php - - - message: '#^If condition is always true\.$#' - identifier: if.alwaysTrue - count: 1 - path: ../../../htdocs/core/customreports.php - - message: '#^Variable \$page might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/accountancy/journal/treasuryjournal.php b/htdocs/accountancy/journal/treasuryjournal.php index c3a1cf26cf9..f7c0bc0762a 100644 --- a/htdocs/accountancy/journal/treasuryjournal.php +++ b/htdocs/accountancy/journal/treasuryjournal.php @@ -1402,7 +1402,7 @@ if (empty($action) || $action == 'view') { print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); } - print '
'; + print '
'; if (getDolGlobalString('ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL')) { print ''; @@ -1441,7 +1441,6 @@ if (empty($action) || $action == 'view') { print '
'; print ''; print ''; - print ""; print ""; print "'; print ""; diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 5ece55be81c..93900c30ae0 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -666,7 +666,6 @@ class FormAccounting extends Form public static function printJournalLine($langs, $date, $ref, $accountAccounting, $labelOperation, $paymentMode, $amount) { $out = ''; - $out .= ''; $out .= ''; $out .= ''; // Ledger account diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index 83563401120..80c7af69f50 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -66,7 +66,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = print $nvpStr; exit;*/ curl_setopt($ch, CURLOPT_VERBOSE, 1); - curl_setopt($ch, CURLOPT_USERAGENT, 'Dolibarr geturl function'); + curl_setopt($ch, CURLOPT_USERAGENT, 'Dolibarr geturl function'); // set the Dolibarr user agent name // We use @ here because this may return warning if safe mode is on or open_basedir is on (following location is forbidden when safe mode is on). // We force value to false so we will manage redirection ourself later. From d63e36d8fbb74414f78369f7f96cdc1c63141515 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 15 Jul 2025 14:55:09 +0200 Subject: [PATCH 10/11] FIX wrong multicompany filter (#34714) Co-authored-by: Laurent Destailleur --- htdocs/projet/list.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 825ab376dfe..b6f8e9df9b3 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -105,8 +105,7 @@ $pageprev = $page - 1; $pagenext = $page + 1; $search_all = GETPOST('search_all', 'alphanohtml'); -$search_entity = ($user->entity > 0 ? $user->entity : GETPOSTINT('search_entity')); - +$search_entity = GETPOSTINT('search_entity'); $search_ref = GETPOST("search_ref", 'alpha'); $search_label = GETPOST("search_label", 'alpha'); $search_societe = GETPOST("search_societe", 'alpha'); @@ -590,11 +589,10 @@ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user AS u ON p.fk_user_creat = u.rowid'; $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; - if ($search_entity > 0) { $sql .= " WHERE p.entity = ".((int) $search_entity); } else { - $sql .= " WHERE p.entity IN (".getEntity('project', (GETPOSTINT('search_current_entity') ? 0 : 1)).')'; + $sql .= " WHERE p.entity IN (".getEntity('project').')'; } if (!$user->hasRight('projet', 'all', 'lire')) { $sql .= " AND p.rowid IN (".$db->sanitize($projectsListId).")"; // public and assigned to, or restricted to company for external users From 11535787df39908370276b4dcf5fa6f55a793468 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Tue, 15 Jul 2025 14:55:40 +0200 Subject: [PATCH 11/11] Doc comment --- htdocs/admin/tools/listevents.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 59c8c18732e..2252b72aacd 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -72,7 +72,7 @@ $search_user = GETPOST("search_user", "alpha"); $search_desc = GETPOST("search_desc", "alpha"); $search_ua = GETPOST("search_ua", "restricthtml"); $search_prefix_session = GETPOST("search_prefix_session", "restricthtml"); -$search_entity = ($user->entity > 0 ? $user->entity : GETPOSTINT('search_entity')); +$search_entity = ($user->entity > 0 ? $user->entity : GETPOSTINT('search_entity')); // TODO Replace with $search_entity = GETPOSTINT('search_entity') when the filter is available on screen for this page $now = dol_now(); $nowarray = dol_getdate($now);
".$langs->trans("Date")."".$langs->trans("Piece").' ('.$langs->trans("ObjectsRef").')".$langs->trans("AccountAccounting")."
'.$date.''.$ref.'