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);
echo '</div>';
echo '<div id="jrn_name_div">';
echo '<h2 id="jrn_name" style="display:inline">' . $ledger->get_name() . '</h2>';
echo '</div>';
// Show the predef operation
// Don't forget the p_jrn
$p_post = $_POST;
if (isset($_GET['action']) && !isset($_POST['correct'])) {
    if ($_GET['action'] == 'use_opd') {
        // get data from predef. operation
        $op = new Pre_op_advanced($cn);
        $p_post = null;
        if (isset($_REQUEST['pre_def']) && $_REQUEST['pre_def'] != '') {
            $op->set_od_id($_REQUEST['pre_def']);
            $p_post = $op->compute_array();
        }
    }
}
 /**
  * @covers Acc_Ledger::get_name
  * @todo   Implement testGet_name().
  */
 public function testGet_name()
 {
     $this->object->id = 3;
     $name = $this->object->get_name();
     $this->assertEquals('Achat', $name);
 }
$gDossier = dossier::id();
require_once NOALYSS_INCLUDE . '/class_pdf.php';
require_once NOALYSS_INCLUDE . '/class_user.php';
require_once NOALYSS_INCLUDE . '/ac_common.php';
require_once NOALYSS_INCLUDE . '/class_database.php';
require_once NOALYSS_INCLUDE . '/class_impress.php';
require_once NOALYSS_INCLUDE . '/class_acc_ledger.php';
require_once NOALYSS_INCLUDE . '/class_own.php';
require_once NOALYSS_INCLUDE . '/class_periode.php';
require_once NOALYSS_INCLUDE . '/class_print_ledger.php';
$cn = new Database($gDossier);
$periode = new Periode($cn);
$l_type = "JRN";
$own = new Own($cn);
$Jrn = new Acc_Ledger($cn, $_GET['jrn_id']);
$Jrn->get_name();
$g_user->Check();
$g_user->check_dossier($gDossier);
// Security
if ($_GET['jrn_id'] != 0 && $g_user->check_jrn($_GET['jrn_id']) == 'X') {
    /* Cannot Access */
    NoAccess();
}
$ret = "";
$jrn_type = $Jrn->get_type();
$pdf = Print_Ledger::factory($cn, $_REQUEST['p_simple'], "PDF", $Jrn);
$pdf->setDossierInfo($Jrn->name);
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetAuthor('NOALYSS');
$pdf->setTitle(_("Journal"), true);
        }
        $ledger->verify_ledger($_POST);
        $ledger->update($_POST);
        $show_menu = 1;
    } catch (Exception $e) {
        alert($e->getMessage());
    }
}
//////////////////////////////////////////////////////////////////////////
// Perform request action : delete
//////////////////////////////////////////////////////////////////////////
if ($action_frm == 'delete') {
    $ledger->jrn_def_id = $_POST['p_jrn'];
    $ledger->id = $_POST['p_jrn'];
    $ledger->load();
    $name = $ledger->get_name();
    try {
        $ledger->delete_ledger();
        $sa = "";
        echo '<div id="jrn_name_div">';
        echo '<h2 id="jrn_name">' . h($name) . "  est effacé" . "</h2>";
        echo '</div>';
        $show_menu = 1;
    } catch (Exception $e) {
        alert($e->getMessage());
    }
}
//////////////////////////////////////////////////////////////////////////
// Perform request action : add
//////////////////////////////////////////////////////////////////////////
if (isset($_POST['add'])) {