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 HtmlInput::hidden('ac',$_REQUEST['ac']); echo $Ledger->confirm($_POST); echo HtmlInput::submit('confirm',_('Confirmer')); echo HtmlInput::submit('correct',_('Corriger')); 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 '
'; echo '

' . $Ledger->get_name() . '

'; echo '
'; 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 '
'; echo '

'.$p_msg.'

'; echo '
'; echo HtmlInput::hidden('ledger_type','fin'); echo HtmlInput::hidden('ac',$_REQUEST['ac']); $array=( isset($correct))?$_POST:null; // show select ledger try { echo $Ledger->input($array); echo HtmlInput::button('add_item',_('Ajout article'), ' onClick="ledger_fin_add_row()"'); echo HtmlInput::submit('save',_('Sauve')); echo HtmlInput::reset(_('Effacer')); if ( ! isset ($_POST['e_date'])&& $g_parameter->MY_DATE_SUGGEST=='Y') { echo create_script(" get_last_date();ajax_saldo('first_sold');"); }else { echo create_script(" ajax_saldo('first_sold');"); } echo create_script(" update_name()"); } catch (Exception $ex) { echo $ex->getMessage(); } return;