From 796678edc17899039d351f915706b1b2a88de76e Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 18 Sep 2023 11:19:45 +0200 Subject: [PATCH 1/7] FIX customer code search filter on invoice list --- htdocs/compta/facture/list.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 632407a4676..1408b02935b 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -111,8 +111,8 @@ $search_town = GETPOST('search_town', 'alpha'); $search_zip = GETPOST('search_zip', 'alpha'); $search_state = GETPOST("search_state"); $search_country = GETPOST("search_country", 'alpha'); +$search_customer_code = GETPOST("search_customer_code", 'alphanohtml'); $search_type_thirdparty = GETPOST("search_type_thirdparty", 'int'); -$search_company_code_client = GETPOST("search_type_thirdparty", 'alpha'); $search_user = GETPOST('search_user', 'int'); $search_sale = GETPOST('search_sale', 'int'); $search_date_startday = GETPOST('search_date_startday', 'int'); @@ -350,6 +350,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', $search_state = ""; $search_country = ''; $search_type_thirdparty = ''; + $search_customer_code = ''; $search_date_startday = ''; $search_date_startmonth = ''; $search_date_startyear = ''; @@ -699,8 +700,8 @@ if (empty($arrayfields['s.name_alias']['checked']) && $search_company) { if ($search_parent_name) { $sql .= natural_search('s2.nom', $search_parent_name); } -if ($search_company_code_client) { - $sql .= natural_search('s.code_client', $search_company_code_client); +if ($search_customer_code) { + $sql .= natural_search('s.code_client', $search_customer_code); } if ($search_town) { $sql .= natural_search('s.town', $search_town); @@ -1095,6 +1096,9 @@ if ($resql) { if ($search_type_thirdparty != '') { $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); } + if ($search_customer_code) { + $param .= '&search_customer_code='.urlencode($search_customer_code); + } if ($search_sale > 0) { $param .= '&search_sale='.urlencode($search_sale); } @@ -1423,7 +1427,7 @@ if ($resql) { } // Customer Code if (!empty($arrayfields['s.code_client']['checked'])) { - print ''; + print ''; } // Town if (!empty($arrayfields['s.town']['checked'])) { From 801b30baa4da125ecbe5eeee29abd83e1d77d372 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Sep 2023 10:59:00 +0200 Subject: [PATCH 2/7] css --- htdocs/partnership/class/partnership.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 8696117b187..2260982670e 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -122,7 +122,7 @@ class Partnership extends CommonObject 'date_partnership_end' => array('type'=>'date', 'label'=>'DatePartnershipEnd', 'enabled'=>'1', 'position'=>53, 'notnull'=>0, 'visible'=>1,), 'url_to_check' => array('type'=>'url', 'label'=>'UrlToCheck', 'enabled'=>'getDolGlobalString("PARTNERSHIP_BACKLINKS_TO_CHECK")', 'position'=>70, 'notnull'=>0, 'visible'=>-1, 'csslist'=>'tdoverflowmax100'), 'count_last_url_check_error' => array('type'=>'integer', 'label'=>'CountLastUrlCheckError', 'enabled'=>'getDolGlobalString("PARTNERSHIP_BACKLINKS_TO_CHECK")', 'position'=>71, 'notnull'=>0, 'visible'=>-4, 'default'=>'0',), - 'last_check_backlink' => array('type'=>'datetime', 'label'=>'LastCheckBacklink', 'enabled'=>'getDolGlobalString("PARTNERSHIP_BACKLINKS_TO_CHECK")', 'position'=>72, 'notnull'=>0, 'visible'=>-4,), + 'last_check_backlink' => array('type'=>'datetime', 'label'=>'LastCheckBacklink', 'enabled'=>'getDolGlobalString("PARTNERSHIP_BACKLINKS_TO_CHECK")', 'position'=>72, 'notnull'=>0, 'visible'=>-4, 'csslist'=>'nowraponall'), 'reason_decline_or_cancel' => array('type'=>'text', 'label'=>'ReasonDeclineOrCancel', 'enabled'=>'1', 'position'=>73, 'notnull'=>0, 'visible'=>-2,), 'ip' => array('type'=>'varchar(250)', 'label'=>'Ip', 'enabled'=>'1', 'position'=>74, 'notnull'=>0, 'visible'=>-2,), 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>2000, 'notnull'=>1, 'visible'=>2, 'default'=>'0', 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '2'=>'Approved', '3'=>'Refused', '9'=>'Terminated'),), From 854f6a83df5fd6c2d0859e7bd280b12dbb10adc9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Sep 2023 11:01:04 +0200 Subject: [PATCH 3/7] CSS --- htdocs/partnership/class/partnership.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 2260982670e..097fb27fc85 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -120,7 +120,7 @@ class Partnership extends CommonObject 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,), 'date_partnership_start' => array('type'=>'date', 'label'=>'DatePartnershipStart', 'enabled'=>'1', 'position'=>52, 'notnull'=>1, 'visible'=>1,), 'date_partnership_end' => array('type'=>'date', 'label'=>'DatePartnershipEnd', 'enabled'=>'1', 'position'=>53, 'notnull'=>0, 'visible'=>1,), - 'url_to_check' => array('type'=>'url', 'label'=>'UrlToCheck', 'enabled'=>'getDolGlobalString("PARTNERSHIP_BACKLINKS_TO_CHECK")', 'position'=>70, 'notnull'=>0, 'visible'=>-1, 'csslist'=>'tdoverflowmax100'), + 'url_to_check' => array('type'=>'url', 'label'=>'UrlToCheck', 'enabled'=>'getDolGlobalString("PARTNERSHIP_BACKLINKS_TO_CHECK")', 'position'=>70, 'notnull'=>0, 'visible'=>-1, 'csslist'=>'tdoverflowmax150'), 'count_last_url_check_error' => array('type'=>'integer', 'label'=>'CountLastUrlCheckError', 'enabled'=>'getDolGlobalString("PARTNERSHIP_BACKLINKS_TO_CHECK")', 'position'=>71, 'notnull'=>0, 'visible'=>-4, 'default'=>'0',), 'last_check_backlink' => array('type'=>'datetime', 'label'=>'LastCheckBacklink', 'enabled'=>'getDolGlobalString("PARTNERSHIP_BACKLINKS_TO_CHECK")', 'position'=>72, 'notnull'=>0, 'visible'=>-4, 'csslist'=>'nowraponall'), 'reason_decline_or_cancel' => array('type'=>'text', 'label'=>'ReasonDeclineOrCancel', 'enabled'=>'1', 'position'=>73, 'notnull'=>0, 'visible'=>-2,), From 11cc0a61dae8d456cd1bed6dda270c4bb9206f2a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Sep 2023 11:59:57 +0200 Subject: [PATCH 4/7] Fix cast of int --- htdocs/categories/info.php | 2 +- htdocs/categories/photos.php | 2 +- htdocs/categories/traduction.php | 2 +- htdocs/categories/viewcat.php | 2 +- htdocs/core/class/commonobject.class.php | 4 ++-- htdocs/eventorganization/conferenceorbooth_card.php | 2 +- htdocs/eventorganization/conferenceorbooth_contact.php | 2 +- htdocs/eventorganization/conferenceorbooth_document.php | 2 +- htdocs/eventorganization/conferenceorbooth_list.php | 2 +- htdocs/eventorganization/conferenceorboothattendee_card.php | 2 +- htdocs/eventorganization/conferenceorboothattendee_list.php | 2 +- htdocs/partnership/partnership_card.php | 6 +++++- htdocs/product/agenda.php | 2 +- htdocs/product/canvas/product/tpl/card_view.tpl.php | 2 +- htdocs/product/canvas/service/tpl/card_view.tpl.php | 2 +- htdocs/product/card.php | 2 +- htdocs/product/document.php | 2 +- htdocs/product/fournisseurs.php | 2 +- htdocs/product/note.php | 2 +- htdocs/product/price.php | 2 +- htdocs/projet/agenda.php | 2 +- htdocs/projet/card.php | 2 +- htdocs/projet/comment.php | 2 +- htdocs/projet/contact.php | 2 +- htdocs/projet/document.php | 2 +- htdocs/projet/element.php | 2 +- htdocs/projet/ganttview.php | 2 +- htdocs/projet/messaging.php | 2 +- htdocs/projet/note.php | 2 +- htdocs/projet/tasks.php | 2 +- htdocs/projet/tasks/comment.php | 6 +++--- htdocs/projet/tasks/contact.php | 6 +++--- htdocs/projet/tasks/document.php | 6 +++--- htdocs/projet/tasks/note.php | 4 ++-- htdocs/projet/tasks/task.php | 6 +++--- htdocs/projet/tasks/time.php | 6 +++--- htdocs/ticket/agenda.php | 4 ++-- htdocs/ticket/card.php | 6 +++--- htdocs/ticket/contact.php | 4 ++-- htdocs/ticket/document.php | 4 ++-- htdocs/ticket/list.php | 2 +- htdocs/ticket/messaging.php | 4 ++-- htdocs/variants/combinations.php | 4 ++-- 43 files changed, 66 insertions(+), 62 deletions(-) diff --git a/htdocs/categories/info.php b/htdocs/categories/info.php index f5f63091f9c..382442030e1 100644 --- a/htdocs/categories/info.php +++ b/htdocs/categories/info.php @@ -74,7 +74,7 @@ print dol_get_fiche_head($head, 'info', $langs->trans($title), -1, 'category'); $backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.urlencode($type)); $linkback = ''.$langs->trans("BackToList").''; -$object->next_prev_filter = ' type = '.$object->type; +$object->next_prev_filter = 'type = '.((int) $object->type); $object->ref = $object->label; $morehtmlref = '
'.$langs->trans("Root").' >> '; $ways = $object->print_all_ways(" >> ", '', 1); diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index bd98afb87f7..ab47eb0088d 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -111,7 +111,7 @@ if ($object->id) { $backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.urlencode($type)); $linkback = ''.$langs->trans("BackToList").''; - $object->next_prev_filter = ' type = '.$object->type; + $object->next_prev_filter = 'type = '.((int) $object->type); $object->ref = $object->label; $morehtmlref = '
'.$langs->trans("Root").' >> '; $ways = $object->print_all_ways(" >> ", '', 1); diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index b63431780e7..9791cdeb5be 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -189,7 +189,7 @@ print dol_get_fiche_head($head, 'translation', $langs->trans($title), -1, 'categ $backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.urlencode($type)); $linkback = ''.$langs->trans("BackToList").''; -$object->next_prev_filter = ' type = '.$object->type; +$object->next_prev_filter = 'type = '.((int) $object->type); $object->ref = $object->label; $morehtmlref = '
'.$langs->trans("Root").' >> '; $ways = $object->print_all_ways(" >> ", '', 1); diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 2791cf1556a..707c23dfe5e 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -257,7 +257,7 @@ print dol_get_fiche_head($head, 'card', $langs->trans($title), -1, 'category'); $backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.urlencode($type)); $linkback = ''.$langs->trans("BackToList").''; -$object->next_prev_filter = ' type = '.$object->type; +$object->next_prev_filter = 'type = '.((int) $object->type); $object->ref = $object->label; $morehtmlref = '
'.$langs->trans("Root").' >> '; $ways = $object->print_all_ways(" >> ", '', 1); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index befd9a74f76..8353e8d7fbe 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2046,7 +2046,7 @@ abstract class CommonObject /** * Load properties id_previous and id_next by comparing $fieldid with $this->ref * - * @param string $filter Optional filter. Example: " AND (t.field1 = 'aa' OR t.field2 = 'bb')". Do not allow user input data here. + * @param string $filter Optional SQL filter. Example: "(t.field1 = 'aa' OR t.field2 = 'bb')". Do not allow user input data here. Use SQL and not Universal Search Filter. * @param string $fieldid Name of field to use for the select MAX and MIN * @param int $nodbprefix Do not include DB prefix to forge table name * @return int <0 if KO, >0 if OK @@ -2107,7 +2107,7 @@ abstract class CommonObject } if (!empty($filter)) { if (!preg_match('/^\s*AND/i', $filter)) { - $sql .= " AND "; // For backward compatibility + $sql .= " AND "; } $sql .= $filter; } diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php index f78d4a9ba2f..9c1bf7c2361 100644 --- a/htdocs/eventorganization/conferenceorbooth_card.php +++ b/htdocs/eventorganization/conferenceorbooth_card.php @@ -216,7 +216,7 @@ if (!empty($withproject)) { // Define a complementary filter for search of next/prev ref. if (empty($user->rights->project->all->lire)) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/eventorganization/conferenceorbooth_contact.php b/htdocs/eventorganization/conferenceorbooth_contact.php index 7810114aec1..6ec1927e5a8 100644 --- a/htdocs/eventorganization/conferenceorbooth_contact.php +++ b/htdocs/eventorganization/conferenceorbooth_contact.php @@ -194,7 +194,7 @@ if (!empty($withproject)) { // Define a complementary filter for search of next/prev ref. if (empty($user->rights->project->all->lire)) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/eventorganization/conferenceorbooth_document.php b/htdocs/eventorganization/conferenceorbooth_document.php index 0326449b0be..802e6be12d3 100644 --- a/htdocs/eventorganization/conferenceorbooth_document.php +++ b/htdocs/eventorganization/conferenceorbooth_document.php @@ -167,7 +167,7 @@ if (!empty($withproject)) { // Define a complementary filter for search of next/prev ref. if (empty($user->rights->project->all->lire)) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 6bed68394a7..1f575c28a12 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -293,7 +293,7 @@ if ($projectid > 0) { // Define a complementary filter for search of next/prev ref. if (empty($user->rights->project->all->lire)) { $objectsListId = $project->getProjectsAuthorizedForUser($user, 0, 0); - $project->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")"; + $project->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($project, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index cb31eb4ac62..5084b3bf798 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -242,7 +242,7 @@ if (!empty($withproject)) { // Define a complementary filter for search of next/prev ref. if (empty($user->rights->projet->all->lire)) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index 00fbe27663f..7404550cdba 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -429,7 +429,7 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) { // Define a complementary filter for search of next/prev ref. if (empty($user->rights->projet->all->lire)) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index bf51b1fe5df..d7684718005 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -448,7 +448,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $npfilter = ""; } - if ($managedfor == 'member') $npfilter .= " AND te.fk_member > 0 "; else $npfilter .= " AND te.fk_soc > 0 "; + if ($managedfor == 'member') { + $npfilter .= " AND te.fk_member > 0 "; + } else { + $npfilter .= " AND te.fk_soc > 0 "; + } $object->next_prev_filter = $npfilter; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/product/agenda.php b/htdocs/product/agenda.php index e77aacc195d..ed5d456b3a5 100644 --- a/htdocs/product/agenda.php +++ b/htdocs/product/agenda.php @@ -161,7 +161,7 @@ if ($id > 0 || $ref) { print dol_get_fiche_head($head, 'agenda', $titre, -1, $picto); $linkback = ''.$langs->trans("BackToList").''; - $object->next_prev_filter = " fk_product_type = ".$object->type; + $object->next_prev_filter = "fk_product_type = ".((int) $object->type); $shownav = 1; if ($user->socid && !in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) { diff --git a/htdocs/product/canvas/product/tpl/card_view.tpl.php b/htdocs/product/canvas/product/tpl/card_view.tpl.php index 7e44b0daf2f..a5a8fedc969 100644 --- a/htdocs/product/canvas/product/tpl/card_view.tpl.php +++ b/htdocs/product/canvas/product/tpl/card_view.tpl.php @@ -33,7 +33,7 @@ $titre = $langs->trans("CardProduct".$object->type); print dol_get_fiche_head($head, 'card', $titre, -1, 'product'); $linkback = ''.$langs->trans("BackToList").''; -$object->next_prev_filter = " fk_product_type = ".$object->type; +$object->next_prev_filter = "fk_product_type = ".((int) $object->type); $shownav = 1; if ($user->socid && !in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) { diff --git a/htdocs/product/canvas/service/tpl/card_view.tpl.php b/htdocs/product/canvas/service/tpl/card_view.tpl.php index 3236e7e7074..1bea6ffe23c 100644 --- a/htdocs/product/canvas/service/tpl/card_view.tpl.php +++ b/htdocs/product/canvas/service/tpl/card_view.tpl.php @@ -33,7 +33,7 @@ $titre = $langs->trans("CardProduct".$object->type); print dol_get_fiche_head($head, 'card', $titre, -1, 'service'); $linkback = ''.$langs->trans("BackToList").''; -$object->next_prev_filter = " fk_product_type = ".$object->type; +$object->next_prev_filter = " fk_product_type = ".((int) $object->type); $shownav = 1; if ($user->socid && !in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) { diff --git a/htdocs/product/card.php b/htdocs/product/card.php index f70f35b0bed..e0bc8b3b4e4 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2347,7 +2347,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print dol_get_fiche_head($head, 'card', $titre, -1, $picto); $linkback = ''.$langs->trans("BackToList").''; - $object->next_prev_filter = " fk_product_type = ".$object->type; + $object->next_prev_filter = "fk_product_type = ".((int) $object->type); $shownav = 1; if ($user->socid && !in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) { diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 9b6876150d2..f7753432043 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -240,7 +240,7 @@ if ($object->id) { $linkback = ''.$langs->trans("BackToList").''; - $object->next_prev_filter = " fk_product_type = ".$object->type; + $object->next_prev_filter = "fk_product_type = ".((int) $object->type); $shownav = 1; if ($user->socid && !in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) { diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 122b28406a1..b36c134d20b 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -391,7 +391,7 @@ if ($id > 0 || $ref) { print dol_get_fiche_head($head, 'suppliers', $titre, -1, $picto); $linkback = ''.$langs->trans("BackToList").''; - $object->next_prev_filter = " fk_product_type = ".$object->type; + $object->next_prev_filter = "fk_product_type = ".((int) $object->type); $shownav = 1; if ($user->socid && !in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) { diff --git a/htdocs/product/note.php b/htdocs/product/note.php index 54c214224d5..f8dab5e6bf3 100644 --- a/htdocs/product/note.php +++ b/htdocs/product/note.php @@ -123,7 +123,7 @@ if ($id > 0 || !empty($ref)) { print dol_get_fiche_head($head, 'note', $titre, -1, $picto); $linkback = ''.$langs->trans("BackToList").''; - $object->next_prev_filter = " fk_product_type = ".$object->type; + $object->next_prev_filter = "fk_product_type = ".((int) $object->type); $shownav = 1; if ($user->socid && !in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) { diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 4f3bae2b3cb..9dc217f782c 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -867,7 +867,7 @@ $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); print dol_get_fiche_head($head, 'price', $titre, -1, $picto); $linkback = ''.$langs->trans("BackToList").''; -$object->next_prev_filter = " fk_product_type = ".$object->type; +$object->next_prev_filter = "fk_product_type = ".((int) $object->type); $shownav = 1; if ($user->socid && !in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) { diff --git a/htdocs/projet/agenda.php b/htdocs/projet/agenda.php index 84a204a2e6a..4b8b2640afe 100644 --- a/htdocs/projet/agenda.php +++ b/htdocs/projet/agenda.php @@ -147,7 +147,7 @@ $morehtmlref .= '
'; // Define a complementary filter for search of next/prev ref. if (empty($user->rights->projet->all->lire)) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index dc26ca4ca76..801129da8e6 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1251,7 +1251,7 @@ if ($action == 'create' && $user->rights->projet->creer) { // Define a complementary filter for search of next/prev ref. if (empty($user->rights->projet->all->lire)) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/comment.php b/htdocs/projet/comment.php index 0b2cc2681f1..2ff0bec07d7 100644 --- a/htdocs/projet/comment.php +++ b/htdocs/projet/comment.php @@ -118,7 +118,7 @@ $morehtmlref .= '
'; // Define a complementary filter for search of next/prev ref. if (empty($user->rights->projet->all->lire)) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($object, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 17fb0cd10ef..b21dbf46a0d 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -315,7 +315,7 @@ if ($id > 0 || !empty($ref)) { // Define a complementary filter for search of next/prev ref. if (empty($user->rights->projet->all->lire)) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index 0f2733daec9..9b5f2e2c31c 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -151,7 +151,7 @@ if ($object->id > 0) { // Define a complementary filter for search of next/prev ref. if (empty($user->rights->projet->all->lire)) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index aa8c0182c58..a4ab7a26393 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -231,7 +231,7 @@ $morehtmlref .= '
'; // Define a complementary filter for search of next/prev ref. if (empty($user->rights->projet->all->lire)) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = " te.rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "te.rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 6e284b5dd0e..145152d0089 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -130,7 +130,7 @@ if (($id > 0 && is_numeric($id)) || !empty($ref)) { // Define a complementary filter for search of next/prev ref. if (empty($user->rights->projet->all->lire)) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/messaging.php b/htdocs/projet/messaging.php index 2b50f32f3d4..9787e7ca587 100644 --- a/htdocs/projet/messaging.php +++ b/htdocs/projet/messaging.php @@ -146,7 +146,7 @@ $morehtmlref .= '
'; // Define a complementary filter for search of next/prev ref. if (empty($user->rights->projet->all->lire)) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php index 5f11bf20282..55f3e6d864a 100644 --- a/htdocs/projet/note.php +++ b/htdocs/projet/note.php @@ -116,7 +116,7 @@ if ($id > 0 || !empty($ref)) { // Define a complementary filter for search of next/prev ref. if (empty($user->rights->projet->all->lire)) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index b9c03aa2610..db780ddfa44 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -586,7 +586,7 @@ if ($id > 0 || !empty($ref)) { // Define a complementary filter for search of next/prev ref. if (empty($user->rights->projet->all->lire)) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php index 4540112f4c3..32745a6ec0d 100644 --- a/htdocs/projet/tasks/comment.php +++ b/htdocs/projet/tasks/comment.php @@ -139,7 +139,7 @@ if ($id > 0 || !empty($ref)) { // Define a complementary filter for search of next/prev ref. if (empty($user->rights->projet->all->lire)) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); @@ -292,9 +292,9 @@ if ($id > 0 || !empty($ref)) { if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = " fk_projet IN (".$db->sanitize($projectsListId).")"; + $object->next_prev_filter = "fk_projet IN (".$db->sanitize($projectsListId).")"; } else { - $object->next_prev_filter = " fk_projet = ".((int) $projectstatic->id); + $object->next_prev_filter = "fk_projet = ".((int) $projectstatic->id); } $morehtmlref = ''; diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 16d60a15033..8bde7e16c5a 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -203,7 +203,7 @@ if ($id > 0 || !empty($ref)) { // Define a complementary filter for search of next/prev ref. if (empty($user->rights->projet->all->lire)) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); @@ -326,9 +326,9 @@ if ($id > 0 || !empty($ref)) { if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = " fk_projet IN (".$db->sanitize($projectsListId).")"; + $object->next_prev_filter = "fk_projet IN (".$db->sanitize($projectsListId).")"; } else { - $object->next_prev_filter = " fk_projet = ".$projectstatic->id; + $object->next_prev_filter = "fk_projet = ".((int) $projectstatic->id); } $morehtmlref = ''; diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index ba9249411aa..2f761e1b304 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -160,7 +160,7 @@ if ($object->id > 0) { // Define a complementary filter for search of next/prev ref. if (empty($user->rights->projet->all->lire)) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); @@ -284,9 +284,9 @@ if ($object->id > 0) { if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = " fk_projet IN (".$db->sanitize($projectsListId).")"; + $object->next_prev_filter = "fk_projet IN (".$db->sanitize($projectsListId).")"; } else { - $object->next_prev_filter = " fk_projet = ".$projectstatic->id; + $object->next_prev_filter = "fk_projet = ".((int) $projectstatic->id); } $morehtmlref = ''; diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index 2e3166fb46d..fd3222907d4 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -150,7 +150,7 @@ if ($object->id > 0) { // Define a complementary filter for search of next/prev ref. if (empty($user->rights->projet->all->lire)) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); @@ -270,7 +270,7 @@ if ($object->id > 0) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); $object->next_prev_filter = " fk_projet IN (".$db->sanitize($projectsListId).")"; } else { - $object->next_prev_filter = " fk_projet = ".$projectstatic->id; + $object->next_prev_filter = " fk_projet = ".((int) $projectstatic->id); } $morehtmlref = ''; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index fd76494cb9f..b8ff5a6f9bc 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -275,7 +275,7 @@ if ($id > 0 || !empty($ref)) { // Define a complementary filter for search of next/prev ref. if (empty($user->rights->projet->all->lire)) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param); @@ -537,9 +537,9 @@ if ($id > 0 || !empty($ref)) { if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = " fk_projet IN (".$db->sanitize($projectsListId).")"; + $object->next_prev_filter = "fk_projet IN (".$db->sanitize($projectsListId).")"; } else { - $object->next_prev_filter = " fk_projet = ".((int) $projectstatic->id); + $object->next_prev_filter = "fk_projet = ".((int) $projectstatic->id); } $morehtmlref = ''; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 3b826a37914..29834437b4d 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -959,7 +959,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser // Define a complementary filter for search of next/prev ref. if (empty($user->rights->projet->all->lire)) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = " rowid IN (" . $db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0') . ")"; + $projectstatic->next_prev_filter = "rowid IN (" . $db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0') . ")"; } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param); @@ -1143,9 +1143,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = " fk_projet IN (" . $db->sanitize($projectsListId) . ")"; + $object->next_prev_filter = "fk_projet IN (" . $db->sanitize($projectsListId) . ")"; } else { - $object->next_prev_filter = " fk_projet = " . ((int) $projectstatic->id); + $object->next_prev_filter = "fk_projet = " . ((int) $projectstatic->id); } $morehtmlref = ''; diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index c6e4cff0b38..39d25c3a215 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -166,9 +166,9 @@ if ($socid > 0) { } if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) { - $object->next_prev_filter = "te.fk_user_assign = '".$user->id."'"; + $object->next_prev_filter = "te.fk_user_assign = ".((int) $user->id); } elseif ($user->socid > 0) { - $object->next_prev_filter = "te.fk_soc = '".$user->socid."'"; + $object->next_prev_filter = "te.fk_soc = ".((int) $user->socid); } $head = ticket_prepare_head($object); diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 043ef502092..1e2c849060d 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -881,7 +881,7 @@ if ($action == 'create' || $action == 'presend') { // Define a complementary filter for search of next/prev ref. if (empty($user->rights->projet->all->lire)) { $objectsListId = $projectstat->getProjectsAuthorizedForUser($user, $mine, 0); - $projectstat->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")"; + $projectstat->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")"; } print $form->showrefnav($projectstat, 'ref', $linkback, 1, 'ref', 'ref', ''); print ''; @@ -931,9 +931,9 @@ if ($action == 'create' || $action == 'presend') { } if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) { - $object->next_prev_filter = "te.fk_user_assign = '".$user->id."'"; + $object->next_prev_filter = "te.fk_user_assign = ".((int) $user->id); } elseif ($user->socid > 0) { - $object->next_prev_filter = "te.fk_soc = '".$user->socid."'"; + $object->next_prev_filter = "te.fk_soc = ".((int) $user->socid); } $head = ticket_prepare_head($object); diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php index 8af633dc140..ba678ae2dca 100644 --- a/htdocs/ticket/contact.php +++ b/htdocs/ticket/contact.php @@ -195,9 +195,9 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) { } if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) { - $object->next_prev_filter = "te.fk_user_assign = '".$user->id."'"; + $object->next_prev_filter = "te.fk_user_assign ='".((int) $user->id); } elseif ($user->socid > 0) { - $object->next_prev_filter = "te.fk_soc = '".$user->socid."'"; + $object->next_prev_filter = "te.fk_soc = ".((int) $user->socid); } $head = ticket_prepare_head($object); diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php index bb078104b05..23e0b00882c 100644 --- a/htdocs/ticket/document.php +++ b/htdocs/ticket/document.php @@ -133,9 +133,9 @@ if ($object->id) { } if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) { - $object->next_prev_filter = "te.fk_user_assign = '".$user->id."'"; + $object->next_prev_filter = "te.fk_user_assign = ".((int) $user->id); } elseif ($user->socid > 0) { - $object->next_prev_filter = "te.fk_soc = '".$user->socid."'"; + $object->next_prev_filter = "te.fk_soc = ".((int) $user->socid); } $head = ticket_prepare_head($object); diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index ce2cdc011ea..17338093ed6 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -598,7 +598,7 @@ if ($projectid > 0 || $project_ref) { // Define a complementary filter for search of next/prev ref. if (empty($user->rights->projet->all->lire)) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($object, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index a80b7727e08..e0926da74f0 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -162,9 +162,9 @@ if ($socid > 0) { } if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) { - $object->next_prev_filter = "te.fk_user_assign = '".$user->id."'"; + $object->next_prev_filter = "te.fk_user_assign = ".((int) $user->id); } elseif ($user->socid > 0) { - $object->next_prev_filter = "te.fk_soc = '".$user->socid."'"; + $object->next_prev_filter = "te.fk_soc = ".((int) $user->socid); } $head = ticket_prepare_head($object); diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index 41b904fe21b..ed31ebb9510 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -416,8 +416,8 @@ if (!empty($id) || !empty($ref)) { print dol_get_fiche_head($head, 'combinations', $titre, -1, $picto); - $linkback = ''.$langs->trans("BackToList").''; - $object->next_prev_filter = " fk_product_type = ".$object->type; + $linkback = ''.$langs->trans("BackToList").''; + $object->next_prev_filter = "fk_product_type = ".((int) $object->type); dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', '', '', '', 0, '', ''); From d05bda157975d6f6421cd68f0ffd5ac3f844f61b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Sep 2023 12:13:32 +0200 Subject: [PATCH 5/7] Code comment --- htdocs/core/class/commonobject.class.php | 3 ++- htdocs/partnership/partnership_card.php | 8 ++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8353e8d7fbe..bd0f169227c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2046,7 +2046,8 @@ abstract class CommonObject /** * Load properties id_previous and id_next by comparing $fieldid with $this->ref * - * @param string $filter Optional SQL filter. Example: "(t.field1 = 'aa' OR t.field2 = 'bb')". Do not allow user input data here. Use SQL and not Universal Search Filter. + * @param string $filter Optional SQL filter. Example: "(t.field1 = 'aa' OR t.field2 = 'bb')". Do not allow user input data here. + * Use SQL and not Universal Search Filter. @TODO Replace this with an USF string after changing all ->next_prev_filter * @param string $fieldid Name of field to use for the select MAX and MIN * @param int $nodbprefix Do not include DB prefix to forge table name * @return int <0 if KO, >0 if OK diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index d7684718005..d1fb24eb493 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -444,16 +444,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } */ $morehtmlref .= ''; - if (!isset($npfilter)) { - $npfilter = ""; - } if ($managedfor == 'member') { - $npfilter .= " AND te.fk_member > 0 "; + $object->next_prev_filter = "te.fk_member > 0"; } else { - $npfilter .= " AND te.fk_soc > 0 "; + $object->next_prev_filter = "te.fk_soc > 0"; } - $object->next_prev_filter = $npfilter; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); From 174d88fe96ca21229ba4cf86b503e29fafa40a5f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Sep 2023 10:36:17 +0200 Subject: [PATCH 6/7] Fix look and feel v18 --- htdocs/comm/mailing/cibles.php | 41 ++++++++++---------- htdocs/comm/mailing/class/mailing.class.php | 2 +- htdocs/core/class/html.formmailing.class.php | 11 +++--- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 067cbce8efe..8fd0fcf726d 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -713,9 +713,10 @@ if ($object->fetch($id) >= 0) { print ''; //Statut - print ''; - print $formmailing->selectDestinariesStatus($search_dest_status, 'search_dest_status', 1); + print ''; + print $formmailing->selectDestinariesStatus($search_dest_status, 'search_dest_status', 1, 'width100 onrightofpage'); print ''; + // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; @@ -739,12 +740,12 @@ if ($object->fetch($id) >= 0) { print_liste_field_titre("Lastname", $_SERVER["PHP_SELF"], "mc.lastname", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Firstname", $_SERVER["PHP_SELF"], "mc.firstname", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("OtherInformations", $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder); - print_liste_field_titre("Source", $_SERVER["PHP_SELF"], "", $param, "", 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Source", $_SERVER["PHP_SELF"], "", $param, "", '', $sortfield, $sortorder, 'center '); // Date last update - print_liste_field_titre("DateLastModification", $_SERVER["PHP_SELF"], "mc.tms", $param, "", 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("DateLastModification", $_SERVER["PHP_SELF"], "mc.tms", $param, "", '', $sortfield, $sortorder, 'center '); // Date sending - print_liste_field_titre("DateSending", $_SERVER["PHP_SELF"], "mc.date_envoi", $param, '', 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "mc.statut", $param, '', 'class="right"', $sortfield, $sortorder); + print_liste_field_titre("DateSending", $_SERVER["PHP_SELF"], "mc.date_envoi", $param, '', '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "mc.statut", $param, '', '', $sortfield, $sortorder, 'center '); // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); @@ -830,22 +831,22 @@ if ($object->fetch($id) >= 0) { print dol_print_date(dol_stringtotime($obj->tms), 'dayhour'); print ''; - // Status of recipient sending email (Warning != status of emailing) - if ($obj->statut == $object::STATUS_DRAFT) { + // Date sent + print ''; + if ($obj->statut != $object::STATUS_DRAFT) { // Date sent - print ''; - - print ''; - print $object::libStatutDest($obj->statut, 2, ''); - print ''; - } else { - // Date sent - print ''.$obj->date_envoi.''; - - print ''; - print $object::libStatutDest($obj->statut, 2, $obj->error_text); - print ''; + print $obj->date_envoi; } + print ''; + + // Status of recipient sending email (Warning != status of emailing) + print ''; + if ($obj->statut == $object::STATUS_DRAFT) { + print $object::libStatutDest($obj->statut, 2, ''); + } else { + print $object::libStatutDest($obj->statut, 2, $obj->error_text); + } + print ''; // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 5710ea27fe8..9e4097d3290 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -218,11 +218,11 @@ class Mailing extends CommonObject $this->statuts[2] = 'MailingStatusSentPartialy'; $this->statuts[3] = 'MailingStatusSentCompletely'; - $this->statut_dest[-1] = 'MailingStatusError'; $this->statut_dest[0] = 'MailingStatusNotSent'; $this->statut_dest[1] = 'MailingStatusSent'; $this->statut_dest[2] = 'MailingStatusRead'; $this->statut_dest[3] = 'MailingStatusReadAndUnsubscribe'; // Read but ask to not be contacted anymore + $this->statut_dest[-1] = 'MailingStatusError'; } /** diff --git a/htdocs/core/class/html.formmailing.class.php b/htdocs/core/class/html.formmailing.class.php index 7ae13608e6a..2fbf1d9e773 100644 --- a/htdocs/core/class/html.formmailing.class.php +++ b/htdocs/core/class/html.formmailing.class.php @@ -36,12 +36,13 @@ class FormMailing extends Form /** * Output a select with destinaries status * - * @param string $selectedid The selected id - * @param string $htmlname Name of controm - * @param integer $show_empty Show empty option + * @param string $selectedid The selected id + * @param string $htmlname Name of controm + * @param integer $show_empty Show empty option + * @param string $morecss More CSS * @return string HTML select */ - public function selectDestinariesStatus($selectedid = '', $htmlname = 'dest_status', $show_empty = 0) + public function selectDestinariesStatus($selectedid = '', $htmlname = 'dest_status', $show_empty = 0, $morecss = 'minwidth75') { global $langs; @@ -55,6 +56,6 @@ class FormMailing extends Form $options = $options + $mailing->statut_dest; // Note -1 is used for error, so we use -2 for tempty value - return Form::selectarray($htmlname, $options, $selectedid, ($show_empty ? -2 : 0), 0, 0, '', 1); + return Form::selectarray($htmlname, $options, $selectedid, ($show_empty ? -2 : 0), 0, 0, '', 1, 0, 0, '', $morecss); } } From d8b59d0bc02ba5b10d420d4c218f37eab9fa9ddb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Sep 2023 12:11:16 +0200 Subject: [PATCH 7/7] Fix use of empty in selectarray when label start with entity char & --- htdocs/core/class/html.form.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index aab16079aef..bf50f09ea52 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8212,7 +8212,7 @@ class Form } $idname = str_replace(array('[', ']'), array('', ''), $htmlname); - $out .= '