id=$_REQUEST['p_jrn'];
else
{
$def_ledger=$Ledger->get_first('fin');
if ( empty ($def_ledger))
{
exit('Pas de journal disponible');
}
$Ledger->id=$def_ledger['jrn_def_id'];
}
$jrn_priv=$g_user->get_ledger_access($Ledger->id);
// Check privilege
if ( isset($_REQUEST['p_jrn']) && ( $jrn_priv == 'X'))
{
NoAccess();
exit -1;
}
$p_msg="";
//----------------------------------------
// Confirm the operations
//----------------------------------------
if ( isset($_POST['save']))
{
try
{
$Ledger->verify($_POST);
}
catch (Exception $e)
{
alert($e->getMessage());
$p_msg=$e->getMessage();
$correct=1;
}
if ( ! isset ($correct ))
{
echo '
';
echo h1(_('Confirmation'),'');
echo_warning(_("Attention, cette opération n'est pas encore sauvée : vous devez encore confirmer"));
echo '';
echo '
';
return;
}
}
//----------------------------------------
// Confirm and save the operations
// into the database
//----------------------------------------
if ( isset($_POST['confirm']))
{
try
{
$Ledger->verify($_POST);
}
catch (Exception $e)
{
alert($e->getMessage());
$p_msg=$e->getMessage();
$correct=1;
}
if ( !isset($correct))
{
echo '';
$a= $Ledger->insert($_POST);
echo '
'._('Enregistrement').'
';
echo '
';
echo $a;
echo '
';
echo '
';
echo $Ledger->button_new_operation();
return;
}
}
//----------------------------------------
// Correct the operations
//----------------------------------------
if ( isset($_POST['correct']))
{
$correct=1;
}
//----------------------------------------
// Blank form
//----------------------------------------
echo '