unset($object->societe); } } } // Build doc if ($action == 'builddoc' && $user->rights->projet->creer) { // Save last template used to generate document if (GETPOST('model')) { $object->setDocModel($user, GETPOST('model', 'alpha')); } $outputlangs = $langs; if (GETPOST('lang_id')) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang(GETPOST('lang_id')); } $result = project_pdf_create($db, $object, $object->modelpdf, $outputlangs); if ($result <= 0) { dol_print_error($db, $result); exit; } } // Delete file in doc form if ($action == 'remove_file' && $user->rights->projet->creer) { require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; if ($object->id > 0) { $langs->load("other"); $upload_dir = $conf->projet->dir_output . "/"; $file = $upload_dir . '/' . GETPOST('file'); $ret = dol_delete_file($file); if ($ret) { setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
/** * testProjectBuild * * @return int */ public function testProjectBuild() { global $conf,$user,$langs,$db; $conf=$this->savconf; $user=$this->savuser; $langs=$this->savlangs; $db=$this->savdb; $conf->project->dir_output.='/temp'; $localobject=new Project($this->savdb); $localobject->initAsSpecimen(); // Soleil $localobject->modelpdf='baleine'; $result=project_pdf_create($db, $localobject, $localobject->modelpdf, $langs); $this->assertLessThan($result, 0); print __METHOD__." result=".$result."\n"; return 0; }