Exemplo n.º 1
0
    $outputlangs = $langs;
    if (!empty($_REQUEST['lang_id'])) {
        $outputlangs = new Translate("", $conf);
        $outputlangs->setDefaultLang($_REQUEST['lang_id']);
    }
    $result = expensereport_pdf_create($db, $depl, '', $depl->modelpdf, $outputlangs);
    if ($result <= 0) {
        setEventMessages($object->error, $object->errors, 'errors');
        $action = '';
    }
} else {
    if ($action == 'remove_file') {
        $object = new ExpenseReport($db, 0, $_GET['id']);
        if ($object->fetch($id)) {
            require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
            $object->fetch_thirdparty();
            $langs->load("other");
            $upload_dir = $conf->expensereport->dir_output;
            $file = $upload_dir . '/' . GETPOST('file');
            $ret = dol_delete_file($file, 0, 0, 0, $object);
            if ($ret) {
                setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
            } else {
                setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
            }
            $action = '';
        }
    }
}
/*
 * View