diff --git a/include/action.inc.php b/include/action.inc.php index 059efb14e..6278c3360 100644 --- a/include/action.inc.php +++ b/include/action.inc.php @@ -46,7 +46,7 @@ function ShowActionList($cn,$retour,$h_url) $a=(isset($_GET['query']))?$_GET['query']:""; printf ('Titre ou référence: ', $a); - $qcode=(isset($_GET['qcode']))?$_GET['qcode']:""; + $qcode=(isset($_GET['qcode_query']))?$_GET['qcode_query']:""; echo JS_SEARCH_CARD; $w=new widget('js_search_only'); $w->name='qcode_query'; diff --git a/include/class_action.php b/include/class_action.php index 3cad0b11c..16f5ab647 100644 --- a/include/class_action.php +++ b/include/class_action.php @@ -637,6 +637,36 @@ class action */ function myList($p_filter="",$p_search="") { + // for the sort + $sort=""; + if ( isset($_GET['s'])){ + { + switch ($_GET['s']) { + case "date": + $sort=" ag_timestamp"; + break; + case "exp": + $sort=" f_id_exp"; + break; + case "dest": + $sort=" f_id_dest"; + break; + case "ti": + $sort=" ag_title"; + break; + case "type": + $sort=" ag_type"; + break; + case "ref": + $sort=" ag_ref"; + break; + case "conc": + $sort=" ag_ref_ag_id"; + break; + } + $sort=" order by ".$sort." desc "; + } + } $sql=" select ag_id,to_char(ag_timestamp,'DD-MM-YYYY') as my_date,ag_ref_ag_id,f_id_dest,f_id_exp". ",ag_title,d_id,md_type,dt_value,ag_ref @@ -644,7 +674,7 @@ class action left outer join document using (ag_id) left outer join document_modele on (ag_type=md_type) join document_type on (ag_type=dt_id) - where dt_id in ($p_filter) $p_search order by ag_timestamp desc,ag_ref desc"; + where dt_id in ($p_filter) $p_search $sort"; $max_line=CountSql($this->db,$sql); $step=$_SESSION['g_pagesize']; $page=(isset($_GET['offset']))?$_GET['page']:1; @@ -659,14 +689,14 @@ class action $r.=$bar; $r.="
| Date | "; - $r.="Destinataire | "; - $r.="Expéditeur | "; - $r.="Titre | "; - $r.="type | "; - $r.="Référence | "; - $r.="concerne | "; - $r.="Document | "; + $r.='Date | '; + $r.='Destinataire | '; + $r.='Expéditeur | '; + $r.='Titre | '; + $r.='type | '; + $r.='Référence | '; + $r.='concerne | '; + $r.='Document | '; $r.="
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ".$row['my_date']." | "; - // Expediteur - $fexp=new fiche($this->db); - $fexp->id=$row['f_id_exp']; - $qcode_exp=$fexp->strAttribut(ATTR_DEF_QUICKCODE); - - $qexp=($qcode_exp=="- ERROR -")?"Interne":$qcode_exp; - $jsexp=sprintf("javascript:showfiche('%s','%s')", - $_REQUEST['PHPSESSID'],$qexp); - if ( $qexp != 'Interne' ) - { - $r.="".''.$qexp." : ".$fexp->getName().' | '; - } - else - $r.="Interne | "; // Destinataire $fdest=new fiche($this->db); $fdest->id=$row['f_id_dest']; @@ -713,6 +729,21 @@ class action else $r.="Interne | "; + // Expediteur + $fexp=new fiche($this->db); + $fexp->id=$row['f_id_exp']; + $qcode_exp=$fexp->strAttribut(ATTR_DEF_QUICKCODE); + + $qexp=($qcode_exp=="- ERROR -")?"Interne":$qcode_exp; + $jsexp=sprintf("javascript:showfiche('%s','%s')", + $_REQUEST['PHPSESSID'],$qexp); + if ( $qexp != 'Interne' ) + { + $r.="".''.$qexp." : ".$fexp->getName().' | '; + } + else + $r.="Interne | "; + // show reference if ( $row['ag_ref_ag_id'] != 0 ) {