diff --git a/html/ajax_misc.php b/html/ajax_misc.php index 8e6f79a60..40f450505 100644 --- a/html/ajax_misc.php +++ b/html/ajax_misc.php @@ -600,6 +600,9 @@ EOF; case 'tag_remove': require_once 'ajax_tag_remove_action.php'; break; + case 'tag_choose': + require_once 'ajax_tag_choose.php'; + break; default: var_dump($_GET); } diff --git a/html/js/scripts.js b/html/js/scripts.js index 949ddc4a5..88a370c92 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -2164,4 +2164,38 @@ function action_tag_remove(p_dossier,ag_id,t_id) } catch (e) { error_message(e.getMessage); } +} +function choose_tag(p_dossier) +{ + try { + waiting_box(); + var queryString="op=tag_choose&gDossier="+p_dossier; + var action = new Ajax.Request( + "ajax_misc.php" , + { + method:'get', parameters:queryString, + onFailure:ajax_misc_failure, + onSuccess:function(req,j){ + var answer=req.responseXML; + var html=answer.getElementsByTagName('code'); + if ( html.length == 0 ) + { + var rec=unescape_xml(req.responseText); + error_message ('erreur :'+rec); + } + var code_html=getNodeText(html[0]); + code_html=unescape_xml(code_html); + remove_waiting_box(); + add_div({id:'tag_div',cssclass:'inner_box',drag:1}); + $('tag_div').style.top=posY-70; + $('tag_div').style.left=posX-70; + remove_waiting_box(); + $('tag_div').innerHTML=code_html; + + } + } + ); + } catch (e) { + error_message(e.getMessage); + } } \ No newline at end of file diff --git a/include/action.common.inc.php b/include/action.common.inc.php index 87f43f5bb..b7ad548df 100644 --- a/include/action.common.inc.php +++ b/include/action.common.inc.php @@ -192,7 +192,7 @@ if ($sub_action == "list") // Add a button to export to Csv echo '
"; diff --git a/include/ajax_tag_choose.php b/include/ajax_tag_choose.php new file mode 100644 index 000000000..87b867ccd --- /dev/null +++ b/include/ajax_tag_choose.php @@ -0,0 +1,42 @@ +select(); + +$response= ob_get_clean(); +ob_end_clean(); +$html=escape_xml($response); +header('Content-type: text/xml; charset=UTF-8'); +echo <<$html
+
+EOF;
+exit();
+
+
+?>
diff --git a/include/class_follow_up.php b/include/class_follow_up.php
index 688fb0552..3353f1bef 100644
--- a/include/class_follow_up.php
+++ b/include/class_follow_up.php
@@ -1182,6 +1182,8 @@ class Follow_Up
$remind_date->value=(isset($_GET['remind_date']))?$_GET['remind_date']:"";
$remind_date_end=new IDate('remind_date_end');
$remind_date_end->value=(isset($_GET['remind_date_end']))?$_GET['remind_date_end']:"";
+ $tag=new Tag($cn);
+
// show the action in
require_once 'template/action_search.php';
}
@@ -1362,8 +1364,8 @@ class Follow_Up
to_char(ag_timestamp,'DD.MM.YYYY') as my_date,
to_char(ag_remind_date,'DD.MM.YYYY') as my_remind,
to_char(coalesce((select max(agc_date) from action_gestion_comment as agc where agc.ag_id=ag_id),ag_timestamp),'DD.MM.YY') as last_comment,
- array_to_string((select array_agg(t1.t_tag) from action_tags as a1 join tags as t1 on (a1.t_id=t1.t_id) where a1.ag_id=ag_id ),',') as tags,
- (select ad_value from fiche_Detail where f_id=action_gestion.f_id_dest and ad_id=1) as name,
+ array_to_string((select array_agg(t1.t_tag) from action_tags as a1 join tags as t1 on (a1.t_id=t1.t_id) where a1.ag_id=ag.ag_id ),',') as tags,
+ (select ad_value from fiche_Detail where f_id=ag.f_id_dest and ad_id=1) as name,
ag_title,
dt_value,
ag_ref,
@@ -1371,10 +1373,10 @@ class Follow_Up
ag_state,
coalesce((select p_name from profile where p_id=ag_dest),'Aucun groupe') as dest
- from action_gestion
- join document_type on (ag_type=dt_id)
- join document_state on(ag_state=s_id)
- where true $p_search order by ag_timestamp,ag_id";
+ from action_gestion as ag
+ join document_type on (ag.ag_type=dt_id)
+ join document_state on(ag.ag_state=s_id)
+ where true $p_search order by ag.ag_timestamp,ag.ag_id";
$ret=$this->db->exec_sql($sql);
if ( Database::num_row($ret)==0)exit();
diff --git a/include/class_tag.php b/include/class_tag.php
index a950e520f..75e5aa248 100644
--- a/include/class_tag.php
+++ b/include/class_tag.php
@@ -75,6 +75,24 @@ class Tag
$this->data->t_id=$p_array['t_id'];
$this->data->delete();
}
+ /**
+ * Show a button to select tag for Search
+ * @return HTML
+ */
+ function choose()
+ {
+ $r="";
+ $r.=HtmlInput::button("choose_tag", "Tag", 'onclick="choose_tag('.Dossier::id().')"', "smallbutton");
+ return $r;
+ }
+ /**
+ * let select a tag to add to the search
+ */
+ function select_search()
+ {
+ $ret=$this->data->seek(' order by t_tag');
+ require_once 'template/tag_select.php';
+ }
}
?>
diff --git a/include/template/action_search.php b/include/template/action_search.php
index 2b0fa0b20..8f46c6e6f 100644
--- a/include/template/action_search.php
+++ b/include/template/action_search.php
@@ -52,32 +52,40 @@
| + Tag + | ++ Description + | +
|---|---|
| + + | ++ + | +