Merge pull request #6288 from marcosgdf/fr-6280
NEW #6280: Generate PDF after creating an invoice from a customer order
This commit is contained in:
commit
ea97491a8f
@ -1291,6 +1291,25 @@ if (empty($reshook))
|
|||||||
if ($id > 0 && ! $error)
|
if ($id > 0 && ! $error)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
|
|
||||||
|
// Define output language
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE) && count($object->lines))
|
||||||
|
{
|
||||||
|
$outputlangs = $langs;
|
||||||
|
$newlang = '';
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $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);
|
||||||
|
}
|
||||||
|
$model=$object->modelpdf;
|
||||||
|
$ret = $object->fetch($id); // Reload to get new records
|
||||||
|
|
||||||
|
$result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id);
|
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user