diff --git a/doc/manuel-fr.odt b/doc/manuel-fr.odt index 93ab93717..b8a62d003 100644 Binary files a/doc/manuel-fr.odt and b/doc/manuel-fr.odt differ diff --git a/include/action.common.inc.php b/include/action.common.inc.php index 49bfe612b..f4b5b6fd2 100644 --- a/include/action.common.inc.php +++ b/include/action.common.inc.php @@ -38,6 +38,7 @@ if( isset($_REQUEST['sb'])) $supl_hidden.=HtmlInput::hidden('sb',$_REQUEST['sb']); $supl_hidden.=HtmlInput::hidden('ac',$_REQUEST['ac']); + /*--------------------------------------------------------------------------- */ /* We ask to generate the document */ /*--------------------------------------------------------------------------- */ @@ -49,6 +50,7 @@ if ( isset($_POST['generate'])) { $act->save(); $ag_id=$act->ag_id; + } else { @@ -82,19 +84,16 @@ if ( $sub_action=="update" ) { $act2=new Follow_Up($cn); $act2->fromArray($_POST ); - - if ( $act2->Update() == false ) - { - $sub_action="detail"; - } - else - { - $url="?$base&sa=detail&ag_id=".$act2->ag_id.'&'.dossier::get(); - echo '

'.hb(_('Action sauvée').' : '.$act2->ag_ref).'

'; - - ShowActionList($cn,$base); - echo '

'.hb(_('Action sauvée').' : '.$act2->ag_ref).'

'; - } + $sub_action="detail"; + if ( $_POST["new_ref"] != "0") + { + $act2->add_depend($_POST['new_ref']); + } + if ( isset ($_POST['sup_dep'])) + { + $act2->suppress_depend($_POST['sup_dep']); + } + $act2->Update(); } //---------------------------------------------------------------------- // Add a related action @@ -141,6 +140,7 @@ if ( $sub_action=='detail' ) echo '
'; $act=new Follow_Up($cn); $act->ag_id=$ag_id; + $act->suppress=1; echo $act->get(); $act->ag_comment=Decode($act->ag_comment); echo '
'; @@ -152,6 +152,7 @@ if ( $sub_action=='detail' ) echo HtmlInput::submit("save","Sauve"); echo HtmlInput::submit("add_action_here",_("Ajoute une action à celle-ci")); echo HtmlInput::submit("delete",_("Efface cette action"),' onclick="return confirm(\''._("Vous confirmez l\'effacement").'\')" '); + echo $retour; echo '
'; echo '
'; diff --git a/include/action.inc.php b/include/action.inc.php index 02be31458..e73a5c8a8 100644 --- a/include/action.inc.php +++ b/include/action.inc.php @@ -23,8 +23,7 @@ */ require_once('class_ipopup.php'); global $g_user; - -$retour=HtmlInput::button_anchor(_('Retour'),'?ac='.$_REQUEST['ac'].'&my_action&'.dossier::get()); +$retour=HtmlInput::button_anchor(_('Retour liste'),'?ac='.$_REQUEST['ac'].'&my_action&'.dossier::get()); //----------------------------------------------------- // Follow_Up //----------------------------------------------------- diff --git a/include/class_follow_up.php b/include/class_follow_up.php index 8ac2045dd..6acafaa11 100644 --- a/include/class_follow_up.php +++ b/include/class_follow_up.php @@ -303,7 +303,7 @@ class Follow_Up if( isset($_REQUEST['sb'])) $supl_hidden.='&sb='.$_REQUEST['sb']; - $lag_ref_ag_id=''. $this->db->get_value("select ag_ref from action_gestion where ag_id=$1",array($this->ag_ref_ag_id)). ""; @@ -523,6 +523,13 @@ class Follow_Up $sql=sprintf(" and ag_id in (select action_get_tree from comptaproc.action_get_tree(%s)) ",$this->ag_id); $r.=$this->myList($p_base,"",$sql); } + // New referecne + ob_start(); + require_once ('template/action-reference.php'); + $content=ob_get_contents(); + ob_end_clean(); + + $r.=$content; return $r; } @@ -664,10 +671,10 @@ class Follow_Up $table=new Sort_Table(); $table->add('Date',$url,'order by ag_timestamp asc','order by ag_timestamp desc','da','dd'); + $table->add('Réf.',$url,'order by ag_ref asc','order by ag_ref desc','ra','rd'); $table->add('Expéditeur',$url,'order by name asc','order by name desc','ea','ed'); $table->add('Titre',$url,'order by ag_title asc','order by ag_title desc','ta','td'); $table->add('Concerne',$url,'order by ag_ref_ag_id asc','order by ag_ref_ag_id desc','ca','cd'); - $table->add('Réf.',$url,'order by ag_ref asc','order by ag_ref desc','ra','rd'); $ord=(! isset($_GET['ord']))?"dd":$_GET['ord']; $sort=$table->get_sql_order($ord); @@ -702,11 +709,14 @@ class Follow_Up $r.=''.$table->get_header(0).''; $r.=''.$table->get_header(1).''; $r.=''.$table->get_header(2).''; + $r.=''.$table->get_header(3).''; $r.='type'; $r.=th('Etat'); $r.=th('Priorité'); $r.=''.$table->get_header(4).''; - $r.=''.$table->get_header(3).''; + if (isset($this->suppress)) { + $r.=" Suppr. dépendance"; + } $r.=""; @@ -732,6 +742,7 @@ class Follow_Up if ($row['my_date']==$today) $st=' style="font-family:bold; border:2px solid orange;"'; $r.=""; $r.="".$href.$row['my_date'].''.""; + $r.="".$href.$row['ag_ref'].''.""; // Expediteur $fexp=new Fiche($this->db); @@ -805,11 +816,17 @@ class Follow_Up } $r.=td($priority); - $r.="".$row['ag_ref'].""; - $r.="".$ref.""; + $r.="" . $ref . ""; + if (isset($this->suppress)) + { + $ck = new ICheckBox('sup_dep[]'); + $ck->value = $row['ag_id']; + $r.="" . $ck->input() . ""; + } $r.=""; } + $r.=""; $r.=$bar; @@ -971,4 +988,26 @@ class Follow_Up $array=$this->db->get_array($sql); return $array; } + /** + *@brief add an related action to the current one + */ + function add_depend($p_ref) + { + if ($p_ref == 0 || $p_ref==$this->ag_id) return; + // check if action exist and is not already related to the current action + $exist=$this->db->get_value("select count(*) from action_gestion where ag_id=$1",array($p_ref)); + if ( $exist == 0) return; + + $this->db->exec_sql("update action_gestion set ag_ref_ag_id=$1 where ag_id=$2", + array($this->ag_id,$p_ref)); + + } + function suppress_depend($p_array) + { + for ($i=0;$idb->exec_sql("update action_gestion set ag_ref_ag_id=0 where ag_id=$1", + array($p_array[$i])); + } + } } diff --git a/include/template/action-reference.php b/include/template/action-reference.php new file mode 100644 index 000000000..4ff723cd4 --- /dev/null +++ b/include/template/action-reference.php @@ -0,0 +1,35 @@ + +

+ Ajout d'une action qui dépend de l'action actuelle : input()?> + Ne donner que le numéro de document + +

\ No newline at end of file