documentation
Add #495 possibilité d'ajouter et enlever des actions dépendantes
This commit is contained in:
parent
9d71aaddc2
commit
636371c255
5 changed files with 94 additions and 20 deletions
Binary file not shown.
|
|
@ -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 '<p><a class="mtitle" href="'.$url.'">'.hb(_('Action sauvée').' : '.$act2->ag_ref).'</a></p>';
|
||||
|
||||
ShowActionList($cn,$base);
|
||||
echo '<p><a class="mtitle" href="'.$url.'">'.hb(_('Action sauvée').' : '.$act2->ag_ref).'</a></p>';
|
||||
}
|
||||
$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 '<div class="content">';
|
||||
$act=new Follow_Up($cn);
|
||||
$act->ag_id=$ag_id;
|
||||
$act->suppress=1;
|
||||
echo $act->get();
|
||||
$act->ag_comment=Decode($act->ag_comment);
|
||||
echo '<form enctype="multipart/form-data" class="print" action="do.php" method="post" >';
|
||||
|
|
@ -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 '</form>';
|
||||
echo '</div>';
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
//-----------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ class Follow_Up
|
|||
if( isset($_REQUEST['sb']))
|
||||
$supl_hidden.='&sb='.$_REQUEST['sb'];
|
||||
|
||||
$lag_ref_ag_id='<a class="mtitle" href="?ac='.$_REQUEST['ac'].$supl_hidden.'&sa=detail&ag_id='.
|
||||
$lag_ref_ag_id='<a class="line" href="?ac='.$_REQUEST['ac'].$supl_hidden.'&sa=detail&ag_id='.
|
||||
$this->ag_ref_ag_id.'&'.dossier::get().'">'.
|
||||
$this->db->get_value("select ag_ref from action_gestion where ag_id=$1",array($this->ag_ref_ag_id)).
|
||||
"</A>";
|
||||
|
|
@ -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.='<th>'.$table->get_header(0).'</th>';
|
||||
$r.='<th>'.$table->get_header(1).'</th>';
|
||||
$r.='<th>'.$table->get_header(2).'</th>';
|
||||
$r.='<th>'.$table->get_header(3).'</th>';
|
||||
$r.='<th>type</th>';
|
||||
$r.=th('Etat');
|
||||
$r.=th('Priorité');
|
||||
$r.='<th>'.$table->get_header(4).'</th>';
|
||||
$r.='<th>'.$table->get_header(3).'</th>';
|
||||
if (isset($this->suppress)) {
|
||||
$r.="<th> Suppr. dépendance</th>";
|
||||
}
|
||||
$r.="</tr>";
|
||||
|
||||
|
||||
|
|
@ -732,6 +742,7 @@ class Follow_Up
|
|||
if ($row['my_date']==$today) $st=' style="font-family:bold; border:2px solid orange;"';
|
||||
$r.="<tr class=\"$tr\" $st>";
|
||||
$r.="<td>".$href.$row['my_date'].'</a>'."</td>";
|
||||
$r.="<td>".$href.$row['ag_ref'].'</a>'."</td>";
|
||||
|
||||
// Expediteur
|
||||
$fexp=new Fiche($this->db);
|
||||
|
|
@ -805,11 +816,17 @@ class Follow_Up
|
|||
}
|
||||
$r.=td($priority);
|
||||
|
||||
$r.="<td>".$row['ag_ref']."</td>";
|
||||
$r.="<td>".$ref."</td>";
|
||||
$r.="<td>" . $ref . "</td>";
|
||||
if (isset($this->suppress))
|
||||
{
|
||||
$ck = new ICheckBox('sup_dep[]');
|
||||
$ck->value = $row['ag_id'];
|
||||
$r.="<td>" . $ck->input() . "</td>";
|
||||
}
|
||||
$r.="</tr>";
|
||||
|
||||
}
|
||||
|
||||
$r.="</table>";
|
||||
|
||||
$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;$i<count($p_array);$i++)
|
||||
{
|
||||
$this->db->exec_sql("update action_gestion set ag_ref_ag_id=0 where ag_id=$1",
|
||||
array($p_array[$i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
35
include/template/action-reference.php
Normal file
35
include/template/action-reference.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of PhpCompta.
|
||||
*
|
||||
* PhpCompta is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PhpCompta is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with PhpCompta; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/* $Revision$ */
|
||||
|
||||
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief add a follow up
|
||||
*
|
||||
*/
|
||||
$new_action=new INum('new_ref',0);
|
||||
?>
|
||||
<p>
|
||||
Ajout d'une action qui dépend de l'action actuelle : <?=$new_action->input()?>
|
||||
<span class="notice"> Ne donner que le numéro de document
|
||||
</span>
|
||||
</p>
|
||||
Loading…
Add table
Add a link
Reference in a new issue