예제 #1
0
$langs->load("donations");
$langs->load("accountancy");
$langs->load('other');
if (!$user->admin) {
    accessforbidden();
}
$typeconst = array('yesno', 'texte', 'chaine');
$action = GETPOST('action', 'alpha');
$type = 'donation';
/*
 * Action
 */
if ($action == 'specimen') {
    $modele = GETPOST('module', 'alpha');
    $don = new Don($db);
    $don->initAsSpecimen();
    // Search template files
    $dir = DOL_DOCUMENT_ROOT . "/core/modules/dons/";
    $file = $modele . ".modules.php";
    if (file_exists($dir . $file)) {
        $classname = $modele;
        require_once $dir . $file;
        $obj = new $classname($db);
        if ($obj->write_file($don, $langs) > 0) {
            header("Location: " . DOL_URL_ROOT . "/document.php?modulepart=donation&file=SPECIMEN.html");
            return;
        } else {
            setEventMessage($obj->error, 'errors');
            dol_syslog($obj->error, LOG_ERR);
        }
    } else {