From 0c4d04b29950dbd0ac20b58125213bd1e600b4d8 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Fri, 15 Jun 2012 00:51:26 +0000 Subject: [PATCH] search by remind date --- include/ac_common.php | 2 +- include/action.common.inc.php | 2 +- include/action.inc.php | 2 +- include/category_followup.inc.php | 2 +- include/class_calendar.php | 9 +++++---- include/class_follow_up.php | 14 ++++++++++---- include/class_icard.php | 3 ++- include/template/action_search.php | 8 +++++++- include/template/detail-action.php | 2 +- 9 files changed, 29 insertions(+), 15 deletions(-) diff --git a/include/ac_common.php b/include/ac_common.php index 14b6626b8..87b1d0440 100644 --- a/include/ac_common.php +++ b/include/ac_common.php @@ -203,7 +203,7 @@ function isNumber(&$p_int) return 0; } -/* ! +/*** * \brief Verifie qu'une date est bien formaté * en d.m.y et est valable * \param $p_date diff --git a/include/action.common.inc.php b/include/action.common.inc.php index 8b64a5ac9..72b13a7be 100644 --- a/include/action.common.inc.php +++ b/include/action.common.inc.php @@ -194,7 +194,7 @@ if ($sub_action == "list") Follow_Up::ShowActionList($cn, $base); // Add a button to export to Csv echo '
'; - echo HtmlInput::request_to_hidden(array("sag_ref", "only_internal", "state", "gDossier", "qcode", "start_date", "end_date", "ag_id", "ag_dest_query", + echo HtmlInput::request_to_hidden(array("remind_date","sag_ref", "remind_date","only_internal", "state", "gDossier", "qcode", "start_date", "end_date", "ag_id", "ag_dest_query", "tdoc", "see_all", "all_action", "query")); echo HtmlInput::hidden("act", "CSV:ActionGestion"); echo HtmlInput::submit("follow_up_csv", "Export CSV"); diff --git a/include/action.inc.php b/include/action.inc.php index 115686da5..f9a36d8d9 100644 --- a/include/action.inc.php +++ b/include/action.inc.php @@ -23,7 +23,7 @@ */ require_once('class_ipopup.php'); global $g_user; -$retour=HtmlInput::button_anchor(_('Retour liste'),HtmlInput::request_to_string(array("sag_ref","only_internal","state","ac","gDossier","qcode","ag_dest_query","query","tdoc","date_start","date_end","see_all","all_action")).'&my_action'); +$retour=HtmlInput::button_anchor(_('Retour liste'),HtmlInput::request_to_string(array("remind_date","sag_ref","only_internal","state","ac","gDossier","qcode","ag_dest_query","query","tdoc","date_start","date_end","see_all","all_action")).'&my_action'); //----------------------------------------------------- // Follow_Up //----------------------------------------------------- diff --git a/include/category_followup.inc.php b/include/category_followup.inc.php index d05e1b584..7277aad60 100644 --- a/include/category_followup.inc.php +++ b/include/category_followup.inc.php @@ -37,7 +37,7 @@ require_once('class_follow_up.php'); $sub_action=(isset($_REQUEST['sa']))?$_REQUEST['sa']:"list"; $ag_id=(isset($_REQUEST['ag_id']))?$_REQUEST['ag_id']:0; $p_action=$_REQUEST['ac']; -$base="ac=$p_action&sc=sv&sb=detail&f_id=".$_REQUEST['f_id']."&".HtmlInput::request_to_string(array("sag_ref","only_internal","state","gDossier","qcode","ag_dest","query","tdoc","date_start","date_end","see_all","all_action","sb","sc"),""); +$base="ac=$p_action&sc=sv&sb=detail&f_id=".$_REQUEST['f_id']."&".HtmlInput::request_to_string(array("remind_date","sag_ref","only_internal","state","gDossier","qcode","ag_dest","query","tdoc","date_start","date_end","see_all","all_action","sb","sc"),""); $retour=HtmlInput::button_anchor('Retour','?'.dossier::get().'&'.$base); $fiche=new Fiche($cn,$_REQUEST['f_id']); diff --git a/include/class_calendar.php b/include/class_calendar.php index c1bf04899..878f042c8 100644 --- a/include/class_calendar.php +++ b/include/class_calendar.php @@ -54,13 +54,14 @@ class Calendar " to_char(ag_remind_date,'MM')::integer=$1 ". " and to_char(ag_remind_date,'YYYY')::integer=$2 ". " and ag_dest in (select p_granted from user_sec_action_profile where p_id =$3) + and ag_state IN (2, 3) group by to_char(ag_remind_date,'DD')::integer"; $array=$cn->get_array($sql,array($this->month,$this->year,$profile)); for ($i=0;$i".$array[$i]['nb'].''; + $p_array[$ind].="".$array[$i]['nb']." "._("Tâches suivis").''; } } @@ -70,17 +71,17 @@ class Calendar function fill_from_todo(&$p_array) { $cn=new Database(dossier::id()); - $sql="select tl_id,substr(tl_title,0,20) as tl_title_fmt,to_char(tl_date,'DD')::integer as tl_date_day ". + $sql="select count(*) as nb,to_char(tl_date,'DD')::integer as tl_date_day ". " from todo_list ". " where ". " to_char(tl_date,'MM')::integer=$1 ". " and to_char(tl_date,'YYYY')::integer=$2 ". - " and use_login=$3"; + " and use_login=$3 group by to_char(tl_date,'DD')::integer "; $array=$cn->get_array($sql,array($this->month,$this->year,$_SESSION['g_user'])); for ($i=0;$i".h($array[$i]['tl_title_fmt']).''; + $p_array[$ind].="".h($array[$i]['nb'])." "._('Notes').''; } } /*!\brief display a calendar after a call to Calendar::fill diff --git a/include/class_follow_up.php b/include/class_follow_up.php index ee80cac7a..795b27811 100644 --- a/include/class_follow_up.php +++ b/include/class_follow_up.php @@ -498,7 +498,7 @@ class Follow_Up /* add the number of item */ $Hid = new IHidden(); $r.=$Hid->input("nb_item", MAX_ARTICLE); - $r.=HtmlInput::request_to_hidden(array("sag_ref","only_internal","state","qcode", "ag_dest_query", "query", "tdoc", "date_start", "date_end", "see_all", "all_action")); + $r.=HtmlInput::request_to_hidden(array("remind_date","sag_ref","only_internal","state","qcode", "ag_dest_query", "query", "tdoc", "date_start", "date_end", "see_all", "all_action")); /* get template */ ob_start(); require_once 'template/detail-action.php'; @@ -671,7 +671,7 @@ class Follow_Up function myList($p_base, $p_filter = "", $p_search = "") { // for the sort - $url = HtmlInput::get_to_string(array("sag_ref","only_internal","state","qcode", "ag_dest_query", "query", "tdoc", "date_start", "date_end", "see_all", "all_action")) . '&' . $p_base; + $url = HtmlInput::get_to_string(array("remind_date","sag_ref","only_internal","state","qcode", "ag_dest_query", "query", "tdoc", "date_start", "date_end", "see_all", "all_action")) . '&' . $p_base; $table = new Sort_Table(); $table->add('Date', $url, 'order by ag_timestamp asc', 'order by ag_timestamp desc', 'da', 'dd'); @@ -743,7 +743,7 @@ class Follow_Up //show the sub_action foreach ($a_row as $row) { - $href = ''; + $href = ''; $i++; $tr = ($i % 2 == 0) ? 'even' : 'odd'; if ($row['ag_priority'] < 2) @@ -1154,6 +1154,8 @@ class Follow_Up $str_ag_dest = $ag_dest->input(); $osag_ref=new IText("sag_ref"); $osag_ref->value=(isset($_GET['sag_ref']))?$_GET['sag_ref']:""; + $remind_date=new IDate('remind_date'); + $remind_date->value=(isset($_GET['remind_date']))?$_GET['remind_date']:""; // show the action in require_once 'template/action_search.php'; } @@ -1251,7 +1253,11 @@ class Follow_Up } if (isNumber($ag_id) == 1 && $ag_id != 0) { - $query = " and ag_id= " . $ag_id; + $query = " and ag_id= " . sql_string($ag_id); + } + if ( isset($remind_date) && $remind_date != "" && isDate($remind_date)==$remind_date) + { + $query = " and to_char(ag_remind_date,'DD.MM.YYYY')= '".sql_string($remind_date)."'"; } return $query . $str; } diff --git a/include/class_icard.php b/include/class_icard.php index 3ee9893d4..9788ec1cc 100644 --- a/include/class_icard.php +++ b/include/class_icard.php @@ -239,7 +239,8 @@ class ICard extends HtmlInput /*!\brief print in html the readonly value of the widget*/ public function display() { - $r=sprintf(' ', + $r=sprintf(' ', + $this->name, $this->name, $this->value ); diff --git a/include/template/action_search.php b/include/template/action_search.php index 6ab7961f6..89b4621c1 100644 --- a/include/template/action_search.php +++ b/include/template/action_search.php @@ -46,7 +46,13 @@ - +
+ + + +
Date de rappel + input();?> +
Référence input();?> diff --git a/include/template/detail-action.php b/include/template/detail-action.php index abdaade15..60baf2ba2 100644 --- a/include/template/detail-action.php +++ b/include/template/detail-action.php @@ -285,7 +285,7 @@ endfor;