diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index ddee2ad5fb4..49c825de1a3 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1382,7 +1382,6 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == ' // @todo : propose model selection if (!$error && $massaction == 'generate_doc' && $permissiontoread) { $db->begin(); - $objecttmp = new $objectclass($db); $nbok = 0; foreach ($toselect as $toselectid) { @@ -1390,7 +1389,6 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) { if ($result > 0) { $outputlangs = $langs; $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { $newlang = GETPOST('lang_id', 'aZ09'); } @@ -1400,6 +1398,10 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) { if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($objecttmp->default_lang)) { $newlang = $objecttmp->default_lang; // for thirdparty } + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && empty($objecttmp->thirdparty)) { //load lang from thirdparty + $objecttmp->fetch_thirdparty(); + $newlang = $objecttmp->thirdparty->default_lang; // for proposal, order, invoice, ... + } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang);