Example #1
0
    }
    else
    {
        $_GET["id"]=$_POST["id"];
        $_GET['action']='edit';
    }
}

// Build doc
if (GETPOST('action') == 'builddoc' && $user->rights->projet->creer)
{
    $project = new Project($db);
    $project->fetch($_GET['id']);
    if (GETPOST('model'))
    {
        $project->setDocModel($user, GETPOST('model'));
    }

    $outputlangs = $langs;
    if (GETPOST('lang_id'))
    {
        $outputlangs = new Translate("",$conf);
        $outputlangs->setDefaultLang(GETPOST('lang_id'));
    }
    $result=project_pdf_create($db, $project, $project->modelpdf, $outputlangs);
    if ($result <= 0)
    {
        dol_print_error($db,$result);
        exit;
    }
    else