';
-
+ print '
'; // ancre
// Documents
$comref = dol_sanitizeFileName($object->ref);
$file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf';
diff --git a/htdocs/core/actions_builddoc.inc.php b/htdocs/core/actions_builddoc.inc.php
index 5984283b996..dc91cbd0404 100644
--- a/htdocs/core/actions_builddoc.inc.php
+++ b/htdocs/core/actions_builddoc.inc.php
@@ -91,6 +91,9 @@ if ($action == 'builddoc' && $permissioncreate)
else
{
setEventMessages($langs->trans("FileGenerated"), null);
+
+ header('Location: '.$_SERVER['REQUEST_URI'].'#builddoc');
+ die;
}
}
}
diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php
index 4ed3ecb7cef..39075022422 100644
--- a/htdocs/fichinter/card.php
+++ b/htdocs/fichinter/card.php
@@ -438,49 +438,6 @@ if (empty($reshook))
}
}
- /*
- * Build doc
- */
- else if ($action == 'builddoc' && $user->rights->ficheinter->creer) // En get ou en post
- {
- $object->fetch_lines();
-
- // Save last template used to generate document
- if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
-
- // Define output language
- $outputlangs = $langs;
- $newlang='';
- if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
- if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
- if (! empty($newlang))
- {
- $outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($newlang);
- }
- $result=fichinter_create($db, $object, GETPOST('model','alpha'), $outputlangs);
- if ($result <= 0)
- {
- dol_print_error($db,$result);
- exit;
- }
- }
-
- // Remove file in doc form
- else if ($action == 'remove_file')
- {
- require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
-
- $object->fetch_thirdparty();
-
- $langs->load("other");
- $upload_dir = $conf->ficheinter->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');
- }
-
// Set into a project
else if ($action == 'classin' && $user->rights->ficheinter->creer)
{
@@ -797,6 +754,11 @@ if (empty($reshook))
if ($error) $action = 'edit_extras';
}
+ // Actions to build doc
+ $upload_dir = $conf->ficheinter->dir_output;
+ $upload_dir = $conf->ficheinter->dir_output;
+ include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
+
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->ficheinter->creer)
{
if ($action == 'addcontact')