';
else
$view.='
';
$view.='
Vue expert
';
$view.='';
echo $view;
}
//---------------------------------------------------------------------
// action = vue ca
//---------------------------------------------------------------------
if ( $action=="view_ca") {
/*!\todo add security here */
$p_id=$_GET["line"];
$view='
';
$view.='
Vue simple
';
$view.=ShowOperationUser($cn,$p_id,0);
$view.='';
$view.='';
$view.='';
$view.='
';
$view.='
Vue expert
';
$view.=ShowOperationExpert($cn,$p_id,0);
$view.='';
$view.='';
$view.='';
echo $view;
exit();
}
//----------------------------------------------------------------------
// update the record and upload files
//----------------------------------------------------------------------
if ( isset($_POST['update_record']) ) {
if ( ($priv=CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$p_jrn,true)) !=2 ) {
NoAccess();
exit -1;
}
try {
// NO UPDATE except rapt & comment && upload pj
StartSql($cn);
UpdateComment($cn,$_POST['jr_id'],$_POST['comment']);
InsertRapt($cn,$_POST['jr_id'],$_POST['rapt']);
if ( isset ($_FILES)) {
echo_debug("modify_op.php",__LINE__, "start upload doc.");
save_upload_document($cn,$_POST['jr_grpt_id']);
}
if ( isset ($_POST['is_paid'] ))
$Res=ExecSql($cn,"update jrn set jr_rapt='paid' where jr_id=".$_POST['jr_id']);
if ( isset ($_POST['to_remove'] )) {
/*! \note we don't remove the document file if another
* operation needs it.
*/
$ret=ExecSql($cn,"select jr_pj from jrn where jr_id=".$_POST['jr_id']);
if (pg_num_rows($ret) != 0) {
$r=pg_fetch_array($ret,0);
$old_oid=$r['jr_pj'];
if (strlen($old_oid) != 0)
{
// check if this pj is used somewhere else
$c=CountSql($cn,"select * from jrn where jr_pj=".$old_oid);
if ( $c == 1 )
pg_lo_unlink($cn,$old_oid);
}
ExecSql($cn,"update jrn set jr_pj=null, jr_pj_name=null, ".
"jr_pj_type=null where jr_id=".$_POST['jr_id']);
}
}
//-------------------------------------
// CA
//------------------------------------
if ( $own->MY_ANALYTIC != "un" )
{
// for each item, insert into operation_analytique
$plan=new PlanAnalytic($cn);
$a_plan=$plan->get_list();
foreach ($a_plan as $r_plan)
{
foreach ($_POST as $post_name=>$post_value) {
$a="plan_".$r_plan['id']."_";
$po=sscanf($post_name,$a."%d");
echo_debug(__FILE__.":".__LINE__,"post ",$post_name);
echo_debug(__FILE__.":".__LINE__,"post ",$post_value);
echo_debug(__FILE__.":".__LINE__,"a = ",$a);
echo_debug(__FILE__.":".__LINE__,"po = ".var_export($po,true));
if ( $po[0] != null ) {
$op=new operation($cn);
$op->j_id=$po[0];
$op->pa_id=$r_plan['id'];
$op->po_id=$post_value;
$op->update_from_jrnx($post_value);
}
} // foreach ($_POST
}// foreach ($a_plan
}// if ( $own->MY_ANALYTIC != "un" )
} catch (Exception $e) {
echo '
'.
'Erreur dans l\'enregistrement '.
__FILE__.':'.__LINE__.' '.
$e->getMessage();
echo_debug(__FILE__,__LINE__,$e->getMessage());
Rollback($cn);
}
Commit($cn);
echo ' ';
} // if update_record
//-----------------------------------------------------
if ( $action == 'delete' ) {
echo_debug('modify_op.php',__LINE__," Call DeleteRapt($cn,".$_GET['line'].",".$_GET['line2'].")");
DeleteRapt($cn,$_GET['line'],$_GET['line2']);
echo ' ';
}
html_page_stop();
?>