From 9857de7e08d652cce01f083f91a5fed288722454 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Fri, 16 Oct 2020 10:14:12 +0200 Subject: [PATCH] Follow-Up improve search --- include/class/follow_up.class.php | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/include/class/follow_up.class.php b/include/class/follow_up.class.php index 5810aa265..c36fe8d60 100644 --- a/include/class/follow_up.class.php +++ b/include/class/follow_up.class.php @@ -1246,15 +1246,26 @@ class Follow_Up static function create_query($cn, $p_array=null) { if ($p_array==null) $p_array=$_GET; - + $http=new HttpInput(); + $search_docid=0; // search for a document $action_query=""; $ag_state=""; //request('action_query'); // if a query is request build the sql stmt - $action_query="and (ag_title ilike '%".sql_string($_REQUEST['action_query'])."%' ". - "or ag_ref ='".trim(sql_string($_REQUEST['action_query'])). - "' or ag_id in (select ag_id from action_gestion_comment where agc_comment ilike '%".trim(sql_string($_REQUEST['action_query']))."%')". + $action_query="and (ag_title ilike '%".sql_string($action_query)."%' ". + "or ag_ref ='".trim(sql_string($action_query)). + "' or ag_id in (select ag_id from action_gestion_comment ". + " where agc_comment ilike '%".trim(sql_string($action_query))."%')". ")"; } @@ -1266,7 +1277,7 @@ class Follow_Up { $fiche=new Fiche($cn); - $fiche->get_by_qcode($_REQUEST['qcode']); + $fiche->get_by_qcode($http->request('qcode')); // if quick code not found then nothing if ($fiche->id==0) $str=' and false '; @@ -1317,10 +1328,6 @@ class Follow_Up if (isset ($p_array['ag_id']) && isNumber($p_array['ag_id'])==1&&$p_array['ag_id']!=0) - { - $action_query=" and ag_id= ".sql_string($p_array['ag_id']); - } - if (isset($p_array['$remind_date'])&&$p_array['remind_date']!=""&&isDate($p_array['remind_date'])==$p_array['remind_date']) { $action_query .= " and to_date('".sql_string($p_array['$remind_date'])."','DD.MM.YYYY')<= ag_remind_date"; }