fromArray($_POST);
if ($act->ag_id == 0 )
{
$act->save();
$ag_id=$act->ag_id;
}
else
{
$act->Update();
}
$act->generate_document($_POST['doc_mod']);
$sub_action='detail';
}
/* for delete */
if ( isset($_POST['delete'] )) $sub_action='delete';
if ( $sub_action == "" ) $sub_action="list";
// if correction is asked go to directly to add_action
if (isset($_POST['corr'] ))
{
$ag_comment=urldecode($_POST['ag_comment']);
$sub_action="add_action";
}
// if this page is called from another menu (customer, supplier,...)
// a button back is added
//----------------------------------------------------------------------
// Update the detail
// Add a new action related to this one or update
//----------------------------------------------------------------------
if ( $sub_action=="update" )
{
// Update the modification
if ( isset($_POST['save']))
{
$act2=new Action($cn);
$act2->fromArray($_POST );
if ( $act2->Update() == false )
{
$sub_action="detail";
}
else
{
$url="?$base&sa=detail&ag_id=".$act2->ag_id.'&'.dossier::get();
echo '
';
}
}
//----------------------------------------------------------------------
// Add a related action
//----------------------------------------------------------------------
if ( isset ($_POST['add_action_here']) )
{
$act=new Action($cn);
//----------------------------------------
// puis comme ajout normal (copier / coller )
$act->fromArray($_POST);
$act->ag_id=0;
$act->d_id=0;
$act->ag_ref_ag_id=$_POST['ag_id'];
echo '
';
// Add hidden tag
echo '';
echo '
';
}
}
//--------------------------------------------------------------------------------
// Show the detail of an action
// permit the update
if ( $sub_action=='detail' )
{
echo '
';
}
//---------------------------------------------------------------------
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='".$_SESSION['g_user']."')";
$r=$act->myList($p_base,"",$query.$str);
echo $r;
}