Merge pull request #22392 from AT-backbone/15.0

FIX: #16476 on massaction the pdf generation is not using the t…
This commit is contained in:
Laurent Destailleur 2022-09-25 14:32:43 +02:00 committed by GitHub
commit e2a1de5bd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);