Fix: [ bug #1367 ] "Show invoice" link after a POS sell throws an error
This commit is contained in:
parent
bcfc9f8aa1
commit
bafc53ad95
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user