Skip to content
Snippets Groups Projects
Commit bafc53ad authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: [ bug #1367 ] "Show invoice" link after a POS sell throws an error

parent bcfc9f8a
No related branches found
No related tags found
No related merge requests found
...@@ -1855,21 +1855,25 @@ else if ($action == 'builddoc') // En get ou en post ...@@ -1855,21 +1855,25 @@ else if ($action == 'builddoc') // En get ou en post
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
if (GETPOST('fk_bank')) $object->fk_bank=GETPOST('fk_bank'); if (GETPOST('fk_bank')) $object->fk_bank=GETPOST('fk_bank');
// Define output language // object->modelpdf can be empty when we are using odt template by default and builddoc is called by POS module (invoice was just created and no template ODT template was selected).
$outputlangs = $langs; if (! empty($object->modelpdf))
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang))
{ {
$outputlangs = new Translate("",$conf); // Define output language
$outputlangs->setDefaultLang($newlang); $outputlangs = $langs;
} $newlang='';
$result=facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
if ($result <= 0) if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
{ if (! empty($newlang))
dol_print_error($db,$result); {
exit; $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$result=facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0)
{
dol_print_error($db,$result);
exit;
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment