From 8f1c8b74063f6d4658d7ec98d6192f3986302893 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Sep 2024 18:22:55 +0200 Subject: [PATCH 1/6] Debug v20: error/warning when using disabled fields coming from profile --- htdocs/exports/export.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index f83522693d4..594ed3b4827 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -960,6 +960,10 @@ if ($step == 4 && $datatoexport) { print ''; foreach ($array_selected as $code => $value) { + if (!isset($objexport->array_export_fields[0][$code])) { // For example when field was in predefined filter but not more active (localtax1 disabled by setup of country) + continue; + } + print ''; $entity = (!empty($objexport->array_export_entities[0][$code]) ? $objexport->array_export_entities[0][$code] : $objexport->array_export_icon[0]); @@ -1193,8 +1197,10 @@ if ($step == 5 && $datatoexport) { print ''.$langs->trans("ExportedFields").''; $list = ''; foreach ($array_selected as $code => $label) { - $list .= (!empty($list) ? ', ' : ''); - $list .= $langs->trans($objexport->array_export_fields[0][$code]); + if (isset($objexport->array_export_fields[0][$code])) { + $list .= (!empty($list) ? ', ' : ''); + $list .= $langs->trans($objexport->array_export_fields[0][$code]); + } } print ''.$list.''; From 544020c32cf8efc00aca6767e5691df0a2a37692 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Sep 2024 22:39:42 +0200 Subject: [PATCH 2/6] Debug v20 --- htdocs/admin/system/security.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index fbf0cada6fd..8e1c16581c3 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -292,6 +292,8 @@ if (file_exists($installlock)) { } else { print img_warning().' '.$langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT); } + +print '
'; print '
'; // Is upgrade unlocked @@ -300,6 +302,7 @@ if (file_exists($installlock)) { // If install not locked, no need to show this. print ''.$langs->trans("DolibarrUpgrade").': '; print img_warning().' '.$langs->trans("WarningUpgradeHasBeenUnlocked", $upgradeunlock); print '
'; + print '
'; } } From 306def7aab6dcd2db98d628241570dde1320253c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Sep 2024 22:46:14 +0200 Subject: [PATCH 3/6] Debug v20 look and feel v20 --- htdocs/admin/system/phpinfo.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index 5972894065e..f54dfd74521 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -105,37 +105,37 @@ $arrayphpminversionerror = array(5, 5, 0); $arrayphpminversionwarning = array(5, 6, 0); if (versioncompare(versionphparray(), $arrayphpminversionerror) < 0) { - print 'Error '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror)); + print img_picto('Error', 'error').' '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror)); } elseif (versioncompare(versionphparray(), $arrayphpminversionwarning) < 0) { - print 'Warning '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionwarning)); + print img_picto('Warning', 'warning').' '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionwarning)); } else { - print 'Ok '.versiontostring(versionphparray()); + print img_picto('Ok', 'tick').' '.versiontostring(versionphparray()); } print ''; print 'GET and POST support'; if (!isset($_GET["testget"]) && !isset($_POST["testpost"]) && !isset($_GET["mainmenu"])) { // We must keep $_GET and $_POST here. This is a specific test. - print 'Warning '.$langs->trans("PHPSupportPOSTGETKo"); + print img_picto('Warning', 'warning').' '.$langs->trans("PHPSupportPOSTGETKo"); print ' ('.$langs->trans("Recheck").')'; } else { - print 'Ok '.$langs->trans("PHPSupportPOSTGETOk"); + print img_picto('Ok', 'tick').' '.$langs->trans("PHPSupportPOSTGETOk"); } print ''; print 'Sessions support'; if (!function_exists("session_id")) { - print 'Error '.$langs->trans("ErrorPHPDoesNotSupportSessions"); + print img_picto('Error', 'error').' '.$langs->trans("ErrorPHPDoesNotSupportSessions"); } else { - print 'Ok '.$langs->trans("PHPSupportSessions"); + print img_picto('Ok', 'tick').' '.$langs->trans("PHPSupportSessions"); } print ''; print 'UTF-8 support'; if (!function_exists("utf8_encode")) { - print 'Warning '.$langs->trans("ErrorPHPDoesNotSupport", "UTF8"); + print img_picto('Warning', 'warning').' '.$langs->trans("ErrorPHPDoesNotSupport", "UTF8"); } else { - print 'Ok '.$langs->trans("PHPSupport", "UTF8"); + print img_picto('Ok', 'tick').' '.$langs->trans("PHPSupport", "UTF8"); } print ''; From 12799d5485a443071352146e1ef2f6f43e0331f6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Sep 2024 01:38:59 +0200 Subject: [PATCH 4/6] Fix regression --- htdocs/categories/class/categorie.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 3c5f8b99bc0..ae9bca3828e 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1259,7 +1259,8 @@ class Categorie extends CommonObject } dol_syslog(get_class($this)."::get_full_arbo dol_sort_array", LOG_DEBUG); - $this->cats = dol_sort_array($this->cats, 'fulllabel', 'asc', true, false); + + $this->cats = dol_sort_array($this->cats, 'fulllabel', 'asc', 1, 0, 1); return $this->cats; } From ec3dcc9565aa832ed0a5439119780d13f68cea7c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Sep 2024 01:54:10 +0200 Subject: [PATCH 5/6] Debug v20 Fix regression --- htdocs/categories/class/categorie.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index b14f8c998b7..330baf65469 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1239,7 +1239,8 @@ class Categorie extends CommonObject } dol_syslog(get_class($this)."::get_full_arbo dol_sort_array", LOG_DEBUG); - $this->cats = dol_sort_array($this->cats, 'fulllabel', 'asc', true, false); + + $this->cats = dol_sort_array($this->cats, 'fulllabel', 'asc', 1, 0, 1); // Sort on full label like "Label 1 >> Sublabel a >> Subsublabel" return $this->cats; } From f4a331405fabacc5c686b8d2d104dcdc9f5771cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Sep 2024 03:28:40 +0200 Subject: [PATCH 6/6] Request for count is smaller/faster --- htdocs/contrat/list.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 0d935b95721..6058bf898d7 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -311,7 +311,9 @@ $sql .= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_modification, $sql .= ' s.rowid as socid, s.nom as name, s.name_alias, s.email, s.town, s.zip, s.fk_pays as country_id, s.client, s.code_client, s.status as company_status, s.logo as company_logo,'; $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; -$sql .= " MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") as lower_planned_end_date,"; +// TODO Add a denormalized field "perf_lower_planned_end_date" so we can remove the HAVING and then, +// remove completely the SUM and GROUP BY (faster). Status of each service can be read into the loop that build the list. +$sql .= " MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") as lower_planned_end_date,"; // lowest expiration date among open service lines $sql .= " SUM(".$db->ifsql("cd.statut=0", 1, 0).') as nb_initial,'; $sql .= " SUM(".$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite >= '".$db->idate($now)."')", 1, 0).') as nb_running,'; $sql .= " SUM(".$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now)."')", 1, 0).') as nb_expired,'; @@ -542,7 +544,12 @@ if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { } else { /* The fast and low memory method to get and count full list converts the sql into a sql count */ $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); - $sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'contratdet as cd ON c.rowid = cd.fk_contrat /', '', $sqlforcount); + + $sqlforcount = str_replace('LEFT JOIN '.MAIN_DB_PREFIX.'c_country as country on (country.rowid = s.fk_pays)', '', $sqlforcount); + $sqlforcount = str_replace('LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as typent on (typent.id = s.fk_typent)', '', $sqlforcount); + $sqlforcount = str_replace('LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as state on (state.rowid = s.fk_departement)', '', $sqlforcount); + $sqlforcount = str_replace('LEFT JOIN '.MAIN_DB_PREFIX.'contratdet as cd ON c.rowid = cd.fk_contrat', '', $sqlforcount); + $sqlforcount = str_replace('LEFT JOIN '.MAIN_DB_PREFIX.'contrat_extrafields as ef on (c.rowid = ef.fk_object)', '', $sqlforcount); $sqlforcount = preg_replace('/GROUP BY.*$/', '', $sqlforcount); $resql = $db->query($sqlforcount);