noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 111/119: Follow-Up improve search


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 111/119: Follow-Up improve search
Date: Mon, 26 Oct 2020 18:27:40 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 9857de7e08d652cce01f083f91a5fed288722454
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Fri Oct 16 10:14:12 2020 +0200

    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 5810aa2..c36fe8d 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=""; //<! selected status of the event , if not set or equal 
to -1 , it is all of them
+        //
+        // search for a specific document id (ag_id) , if given then status 
and date doesn't count
+         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']);
+            $search_docid=$p_array['ag_id']; 
+            return $action_query;
+        }
         if (isset($_REQUEST['action_query']))
         {
+            $action_query = $http->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 ';
@@ -1318,10 +1329,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";
         }
         if 
(isset($p_array['remind_date_end'])&&$p_array['remind_date_end']!=""&&isDate($p_array['$remind_date_end'])==$p_array['remind_date_end'])



reply via email to

[Prev in Thread] Current Thread [Next in Thread]