From 3a13924685a454e1c7a571047ce9fea405710f86 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 5 Apr 2023 12:43:52 +0200 Subject: [PATCH 01/30] FIX - Operator to search category Knowledge --- htdocs/knowledgemanagement/knowledgerecord_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index cafb5776cf7..c4b6eb7eaa6 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -293,7 +293,7 @@ if (!empty($searchCategoryKnowledgemanagementList)) { if (intval($searchCategoryKnowledgemanagement) == -2) { $searchCategoryKnowledgemanagementSqlList[] = "NOT EXISTS (SELECT ck.fk_knowledgemanagement FROM ".MAIN_DB_PREFIX."categorie_knowledgemanagement as ck WHERE t.rowid = ck.fk_knowledgemanagement)"; } elseif (intval($searchCategoryKnowledgemanagement) > 0) { - if ($searchCategoryKnowledgemanagementOperator == 0) { + if (empty($searchCategoryKnowledgemanagementOperator)) { $searchCategoryKnowledgemanagementSqlList[] = " EXISTS (SELECT ck.fk_knowledgemanagement FROM ".MAIN_DB_PREFIX."categorie_knowledgemanagement as ck WHERE t.rowid = ck.fk_knowledgemanagement AND ck.fk_categorie = ".((int) $searchCategoryKnowledgemanagement).")"; } else { $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryKnowledgemanagement); From 3d9aa470783c5bf0060004f4b89e2171d2310b3c Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 5 Apr 2023 12:47:14 +0200 Subject: [PATCH 02/30] Copyright --- htdocs/knowledgemanagement/knowledgerecord_list.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index c4b6eb7eaa6..706f103a13d 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -1,6 +1,7 @@ - * Copyright (C) 2021 Frédéric France +/* Copyright (C) 2007-2017 Laurent Destailleur + * Copyright (C) 2021 Frédéric France + * Copyright (C) 2023 Anthony Berton * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by From 424c53109f8a128f0b5514c368ade04580fc7ace Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Apr 2023 17:56:03 +0200 Subject: [PATCH 03/30] FIX Better support for option MAIN_NO_INPUT_PRICE_WITH_TAX --- htdocs/core/tpl/objectline_create.tpl.php | 2 +- htdocs/master.inc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 5974daa0573..51ae07640e6 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -761,7 +761,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) { jQuery('#date_end').removeClass('inputmandatory'); } - if ( == 1 && data.pricebasetype == 'TTC') { + if ( == 1 && data.pricebasetype == 'TTC' && ) { console.log("objectline_create.tpl set content of price_ttc"); jQuery("#price_ttc").val(data.price_ttc); } else { diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 39c6128435b..8478e5279a8 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -219,7 +219,7 @@ if (!defined('NOREQUIREDB') && !defined('NOREQUIRESOC')) { $conf->global->MAIN_PROFID1_IN_ADDRESS = 1; } - if ($mysoc->localtax1_assuj || $mysoc->localtax2_assuj) { + if (($mysoc->localtax1_assuj || $mysoc->localtax2_assuj) && !isset($conf->global->MAIN_NO_INPUT_PRICE_WITH_TAX)) { // For countries using the 2nd or 3rd tax, we disable input/edit of lines using the price including tax (because 2nb and 3rd tax not yet taken into account). // Work In Progress to support all taxes into unit price entry when MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES is set. $conf->global->MAIN_NO_INPUT_PRICE_WITH_TAX = 1; From ae8bcfa6caa0227c6ea4e409e78f2dc6fd711e47 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Apr 2023 17:57:05 +0200 Subject: [PATCH 04/30] Prepare 17.0.2 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 3a2e7d227eb..1ee519e38ee 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -34,7 +34,7 @@ if (!defined('DOL_APPLICATION_TITLE')) { define('DOL_APPLICATION_TITLE', 'Dolibarr'); } if (!defined('DOL_VERSION')) { - define('DOL_VERSION', '17.0.1'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c + define('DOL_VERSION', '17.0.2'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c } if (!defined('EURO')) { From 4d504b3f985528457d3bd24dbb112f1c645296c0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Apr 2023 18:43:59 +0200 Subject: [PATCH 05/30] Fix css --- htdocs/user/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 2a6b8a813be..c4029951b87 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -2338,25 +2338,25 @@ if ($action == 'create' || $action == 'adduserldap') { } if ($object->socid > 0 && !($object->contact_id > 0)) { // external user but no link to a contact - print img_picto('', 'company').$form->select_company($object->socid, 'socid', '', ' '); + print img_picto('', 'company').$form->select_company($object->socid, 'socid', '', ' ', 0, 0, null, 0, 'maxwidth300'); print img_picto('', 'contact').$form->selectcontacts(0, 0, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1); if ($object->ldap_sid) { print ' ('.$langs->trans("DomainUser").')'; } } elseif ($object->socid > 0 && $object->contact_id > 0) { // external user with a link to a contact - print img_picto('', 'company').$form->select_company($object->socid, 'socid', '', ' '); // We keep thirdparty empty, contact is already set + print img_picto('', 'company').$form->select_company($object->socid, 'socid', '', ' ', 0, 0, null, 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set print img_picto('', 'contact').$form->selectcontacts(0, $object->contact_id, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1); if ($object->ldap_sid) { print ' ('.$langs->trans("DomainUser").')'; } } elseif (!($object->socid > 0) && $object->contact_id > 0) { // internal user with a link to a contact - print img_picto('', 'company').$form->select_company(0, 'socid', '', ' '); // We keep thirdparty empty, contact is already set + print img_picto('', 'company').$form->select_company(0, 'socid', '', ' ', 0, 0, null, 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set print img_picto('', 'contact').$form->selectcontacts(0, $object->contact_id, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1); if ($object->ldap_sid) { print ' ('.$langs->trans("DomainUser").')'; } } else { // $object->socid is not > 0 here - print img_picto('', 'company').$form->select_company(0, 'socid', '', ' '); // We keep thirdparty empty, contact is already set + print img_picto('', 'company').$form->select_company(0, 'socid', '', ' ', 0, 0, null, 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set print img_picto('', 'contact').$form->selectcontacts(0, 0, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1); } } From 99b595a80762a81b569f24e09655e7b2577ee088 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Apr 2023 13:29:24 +0200 Subject: [PATCH 06/30] Fix typo --- htdocs/projet/list.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index f5c25f6a516..924930e14ac 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -734,7 +734,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_all != '') { $param .= '&search_all='.urlencode($search_all); @@ -808,9 +808,6 @@ if ($search_date_end_end) { if ($socid) { $param .= '&socid='.urlencode($socid); } -if (!empty($search_categ)) { - $param .= '&search_categ='.urlencode($search_categ); -} if ($search_ref != '') { $param .= '&search_ref='.urlencode($search_ref); } @@ -973,7 +970,7 @@ $moreforfilter .= ''; $moreforfilter .= '
'; $tmptitle = $langs->trans('ProjectsWithThisContact'); -$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->selectcontacts(0, $search_project_contact ? $search_project_contact : '', 'search_project_contact', $tmptitle, '', '', 0, 'maxwidth250 widthcentpercentminusx'); +$moreforfilter .= img_picto($tmptitle, 'contact', 'class="pictofixedwidth"').$form->selectcontacts(0, $search_project_contact ? $search_project_contact : '', 'search_project_contact', $tmptitle, '', '', 0, 'maxwidth250 widthcentpercentminusx'); $moreforfilter .= '
'; // If the user can view thirdparties other than his' From 595abd50291ce6408a47ef335cf46693d0747aae Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Thu, 6 Apr 2023 14:57:49 +0200 Subject: [PATCH 07/30] fix : Warning: Undefined array key facture in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/compta/facture/card.php on line 3904 --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 8f65df86da7..be552526e1f 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3901,7 +3901,7 @@ if ($action == 'create') { print $objectsrc->getNomUrl(1); // We check if Origin document (id and type is known) has already at least one invoice attached to it $objectsrc->fetchObjectLinked($originid, $origin, '', 'facture'); - if (is_array($objectsrc->linkedObjects['facture']) && count($objectsrc->linkedObjects['facture']) >= 1) { + if (isset($objectsrc->linkedObjects['facture']) && is_array($objectsrc->linkedObjects['facture']) && count($objectsrc->linkedObjects['facture']) >= 1) { setEventMessages('WarningBillExist', null, 'warnings'); echo ' - '.$langs->trans('LatestRelatedBill').' '.end($objectsrc->linkedObjects['facture'])->getNomUrl(1); } From 399eb9d826b38308235b932e30209c20de25f7a1 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Thu, 6 Apr 2023 15:30:47 +0200 Subject: [PATCH 08/30] Update changelog warning for developer. --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 07fa52ed00f..cf79e783b35 100644 --- a/ChangeLog +++ b/ChangeLog @@ -261,6 +261,7 @@ Following changes may create regressions for some external modules, but were nec * You must use "$objectoffield" to manipulate the current object inside the formulare of computed custom extrafields instead of $obj/$object. * Making a global search is sending the parameter using always the name search_all (instead of sometimes sall and search_all) * The property $url_last_version must be public if defined into module descriptor files; +* Filters in class field definitions must be a Dolibarr filter syntax string. ***** ChangeLog for 16.0.5 compared to 16.0.4 ***** From cfae78c86f21a868ba80a8449c95c3b29d4bdd76 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Apr 2023 21:39:41 +0200 Subject: [PATCH 09/30] Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into 17.0 --- htdocs/adherents/list.php | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index bcbbbd5f701..ec8b1159c1c 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -181,7 +181,8 @@ $result = restrictedArea($user, 'adherent'); */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; @@ -317,10 +318,16 @@ $formother = new FormOther($db); $membertypestatic = new AdherentType($db); $memberstatic = new Adherent($db); -$title = $langs->trans("Members"); - $now = dol_now(); +// Page Header +$title = $langs->trans("Members")." - ".$langs->trans("List"); +$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder'; +$morejs = array(); +$morecss = array(); + +// Build and execute select +// -------------------------------------------------------------------- if ((!empty($search_categ) && $search_categ > 0) || !empty($catid)) { $sql = "SELECT DISTINCT"; } else { @@ -343,8 +350,8 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { } // Add fields from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook -$sql .= preg_replace('/^,/', '', $hookmanager->resPrint); +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; $sql = preg_replace('/,\s*$/', '', $sql); $sqlfields = $sql; // $sql fields to remove for count total @@ -471,16 +478,14 @@ if ($search_country) { if ($search_import_key) { $sql .= natural_search("d.import_key", $search_import_key); } - // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; - // Add where from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; -// Count total nb of records with no order and no limits +// Count total nb of records $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { /* The fast and low memory method to get and count full list converts the sql into a sql count */ @@ -494,7 +499,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { dol_print_error($db); } - if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } @@ -517,8 +522,7 @@ if (!$resql) { $num = $db->num_rows($resql); -$arrayofselected = is_array($toselect) ? $toselect : array(); - +// Direct jump if only one record found if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) { $obj = $db->fetch_object($resql); $id = $obj->rowid; @@ -526,8 +530,12 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ exit; } -$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'; -llxHeader('', $title, $help_url); +// Output page +// -------------------------------------------------------------------- + +llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll + +$arrayofselected = is_array($toselect) ? $toselect : array(); if ($search_type > 0) { $membertype = new AdherentType($db); @@ -1274,7 +1282,7 @@ if ($num == 0) { $colspan++; } } - print ''.$langs->trans("NoRecordFound").''; + print ''.$langs->trans("NoRecordFound").''; } $db->free($resql); From 7d0663451181a3274d7639abc8a0bbc99b6b66a2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Apr 2023 22:11:40 +0200 Subject: [PATCH 10/30] css --- htdocs/theme/md/style.css.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index be1b3246256..c5bd85742dd 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -3129,6 +3129,7 @@ div.login_block { top: 0; padding-top: 3px; padding-bottom: 3px; + border-right: 1px solid rgba(0,0,0,0.2); : 0; browser->layout, array('phone', 'tablet')) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?> position: absolute; From d9c55c1711cb97307e639138cdbde25fc16a4839 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Apr 2023 22:14:18 +0200 Subject: [PATCH 11/30] Trans --- htdocs/langs/en_US/bills.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index d7c29a82399..618cdeb0e2c 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -285,6 +285,7 @@ SetRevenuStamp=Set revenue stamp Billed=Billed RecurringInvoices=Recurring invoices RecurringInvoice=Recurring invoice +RecurringInvoiceSource=Recurring invoice ar source RepeatableInvoice=Template invoice RepeatableInvoices=Template invoices RecurringInvoicesJob=Generation of recurring invoices (sales invoices) From f0d5dfe71917cb6645bd67d34282c5f40972f3d7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Apr 2023 22:17:55 +0200 Subject: [PATCH 12/30] FIX Rounding on total margin on invoice list --- htdocs/compta/facture/list.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 702cc057568..3de67f73acf 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -2547,6 +2547,9 @@ if ($resql) { $i++; } + // Use correct digits number for totals + $totalarray['val']['total_margin'] = price2num($totalarray['val']['total_margin'], 'MT'); + // Show total line include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; } From e36ace0ed6255a48156d529f0970482ff75d42ce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Apr 2023 22:21:29 +0200 Subject: [PATCH 13/30] Fix css --- htdocs/product/inventory/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index 88e590c478b..682589b2563 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -704,7 +704,7 @@ if ($num == 0) { $colspan++; } } - print ''.$langs->trans("NoRecordFound").''; + print ''.$langs->trans("NoRecordFound").''; } From ef9d7d8d8247925a4bc8436a3fc922ca44881d8b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 7 Apr 2023 01:48:39 +0200 Subject: [PATCH 14/30] FIX Compress in xz for better debian old version compatibility --- build/debian/rules | 6 +++++- build/debian/source/options | 4 +++- build/makepack-dolibarr.pl | 6 +++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/build/debian/rules b/build/debian/rules index b63fcffde93..df6abfd1b89 100755 --- a/build/debian/rules +++ b/build/debian/rules @@ -19,6 +19,10 @@ override_dh_auto_clean: override_dh_auto_build: # Do nothing. Added to disable launchpad to use bugged dh_auto_build search for ant +# Force the compression format for control files +override_dh_builddeb: + dh_builddeb -- -Zxz + #override_dh_compress: # dh_compress --no-act -X.png @@ -124,4 +128,4 @@ override_dh_fixperms: # Give rights to the webserver on the upload directory chown www-data:www-data debian/dolibarr/var/lib/dolibarr/documents chmod 2775 debian/dolibarr/var/lib/dolibarr/documents - + diff --git a/build/debian/source/options b/build/debian/source/options index 8d8fd181896..49a59df5428 100644 --- a/build/debian/source/options +++ b/build/debian/source/options @@ -1,3 +1,5 @@ -# Force use of gzip compression by dpkg-buildpackage +# Force use of gzip compression by dpkg-buildpackage for the tarball *.debian.tar.gz +# See also option --compression from command line of dpkg-buildpackage +# Format for the control files are defined into the rules file in override_dh_builddeb section compression = "gzip" #compression-level = 9 diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index f0433da142b..b7586e3909f 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -1050,16 +1050,16 @@ if ($nboftargetok) { print "Go into directory $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n"; chdir("$BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build"); #$cmd="dpkg-source -b $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build"; - $cmd="dpkg-buildpackage -us -uc"; + $cmd="dpkg-buildpackage -us -uc --compression=gzip"; print "Launch DEB build ($cmd)\n"; $ret=`$cmd 2>&1 3>&1`; print $ret."\n"; chdir("$olddir"); - + print "You can check bin package with lintian --pedantic -E -I \"$NEWDESTI/${FILENAMEDEB}_all.deb\"\n"; print "You can check src package with lintian --pedantic -E -I \"$NEWDESTI/${FILENAMEDEB}.dsc\"\n"; - + # Move to final dir print "Move *_all.deb *.dsc *.orig.tar.gz *.changes to $NEWDESTI\n"; $ret=`mv $BUILDROOT/*_all.deb "$NEWDESTI/"`; From 97344e38cbd0d7d47b5e9000d9534995a2c33f44 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 7 Apr 2023 03:08:02 +0200 Subject: [PATCH 15/30] FIX Move table projet_task_time to element_time --- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/core/lib/project.lib.php | 12 ++++++------ htdocs/projet/activity/index.php | 2 +- htdocs/projet/activity/perday.php | 2 +- htdocs/projet/activity/permonth.php | 2 +- htdocs/projet/activity/perweek.php | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 9eadd0fa421..b9b4ff3d1c2 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -6440,7 +6440,7 @@ class FactureLigne extends CommonInvoiceLine return -1; } - $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time'; + $sql = 'UPDATE '.MAIN_DB_PREFIX.'element_time'; $sql .= ' SET invoice_id = NULL, invoice_line_id = NULL'; $sql .= ' WHERE invoice_line_id = '.((int) $this->id); if (!$this->db->query($sql)) { diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 9baccc8e9fc..67ebae4ac13 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -99,7 +99,7 @@ function project_prepare_head(Project $project, $moreparam = '') $nbTimeSpent = $dataretrieved; } else { $sql = "SELECT t.rowid"; - //$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u"; + //$sql .= " FROM ".MAIN_DB_PREFIX."element_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u"; //$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."element_time as t, ".MAIN_DB_PREFIX."projet_task as pt"; $sql .= " WHERE t.fk_element = pt.rowid"; @@ -372,7 +372,7 @@ function task_prepare_head($object) // Is there timespent ? $nbTimeSpent = 0; $sql = "SELECT t.rowid"; - //$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u"; + //$sql .= " FROM ".MAIN_DB_PREFIX."element_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u"; //$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."element_time as t"; $sql .= " WHERE t.elementtype='task' AND t.fk_element = ".((int) $object->id); @@ -1153,7 +1153,7 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec if (empty($workloadforid[$projectstatic->id])) { if ($preselectedday) { - $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week + $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent from table element_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week $workloadforid[$projectstatic->id] = 1; } } @@ -1391,7 +1391,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr if (empty($workloadforid[$projectstatic->id])) { if ($preselectedday) { - $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week + $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent from table element_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week $workloadforid[$projectstatic->id] = 1; } } @@ -1788,7 +1788,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ //var_dump('--- '.$level.' '.$firstdaytoshow.' '.$fuser->id.' '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]); //var_dump($projectstatic->weekWorkLoadPerTask); if (empty($workloadforid[$projectstatic->id])) { - $projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week + $projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id); // Load time spent from table element_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week $workloadforid[$projectstatic->id] = 1; } //var_dump($projectstatic->weekWorkLoadPerTask); @@ -2175,7 +2175,7 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & //var_dump('--- '.$level.' '.$firstdaytoshow.' '.$fuser->id.' '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]); //var_dump($projectstatic->weekWorkLoadPerTask); if (empty($workloadforid[$projectstatic->id])) { - $projectstatic->loadTimeSpentMonth($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week + $projectstatic->loadTimeSpentMonth($firstdaytoshow, 0, $fuser->id); // Load time spent from table element_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week $workloadforid[$projectstatic->id] = 1; } //var_dump($projectstatic->weekWorkLoadPerTask); diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index 93da1e218e4..ccd5b0b88db 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -231,7 +231,7 @@ if ($db->type != 'pgsql') $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " , ".MAIN_DB_PREFIX."projet_task as t"; - $sql.= " , ".MAIN_DB_PREFIX."projet_task_time as tt"; + $sql.= " , ".MAIN_DB_PREFIX."element_time as tt"; $sql.= " WHERE t.fk_projet = p.rowid"; $sql.= " AND p.entity = ".((int) $conf->entity); $sql.= " AND tt.fk_task = t.rowid"; diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index e2f01f73738..5438ea6e47f 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -719,7 +719,7 @@ if (count($tasksarray) > 0) { $totalforeachday = array(); foreach ($listofdistinctprojectid as $tmpprojectid) { $projectstatic->id = $tmpprojectid; - $projectstatic->loadTimeSpent($daytoparse, 0, $usertoprocess->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week + $projectstatic->loadTimeSpent($daytoparse, 0, $usertoprocess->id); // Load time spent from table element_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week for ($idw = 0; $idw < 7; $idw++) { $tmpday = dol_time_plus_duree($daytoparse, $idw, 'd'); $totalforeachday[$tmpday] += $projectstatic->weekWorkLoad[$tmpday]; diff --git a/htdocs/projet/activity/permonth.php b/htdocs/projet/activity/permonth.php index 066621f3083..e6226ca677c 100644 --- a/htdocs/projet/activity/permonth.php +++ b/htdocs/projet/activity/permonth.php @@ -536,7 +536,7 @@ if (count($tasksarray) > 0) { $totalforeachweek = array(); foreach ($listofdistinctprojectid as $tmpprojectid) { $projectstatic->id = $tmpprojectid; - $projectstatic->loadTimeSpentMonth($firstdaytoshow, 0, $usertoprocess->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week + $projectstatic->loadTimeSpentMonth($firstdaytoshow, 0, $usertoprocess->id); // Load time spent from table element_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week foreach ($TWeek as $weekNb) { $totalforeachweek[$weekNb] += $projectstatic->monthWorkLoad[$weekNb]; } diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index d2cb15791b1..b3aa85e6226 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -758,7 +758,7 @@ if (count($tasksarray) > 0) { $totalforeachday = array(); foreach ($listofdistinctprojectid as $tmpprojectid) { $projectstatic->id = $tmpprojectid; - $projectstatic->loadTimeSpent($firstdaytoshow, 0, $usertoprocess->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week + $projectstatic->loadTimeSpent($firstdaytoshow, 0, $usertoprocess->id); // Load time spent from table element_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week for ($idw = 0; $idw < 7; $idw++) { $tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); $totalforeachday[$tmpday] += $projectstatic->weekWorkLoad[$tmpday]; From fd240cd503ef70aa64bf666aca9842e743bbaa8f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 7 Apr 2023 10:34:20 +0200 Subject: [PATCH 16/30] Add defaultfortype into table for email templates. --- htdocs/install/mysql/migration/17.0.0-18.0.0.sql | 1 + htdocs/install/mysql/tables/llx_c_email_templates.sql | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql index 10ac052c288..a143108a546 100644 --- a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql +++ b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql @@ -386,3 +386,4 @@ ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_ ALTER TABLE llx_bordereau_cheque ADD COLUMN label varchar(255) AFTER ref; +ALTER TABLE llx_c_email_templates add COLUMN defaultfortype smallint DEFAULT 0; diff --git a/htdocs/install/mysql/tables/llx_c_email_templates.sql b/htdocs/install/mysql/tables/llx_c_email_templates.sql index 4d22767bc58..06c053004ec 100644 --- a/htdocs/install/mysql/tables/llx_c_email_templates.sql +++ b/htdocs/install/mysql/tables/llx_c_email_templates.sql @@ -30,6 +30,7 @@ create table llx_c_email_templates tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, label varchar(180), -- Label of predefined email position smallint, -- Position + defaultfortype smallint DEFAULT 0, -- 1=Use this template by default when creating a new email for this type enabled varchar(255) DEFAULT '1', -- Condition to have this module visible active tinyint DEFAULT 1 NOT NULL, email_from varchar(255), -- default email from From 4ad90b36d0eaa7acf8bf91aeb1bdfdb532fae0b7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 7 Apr 2023 14:44:02 +0200 Subject: [PATCH 17/30] NEW Setup emailcollector easier. Can also use ! for negative search. --- htdocs/admin/emailcollector_card.php | 23 ++++++---- .../core/modules/modEmailCollector.class.php | 2 +- .../class/emailcollector.class.php | 44 ++++++++++++------- htdocs/langs/en_US/mails.lang | 2 +- 4 files changed, 44 insertions(+), 27 deletions(-) diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 880589fb5b1..c61643739ab 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -603,7 +603,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Filters print '
'; - print ''; + print '
'; print ''; print ''; print ''; @@ -627,8 +627,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea 'unseen'=>array('label'=>'NotRead', 'data-noparam'=>1), 'unanswered'=>array('label'=>'Unanswered', 'data-noparam'=>1), 'answered'=>array('label'=>'Answered', 'data-noparam'=>1), - 'smaller'=>array('label'=>'SmallerThan', 'data-placeholder'=>$langs->trans('NumberOfBytes')), - 'larger'=>array('label'=>'LargerThan', 'data-placeholder'=>$langs->trans('NumberOfBytes')), + 'smaller'=>array('label'=>$langs->trans("Size").' ('.$langs->trans("SmallerThan").")", 'data-placeholder'=>$langs->trans('NumberOfBytes')), + 'larger'=>array('label'=>$langs->trans("Size").' ('.$langs->trans("LargerThan").")", 'data-placeholder'=>$langs->trans('NumberOfBytes')), 'X3'=>'---', 'withtrackingid'=>array('label'=>'WithDolTrackingID', 'data-noparam'=>1), 'withouttrackingid'=>array('label'=>'WithoutDolTrackingID', 'data-noparam'=>1), @@ -690,7 +690,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; print '
'.img_picto('', 'filter', 'class="pictofixedwidth opacitymedium"').$form->textwithpicto($langs->trans("Filters"), $langs->trans("EmailCollectorFilterDesc")).'
'; print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; $arrayoftypes = array( @@ -730,9 +736,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print ''; @@ -766,7 +770,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print ''; - print ''; + print ''; print ''; // List filters foreach ($object->filters as $rulefilter) { @@ -740,7 +740,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print ''; - print ''; + print ''; print ''; // List operations $nboflines = count($object->actions); diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 6f8601a4966..3d80df465aa 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -895,7 +895,7 @@ class EmailCollector extends CommonObject // Overwrite values with values extracted from source email // $this->actionparam = 'opportunity_status=123;abc=EXTRACT:BODY:....' - $arrayvaluetouse = dolExplodeIntoArray($actionparam, ';', '='); + $arrayvaluetouse = dolExplodeIntoArray($actionparam, '(\n\r|\r|\n|;)', '='); foreach ($arrayvaluetouse as $propertytooverwrite => $valueforproperty) { $tmpclass = ''; $tmpproperty = ''; $tmparray = explode('.', $propertytooverwrite); @@ -2050,7 +2050,7 @@ class EmailCollector extends CommonObject $namealiastouseforthirdparty = ''; // $actionparam = 'param=SET:aaa' or 'param=EXTRACT:BODY:....' - $arrayvaluetouse = dolExplodeIntoArray($actionparam, ';', '='); + $arrayvaluetouse = dolExplodeIntoArray($actionparam, '(\n\r|\r|\n|;)', '='); foreach ($arrayvaluetouse as $propertytooverwrite => $valueforproperty) { $sourcestring = ''; $sourcefield = ''; From 2ab812d7666a905d826fbce3bc5eeae1fcf436b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 7 Apr 2023 16:59:51 +0200 Subject: [PATCH 20/30] Accept \n into parameters of emailcollector --- htdocs/admin/emailcollector_card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index c20b65fd959..d8bd172ed05 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -772,13 +772,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($action == 'editoperation' && $ruleaction['id'] == $operationid) { //print '
'; print ''; print ''; print ''; print ''; } else { - print dol_escape_htmltag($ruleaction['actionparam']); + print dol_nl2br(dol_escape_htmltag($ruleaction['actionparam'], 0, 1)); } print ''; // Move up/down From d5e2b2f6b9cfcea845dfa3efbda1be5386e1cd5f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 7 Apr 2023 17:17:13 +0200 Subject: [PATCH 21/30] NEW Add field reply-to in email collector as possible filter --- htdocs/admin/emailcollector_card.php | 3 +- .../class/emailcollector.class.php | 81 +++++++++++++------ 2 files changed, 59 insertions(+), 25 deletions(-) diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index d8bd172ed05..98a4eec28fb 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -615,13 +615,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea 'to'=>array('label'=>'MailTo', 'data-placeholder'=>$langs->trans('SearchString')), 'cc'=>array('label'=>'Cc', 'data-placeholder'=>$langs->trans('SearchString')), 'bcc'=>array('label'=>'Bcc', 'data-placeholder'=>$langs->trans('SearchString')), + 'replyto'=>array('label'=>'ReplyTo', 'data-placeholder'=>$langs->trans('SearchString')), 'subject'=>array('label'=>'Subject', 'data-placeholder'=>$langs->trans('SearchString')), 'body'=>array('label'=>'Body', 'data-placeholder'=>$langs->trans('SearchString')), // disabled because PHP imap_search is not compatible IMAPv4, only IMAPv2 //'header'=>array('label'=>'Header', 'data-placeholder'=>'HeaderKey SearchString'), // HEADER key value //'X1'=>'---', - //'notinsubject'=>array('label'=>'SubjectNotIn', 'data-placeholder'=>'SearchString'), - //'notinbody'=>array('label'=>'BodyNotIn', 'data-placeholder'=>'SearchString'), 'X2'=>'---', 'seen'=>array('label'=>'AlreadyRead', 'data-noparam'=>1), 'unseen'=>array('label'=>'NotRead', 'data-noparam'=>1), diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 3d80df465aa..550ebeca35b 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1056,6 +1056,7 @@ class EmailCollector extends CommonObject $searchfilternodoltrackid = 0; $searchfilterisanswer = 0; $searchfilterisnotanswer = 0; + $searchfilterreplyto = 0; $operationslog = ''; $now = dol_now(); @@ -1205,64 +1206,81 @@ class EmailCollector extends CommonObject } if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) { + // Use PHPIMAP external library $criteria = array(array('UNDELETED')); // Seems not supported by some servers foreach ($this->filters as $rule) { if (empty($rule['status'])) { continue; } + + $not = ''; + if (strpos($rule['rulevalue'], '!') === 0) { + // The value start with !, so we exclude the criteria + $not = 'NOT '; + } + + if ($rule['type'] == 'from') { + $tmprulevaluearray = explode('*', $rule['rulevalue']); + if (count($tmprulevaluearray) >= 2) { + foreach ($tmprulevaluearray as $tmprulevalue) { + array_push($criteria, array($not."FROM" => $tmprulevalue)); + } + } else { + array_push($criteria, array($not."FROM" => $rule['rulevalue'])); + } + } if ($rule['type'] == 'to') { $tmprulevaluearray = explode('*', $rule['rulevalue']); if (count($tmprulevaluearray) >= 2) { foreach ($tmprulevaluearray as $tmprulevalue) { - array_push($criteria, array("TO" => $tmprulevalue)); + array_push($criteria, array($not."TO" => $tmprulevalue)); } } else { - array_push($criteria, array("TO" => $rule['rulevalue'])); + array_push($criteria, array($not."TO" => $rule['rulevalue'])); } } if ($rule['type'] == 'bcc') { - array_push($criteria, array("BCC" => $rule['rulevalue'])); + array_push($criteria, array($not."BCC" => $rule['rulevalue'])); } if ($rule['type'] == 'cc') { - array_push($criteria, array("CC" => $rule['rulevalue'])); - } - if ($rule['type'] == 'from') { - array_push($criteria, array("FROM" => $rule['rulevalue'])); + array_push($criteria, array($not."CC" => $rule['rulevalue'])); } if ($rule['type'] == 'subject') { - array_push($criteria, array("SUBJECT" => $rule['rulevalue'])); + array_push($criteria, array($not."SUBJECT" => $rule['rulevalue'])); } if ($rule['type'] == 'body') { - array_push($criteria, array("BODY" => $rule['rulevalue'])); + array_push($criteria, array($not."BODY" => $rule['rulevalue'])); } if ($rule['type'] == 'header') { - array_push($criteria, array("HEADER" => $rule['rulevalue'])); + array_push($criteria, array($not."HEADER" => $rule['rulevalue'])); } + /* seems not used */ + /* if ($rule['type'] == 'notinsubject') { - array_push($criteria, array("SUBJECT NOT" => $rule['rulevalue'])); + array_push($criteria, array($not."SUBJECT NOT" => $rule['rulevalue'])); } if ($rule['type'] == 'notinbody') { - array_push($criteria, array("BODY NOT" => $rule['rulevalue'])); - } + array_push($criteria, array($not."BODY NOT" => $rule['rulevalue'])); + }*/ if ($rule['type'] == 'seen') { - array_push($criteria, array("SEEN")); + array_push($criteria, array($not."SEEN")); } if ($rule['type'] == 'unseen') { - array_push($criteria, array("UNSEEN")); + array_push($criteria, array($not."UNSEEN")); } if ($rule['type'] == 'unanswered') { - array_push($criteria, array("UNANSWERED")); + array_push($criteria, array($not."UNANSWERED")); } if ($rule['type'] == 'answered') { - array_push($criteria, array("ANSWERED")); + array_push($criteria, array($not."ANSWERED")); } if ($rule['type'] == 'smaller') { - array_push($criteria, array("SMALLER")); + array_push($criteria, array($not."SMALLER")); } if ($rule['type'] == 'larger') { - array_push($criteria, array("LARGER")); + array_push($criteria, array($not."LARGER")); } // Rules to filter after the search imap @@ -1285,6 +1303,10 @@ class EmailCollector extends CommonObject if ($rule['type'] == 'isnotanswer') { $searchfilterisnotanswer++; $searchhead .= '! /References.*@.*/'; } + + if ($rule['type'] == 'replyto') { + $searchfilterreplyto++; $searchhead .= '/Reply-To.*'.preg_quote($rule['rulevalue'], '/').'/'; + } } if (empty($targetdir)) { // Use last date as filter if there is no targetdir defined. @@ -1302,6 +1324,7 @@ class EmailCollector extends CommonObject dol_syslog("IMAP search string = ".var_export($criteria, true)); $search = var_export($criteria, true); } else { + // Use native IMAP functions $search = 'UNDELETED'; // Seems not supported by some servers foreach ($this->filters as $rule) { if (empty($rule['status'])) { @@ -1317,6 +1340,16 @@ class EmailCollector extends CommonObject $not = 'NOT '; } + if ($rule['type'] == 'from') { + $tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def' + if (count($tmprulevaluearray) >= 2) { + foreach ($tmprulevaluearray as $tmprulevalue) { + $search .= ($search ? ' ' : '').$not.'FROM "'.str_replace('"', '', $tmprulevalue).'"'; + } + } else { + $search .= ($search ? ' ' : '').$not.'FROM "'.str_replace('"', '', $rule['rulevalue']).'"'; + } + } if ($rule['type'] == 'to') { $tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def' if (count($tmprulevaluearray) >= 2) { @@ -1333,9 +1366,6 @@ class EmailCollector extends CommonObject if ($rule['type'] == 'cc') { $search .= ($search ? ' ' : '').$not.'CC'; } - if ($rule['type'] == 'from') { - $search .= ($search ? ' ' : '').$not.'FROM "'.str_replace('"', '', $rule['rulevalue']).'"'; - } if ($rule['type'] == 'subject') { $search .= ($search ? ' ' : '').$not.'SUBJECT "'.str_replace('"', '', $rule['rulevalue']).'"'; } @@ -1347,12 +1377,13 @@ class EmailCollector extends CommonObject } /* seems not used */ + /* if ($rule['type'] == 'notinsubject') { $search .= ($search ? ' ' : '').'NOT SUBJECT "'.str_replace('"', '', $rule['rulevalue']).'"'; } if ($rule['type'] == 'notinbody') { $search .= ($search ? ' ' : '').'NOT BODY "'.str_replace('"', '', $rule['rulevalue']).'"'; - } + }*/ if ($rule['type'] == 'seen') { $search .= ($search ? ' ' : '').$not.'SEEN'; @@ -1393,6 +1424,10 @@ class EmailCollector extends CommonObject if ($rule['type'] == 'isnotanswer') { $searchfilterisnotanswer++; $searchhead .= '! /References.*@.*/'; } + + if ($rule['type'] == 'replyto') { + $searchfilterreplyto++; $searchhead .= '/Reply-To.*'.preg_quote($rule['rulevalue'], '/').'/'; + } } if (empty($targetdir)) { // Use last date as filter if there is no targetdir defined. From 52ad0edd2d5c484b21bab316437ed96747ed1c3c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 7 Apr 2023 19:05:37 +0200 Subject: [PATCH 22/30] Fix link to remove a target --- htdocs/comm/mailing/cibles.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index ba3839afa5f..d65a35f7527 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -711,7 +711,7 @@ if ($object->fetch($id) >= 0) { print '
'; diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index cbd4cae931c..db352d4802d 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -50,7 +50,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) { .info-box small { font-size: 14px; } -.info-box .progress { +.info-box:not(.info-box-kanban) .progress { background: rgba(0, 0, 0, 0.2); margin: 5px -10px 5px -10px; height: 2px; @@ -60,7 +60,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) { border-radius: 0; } -.info-box .progress .progress-bar { +.info-box:not(.info-box-kanban) .progress .progress-bar { float: left; width: 0; height: 100%; diff --git a/htdocs/theme/eldy/progress.inc.php b/htdocs/theme/eldy/progress.inc.php index 1bc40e2f2fc..0157de99161 100644 --- a/htdocs/theme/eldy/progress.inc.php +++ b/htdocs/theme/eldy/progress.inc.php @@ -29,7 +29,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) { box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); } -.progress.spaced{ +.progress.spaced { margin-bottom: 20px; } diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index 9938225eebb..4755225ea4a 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -167,7 +167,7 @@ a.info-box-text-a i.fa.fa-exclamation-triangle { .info-box small { font-size: 14px; } -.info-box .progress { +.info-box:not(.info-box-kanban) .progress { background: rgba(0, 0, 0, 0.2); margin: 5px -10px 5px -10px; height: 2px; @@ -177,7 +177,7 @@ a.info-box-text-a i.fa.fa-exclamation-triangle { border-radius: 0; } -.info-box .progress .progress-bar { +.info-box:not(.info-box-kanban) .progress .progress-bar { float: left; width: 0; height: 100%; From b7633a392980b0f43be11ddbbfc43d86b7c0949d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Apr 2023 00:37:46 +0200 Subject: [PATCH 26/30] FIX Look and feel v18 --- htdocs/core/class/html.formother.class.php | 4 +- htdocs/projet/tasks/list.php | 144 +++++++++++++-------- 2 files changed, 95 insertions(+), 53 deletions(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 118e75773c1..6bcd8ea1e6c 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -429,7 +429,9 @@ class FormOther if (!is_numeric($showempty)) { $textforempty = $showempty; } - $moreforfilter .= ''."\n"; + $moreforfilter .= '
'.img_picto('', 'technic', 'class="pictofixedwidth"').$form->textwithpicto($langs->trans("EmailcollectorOperations"), $langs->trans("EmailcollectorOperationsDesc")).''.img_picto('', 'technic', 'class="pictofixedwidth"').$form->textwithpicto($langs->trans("EmailcollectorOperations"), $langs->trans("EmailcollectorOperationsDesc")).''; + $htmltext = $langs->transnoentitiesnoconv("OperationParamDesc"); + print $form->textwithpicto($langs->trans("Parameters"), $htmltext, 1, 'help', '', 0, 2, 'operationparamtt'); + print '
'; print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'minwidth150 maxwidth300', 1); print ''; - //print ''; - $htmltext = $langs->transnoentitiesnoconv("OperationParamDesc"); - print $form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'operationparamtt'); + print ''; print ''; print ''; if ($action == 'editoperation' && $ruleaction['id'] == $operationid) { - print '
'; + //print '
'; + print ''; print ''; print ''; print ''; diff --git a/htdocs/core/modules/modEmailCollector.class.php b/htdocs/core/modules/modEmailCollector.class.php index 514fe1be667..3a8f5a47497 100644 --- a/htdocs/core/modules/modEmailCollector.class.php +++ b/htdocs/core/modules/modEmailCollector.class.php @@ -176,7 +176,7 @@ class modEmailCollector extends DolibarrModules 'url'=>'/admin/emailcollector_list.php?leftmenu=admintools', 'langs'=>'admin', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>400, - 'enabled'=>'$conf->emailcollector->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. + 'enabled'=>'isModEnabled("emailcollector") && 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->admin', // Use 'perms'=>'$user->rights->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 diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 4c4aaab84af..6f8601a4966 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1308,59 +1308,69 @@ class EmailCollector extends CommonObject continue; } + // Forge the IMAP search string. + // See https://www.rfc-editor.org/rfc/rfc3501 + + $not = ''; + if (strpos($rule['rulevalue'], '!') === 0) { + // The value start with !, so we exclude the criteria + $not = 'NOT '; + } + if ($rule['type'] == 'to') { - $tmprulevaluearray = explode('*', $rule['rulevalue']); + $tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def' if (count($tmprulevaluearray) >= 2) { foreach ($tmprulevaluearray as $tmprulevalue) { - $search .= ($search ? ' ' : '').'TO "'.str_replace('"', '', $tmprulevalue).'"'; + $search .= ($search ? ' ' : '').$not.'TO "'.str_replace('"', '', $tmprulevalue).'"'; } } else { - $search .= ($search ? ' ' : '').'TO "'.str_replace('"', '', $rule['rulevalue']).'"'; + $search .= ($search ? ' ' : '').$not.'TO "'.str_replace('"', '', $rule['rulevalue']).'"'; } } if ($rule['type'] == 'bcc') { - $search .= ($search ? ' ' : '').'BCC'; + $search .= ($search ? ' ' : '').$not.'BCC'; } if ($rule['type'] == 'cc') { - $search .= ($search ? ' ' : '').'CC'; + $search .= ($search ? ' ' : '').$not.'CC'; } if ($rule['type'] == 'from') { - $search .= ($search ? ' ' : '').'FROM "'.str_replace('"', '', $rule['rulevalue']).'"'; + $search .= ($search ? ' ' : '').$not.'FROM "'.str_replace('"', '', $rule['rulevalue']).'"'; } if ($rule['type'] == 'subject') { - $search .= ($search ? ' ' : '').'SUBJECT "'.str_replace('"', '', $rule['rulevalue']).'"'; + $search .= ($search ? ' ' : '').$not.'SUBJECT "'.str_replace('"', '', $rule['rulevalue']).'"'; } if ($rule['type'] == 'body') { - $search .= ($search ? ' ' : '').'BODY "'.str_replace('"', '', $rule['rulevalue']).'"'; + $search .= ($search ? ' ' : '').$not.'BODY "'.str_replace('"', '', $rule['rulevalue']).'"'; } if ($rule['type'] == 'header') { - $search .= ($search ? ' ' : '').'HEADER '.$rule['rulevalue']; + $search .= ($search ? ' ' : '').$not.'HEADER '.$rule['rulevalue']; } + /* seems not used */ if ($rule['type'] == 'notinsubject') { - $search .= ($search ? ' ' : '').'SUBJECT NOT "'.str_replace('"', '', $rule['rulevalue']).'"'; + $search .= ($search ? ' ' : '').'NOT SUBJECT "'.str_replace('"', '', $rule['rulevalue']).'"'; } if ($rule['type'] == 'notinbody') { - $search .= ($search ? ' ' : '').'BODY NOT "'.str_replace('"', '', $rule['rulevalue']).'"'; + $search .= ($search ? ' ' : '').'NOT BODY "'.str_replace('"', '', $rule['rulevalue']).'"'; } if ($rule['type'] == 'seen') { - $search .= ($search ? ' ' : '').'SEEN'; + $search .= ($search ? ' ' : '').$not.'SEEN'; } if ($rule['type'] == 'unseen') { - $search .= ($search ? ' ' : '').'UNSEEN'; + $search .= ($search ? ' ' : '').$not.'UNSEEN'; } if ($rule['type'] == 'unanswered') { - $search .= ($search ? ' ' : '').'UNANSWERED'; + $search .= ($search ? ' ' : '').$not.'UNANSWERED'; } if ($rule['type'] == 'answered') { - $search .= ($search ? ' ' : '').'ANSWERED'; + $search .= ($search ? ' ' : '').$not.'ANSWERED'; } if ($rule['type'] == 'smaller') { - $search .= ($search ? ' ' : '').'SMALLER "'.str_replace('"', '', $rule['rulevalue']).'"'; + $search .= ($search ? ' ' : '').$not.'SMALLER "'.str_replace('"', '', $rule['rulevalue']).'"'; } if ($rule['type'] == 'larger') { - $search .= ($search ? ' ' : '').'LARGER "'.str_replace('"', '', $rule['rulevalue']).'"'; + $search .= ($search ? ' ' : '').$not.'LARGER "'.str_replace('"', '', $rule['rulevalue']).'"'; } // Rules to filter after the search imap diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index f04ee17575c..ed2d1409d00 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -93,7 +93,7 @@ MailingModuleDescEmailsFromUser=Emails input by user MailingModuleDescDolibarrUsers=Users with Emails MailingModuleDescThirdPartiesByCategories=Third parties SendingFromWebInterfaceIsNotAllowed=Sending from web interface is not allowed. -EmailCollectorFilterDesc=All filters must match to have an email being collected +EmailCollectorFilterDesc=All filters must match to have an email being collected.
You can use the character "!" before the search string value if you need a negative test # Libelle des modules de liste de destinataires mailing LineInFile=Line %s in file From 3b8406a83ea779830a9c4a23571268583e599e4c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 7 Apr 2023 16:21:51 +0200 Subject: [PATCH 18/30] NEW dolExplodeIntoArray can accept regex --- htdocs/core/lib/functions.lib.php | 13 +++++++++++-- test/phpunit/FunctionsLibTest.php | 6 ++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 26d9f38fcf6..8cf0462d606 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9805,13 +9805,21 @@ function printCommonFooter($zone = 'private') * For example: "A=1;B=2;C=2" is exploded into array('A'=>1,'B'=>2,'C'=>3) * * @param string $string String to explode - * @param string $delimiter Delimiter between each couple of data + * @param string $delimiter Delimiter between each couple of data. Example: ';' or '[\n;]+' or '(\n\r|\r|\n|;)' * @param string $kv Delimiter between key and value * @return array Array of data exploded */ function dolExplodeIntoArray($string, $delimiter = ';', $kv = '=') { - if ($a = explode($delimiter, $string)) { + if (preg_match('/^\[.*\]$/sm', $delimiter) || preg_match('/^\(.*\)$/sm', $delimiter)) { + // This is a regex string + $newdelimiter = $delimiter; + } else { + // This is a simple string + $newdelimiter = preg_quote($delimiter, '/'); + } + + if ($a = preg_split('/'.$newdelimiter.'/', $string)) { $ka = array(); foreach ($a as $s) { // each part if ($s) { @@ -9824,6 +9832,7 @@ function dolExplodeIntoArray($string, $delimiter = ';', $kv = '=') } return $ka; } + return array(); } diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index b7e3b4c7555..e635e449379 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -1381,6 +1381,12 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase print __METHOD__." tmp=".json_encode($tmp)."\n"; $this->assertEquals('{"AA":"B\/B","CC":"","EE":"FF","HH":"GG;"}', json_encode($tmp)); + + $stringtoexplode="AA=B/B;CC=\n\rEE=FF\nHH=GG;;;\nII=JJ\n"; + $tmp=dolExplodeIntoArray($stringtoexplode, "(\r\n|\n|\r|;)", '='); + + print __METHOD__." tmp=".json_encode($tmp)."\n"; + $this->assertEquals('{"AA":"B\/B","CC":"","EE":"FF","HH":"GG","II":"JJ"}', json_encode($tmp)); } /** From e285d3b135310a1b8463e2560c7d565b53c8d50e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 7 Apr 2023 16:52:47 +0200 Subject: [PATCH 19/30] Accept \n into parameters of emailcollector --- htdocs/admin/emailcollector_card.php | 4 ++-- htdocs/emailcollector/class/emailcollector.class.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index c61643739ab..c20b65fd959 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -662,7 +662,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; print ''; print '
'; print '
'; print ''; if ($obj->statut == 0) { // Not sent yet - if (!empty($user->rights->mailing->creer) && $allowaddtarget) { + if (!empty($user->rights->mailing->creer)) { print ''.img_delete($langs->trans("RemoveRecipient")).''; } } From 2bc2a5e791c02965b4b087c6d8ac370a2a28699d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 7 Apr 2023 19:10:52 +0200 Subject: [PATCH 23/30] Add column evenunsubscribe for emailing --- htdocs/install/mysql/migration/17.0.0-18.0.0.sql | 3 +++ htdocs/install/mysql/tables/llx_mailing-mailing.sql | 1 + 2 files changed, 4 insertions(+) diff --git a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql index a143108a546..02b3eedd57a 100644 --- a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql +++ b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql @@ -387,3 +387,6 @@ ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_ ALTER TABLE llx_bordereau_cheque ADD COLUMN label varchar(255) AFTER ref; ALTER TABLE llx_c_email_templates add COLUMN defaultfortype smallint DEFAULT 0; + +ALTER TALBE llx_mailing ADD COLUMN evenunsubscribe smallint DEFAULT 0; + diff --git a/htdocs/install/mysql/tables/llx_mailing-mailing.sql b/htdocs/install/mysql/tables/llx_mailing-mailing.sql index d9fc0832045..39392502053 100644 --- a/htdocs/install/mysql/tables/llx_mailing-mailing.sql +++ b/htdocs/install/mysql/tables/llx_mailing-mailing.sql @@ -33,6 +33,7 @@ create table llx_mailing body mediumtext, bgcolor varchar(8), -- Backgroud color of mailing bgimage varchar(255), -- Backgroud image of mailing + evenunsubscribe smallint DEFAULT 0, -- If 1, email will be send event if recipient has opt-out to emailings cible varchar(60), nbemail integer, email_from varchar(160), -- Email address of sender From 6dfb3978f20a7018a082dce1bce7e0971c37e4b2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 7 Apr 2023 19:38:34 +0200 Subject: [PATCH 24/30] Update dao to support evenunsubscribe. --- htdocs/comm/mailing/class/mailing.class.php | 10 +++++++++- htdocs/install/mysql/migration/17.0.0-18.0.0.sql | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index ef83c5d1470..e5cda94aa9f 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -61,6 +61,11 @@ class Mailing extends CommonObject */ public $body; + /** + * @var int 1=Email will be sent even to email that has opt-out + */ + public $evenunsubscribe; + /** * @var int number of email */ @@ -317,6 +322,7 @@ class Mailing extends CommonObject $sql .= ", email_errorsto = '".$this->db->escape($this->email_errorsto)."'"; $sql .= ", bgcolor = '".($this->bgcolor ? $this->db->escape($this->bgcolor) : null)."'"; $sql .= ", bgimage = '".($this->bgimage ? $this->db->escape($this->bgimage) : null)."'"; + $sql .= ", evenunsubscribe = ".((int) $this->evenunsubscribe); $sql .= " WHERE rowid = ".(int) $this->id; dol_syslog(__METHOD__, LOG_DEBUG); @@ -357,7 +363,7 @@ class Mailing extends CommonObject { global $conf; - $sql = "SELECT m.rowid, m.titre as title, m.sujet, m.body, m.bgcolor, m.bgimage"; + $sql = "SELECT m.rowid, m.titre as title, m.sujet, m.body, m.bgcolor, m.bgimage, m.evenunsubscribe"; $sql .= ", m.email_from, m.email_replyto, m.email_errorsto"; $sql .= ", m.statut, m.nbemail"; $sql .= ", m.fk_user_creat, m.fk_user_valid"; @@ -389,6 +395,7 @@ class Mailing extends CommonObject $this->bgcolor = $obj->bgcolor; $this->bgimage = $obj->bgimage; + $this->evenunsubscribe = $obj->evenunsubscribe; $this->email_from = $obj->email_from; $this->email_replyto = $obj->email_replyto; @@ -454,6 +461,7 @@ class Mailing extends CommonObject $object->body = ''; $object->bgcolor = ''; $object->bgimage = ''; + $object->evenunsubscribe = 0; //$object->email_from = ''; // We do not reset from email because it is a mandatory value $object->email_replyto = ''; diff --git a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql index 02b3eedd57a..a5b1406cfdb 100644 --- a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql +++ b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql @@ -388,5 +388,5 @@ ALTER TABLE llx_bordereau_cheque ADD COLUMN label varchar(255) AFTER ref; ALTER TABLE llx_c_email_templates add COLUMN defaultfortype smallint DEFAULT 0; -ALTER TALBE llx_mailing ADD COLUMN evenunsubscribe smallint DEFAULT 0; +ALTER TABLE llx_mailing ADD COLUMN evenunsubscribe smallint DEFAULT 0; From 931c9fa7ca0ee95882d84652af4402d575334b95 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 7 Apr 2023 23:51:41 +0200 Subject: [PATCH 25/30] Look and feel v18 --- htdocs/core/lib/project.lib.php | 4 +- .../class/conferenceorboothattendee.class.php | 10 +- .../conferenceorbooth_list.php | 63 ++-- .../conferenceorboothattendee_list.php | 335 ++++++++++++------ .../modulebuilder/template/myobject_list.php | 6 +- htdocs/projet/class/task.class.php | 13 +- htdocs/projet/tasks/list.php | 4 +- htdocs/theme/eldy/info-box.inc.php | 4 +- htdocs/theme/eldy/progress.inc.php | 2 +- htdocs/theme/md/info-box.inc.php | 4 +- 10 files changed, 280 insertions(+), 165 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 67ebae4ac13..47e45225205 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2811,8 +2811,8 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide // this conf is actually hidden, by default we use 10% for "be carefull or warning" $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10; - $diffTitle = '
'.$langs->trans('ProgressDeclared').' : '.$task->progress.($task->progress ? '%' : ''); - $diffTitle .= '
'.$langs->trans('ProgressCalculated').' : '.$progressCalculated.($progressCalculated ? '%' : ''); + $diffTitle = '
'.$langs->trans('ProgressDeclared').' : '.$task->progress.(isset($task->progress) ? '%' : ''); + $diffTitle .= '
'.$langs->trans('ProgressCalculated').' : '.$progressCalculated.(isset($progressCalculated) ? '%' : ''); //var_dump($progressCalculated.' '.$warningRatio.' '.$task->progress.' '.floatval($task->progress * $warningRatio)); if (floatval($progressCalculated) > floatval($task->progress * $warningRatio)) { diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 0ac9fdb4481..47d7e96ab03 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -105,17 +105,17 @@ class ConferenceOrBoothAttendee extends CommonObject 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>2, 'index'=>1, 'comment'=>"Reference of object"), 'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>15, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'position'=>20, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), - 'email' => array('type'=>'mail', 'label'=>'EmailAttendee', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'autofocusoncreate'=>1, 'searchall'=>1), - 'firstname' => array('type'=>'varchar(100)', 'label'=>'Firstname', 'enabled'=>'1', 'position'=>31, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1), - 'lastname' => array('type'=>'varchar(100)', 'label'=>'Lastname', 'enabled'=>'1', 'position'=>32, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1), + 'email' => array('type'=>'mail', 'label'=>'EmailAttendee', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'autofocusoncreate'=>1, 'searchall'=>1, 'csslist'=>'tdoverflowmax150'), + 'firstname' => array('type'=>'varchar(100)', 'label'=>'Firstname', 'enabled'=>'1', 'position'=>31, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1, 'csslist'=>'tdoverflowmax125'), + 'lastname' => array('type'=>'varchar(100)', 'label'=>'Lastname', 'enabled'=>'1', 'position'=>32, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1, 'csslist'=>'tdoverflowmax125'), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label'=>'ThirdParty', 'enabled'=>'isModEnabled("societe")', 'position'=>40, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), 'email_company' => array('type'=>'mail', 'label'=>'EmailCompany', 'enabled'=>'1', 'position'=>41, 'notnull'=>0, 'visible'=>-2, 'searchall'=>1), 'date_subscription' => array('type'=>'datetime', 'label'=>'DateOfRegistration', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1, 'showoncombobox'=>'1',), - 'fk_invoice' => array('type'=>'integer:Facture:compta/facture/class/facture.class.php', 'label'=>'Invoice', 'enabled'=>'$conf->facture->enabled', 'position'=>57, 'notnull'=>0, 'visible'=>-1, 'index'=>0, 'picto'=>'bill', 'css'=>'tdoverflowmax150 maxwidth500'), + 'fk_invoice' => array('type'=>'integer:Facture:compta/facture/class/facture.class.php', 'label'=>'Invoice', 'enabled'=>'isModEnabled("facture")', 'position'=>57, 'notnull'=>0, 'visible'=>-1, 'index'=>0, 'picto'=>'bill', 'css'=>'tdoverflowmax150 maxwidth500'), 'amount' => array('type'=>'price', 'label'=>'AmountPaid', 'enabled'=>'1', 'position'=>57, 'notnull'=>0, 'visible'=>1, 'default'=>'null', 'isameasure'=>'1', 'help'=>"AmountOfSubscriptionPaid",), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>3,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>3,), - 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), + 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2, 'css'=>'nowraponall'), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,), 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>-1, 'visible'=>-2), 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,), diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 258c47f12fc..f78654a94f4 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -523,7 +523,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { } // Add fields from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // 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 = preg_replace('/,\s*$/', '', $sql); //$sql .= ", COUNT(rc.rowid) as anotherfield"; @@ -537,7 +537,7 @@ if (isset($extrafields->attributes[$object->table_element]['label']) && is_array $sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as cact ON cact.id=t.fk_action AND cact.module LIKE '%@eventorganization'"; // Add table from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; if ($object->ismultientitymanaged == 1) { $sql .= " WHERE t.entity IN (".getEntity($object->element).")"; @@ -585,7 +585,7 @@ if ($search_all) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; // Count total nb of records @@ -602,7 +602,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { dol_print_error($db); } - if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } @@ -642,7 +642,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key])) { @@ -666,7 +666,7 @@ if ($optioncss != '') { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Add $param from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $param .= $hookmanager->resPrint; // List of mass actions available @@ -702,7 +702,8 @@ print ''; $title = $langs->trans("EventOrganizationConfOrBoothes"); -$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?action=create'.(!empty($project->id)?'&withproject=1&fk_project='.$project->id:'').(!empty($project->socid)?'&fk_soc='.$project->socid:'').'&backtopage='.urlencode($_SERVER['PHP_SELF']).(!empty($project->id)?'?projectid='.$project->id:''), '', $permissiontoadd); +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?action=create'.(!empty($project->id)?'&withproject=1&fk_project='.$project->id:'').(!empty($project->socid)?'&fk_soc='.$project->socid:'').'&backtopage='.urlencode($_SERVER['PHP_SELF']).(!empty($project->id)?'?projectid='.$project->id:''), '', $permissiontoadd); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -732,7 +733,7 @@ $moreforfilter.= $langs->trans('MyFilter') . ': '; print $moreforfilter; + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; print ''; } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields +$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); @@ -756,10 +760,10 @@ print ''; +print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; @@ -773,13 +777,13 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $key != 'ref' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; @@ -821,8 +825,11 @@ $totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- print ''; +// Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + //print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; } foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); @@ -832,12 +839,12 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $key != 'ref' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label if (!empty($arrayfields['t.'.$key]['checked'])) { - print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n"; $totalarray['nbfield']++; } } @@ -845,13 +852,13 @@ foreach ($object->fields as $key => $val) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); -$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; } -$totalarray['nbfield']++; print ''."\n"; @@ -859,7 +866,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if ($val && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } @@ -888,6 +895,12 @@ while ($i < $imaxinloop) { print '
'; } // Output Kanban + 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($object->id, $arrayofselected)) { + $selected = 1; + } + } print $object->getKanbanView(''); if ($i == ($imaxinloop - 1)) { print '
'; @@ -926,7 +939,7 @@ while ($i < $imaxinloop) { $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall'; } - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref', 'status')) && empty($val['arrayofkeyval'])) { + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; @@ -966,7 +979,7 @@ while ($i < $imaxinloop) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index 1582da86987..5fd8425c259 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -51,10 +51,10 @@ $show_files = GETPOST('show_files', 'int'); // Show files area generated by b $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'conferenceorboothattendeelist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') -$mode = GETPOST('mode', 'alpha'); +$mode = GETPOST('mode', 'aZ'); $id = GETPOST('id', 'int'); $conf_or_booth_id = GETPOST('conforboothid', 'int'); @@ -71,8 +71,9 @@ $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 or if we click on clear filters +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -125,11 +126,11 @@ $arrayfields = array(); foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field if (!empty($val['visible'])) { - $visible = (int) dol_eval($val['visible'], 1, 1, '1'); + $visible = (int) dol_eval($val['visible'], 1); $arrayfields['t.'.$key] = array( 'label'=>$val['label'], 'checked'=>(($visible < 0) ? 0 : 1), - 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')), + 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], 'help'=> isset($val['help']) ? $val['help'] : '' ); @@ -185,9 +186,7 @@ if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } -if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' -&& $massaction != 'presend' -&& $massaction != 'confirm_presend') { +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; } @@ -270,9 +269,13 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { } // Add fields from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // 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 = preg_replace('/,\s*$/', '', $sql); +//$sql .= ", COUNT(rc.rowid) as anotherfield"; + +$sqlfields = $sql; // $sql fields to remove for count total + $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; if (!empty($confOrBooth->id)) { $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm as a on a.id=t.fk_actioncomm AND a.id=".((int) $confOrBooth->id); @@ -282,7 +285,7 @@ if (isset($extrafields->attributes[$object->table_element]['label']) && is_array } // Add table from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; if ($object->ismultientitymanaged == 1) { $sql .= " WHERE t.entity IN (".getEntity($object->element).")"; @@ -312,10 +315,10 @@ foreach ($search as $key => $val) { $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key); if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { if (preg_match('/_dtstart$/', $key)) { - $sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'"; + $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'"; } if (preg_match('/_dtend$/', $key)) { - $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; + $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'"; } } } @@ -329,39 +332,45 @@ if ($search_all) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; -$sql .= $db->order($sortfield, $sortorder); - // Count total nb of records $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $resql = $db->query($sql); - $nbtotalofrecords = $db->num_rows($resql); - if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0 + /* 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('/GROUP BY .*$/', '', $sqlforcount); + $resql = $db->query($sqlforcount); + if ($resql) { + $objforcount = $db->fetch_object($resql); + $nbtotalofrecords = $objforcount->nbtotalofrecords; + } else { + dol_print_error($db); + } + + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } + $db->free($resql); } -// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. -if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) { - $num = $nbtotalofrecords; -} else { - if ($limit) { - $sql .= $db->plimit($limit + 1, $offset); - } - $resql = $db->query($sql); - if (!$resql) { - dol_print_error($db); - exit; - } - - $num = $db->num_rows($resql); +// Complete request and execute it with limit +$sql .= $db->order($sortfield, $sortorder); +if ($limit) { + $sql .= $db->plimit($limit + 1, $offset); } +$resql = $db->query($sql); +if (!$resql) { + dol_print_error($db); + exit; +} + +$num = $db->num_rows($resql); + // Direct jump if only one record found if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { $obj = $db->fetch_object($resql); @@ -376,6 +385,9 @@ if ($confOrBooth->id > 0) { $title = $langs->trans('ListOfAttendeesOfEvent'); } +// Output page +// -------------------------------------------------------------------- + llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs'); @@ -664,19 +676,26 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) { $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { - if (is_array($search[$key]) && count($search[$key])) { + if (is_array($search[$key])) { foreach ($search[$key] as $skey) { if ($skey != '') { $param .= '&search_'.$key.'[]='.urlencode($skey); } } + } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) { + $param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int')); + $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int')); + $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int')); } elseif ($search[$key] != '') { $param .= '&search_'.$key.'='.urlencode($search[$key]); } @@ -696,7 +715,7 @@ if ($optioncss != '') { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Add $param from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $param .= $hookmanager->resPrint; // List of mass actions available @@ -706,7 +725,7 @@ $arrayofmassactions = array( //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), 'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); -if ($permissiontodelete) { +if (!empty($permissiontodelete)) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { @@ -723,13 +742,17 @@ print ''; print ''; print ''; +print ''; print ''; print ''; print ''; print ''; +print ''; $params = array('morecss'=>'reposition'); -$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.(empty($confOrBooth->id) ? '' : '&conforboothid='.$confOrBooth->id).$withProjectUrl), '', $permissiontoadd, $params); + +$newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.(empty($confOrBooth->id) ? '' : '&conforboothid='.$confOrBooth->id).$withProjectUrl), '', $permissiontoadd, $params); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -744,9 +767,12 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { + $setupstring = ''; foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); + $setupstring .= $key."=".$val.";"; } + print ''."\n"; print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; } @@ -756,7 +782,7 @@ $moreforfilter.= $langs->trans('MyFilter') . ': '; print $moreforfilter; + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; print ''; } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table @@ -779,26 +808,32 @@ print '
'; + print ''; $searchpicto = $form->showFilterButtons('left'); print $searchpicto; print ''; + print ''; if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { - print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status onrightofpage' : ''), 1); + print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1); } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { @@ -804,11 +808,11 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields); -$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; print '
'; +print ''; +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} foreach ($object->fields as $key => $val) { - $cssforfield = (empty($val['css']) ? '' : $val['css']); + $searchkey = empty($search[$key]) ? '' : $search[$key]; + $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref')) && $val['label'] != 'TechnicalID') { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; } @@ -815,19 +856,28 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields); -$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print ''; +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} print ''."\n"; +$totalarray = array(); +$totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- print ''; +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; +} foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { @@ -836,21 +886,26 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref')) && $val['label'] != 'TechnicalID') { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } + $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label if (!empty($arrayfields['t.'.$key]['checked'])) { - print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n"; + $totalarray['nbfield']++; } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); -$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; +} print ''."\n"; @@ -858,7 +913,7 @@ print ''."\n"; $needToFetchEachLine = 0; if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) { + if ($val && preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object } } @@ -868,9 +923,11 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar // Loop on record // -------------------------------------------------------------------- $i = 0; +$savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; -while ($i < ($limit ? min($num, $limit) : $num)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; // Should not happen @@ -878,79 +935,121 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Store properties in $object $object->setVarsFromFetchObj($obj); - // Show here line of result - print ''; - foreach ($object->fields as $key => $val) { - $cssforfield = (empty($val['css']) ? '' : $val['css']); - if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; - } elseif ($key == 'status') { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; - } - if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap left'; - } elseif ($key == 'ref') { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + } + } else { + // Show here line of result + $j = 0; + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; if (!$i) { $totalarray['nbfield']++; } - if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + } + foreach ($object->fields as $key => $val) { + $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } elseif ($key == 'status') { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } + + if (in_array($val['type'], array('timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall'; + } elseif ($key == 'ref') { + $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall'; + } + + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { + $cssforfield .= ($cssforfield ? ' ' : '').'right'; + } + //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; + + if (!empty($arrayfields['t.'.$key]['checked'])) { + print '$key)) { + print ' title="'.dol_escape_htmltag($object->$key).'"'; + } + print '>'; + if ($key == 'status') { + print $object->getLibStatut(5); + } elseif ($key == 'ref') { + $optionLink = (!empty($withproject)?'conforboothidproject':'conforboothid'); + if (empty($confOrBooth->id)) { + $optionLink='projectid'; + } + print $object->getNomUrl(1, $optionLink); + } else { + print $object->showOutputField($val, $key, $object->$key, ''); + } + print ''; if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + $totalarray['nbfield']++; } - if (!isset($totalarray['val'])) { - $totalarray['val'] = array(); + if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + } + if (!isset($totalarray['val'])) { + $totalarray['val'] = array(); + } + if (!isset($totalarray['val']['t.'.$key])) { + $totalarray['val']['t.'.$key] = 0; + } + $totalarray['val']['t.'.$key] += $object->$key; } - if (!isset($totalarray['val']['t.'.$key])) { - $totalarray['val']['t.'.$key] = 0; - } - $totalarray['val']['t.'.$key] += $object->$key; } } - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Action column - print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - print ''."\n"; + print ''."\n"; + } $i++; } @@ -973,7 +1072,7 @@ if ($num == 0) { $db->free($resql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); -$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print '
'; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print ''; + print ''; if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { - print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); - } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) { - print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1); - } elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) { - print ''; + print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); + } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { + print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1); } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { print '
'; print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); @@ -806,6 +841,12 @@ foreach ($object->fields as $key => $val) { print '
'; print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); print '
'; + } elseif ($key == 'lang') { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; + $formadmin = new FormAdmin($db); + print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2); + } else { + print ''; } print '
'; -$searchpicto = $form->showFilterButtons(); -print $searchpicto; -print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print '
'; + print '
'; } - - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'ref', 'status'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'right'; + // Output Kanban + 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($object->id, $arrayofselected)) { + $selected = 1; + } } - //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; - - if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; - if ($key == 'status') { - print $object->getLibStatut(5); - } elseif ($key == 'ref') { - $optionLink = (!empty($withproject)?'conforboothidproject':'conforboothid'); - if (empty($confOrBooth->id)) { - $optionLink='projectid'; + print $object->getKanbanView(''); + if ($i == ($imaxinloop - 1)) { + 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($object->id, $arrayofselected)) { + $selected = 1; } - print $object->getNomUrl(1, $optionLink); - } else { - print $object->showOutputField($val, $key, $object->$key, ''); + 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($object->id, $arrayofselected)) { - $selected = 1; + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, '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; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + 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($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print '
'."\n"; diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index a1fcce9092a..ca0dd2f04bf 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -741,9 +741,9 @@ while ($i < $imaxinloop) { } if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall'; } elseif ($key == 'ref') { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall'; } if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { @@ -856,7 +856,7 @@ if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $n $genallowed = $permissiontoread; $delallowed = $permissiontoadd; - print $formfile->showdocuments('massfilesarea_mymodule', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); + print $formfile->showdocuments('massfilesarea_'.$object->module, '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } // End of page diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index fe00eb671d9..3f4293c1c0e 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -2364,7 +2364,7 @@ class Task extends CommonObjectLine $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']); $return = '
'; - $return .= '
'; + $return .= '
'; $return .= ''; $return .= img_picto('', $this->picto); //$return .= ''; // Can be image @@ -2372,17 +2372,20 @@ class Task extends CommonObjectLine $return .= '
'; $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; $return .= ''; - if (property_exists($this, 'fk_project') ) { - $return .= '
'.$this->fk_project.''; + if (!empty($arraydata['projectlink'])) { + //$tmpproject = $arraydata['project']; + //$return .= '
'.$tmpproject->getNomProject().''; + $return .= '
'.$arraydata['projectlink'].''; } if (property_exists($this, 'budget_amount')) { - $return .= '
'.$langs->trans("Budget").' : '.price($this->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).''; + //$return .= '
'.$langs->trans("Budget").' : '.price($this->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).''; } if (property_exists($this, 'fk_statut')) { $return .= '
'.$this->fk_statut.''; + //$return .= ' '.$this->progress.'%'; } if (property_exists($this, 'duration_effective')) { - $return .= '
'.getTaskProgressView($this, false, false).'
'; + $return .= '
'.getTaskProgressView($this, false, true).'
'; } $return .= '
'; $return .= '
'; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 35e47f64604..c9771265eac 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -1132,8 +1132,8 @@ while ($i < $imaxinloop) { } // Output Kanban $object->fk_statut = $projectstatic->getLibStatut(1); - $object->fk_project = $projectstatic->getNomUrl(1, 'task'); - print $object->getKanbanView(''); + $arraydata['projectlink'] = $projectstatic->getNomUrl(1); + print $object->getKanbanView('', $arraydata); if ($i == ($imaxinloop - 1)) { print '
'; print '
'."\n"; // Fields title search // -------------------------------------------------------------------- print ''; // Action column -if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; @@ -930,7 +954,7 @@ if (!empty($arrayfields['t.billed']['checked'])) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields); -$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['t.datec']['checked'])) { // Date creation @@ -943,8 +967,8 @@ if (!empty($arrayfields['t.tms']['checked'])) { print ''; } // Action column -if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print ''; @@ -973,8 +997,10 @@ $totalarray = array( // Fields title label // -------------------------------------------------------------------- print ''; -if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; } if (!empty($arrayfields['t.fk_task_parent']['checked'])) { print_liste_field_titre($arrayfields['t.fk_task_parent']['label'], $_SERVER["PHP_SELF"], "t.fk_task_parent", "", $param, "", $sortfield, $sortorder); @@ -1072,10 +1098,11 @@ if (!empty($arrayfields['t.tms']['checked'])) { print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER["PHP_SELF"], "t.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); $totalarray['nbfield']++; } -if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); +// Action column +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; } -$totalarray['nbfield']++; print ''."\n"; $plannedworkloadoutputformat = 'allhourmin'; @@ -1091,6 +1118,7 @@ if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) { // -------------------------------------------------------------------- $i = 0; $savnbfield = $totalarray['nbfield']; +$totalarray = array(); $totalarray['nbfield'] = 0; $imaxinloop = ($limit ? min($num, $limit) : $num); while ($i < $imaxinloop) { @@ -1131,6 +1159,13 @@ while ($i < $imaxinloop) { print '
'; } // Output Kanban + 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($object->id, $arrayofselected)) { + $selected = 1; + } + } + $object->fk_statut = $projectstatic->getLibStatut(1); $arraydata['projectlink'] = $projectstatic->getNomUrl(1); print $object->getKanbanView('', $arraydata); @@ -1141,10 +1176,12 @@ while ($i < $imaxinloop) { } else { $userAccess = $projectstatic->restrictedProjectArea($user); // why this ? if ($userAccess >= 0) { + // Show here line of result + $j = 0; print '
'; // Action column - if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; + if (!$i) { + $totalarray['nbfield']++; + } } // Ref Parent if (!empty($arrayfields['t.fk_task_parent']['checked'])) { @@ -1452,8 +1492,8 @@ while ($i < $imaxinloop) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, '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; // Date creation if (!empty($arrayfields['t.datec']['checked'])) { @@ -1480,7 +1520,7 @@ while ($i < $imaxinloop) { print ''; }*/ // Action column - if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; - } - if (!$i) { - $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } } print ''."\n"; @@ -1554,7 +1594,7 @@ if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['tota $db->free($resql); $parameters = array('arrayfields'=>$arrayfields, 'sql' => $sql); -$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print '
'; +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; $searchpicto = $form->showFilterButtons('left'); print $searchpicto; print ''; +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; 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; @@ -1154,6 +1191,9 @@ while ($i < $imaxinloop) { print ''; } print ''.$projectstatic->getLibStatut(5).''; 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; @@ -1490,9 +1530,9 @@ while ($i < $imaxinloop) { print ''; } print '
'."\n"; From 0fb03fdc2d5c1967dfd3c4529e841c4e8929ed21 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Apr 2023 01:43:21 +0200 Subject: [PATCH 27/30] Clean code --- htdocs/accountancy/admin/account.php | 2 +- htdocs/accountancy/admin/productaccount.php | 2 +- htdocs/accountancy/admin/subaccount.php | 2 +- htdocs/accountancy/bookkeeping/balance.php | 2 +- htdocs/accountancy/bookkeeping/list.php | 2 +- htdocs/accountancy/bookkeeping/listbyaccount.php | 2 +- htdocs/accountancy/customer/lines.php | 2 +- htdocs/accountancy/customer/list.php | 2 +- htdocs/accountancy/expensereport/lines.php | 2 +- htdocs/accountancy/expensereport/list.php | 2 +- htdocs/accountancy/supplier/lines.php | 2 +- htdocs/accountancy/supplier/list.php | 2 +- htdocs/adherents/list.php | 2 +- htdocs/adherents/subscription.php | 2 +- htdocs/admin/defaultvalues.php | 2 +- htdocs/admin/emailcollector_list.php | 2 +- htdocs/admin/mails_senderprofile_list.php | 4 ++-- htdocs/admin/mails_templates.php | 2 +- htdocs/admin/tools/listevents.php | 2 +- htdocs/admin/translation.php | 2 +- htdocs/asset/agenda.php | 2 +- htdocs/asset/list.php | 2 +- htdocs/asset/model/agenda.php | 2 +- htdocs/asset/model/list.php | 2 +- htdocs/blockedlog/admin/blockedlog_list.php | 2 +- htdocs/bom/bom_agenda.php | 2 +- htdocs/bom/bom_list.php | 2 +- htdocs/bookcal/availabilities_agenda.php | 2 +- htdocs/bookcal/availabilities_list.php | 2 +- htdocs/bookcal/booking_agenda.php | 2 +- htdocs/bookcal/booking_list.php | 2 +- htdocs/bookmarks/list.php | 2 +- htdocs/comm/action/list.php | 2 +- htdocs/comm/mailing/cibles.php | 2 +- htdocs/comm/mailing/list.php | 2 +- htdocs/comm/propal/agenda.php | 2 +- htdocs/comm/propal/list.php | 2 +- htdocs/commande/agenda.php | 2 +- htdocs/commande/list.php | 4 ++-- htdocs/commande/list_det.php | 2 +- htdocs/compta/bank/bankentries_list.php | 4 ++-- htdocs/compta/bank/list.php | 2 +- htdocs/compta/bank/various_payment/list.php | 2 +- htdocs/compta/cashcontrol/cashcontrol_list.php | 2 +- htdocs/compta/facture/agenda.php | 2 +- htdocs/compta/facture/invoicetemplate_list.php | 2 +- htdocs/compta/facture/list.php | 2 +- htdocs/compta/paiement/list.php | 2 +- htdocs/compta/prelevement/card.php | 2 +- htdocs/compta/prelevement/create.php | 2 +- htdocs/compta/prelevement/factures.php | 2 +- htdocs/compta/prelevement/list.php | 2 +- htdocs/compta/prelevement/orders_list.php | 2 +- htdocs/compta/sociales/list.php | 2 +- htdocs/compta/sociales/payments.php | 2 +- htdocs/contact/consumption.php | 2 +- htdocs/contrat/list.php | 2 +- htdocs/cron/list.php | 4 ++-- htdocs/don/list.php | 2 +- htdocs/expedition/list.php | 2 +- htdocs/expensereport/list.php | 2 +- htdocs/expensereport/payment/list.php | 2 +- htdocs/fichinter/agenda.php | 2 +- htdocs/fourn/commande/list.php | 4 ++-- htdocs/fourn/facture/list-rec.php | 2 +- htdocs/fourn/paiement/list.php | 2 +- htdocs/holiday/month_report.php | 2 +- htdocs/holiday/view_log.php | 2 +- htdocs/hrm/evaluation_agenda.php | 2 +- htdocs/hrm/evaluation_list.php | 2 +- htdocs/hrm/job_agenda.php | 2 +- htdocs/hrm/job_list.php | 2 +- htdocs/hrm/position.php | 14 +++++++------- htdocs/hrm/position_agenda.php | 2 +- htdocs/hrm/position_list.php | 2 +- htdocs/hrm/skill_agenda.php | 2 +- htdocs/hrm/skill_list.php | 2 +- htdocs/intracommreport/list.php | 2 +- .../knowledgemanagement/knowledgerecord_agenda.php | 2 +- .../knowledgemanagement/knowledgerecord_list.php | 2 +- htdocs/loan/list.php | 2 +- htdocs/modulebuilder/template/myobject_agenda.php | 2 +- htdocs/mrp/mo_agenda.php | 2 +- htdocs/mrp/mo_list.php | 2 +- htdocs/mrp/mo_movements.php | 2 +- htdocs/multicurrency/multicurrency_rate.php | 2 +- htdocs/opensurvey/list.php | 2 +- htdocs/partnership/partnership_agenda.php | 2 +- htdocs/partnership/partnership_list.php | 2 +- htdocs/product/fournisseurs.php | 2 +- htdocs/product/inventory/inventory.php | 2 +- htdocs/product/list.php | 2 +- htdocs/product/reassort.php | 2 +- htdocs/product/reassortlot.php | 2 +- htdocs/product/stats/bom.php | 2 +- htdocs/product/stats/commande.php | 2 +- htdocs/product/stats/commande_fournisseur.php | 2 +- htdocs/product/stats/contrat.php | 2 +- htdocs/product/stats/facture.php | 2 +- htdocs/product/stats/facture_fournisseur.php | 2 +- htdocs/product/stats/facturerec.php | 2 +- htdocs/product/stats/mo.php | 2 +- htdocs/product/stats/propal.php | 2 +- htdocs/product/stats/supplier_proposal.php | 2 +- htdocs/product/stock/list.php | 2 +- htdocs/product/stock/movement_card.php | 2 +- htdocs/product/stock/movement_list.php | 2 +- htdocs/product/stock/productlot_list.php | 2 +- htdocs/product/stock/replenish.php | 2 +- htdocs/product/stock/replenishorders.php | 2 +- .../product/stock/stats/commande_fournisseur.php | 2 +- htdocs/product/stock/stats/expedition.php | 2 +- htdocs/product/stock/stats/mo.php | 2 +- htdocs/product/stock/stats/reception.php | 2 +- htdocs/product/stock/stockatdate.php | 2 +- .../stock/stocktransfer/stocktransfer_agenda.php | 2 +- .../stock/stocktransfer/stocktransfer_list.php | 2 +- htdocs/projet/tasks/time.php | 2 +- htdocs/reception/list.php | 2 +- .../recruitment/recruitmentcandidature_agenda.php | 2 +- htdocs/recruitment/recruitmentcandidature_list.php | 2 +- .../recruitment/recruitmentjobposition_agenda.php | 2 +- htdocs/recruitment/recruitmentjobposition_list.php | 2 +- htdocs/resource/agenda.php | 2 +- htdocs/resource/list.php | 2 +- htdocs/salaries/payments.php | 2 +- htdocs/societe/agenda.php | 2 +- htdocs/societe/consumption.php | 2 +- htdocs/societe/list.php | 2 +- htdocs/societe/messaging.php | 2 +- htdocs/societe/website.php | 2 +- htdocs/stripe/charge.php | 2 +- htdocs/supplier_proposal/list.php | 2 +- htdocs/ticket/list.php | 2 +- htdocs/user/list.php | 12 ++++++------ htdocs/webhook/target_list.php | 2 +- htdocs/workstation/workstation_agenda.php | 2 +- htdocs/workstation/workstation_list.php | 2 +- 138 files changed, 154 insertions(+), 154 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 91b7673ab81..324f5d8d447 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -321,7 +321,7 @@ if ($resql) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_account) { $param .= '&search_account='.urlencode($search_account); diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 620e4158ceb..01bfa1da942 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -416,7 +416,7 @@ if ($resql) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($searchCategoryProductOperator == 1) { $param .= "&search_category_product_operator=".urlencode($searchCategoryProductOperator); diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php index 40055a4b75f..31b99be39a3 100644 --- a/htdocs/accountancy/admin/subaccount.php +++ b/htdocs/accountancy/admin/subaccount.php @@ -296,7 +296,7 @@ if ($resql) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_subaccount) { $param .= '&search_subaccount='.urlencode($search_subaccount); diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index fd8cd8ad688..c45a1202419 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -327,7 +327,7 @@ if ($action != 'export_csv') { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1); diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 217474db0c9..78106b1026e 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -970,7 +970,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } // List of mass actions available diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 419369fe9d3..599e2360147 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -686,7 +686,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1); diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 888cc568cf8..a0488793ebf 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -317,7 +317,7 @@ if ($result) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_societe) { $param .= "&search_societe=".urlencode($search_societe); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 8834ad69cf8..753ad06a503 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -382,7 +382,7 @@ if ($result) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_societe) { $param .= '&search_societe='.urlencode($search_societe); diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 1d0653fc5ac..f38b617509e 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -248,7 +248,7 @@ if ($result) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_login) { $param .= '&search_login='.urlencode($search_login); diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 4ad8c80a2c1..0eb84e6d77b 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -306,7 +306,7 @@ if ($result) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_login) { $param .= '&search_login='.urlencode($search_login); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index ea9841d2fbb..1eef199894d 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -322,7 +322,7 @@ if ($result) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_societe) { $param .= "&search_societe=".urlencode($search_societe); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 3ec92f490bd..03b3fb8eeec 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -386,7 +386,7 @@ if ($result) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_societe) { $param .= '&search_societe='.urlencode($search_societe); diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index ef396c143a1..0c4a5aaccf1 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -566,7 +566,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sall != "") { $param .= "&sall=".urlencode($sall); diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index ea2796ae910..8296fd5591d 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -451,7 +451,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } $param .= '&id='.$rowid; if ($optioncss != '') { diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index 4baddd8b29b..6b0b722b629 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -226,7 +226,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index ccee1f604b2..20d9ddf4ac9 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -337,7 +337,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index dbf47365440..280a3b06247 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -334,7 +334,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { @@ -627,7 +627,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { print ''; $url = $_SERVER["PHP_SELF"].'?id='.$obj->rowid; if ($limit) { - $url .= '&limit='.urlencode($limit); + $url .= '&limit='.((int) $limit); } if ($page) { $url .= '&page='.urlencode($page); diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 47e4939ef82..167e851a6c2 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -623,7 +623,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if (!empty($search) && is_array($search)) { foreach ($search as $key => $val) { diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 3e04243eb72..045ecda2cc7 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -259,7 +259,7 @@ if ($result) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index fcbc01abef1..6013ae41e94 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -226,7 +226,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if (isset($optioncss) && $optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); diff --git a/htdocs/asset/agenda.php b/htdocs/asset/agenda.php index 166eb12935c..ef9afa10458 100644 --- a/htdocs/asset/agenda.php +++ b/htdocs/asset/agenda.php @@ -197,7 +197,7 @@ if ($object->id > 0) { $param .= '&contextpage=' . urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit=' . urlencode($limit); + $param .= '&limit='.((int) $limit); } diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index 4b3b530148d..8f8c551d66b 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -354,7 +354,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { diff --git a/htdocs/asset/model/agenda.php b/htdocs/asset/model/agenda.php index 51a55e0e144..44a0fa504a3 100644 --- a/htdocs/asset/model/agenda.php +++ b/htdocs/asset/model/agenda.php @@ -199,7 +199,7 @@ if ($object->id > 0) { // $param .= '&contextpage=' . urlencode($contextpage); // } // if ($limit > 0 && $limit != $conf->liste_limit) { - // $param .= '&limit=' . urlencode($limit); + // $param .= '&limit='.((int) $limit); // } // // diff --git a/htdocs/asset/model/list.php b/htdocs/asset/model/list.php index 51e45f244d0..8ccf50a8ab1 100644 --- a/htdocs/asset/model/list.php +++ b/htdocs/asset/model/list.php @@ -360,7 +360,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index b3b2a1d36f4..bf5a07f98b5 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -325,7 +325,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_id != '') { $param .= '&search_id='.urlencode($search_id); diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php index ddd57d34e76..5e25d788ac7 100644 --- a/htdocs/bom/bom_agenda.php +++ b/htdocs/bom/bom_agenda.php @@ -241,7 +241,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 065a3a578b7..0819c4f1cd1 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -442,7 +442,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key])) { diff --git a/htdocs/bookcal/availabilities_agenda.php b/htdocs/bookcal/availabilities_agenda.php index 16673d6b8a3..f21d88fa02a 100644 --- a/htdocs/bookcal/availabilities_agenda.php +++ b/htdocs/bookcal/availabilities_agenda.php @@ -247,7 +247,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } diff --git a/htdocs/bookcal/availabilities_list.php b/htdocs/bookcal/availabilities_list.php index fd5866eaff8..732ddf20a93 100644 --- a/htdocs/bookcal/availabilities_list.php +++ b/htdocs/bookcal/availabilities_list.php @@ -396,7 +396,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { diff --git a/htdocs/bookcal/booking_agenda.php b/htdocs/bookcal/booking_agenda.php index b171b953b42..da4c9936860 100644 --- a/htdocs/bookcal/booking_agenda.php +++ b/htdocs/bookcal/booking_agenda.php @@ -247,7 +247,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } diff --git a/htdocs/bookcal/booking_list.php b/htdocs/bookcal/booking_list.php index e030a52b7e3..e416dd498ed 100644 --- a/htdocs/bookcal/booking_list.php +++ b/htdocs/bookcal/booking_list.php @@ -396,7 +396,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index 34b727aaa16..2bd7109c80b 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -221,7 +221,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 786e571ee3c..ea776094625 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -301,7 +301,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($actioncode != '') { if (is_array($actioncode)) { diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index d65a35f7527..206909d1602 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -529,7 +529,7 @@ if ($object->fetch($id) >= 0) { $param = "&id=".$object->id; //if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_lastname) { $param .= "&search_lastname=".urlencode($search_lastname); diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index e6163b9f2da..3fea5458a2d 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -271,7 +271,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); diff --git a/htdocs/comm/propal/agenda.php b/htdocs/comm/propal/agenda.php index 42e15dca146..c679fd267da 100644 --- a/htdocs/comm/propal/agenda.php +++ b/htdocs/comm/propal/agenda.php @@ -230,7 +230,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } // Try to know count of actioncomm from cache diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 13b9aa1a4fe..1b159c9a113 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -875,7 +875,7 @@ if ($resql) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sall) { $param .= '&sall='.urlencode($sall); diff --git a/htdocs/commande/agenda.php b/htdocs/commande/agenda.php index a998229f776..0cb944afa63 100644 --- a/htdocs/commande/agenda.php +++ b/htdocs/commande/agenda.php @@ -230,7 +230,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } // Try to know count of actioncomm from cache diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 27b9a05181b..49e6b0b3555 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -587,7 +587,7 @@ if (empty($reshook)) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sall) { $param .= '&sall='.urlencode($sall); @@ -1143,7 +1143,7 @@ if ($resql) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sall) { $param .= '&sall='.urlencode($sall); diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index d5b0336b95a..3faa292b78d 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -671,7 +671,7 @@ if ($resql) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sall) { $param .= '&sall='.urlencode($sall); diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index a678c176ca7..5740c58c86c 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -286,7 +286,7 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', ' $param .= '&offset='.urlencode($offset); } if ($limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_conciliated != '' && $search_conciliated != '-1') { $param .= '&search_conciliated='.urlencode($search_conciliated); @@ -438,7 +438,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($id > 0) { $param .= '&id='.urlencode($id); diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 073e9de9a15..85c9e72af5a 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -313,7 +313,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_ref != '') { $param .= '&search_ref='.urlencode($search_ref); diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index d72238e3fe6..ec703f3fea4 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -351,7 +351,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 1333a6b2346..4451707bdff 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -348,7 +348,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key])) { diff --git a/htdocs/compta/facture/agenda.php b/htdocs/compta/facture/agenda.php index a452a8dd6aa..45f495c1723 100644 --- a/htdocs/compta/facture/agenda.php +++ b/htdocs/compta/facture/agenda.php @@ -230,7 +230,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } // Try to know count of actioncomm from cache diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index d0c8ea7f1f5..e0d45a5e38f 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -440,7 +440,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($socid > 0) { $param .= '&socid='.urlencode($socid); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index ec8ece79c56..407b2dc4e3c 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -993,7 +993,7 @@ if ($resql) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sall) { $param .= '&sall='.urlencode($sall); diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 6db18f6aa55..5e39e05c818 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -301,7 +301,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if (GETPOST("orphelins")) { diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 727b3b85f48..8752e63517a 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -412,7 +412,7 @@ if ($id > 0 || $ref) { $urladd = "&id=".urlencode($id); if ($limit > 0 && $limit != $conf->liste_limit) { - $urladd .= '&limit='.urlencode($limit); + $urladd .= '&limit='.((int) $limit); } print ''."\n"; diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 85f0be90125..39c48e0767e 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -395,7 +395,7 @@ if ($resql) { $param = ''; if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($socid) { $param .= '&socid='.urlencode($socid); diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index 4c3d26720c3..949ebed87c5 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -235,7 +235,7 @@ if ($resql) { $i = 0; if ($limit > 0 && $limit != $conf->liste_limit) { - $param.='&limit='.urlencode($limit); + $param.='&limit='.((int) $limit); } $param = "&id=".urlencode($id); diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index 307a7239fe8..96c365997b0 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -196,7 +196,7 @@ if ($result) { $param .= '&type=bank-transfer'; } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } $newcardbutton = ''; $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); diff --git a/htdocs/compta/prelevement/orders_list.php b/htdocs/compta/prelevement/orders_list.php index 8dd056ed796..974ed47deff 100644 --- a/htdocs/compta/prelevement/orders_list.php +++ b/htdocs/compta/prelevement/orders_list.php @@ -159,7 +159,7 @@ if ($result) { $param .= '&type=bank-transfer'; } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } $param .= "&statut=".urlencode($statut); diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index ed92d834488..6ea46c3ea4e 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -314,7 +314,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index 9956cf5153a..8c575ad4b6a 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -114,7 +114,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sortfield) { $param .= '&sortfield='.urlencode($sortfield); diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index 8efae5a836d..7b2374830b3 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -382,7 +382,7 @@ if ($sql_select) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sprod_fulldescr) { $param .= "&sprod_fulldescr=".urlencode($sprod_fulldescr); diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 15b4776c2b9..a671297b0de 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -545,7 +545,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_all != '') { $param .= '&search_all='.urlencode($search_all); diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index fd3f705b7aa..021e33dd20a 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -184,7 +184,7 @@ if (empty($reshook)) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_label) { $param .= '&search_label='.urlencode($search_label); @@ -327,7 +327,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_status) { $param .= '&search_status='.urlencode($search_status); diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 320c1616d22..b8412c58707 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -163,7 +163,7 @@ if ($resql) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 5b109c8b29d..2b8a54e999f 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -497,7 +497,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sall) { $param .= "&sall=".urlencode($sall); diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 1edf6c0edca..0f7145418aa 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -386,7 +386,7 @@ if ($resql) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sall) { $param .= "&sall=".urlencode($sall); diff --git a/htdocs/expensereport/payment/list.php b/htdocs/expensereport/payment/list.php index 18420e7ac20..675696473f5 100644 --- a/htdocs/expensereport/payment/list.php +++ b/htdocs/expensereport/payment/list.php @@ -262,7 +262,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER['PHP_SELF']) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); diff --git a/htdocs/fichinter/agenda.php b/htdocs/fichinter/agenda.php index 451f0a533f5..c06ccbc254e 100644 --- a/htdocs/fichinter/agenda.php +++ b/htdocs/fichinter/agenda.php @@ -231,7 +231,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } // Try to know count of actioncomm from cache diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 64ac75ce0e9..ddab56300ce 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -586,7 +586,7 @@ if (empty($reshook)) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sall) { $param .= '&sall='.urlencode($sall); @@ -1012,7 +1012,7 @@ if ($resql) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sall) { $param .= '&sall='.urlencode($sall); diff --git a/htdocs/fourn/facture/list-rec.php b/htdocs/fourn/facture/list-rec.php index 2c5f8d4980e..65c35a1ed67 100644 --- a/htdocs/fourn/facture/list-rec.php +++ b/htdocs/fourn/facture/list-rec.php @@ -378,7 +378,7 @@ if ($resql) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($socid > 0) { $param .= '&socid='.urlencode($socid); diff --git a/htdocs/fourn/paiement/list.php b/htdocs/fourn/paiement/list.php index c19fc90e5d7..e4db29cb962 100644 --- a/htdocs/fourn/paiement/list.php +++ b/htdocs/fourn/paiement/list.php @@ -272,7 +272,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER['PHP_SELF']) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index 9b611c18852..bcadcf25afd 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -187,7 +187,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if (!empty($search_ref)) { $param .= '&search_ref='.urlencode($search_ref); diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index d0ba35add68..d868cdd9cbc 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -241,7 +241,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if (!empty($search_id)) { $param .= '&search_statut='.urlencode($search_statut); diff --git a/htdocs/hrm/evaluation_agenda.php b/htdocs/hrm/evaluation_agenda.php index 2124dca8a8d..1032287da61 100644 --- a/htdocs/hrm/evaluation_agenda.php +++ b/htdocs/hrm/evaluation_agenda.php @@ -222,7 +222,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } //print load_fiche_titre($langs->trans("ActionsOnMyObject"), '', ''); diff --git a/htdocs/hrm/evaluation_list.php b/htdocs/hrm/evaluation_list.php index 5dbddbd6ec6..3b77d199388 100644 --- a/htdocs/hrm/evaluation_list.php +++ b/htdocs/hrm/evaluation_list.php @@ -377,7 +377,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { diff --git a/htdocs/hrm/job_agenda.php b/htdocs/hrm/job_agenda.php index c108a7f113b..eee0f80c507 100644 --- a/htdocs/hrm/job_agenda.php +++ b/htdocs/hrm/job_agenda.php @@ -203,7 +203,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } diff --git a/htdocs/hrm/job_list.php b/htdocs/hrm/job_list.php index 3616c696d54..ae215e50556 100644 --- a/htdocs/hrm/job_list.php +++ b/htdocs/hrm/job_list.php @@ -365,7 +365,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key])) { diff --git a/htdocs/hrm/position.php b/htdocs/hrm/position.php index 3b3931fcf64..e7033e88b86 100644 --- a/htdocs/hrm/position.php +++ b/htdocs/hrm/position.php @@ -464,7 +464,7 @@ if ($job->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create' $param .= '&contextpage=' . urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit=' . urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { @@ -1020,24 +1020,24 @@ function DisplayPositionList() $arrayofselected = is_array($toselect) ? $toselect : array(); - $param = 'fk_job=' . $fk_job; + $param = 'fk_job='.$fk_job; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { - $param .= '&contextpage=' . urlencode($contextpage); + $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit=' . urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { foreach ($search[$key] as $skey) { - $param .= '&search_' . $key . '[]=' . urlencode($skey); + $param .= '&search_'.$key.'[]='.urlencode($skey); } } else { - $param .= '&search_' . $key . '=' . urlencode($search[$key]); + $param .= '&search_'.$key.'='.urlencode($search[$key]); } } if ($optioncss != '') { - $param .= '&optioncss=' . urlencode($optioncss); + $param .= '&optioncss='.urlencode($optioncss); } // Add $param from extra fields include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_param.tpl.php'; diff --git a/htdocs/hrm/position_agenda.php b/htdocs/hrm/position_agenda.php index 8386c0bb1df..c1d2f2e57f1 100644 --- a/htdocs/hrm/position_agenda.php +++ b/htdocs/hrm/position_agenda.php @@ -216,7 +216,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } diff --git a/htdocs/hrm/position_list.php b/htdocs/hrm/position_list.php index 3f605a84d4a..c2ce65032bc 100644 --- a/htdocs/hrm/position_list.php +++ b/htdocs/hrm/position_list.php @@ -376,7 +376,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { diff --git a/htdocs/hrm/skill_agenda.php b/htdocs/hrm/skill_agenda.php index e7814db1dc2..db742a95434 100644 --- a/htdocs/hrm/skill_agenda.php +++ b/htdocs/hrm/skill_agenda.php @@ -210,7 +210,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } diff --git a/htdocs/hrm/skill_list.php b/htdocs/hrm/skill_list.php index b11af391ae2..3ec1e393ace 100644 --- a/htdocs/hrm/skill_list.php +++ b/htdocs/hrm/skill_list.php @@ -372,7 +372,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key])) { diff --git a/htdocs/intracommreport/list.php b/htdocs/intracommreport/list.php index d7995ef275b..f25dc9536c4 100644 --- a/htdocs/intracommreport/list.php +++ b/htdocs/intracommreport/list.php @@ -327,7 +327,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sall) { $param .= "&sall=".urlencode($sall); diff --git a/htdocs/knowledgemanagement/knowledgerecord_agenda.php b/htdocs/knowledgemanagement/knowledgerecord_agenda.php index 18ab83e1ff2..cd4580c4d29 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_agenda.php +++ b/htdocs/knowledgemanagement/knowledgerecord_agenda.php @@ -237,7 +237,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index fbf3a26ce25..8450484160e 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -407,7 +407,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key])) { diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index 57e5ef97d97..70a91ecfe3a 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -181,7 +181,7 @@ if ($resql) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_ref) { $param .= "&search_ref=".urlencode($search_ref); diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index 189bfd6282b..c752dd41632 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -301,7 +301,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } // Try to know count of actioncomm from cache diff --git a/htdocs/mrp/mo_agenda.php b/htdocs/mrp/mo_agenda.php index 470d87b727e..1ec339ee333 100644 --- a/htdocs/mrp/mo_agenda.php +++ b/htdocs/mrp/mo_agenda.php @@ -234,7 +234,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index d1d50441ea2..c49b5903046 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -379,7 +379,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { diff --git a/htdocs/mrp/mo_movements.php b/htdocs/mrp/mo_movements.php index c450baf92fe..ae3ed6d9e34 100644 --- a/htdocs/mrp/mo_movements.php +++ b/htdocs/mrp/mo_movements.php @@ -513,7 +513,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($id > 0) { $param .= '&id='.urlencode($id); diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index 8b9bbf4eef6..b518a0d378c 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -354,7 +354,7 @@ if ($resql) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sall) { $param .= "&sall=".urlencode($sall); diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index 5700909cd91..d845ef337d4 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -243,7 +243,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } $fieldtosortuser = empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION) ? 'firstname' : 'lastname'; diff --git a/htdocs/partnership/partnership_agenda.php b/htdocs/partnership/partnership_agenda.php index 8214e3e907d..f4b8275a8f6 100644 --- a/htdocs/partnership/partnership_agenda.php +++ b/htdocs/partnership/partnership_agenda.php @@ -243,7 +243,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index 7259ae0ff2b..33b940748bd 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -587,7 +587,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($socid) { $param .= '&socid='.urlencode($socid); diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 600bf8eb9c0..eaac0f303e7 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -923,7 +923,7 @@ END; $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } $param .= '&ref='.urlencode($object->ref); diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 5f72928ed13..89f59239e7c 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -99,7 +99,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ //Parameters Page $param = '&id='.$object->id; if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } $paramwithsearch = $param; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index c3464739589..4d654bd5187 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -702,7 +702,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sall) { $param .= "&sall=".urlencode($sall); diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index cdeadb5d315..6cb7c455759 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -326,7 +326,7 @@ if ($resql) { $param = ''; if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sall) { $param .= "&sall=".urlencode($sall); diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index d24b5282d11..3fcbbd73ced 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -427,7 +427,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { diff --git a/htdocs/product/stats/bom.php b/htdocs/product/stats/bom.php index 0ccc249b94f..d417fc8af73 100644 --- a/htdocs/product/stats/bom.php +++ b/htdocs/product/stats/bom.php @@ -262,7 +262,7 @@ if ($id > 0 || !empty($ref)) { $option .= '&id='.$product->id; if ($limit > 0 && $limit != $conf->liste_limit) { - $option .= '&limit='.urlencode($limit); + $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index d5854fdc702..a8606e49a8f 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -188,7 +188,7 @@ if ($id > 0 || !empty($ref)) { $option = '&id='.$product->id; if ($limit > 0 && $limit != $conf->liste_limit) { - $option .= '&limit='.urlencode($limit); + $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index 4d5972529cd..dddd911224c 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -188,7 +188,7 @@ if ($id > 0 || !empty($ref)) { $option = '&id='.$product->id; if ($limit > 0 && $limit != $conf->liste_limit) { - $option .= '&limit='.urlencode($limit); + $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index a53c71085fd..21737badb16 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -173,7 +173,7 @@ if ($id > 0 || !empty($ref)) { $option = '&id='.$product->id; if ($limit > 0 && $limit != $conf->liste_limit) { - $option .= '&limit='.urlencode($limit); + $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index c0a4d36793c..f17d56faeb9 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -204,7 +204,7 @@ if ($id > 0 || !empty($ref)) { $option .= '&id='.$product->id; if ($limit > 0 && $limit != $conf->liste_limit) { - $option .= '&limit='.urlencode($limit); + $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 8e89a05273f..06a63cb4c6e 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -187,7 +187,7 @@ if ($id > 0 || !empty($ref)) { $option .= '&id='.$product->id; if ($limit > 0 && $limit != $conf->liste_limit) { - $option .= '&limit='.urlencode($limit); + $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); diff --git a/htdocs/product/stats/facturerec.php b/htdocs/product/stats/facturerec.php index d1bbfe54e57..ddc7e1a0e3d 100644 --- a/htdocs/product/stats/facturerec.php +++ b/htdocs/product/stats/facturerec.php @@ -205,7 +205,7 @@ if ($id > 0 || !empty($ref)) { $option = '&id='.$product->id; if ($limit > 0 && $limit != $conf->liste_limit) { - $option .= '&limit='.urlencode($limit); + $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); diff --git a/htdocs/product/stats/mo.php b/htdocs/product/stats/mo.php index 561557e62fe..8a4fc03b530 100644 --- a/htdocs/product/stats/mo.php +++ b/htdocs/product/stats/mo.php @@ -183,7 +183,7 @@ if ($id > 0 || !empty($ref)) { $option = '&id='.$product->id; if ($limit > 0 && $limit != $conf->liste_limit) { - $option .= '&limit='.urlencode($limit); + $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index e1b46677c65..99f3e42e921 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -189,7 +189,7 @@ if ($id > 0 || !empty($ref)) { $option = '&id='.$product->id; if ($limit > 0 && $limit != $conf->liste_limit) { - $option .= '&limit='.urlencode($limit); + $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); diff --git a/htdocs/product/stats/supplier_proposal.php b/htdocs/product/stats/supplier_proposal.php index a182aa61eb6..841c0e29004 100644 --- a/htdocs/product/stats/supplier_proposal.php +++ b/htdocs/product/stats/supplier_proposal.php @@ -188,7 +188,7 @@ if ($id > 0 || !empty($ref)) { $option = '&id='.$product->id; if ($limit > 0 && $limit != $conf->liste_limit) { - $option .= '&limit='.urlencode($limit); + $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 3201bb5f507..f731c6e855f 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -385,7 +385,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php index e28dcc5ca51..5babcfc4c7c 100644 --- a/htdocs/product/stock/movement_card.php +++ b/htdocs/product/stock/movement_card.php @@ -685,7 +685,7 @@ if ($resql) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($id > 0) { $param .= '&id='.urlencode($id); diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 09f1975bcb4..56d39ae0e88 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -944,7 +944,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($id > 0) { $param .= '&id='.urlencode($id); diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index ef6315446aa..d77075bdd8b 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -371,7 +371,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index aad386ce444..ed014731b52 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -669,7 +669,7 @@ if ($search_ref || $search_label || $sall || $salert || $draftorder || GETPOST(' } } if ($limit > 0 && $limit != $conf->liste_limit) { - $filters .= '&limit='.urlencode($limit); + $filters .= '&limit='.((int) $limit); } if (!empty($includeproductswithoutdesiredqty)) $filters .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty); if (!empty($salert)) $filters .= '&salert='.urlencode($salert); diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index c3c031b14bd..6695a1ce874 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -187,7 +187,7 @@ if ($resql) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sref) { $param .= '&search_ref='.urlencode($sref); diff --git a/htdocs/product/stock/stats/commande_fournisseur.php b/htdocs/product/stock/stats/commande_fournisseur.php index 22be071ffc5..34f0a75109e 100644 --- a/htdocs/product/stock/stats/commande_fournisseur.php +++ b/htdocs/product/stock/stats/commande_fournisseur.php @@ -263,7 +263,7 @@ if ($id > 0 || !empty($ref)) { $option .= '&id='.$object->id; if ($limit > 0 && $limit != $conf->liste_limit) { - $option .= '&limit='.urlencode($limit); + $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); diff --git a/htdocs/product/stock/stats/expedition.php b/htdocs/product/stock/stats/expedition.php index 79beefa40cb..d4672fb31c5 100644 --- a/htdocs/product/stock/stats/expedition.php +++ b/htdocs/product/stock/stats/expedition.php @@ -262,7 +262,7 @@ if ($id > 0 || !empty($ref)) { $option .= '&id='.$object->id; if ($limit > 0 && $limit != $conf->liste_limit) { - $option .= '&limit='.urlencode($limit); + $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); diff --git a/htdocs/product/stock/stats/mo.php b/htdocs/product/stock/stats/mo.php index f0be40d1a1d..95fbb7d9e9a 100644 --- a/htdocs/product/stock/stats/mo.php +++ b/htdocs/product/stock/stats/mo.php @@ -204,7 +204,7 @@ if ($id > 0 || !empty($ref)) { $option = '&id='.$object->id; if ($limit > 0 && $limit != $conf->liste_limit) { - $option .= '&limit='.urlencode($limit); + $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); diff --git a/htdocs/product/stock/stats/reception.php b/htdocs/product/stock/stats/reception.php index 4e80dcf05f2..444629cd3ff 100644 --- a/htdocs/product/stock/stats/reception.php +++ b/htdocs/product/stock/stats/reception.php @@ -261,7 +261,7 @@ if ($id > 0 || !empty($ref)) { $option .= '&id='.$object->id; if ($limit > 0 && $limit != $conf->liste_limit) { - $option .= '&limit='.urlencode($limit); + $option .= '&limit='.((int) $limit); } if (!empty($search_month)) { $option .= '&search_month='.urlencode($search_month); diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 46c902238de..76d4958da34 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -397,7 +397,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } $param .= '&mode='.$mode; if (!empty($search_fk_warehouse)) { diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php b/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php index 893bbf05ff6..55545a6868c 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php @@ -214,7 +214,7 @@ if ($object->id > 0) { if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { $param = '&id='.$object->id.'&socid='.$socid; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); - if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.((int) $limit); //print load_fiche_titre($langs->trans("ActionsOnStockTransfer"), '', ''); diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_list.php b/htdocs/product/stock/stocktransfer/stocktransfer_list.php index 2a57b3f2f94..47904825ca7 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_list.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_list.php @@ -289,7 +289,7 @@ $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); -if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); +if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.((int) $limit); foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey); else $param .= '&search_'.$key.'='.urlencode($search[$key]); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 3dc22b5a589..0cd2eb6de5e 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1297,7 +1297,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_month > 0) { $param .= '&search_month='.urlencode($search_month); diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 8653953371a..fe47b95fb1e 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -747,7 +747,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sall) { $param .= "&sall=".urlencode($sall); diff --git a/htdocs/recruitment/recruitmentcandidature_agenda.php b/htdocs/recruitment/recruitmentcandidature_agenda.php index 19e64bc9a09..b01a7233f76 100644 --- a/htdocs/recruitment/recruitmentcandidature_agenda.php +++ b/htdocs/recruitment/recruitmentcandidature_agenda.php @@ -239,7 +239,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php index ce30277a82e..deca6c40548 100644 --- a/htdocs/recruitment/recruitmentcandidature_list.php +++ b/htdocs/recruitment/recruitmentcandidature_list.php @@ -508,7 +508,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key])) { diff --git a/htdocs/recruitment/recruitmentjobposition_agenda.php b/htdocs/recruitment/recruitmentjobposition_agenda.php index cacee2fd82c..3e365a350ca 100644 --- a/htdocs/recruitment/recruitmentjobposition_agenda.php +++ b/htdocs/recruitment/recruitmentjobposition_agenda.php @@ -235,7 +235,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } diff --git a/htdocs/recruitment/recruitmentjobposition_list.php b/htdocs/recruitment/recruitmentjobposition_list.php index fe2d2a5d612..82bad29b8ea 100644 --- a/htdocs/recruitment/recruitmentjobposition_list.php +++ b/htdocs/recruitment/recruitmentjobposition_list.php @@ -353,7 +353,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { diff --git a/htdocs/resource/agenda.php b/htdocs/resource/agenda.php index b9c4090aedd..78f449cb850 100644 --- a/htdocs/resource/agenda.php +++ b/htdocs/resource/agenda.php @@ -173,7 +173,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } print_barre_liste($langs->trans("ActionsOnResource"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', '', '', '', 0, 1, 1); diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index dcee2d813f5..8ad57e0d93b 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -157,7 +157,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_ref != '') { diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index 15b50c6dfc3..adee2a2ebf1 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -326,7 +326,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_type_id) { $param .= '&search_type_id='.urlencode($search_type_id); diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index c7a50fd0f19..669f4349247 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -202,7 +202,7 @@ if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } // Try to know count of actioncomm from cache diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 1f044b8c4de..07436ae6140 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -414,7 +414,7 @@ if ($sql_select) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sprod_fulldescr) { $param .= "&sprod_fulldescr=".urlencode($sprod_fulldescr); diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 9361fe34b3d..3362755d962 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -809,7 +809,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_all != '') { $param = "&sall=".urlencode($search_all); diff --git a/htdocs/societe/messaging.php b/htdocs/societe/messaging.php index 157510110fe..3219be29232 100644 --- a/htdocs/societe/messaging.php +++ b/htdocs/societe/messaging.php @@ -192,7 +192,7 @@ if ($socid > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } // Try to know count of actioncomm from cache diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 9ca58ab0bf4..4af74bdb2ce 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -190,7 +190,7 @@ if ($id > 0) { $param .= '&id='.urlencode($id); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { $param .= '&search_'.$key.'='.urlencode($search[$key]); diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index 0aee0c11e30..11594c2bff4 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -137,7 +137,7 @@ if (!$rowid) { //if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } $param .= '&starting_after_'.($page + 1).'='.$list->data[($limit - 1)]->id; //$param.='&ending_before_'.($page+1).'='.$list->data[($limit-1)]->id; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 226ddb55206..d6b15e0baa5 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -518,7 +518,7 @@ if ($resql) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sall) { $param .= '&sall='.urlencode($sall); diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 71b6d8cff0d..fa009bfec76 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -637,7 +637,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key])) { diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 79d442830f3..1f18cc20da5 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -151,7 +151,7 @@ $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); // Init search fields -$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); +$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_user = GETPOST('search_user', 'alpha'); $search_login = GETPOST('search_login', 'alpha'); $search_lastname = GETPOST('search_lastname', 'alpha'); @@ -448,8 +448,8 @@ if ($search_job != '') { if ($search_statut != '' && $search_statut >= 0) { $sql .= " AND u.statut IN (".$db->sanitize($search_statut).")"; } -if ($sall) { - $sql .= natural_search(array_keys($fieldstosearchall), $sall); +if ($search_all) { + $sql .= natural_search(array_keys($fieldstosearchall), $search_all); } // Search for tag/category ($searchCategoryUserList is an array of ID) $searchCategoryUserList = array($search_categ); @@ -551,10 +551,10 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } -if ($sall != '') { - $param .= '&search_all='.urlencode($sall); +if ($search_all != '') { + $param .= '&search_all='.urlencode($search_all); } if ($search_user != '') { $param .= "&search_user=".urlencode($search_user); diff --git a/htdocs/webhook/target_list.php b/htdocs/webhook/target_list.php index d28221c0e3d..fac35b03190 100644 --- a/htdocs/webhook/target_list.php +++ b/htdocs/webhook/target_list.php @@ -409,7 +409,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { diff --git a/htdocs/workstation/workstation_agenda.php b/htdocs/workstation/workstation_agenda.php index c5c73c3f668..a3036ad19c7 100644 --- a/htdocs/workstation/workstation_agenda.php +++ b/htdocs/workstation/workstation_agenda.php @@ -238,7 +238,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } diff --git a/htdocs/workstation/workstation_list.php b/htdocs/workstation/workstation_list.php index 47e93d8294b..80c64ff303b 100644 --- a/htdocs/workstation/workstation_list.php +++ b/htdocs/workstation/workstation_list.php @@ -372,7 +372,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { From 1bab84727829215056dd8efb32f6d149b7b96deb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Apr 2023 03:08:17 +0200 Subject: [PATCH 28/30] NEW Can set the page "List of opportunities" as landing page --- .../core/boxes/box_funnel_of_prospection.php | 2 +- htdocs/core/class/html.form.class.php | 38 +++++------ htdocs/user/param_ihm.php | 65 +++++++++++++------ 3 files changed, 64 insertions(+), 41 deletions(-) diff --git a/htdocs/core/boxes/box_funnel_of_prospection.php b/htdocs/core/boxes/box_funnel_of_prospection.php index cdaa9298f63..2cecc278392 100644 --- a/htdocs/core/boxes/box_funnel_of_prospection.php +++ b/htdocs/core/boxes/box_funnel_of_prospection.php @@ -152,7 +152,7 @@ class box_funnel_of_prospection extends ModeleBoxes 'graph' => '1' ); - if ($user->rights->projet->lire || !empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if ($user->hasRight('projet', 'lire') || getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { $sql = "SELECT p.fk_opp_status as opp_status, cls.code, COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, SUM(p.opp_amount * p.opp_percent) as ponderated_opp_amount"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p, ".MAIN_DB_PREFIX."c_lead_status as cls"; $sql .= " WHERE p.entity IN (".getEntity('project').")"; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f5024b5cb71..73aefd0c3f7 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8112,26 +8112,26 @@ class Form /** - * Return a HTML select string, built from an array of key+value. + * Return a HTML select string, built from an array of key+value. * Note: Do not apply langs->trans function on returned content, content may be entity encoded twice. * - * @param string $htmlname Name of html select area. Must start with "multi" if this is a multiselect - * @param array $array Array like array(key => value) or array(key=>array('label'=>..., 'data-...'=>..., 'disabled'=>..., 'css'=>...)) - * @param string|string[] $id Preselected key or preselected keys for multiselect. Use 'ifone' to autoselect record if there is only one record. - * @param int|string $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (If 1: key is -1 and value is '' or ' ', If placeholder string: key is -1 and value is the string), <0 to add an empty value with key that is this value. - * @param int $key_in_label 1 to show key into label with format "[key] value" - * @param int $value_as_key 1 to use value as key - * @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container - * @param int $translate 1=Translate and encode value - * @param int $maxlen Length maximum for labels - * @param int $disabled Html select box is disabled - * @param string $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' or 'POS' = Do not sort, we keep original order - * @param string $morecss Add more class to css styles - * @param int $addjscombo Add js combo - * @param string $moreparamonempty Add more param on the empty option line. Not used if show_empty not set - * @param int $disablebademail 1=Check if a not valid email, 2=Check string '---', and if found into value, disable and colorize entry - * @param int $nohtmlescape No html escaping. - * @return string HTML select string. + * @param string $htmlname Name of html select area. Must start with "multi" if this is a multiselect + * @param array $array Array like array(key => value) or array(key=>array('label'=>..., 'data-...'=>..., 'disabled'=>..., 'css'=>...)) + * @param string|string[] $id Preselected key or preselected keys for multiselect. Use 'ifone' to autoselect record if there is only one record. + * @param int|string $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (If 1: key is -1 and value is '' or ' ', If placeholder string: key is -1 and value is the string), <0 to add an empty value with key that is this value. + * @param int $key_in_label 1 to show key into label with format "[key] value" + * @param int $value_as_key 1 to use value as key + * @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container + * @param int $translate 1=Translate and encode value + * @param int $maxlen Length maximum for labels + * @param int $disabled Html select box is disabled + * @param string $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' or 'POS' = Do not sort, we keep original order + * @param string $morecss Add more class to css styles + * @param int $addjscombo Add js combo + * @param string $moreparamonempty Add more param on the empty option line. Not used if show_empty not set + * @param int $disablebademail 1=Check if a not valid email, 2=Check string '---', and if found into value, disable and colorize entry + * @param int $nohtmlescape No html escaping. + * @return string HTML select string. * @see multiselectarray(), selectArrayAjax(), selectArrayFilter() */ public static function selectarray($htmlname, $array, $id = '', $show_empty = 0, $key_in_label = 0, $value_as_key = 0, $moreparam = '', $translate = 0, $maxlen = 0, $disabled = 0, $sort = '', $morecss = 'minwidth75', $addjscombo = 1, $moreparamonempty = '', $disablebademail = 0, $nohtmlescape = 0) @@ -8245,7 +8245,7 @@ class Form if (is_array($tmpvalue)) { foreach ($tmpvalue as $keyforvalue => $valueforvalue) { if (preg_match('/^data-/', $keyforvalue)) { - $out .= ' ' . $keyforvalue . '="' . $valueforvalue . '"'; + $out .= ' '.$keyforvalue.'="'.dol_escape_htmltag($valueforvalue).'"'; } } } diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 9d42e210ada..3bd180989b3 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -176,9 +176,11 @@ if (empty($reshook)) { } } + /* * View */ + $person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname; $title = $person_name." - ".$langs->trans('Card'); $help_url = ''; @@ -186,33 +188,37 @@ $help_url = ''; llxHeader('', $title, $help_url); // List of possible landing pages -$tmparray = array('index.php'=>'Dashboard'); +$tmparray = array(); +$tmparray['index.php'] = array('label'=>'Dashboard', 'picto'=>'graph'); if (isModEnabled("societe")) { - $tmparray['societe/index.php?mainmenu=companies&leftmenu='] = 'ThirdPartiesArea'; + $tmparray['societe/index.php?mainmenu=companies&leftmenu='] = array('label'=>'ThirdPartiesArea', 'picto'=>'company'); } if (!empty($conf->project->enabled)) { - $tmparray['projet/index.php?mainmenu=project&leftmenu='] = 'ProjectsArea'; + $tmparray['projet/index.php?mainmenu=project&leftmenu='] = array('label'=>'ProjectsArea', 'picto'=>'project'); + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { + $tmparray['projet/list.php?mainmenu=project&leftmenu=&search_usage_opportunity=1&search_status=99&search_opp_status=openedopp&contextpage=lead'] = array('label'=>'ListOpenLeads', 'picto'=>'project'); + } } if (isModEnabled('holiday') || isModEnabled('expensereport')) { - $tmparray['hrm/index.php?mainmenu=hrm&leftmenu='] = 'HRMArea'; // TODO Complete list with first level of menus + $tmparray['hrm/index.php?mainmenu=hrm&leftmenu='] = array('label'=>'HRMArea', 'picto'=>'user'); // TODO Complete list with first level of menus } if (isModEnabled("product") || isModEnabled("service")) { - $tmparray['product/index.php?mainmenu=products&leftmenu='] = 'ProductsAndServicesArea'; + $tmparray['product/index.php?mainmenu=products&leftmenu='] = array('label'=>'ProductsAndServicesArea', 'picto'=>'product'); } if (isModEnabled("propal") || isModEnabled('commande') || isModEnabled('ficheinter') || isModEnabled('contrat')) { - $tmparray['comm/index.php?mainmenu=commercial&leftmenu='] = 'CommercialArea'; + $tmparray['comm/index.php?mainmenu=commercial&leftmenu='] = array('label'=>'CommercialArea', 'picto'=>'commercial'); } if (isModEnabled('comptabilite') || isModEnabled('accounting')) { - $tmparray['compta/index.php?mainmenu=compta&leftmenu='] = 'AccountancyTreasuryArea'; + $tmparray['compta/index.php?mainmenu=compta&leftmenu='] = array('label'=>'AccountancyTreasuryArea', 'picto'=>'bill'); } if (isModEnabled('adherent')) { - $tmparray['adherents/index.php?mainmenu=members&leftmenu='] = 'MembersArea'; + $tmparray['adherents/index.php?mainmenu=members&leftmenu='] = array('label'=>'MembersArea', 'picto'=>'member'); } if (isModEnabled('agenda')) { - $tmparray['comm/action/index.php?mainmenu=agenda&leftmenu='] = 'Agenda'; + $tmparray['comm/action/index.php?mainmenu=agenda&leftmenu='] = array('label'=>'Agenda', 'picto'=>'action'); } if (isModEnabled('ticket')) { - $tmparray['ticket/list.php?mainmenu=ticket&leftmenu='] = 'Tickets'; + $tmparray['ticket/list.php?mainmenu=ticket&leftmenu='] = array('label'=>'Tickets', 'picto'=>'ticket'); } // add bookmarks to available landing pages if (empty($conf->global->MAIN_NO_BOOKMARKS_FOR_LANDING_PAGES)) { @@ -227,11 +233,15 @@ if (empty($conf->global->MAIN_NO_BOOKMARKS_FOR_LANDING_PAGES)) { if ($resql) { $i = 0; $num_rows = $db->num_rows($resql); - while ($i < $num_rows) { - $obj = $db->fetch_object($resql); - $landing_url = str_replace(DOL_URL_ROOT, '', $obj->url); - $tmparray[$landing_url] = $obj->title; - $i++; + if ($num_rows > 0) { + $tmparray['sep'.$i] = '--- '.$langs->trans("Bookmarks").''; + while ($i < $num_rows) { + $obj = $db->fetch_object($resql); + + $landing_url = str_replace(DOL_URL_ROOT, '', $obj->url); + $tmparray[$landing_url] = array('label'=>$obj->title, 'picto'=>'generic'); + $i++; + } } } } @@ -241,9 +251,13 @@ $reshook = $hookmanager->executeHooks('addToLandingPageList', $tmparray, $object if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } elseif ($reshook > 0) { - $tmparray=$hookmanager->resArray; + $tmparray = $hookmanager->resArray; } elseif ($reshook == 0) { - $tmparray=array_merge($tmparray, $hookmanager->resArray); + $tmparray = array_merge($tmparray, $hookmanager->resArray); +} +foreach ($tmparray as $key => $val) { + $tmparray[$key]['data-html'] = img_picto($langs->trans($val['label']), $val['picto'], 'class="pictofixedwidth"').$langs->trans($val['label']); + $tmparray[$key]['label'] = $langs->trans($val['label']); } $head = user_prepare_head($object); @@ -338,7 +352,7 @@ if ($action == 'edit') { print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo print '> '; print ''; - print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (!empty($object->conf->MAIN_LANDING_PAGE) ? $object->conf->MAIN_LANDING_PAGE : ''), 0, 0, 0, '', 1); + print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (!empty($object->conf->MAIN_LANDING_PAGE) ? $object->conf->MAIN_LANDING_PAGE : ''), 0, 0, 0, '', 0, 0, 0, '', 'maxwidth250'); //print info_admin($langs->trans("WarningYouMayLooseAccess"), 0, 0, 0); print ''; @@ -444,13 +458,22 @@ if ($action == 'edit') { print '> '.$langs->trans("UsePersonalValue").''; print ''; if (!empty($object->conf->MAIN_LANDING_PAGE)) { + $urltoshow = ''; if (!empty($tmparray[$object->conf->MAIN_LANDING_PAGE])) { - print $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]); + if (is_array($tmparray[$object->conf->MAIN_LANDING_PAGE])) { + $urltoshow = $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]['label']); + } else { + $urltoshow = $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]); + } } else { - print $object->conf->MAIN_LANDING_PAGE; + $urltoshow = $object->conf->MAIN_LANDING_PAGE; } + print ' '; + print img_picto($urltoshow, $tmparray[$object->conf->MAIN_LANDING_PAGE]['picto'], 'class="pictofixedwidth"'); + print $urltoshow; + print img_picto($urltoshow, 'globe', 'class="paddingleft"'); + print ''; } - //print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (!empty($object->conf->MAIN_LANDING_PAGE)?$object->conf->MAIN_LANDING_PAGE:''), 0, 0, 0, '', 1); print ''; // Landing page for Agenda - AGENDA_DEFAULT_VIEW From 3127975aebd08fc5ae68c352e85fddca5fc424a9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Apr 2023 03:43:21 +0200 Subject: [PATCH 29/30] Can limit message in sessions if similar to a previous one Fix token for static code into lib_foot.js.php --- htdocs/core/js/lib_foot.js.php | 10 ++++++---- htdocs/core/lib/functions.lib.php | 20 ++++++++++++++------ htdocs/main.inc.php | 2 +- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index 297a33b93f5..7e300ddebc0 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -86,9 +86,10 @@ if (empty($conf->dol_no_mouse_hover)) { open: function (event, ui) { var elem = $(this); var params = JSON.parse($(this).attr("data-params")); - params.token = "'.currentToken().'"; + var currenttoken = jQuery("meta[name=anti-csrf-currenttoken]").attr("content"); + params.token = currenttoken; $.ajax({ - url:"' . dol_buildpath('/core/ajax/ajaxtooltip.php', 1) . '", + url:"'. DOL_URL_ROOT.'/core/ajax/ajaxtooltip.php", type: "post", async: false, data: params, @@ -306,11 +307,12 @@ print ' jQuery(document).ready(function() { jQuery(".cssforclicktodial").click(function() { event.preventDefault(); - console.log("We click on a cssforclicktodial class with url="+this.href); + var currenttoken = jQuery("meta[name=anti-csrf-currenttoken]").attr("content"); + console.log("We click on a cssforclicktodial class with href="+this.href); $.ajax({ url: this.href, type: \'GET\', - data: { token: \''.newToken().'\' } + data: { token: currenttoken } }).done(function(xhr, textStatus, errorThrown) { /* do nothing */ }).fail(function(xhr, textStatus, errorThrown) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8cf0462d606..18306842df6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8523,21 +8523,28 @@ function dolGetFirstLastname($firstname, $lastname, $nameorder = -1) * * @param string|string[] $mesgs Message string or array * @param string $style Which style to use ('mesgs' by default, 'warnings', 'errors') + * @param int $noduplicate 1 means we do not add the message if already present in session stack * @return void * @see dol_htmloutput_events() */ -function setEventMessage($mesgs, $style = 'mesgs') +function setEventMessage($mesgs, $style = 'mesgs', $noduplicate = 0) { //dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); This is not deprecated, it is used by setEventMessages function if (!is_array($mesgs)) { // If mesgs is a string if ($mesgs) { + if (!empty($noduplicate) && isset($_SESSION['dol_events'][$style]) && in_array($mesgs, $_SESSION['dol_events'][$style])) { + return; + } $_SESSION['dol_events'][$style][] = $mesgs; } } else { // If mesgs is an array foreach ($mesgs as $mesg) { if ($mesg) { + if (!empty($noduplicate) && isset($_SESSION['dol_events'][$style]) && in_array($mesg, $_SESSION['dol_events'][$style])) { + return; + } $_SESSION['dol_events'][$style][] = $mesg; } } @@ -8552,13 +8559,14 @@ function setEventMessage($mesgs, $style = 'mesgs') * @param array|null $mesgs Message array * @param string $style Which style to use ('mesgs' by default, 'warnings', 'errors') * @param string $messagekey A key to be used to allow the feature "Never show this message again" + * @param int $noduplicate 1 means we do not add the message if already present in session stack * @return void * @see dol_htmloutput_events() */ -function setEventMessages($mesg, $mesgs, $style = 'mesgs', $messagekey = '') +function setEventMessages($mesg, $mesgs, $style = 'mesgs', $messagekey = '', $noduplicate = 0) { if (empty($mesg) && empty($mesgs)) { - dol_syslog("Try to add a message in stack with empty message", LOG_WARNING); + dol_syslog("Try to add a message in stack, but value to add is empty message", LOG_WARNING); } else { if ($messagekey) { // Complete message with a js link to set a cookie "DOLHIDEMESSAGE".$messagekey; @@ -8570,12 +8578,12 @@ function setEventMessages($mesg, $mesgs, $style = 'mesgs', $messagekey = '') dol_print_error('', 'Bad parameter style='.$style.' for setEventMessages'); } if (empty($mesgs)) { - setEventMessage($mesg, $style); + setEventMessage($mesg, $style, $noduplicate); } else { if (!empty($mesg) && !in_array($mesg, $mesgs)) { - setEventMessage($mesg, $style); // Add message string if not already into array + setEventMessage($mesg, $style, $noduplicate); // Add message string if not already into array } - setEventMessage($mesgs, $style); + setEventMessage($mesgs, $style, $noduplicate); } } } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index f71955af2aa..97a24d54538 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -594,7 +594,7 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"]) ? '' : $_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." refused by CSRF protection (invalid token), so we disable POST and some GET parameters - referer=".(empty($_SERVER['HTTP_REFERER'])?'':$_SERVER['HTTP_REFERER']).", action=".GETPOST('action', 'aZ09').", _GET|POST['token']=".GETPOST('token', 'alpha'), LOG_WARNING); //dol_syslog("_SESSION['token']=".$sessiontokenforthisurl, LOG_DEBUG); // Do not output anything on standard output because this create problems when using the BACK button on browsers. So we just set a message into session. - setEventMessages('SecurityTokenHasExpiredSoActionHasBeenCanceledPleaseRetry', null, 'warnings'); + setEventMessages('SecurityTokenHasExpiredSoActionHasBeenCanceledPleaseRetry', null, 'warnings', '', 1); $savid = null; if (isset($_POST['id'])) { $savid = ((int) $_POST['id']); From 572d09f8459de0a4f186cb4402265ffaa74f7ad5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Apr 2023 03:51:15 +0200 Subject: [PATCH 30/30] Do not show token expired on error on ajax components --- htdocs/main.inc.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 97a24d54538..bfcb5dab7ce 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -594,7 +594,10 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"]) ? '' : $_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." refused by CSRF protection (invalid token), so we disable POST and some GET parameters - referer=".(empty($_SERVER['HTTP_REFERER'])?'':$_SERVER['HTTP_REFERER']).", action=".GETPOST('action', 'aZ09').", _GET|POST['token']=".GETPOST('token', 'alpha'), LOG_WARNING); //dol_syslog("_SESSION['token']=".$sessiontokenforthisurl, LOG_DEBUG); // Do not output anything on standard output because this create problems when using the BACK button on browsers. So we just set a message into session. - setEventMessages('SecurityTokenHasExpiredSoActionHasBeenCanceledPleaseRetry', null, 'warnings', '', 1); + if (!defined('NOTOKENRENEWAL')) { + // If the page is not a page that disable the token renewal, we report a warning message to explain token has epired. + setEventMessages('SecurityTokenHasExpiredSoActionHasBeenCanceledPleaseRetry', null, 'warnings', '', 1); + } $savid = null; if (isset($_POST['id'])) { $savid = ((int) $_POST['id']);