예제 #1
0
/*!\file
 *
 *
 * \brief to write into the ledgers ODS a new operation
 */
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
require_once NOALYSS_INCLUDE . '/class_pre_op_ods.php';
require_once NOALYSS_INCLUDE . '/class_iconcerned.php';
global $g_user, $g_parameter;
$cn = new Database(dossier::id());
$id_predef = isset($_REQUEST['p_jrn_predef']) ? $_REQUEST['p_jrn_predef'] : -1;
$id_ledger = isset($_REQUEST['p_jrn']) ? $_REQUEST['p_jrn'] : $id_predef;
$ledger = new Acc_Ledger($cn, $id_ledger);
$first_ledger = $ledger->get_first('ODS');
$ledger->id = $ledger->id == -1 ? $first_ledger['jrn_def_id'] : $id_ledger;
// check if we can write in the ledger
if ($g_user->check_jrn($ledger->id) == 'X') {
    alert(_("Vous ne pouvez pas écrire dans ce journal, contacter votre administrateur"));
    return;
}
echo '<div style="position:absolute" class="content">';
echo '<div id="predef_form">';
echo HtmlInput::hidden('p_jrn_predef', $ledger->id);
$op = new Pre_op_ods($cn);
$op->set('ledger', $ledger->id);
$op->set('ledger_type', "ODS");
$op->set('direct', 't');
$url = http_build_query(array('action' => 'use_opd', 'p_jrn_predef' => $ledger->id, 'ac' => $_REQUEST['ac'], 'gDossier' => dossier::id()));
echo $op->form_get('do.php?' . $url);