diff --git a/html/ajax_misc.php b/html/ajax_misc.php index b0b052131..40db89ce2 100644 --- a/html/ajax_misc.php +++ b/html/ajax_misc.php @@ -481,6 +481,9 @@ EOF; case 'search_op': require_once 'search.inc.php'; break; + case 'search_action': + require_once 'ajax_search_action.php'; + break; case 'display_profile': require_once("ajax_get_profile.php"); break; diff --git a/html/js/scripts.js b/html/js/scripts.js index 291b03116..550355781 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -1379,3 +1379,39 @@ function rapport_add_row(p_dossier) g('form'+line).value=''; } +/** + * Search an action in an inner box + */ +function search_action(dossier,ctl_concern) +{ + var dossier=g('gDossier').value; + + var target="search_action_div"; + removeDiv(target); + var str_style=fixed_position(77, 99); + str_style+=";width:80%"; + + var div={id:target, cssclass:'inner_box',style:str_style,html:loading(),drag:1}; + + add_div(div); + var target={gDossier:dossier, + ctlc:ctl_concern, + op:'search_action', + ctl:target + }; + + var qs=encodeJSON(target); + + var action=new Ajax.Request ( 'ajax_misc.php', + { + method:'get', + parameters:qs, + onFailure:null, + onSuccess:function (req){ + remove_waiting_box(); + $('search_action').innerHTML=req.responseText; + req.responseText.evalScripts(); + } + } + ); +} \ No newline at end of file diff --git a/include/action.common.inc.php b/include/action.common.inc.php index c321e04c5..6f9a667ed 100644 --- a/include/action.common.inc.php +++ b/include/action.common.inc.php @@ -169,7 +169,7 @@ if ( $sub_action == 'delete' ) $act->remove(); $sub_action="list"; $cn->commit(); - ShowActionList($cn,$base); + Follow_Up::ShowActionList($cn,$base); if ( isset( $act->ag_ref) ) echo hb(_('Action ').$act->ag_ref._(' effacée')); exit(); @@ -179,7 +179,7 @@ if ( $sub_action == 'delete' ) // Show a list of the action if ( $sub_action == "list" ) { - ShowActionList($cn,$base); + Follow_Up::ShowActionList($cn,$base); } //-------------------------------------------------------------------------------- // Add an action @@ -226,205 +226,9 @@ if ( $sub_action == "save_action_st2" ) echo '

'.hb('Action Sauvée : '.$act->ag_ref).'

'; - ShowActionList($cn,$base); + Follow_Up::ShowActionList($cn,$base); $url="?$base&sa=detail&ag_id=".$act->ag_id.'&'.dossier::get(); echo '

'.hb('Action Sauvée : '.$act->ag_ref).'

'; } -//--------------------------------------------------------------------- -function ShowActionList($cn,$p_base) -{ - // show the search menu - ?> - - -
-
-
- - "> - - - - - - - -
-
- - get_by_qcode($_REQUEST['qcode']); - // if quick code not found then nothing - if ( $fiche->id == 0 ) - $str=' and false '; - else - $str=" and (f_id_dest= ".$fiche->id." ) "; - } - } - if (isset($_GET['tdoc']) && $_GET['tdoc'] != -1 ) - { - $query .= ' and dt_id = '.Formatstring($_GET['tdoc']); - } - if ( ! $see_all->selected ) $query .= ' and ag_state in (2,3) '; - if ( ! $my_action->selected ) { - $query .=" and (ag_owner='".$_SESSION['g_user']."' or ag_dest in (select p_id from profile_user where user_name='".$_SESSION['g_user']."') )"; - } - if (isset ($_GET['date_start']) && isDate($_GET['date_start'])!= null ) { - $date_start=$_GET['date_start']; - $query.=" and ag_timestamp >= to_date('$date_start','DD.MM.YYYY')"; - } - if (isset ($_GET['date_end']) && isDate($_GET['date_end'])!= null ) { - $date_end=$_GET['date_end']; - $query.=" and ag_timestamp <= to_date('$date_end','DD.MM.YYYY')"; - } - if ( isset($_GET['ag_dest_query'])) - { - if ( $_GET['ag_dest_query']==0) - $query .= "and ag_dest is null "; - else - $query.= " and ag_dest = ".sql_string($_GET['ag_dest_query']); - } - $r=$act->myList($p_base,"",$query.$str); - echo $r; -} diff --git a/include/ajax_search_action.php b/include/ajax_search_action.php new file mode 100755 index 000000000..2eaf324eb --- /dev/null +++ b/include/ajax_search_action.php @@ -0,0 +1,32 @@ + diff --git a/include/class_follow_up.php b/include/class_follow_up.php index cfe572ac3..46060fee7 100644 --- a/include/class_follow_up.php +++ b/include/class_follow_up.php @@ -1112,4 +1112,202 @@ class Follow_Up $this->db->exec_sql("delete from action_gestion_operation where ago_id=$1",array($op[$i])); } } +function ShowActionList($cn,$p_base) +{ + // show the search menu + ?> + + +
+
+
+ + "> + + + + + + + +
+
+ + get_by_qcode($_REQUEST['qcode']); + // if quick code not found then nothing + if ( $fiche->id == 0 ) + $str=' and false '; + else + $str=" and (f_id_dest= ".$fiche->id." ) "; + } + } + if (isset($_GET['tdoc']) && $_GET['tdoc'] != -1 ) + { + $query .= ' and dt_id = '.Formatstring($_GET['tdoc']); + } + if ( ! $see_all->selected ) $query .= ' and ag_state in (2,3) '; + if ( ! $my_action->selected ) { + $query .=" and (ag_owner='".$_SESSION['g_user']."' or ag_dest in (select p_id from profile_user where user_name='".$_SESSION['g_user']."') )"; + } + if (isset ($_GET['date_start']) && isDate($_GET['date_start'])!= null ) { + $date_start=$_GET['date_start']; + $query.=" and ag_timestamp >= to_date('$date_start','DD.MM.YYYY')"; + } + if (isset ($_GET['date_end']) && isDate($_GET['date_end'])!= null ) { + $date_end=$_GET['date_end']; + $query.=" and ag_timestamp <= to_date('$date_end','DD.MM.YYYY')"; + } + if ( isset($_GET['ag_dest_query'])) + { + if ( $_GET['ag_dest_query']==0) + $query .= "and ag_dest is null "; + else + $query.= " and ag_dest = ".sql_string($_GET['ag_dest_query']); + } + $r=$act->myList($p_base,"",$query.$str); + echo $r; +} + }