From 322d0955f20e6cbf7ed93e40649458ae8e197c2a Mon Sep 17 00:00:00 2001 From: Guido Schratzer Date: Sat, 24 Sep 2022 17:58:58 +0300 Subject: [PATCH 1/3] FIX: Issue #16476 on massaction the pdf generation is not using the thirdparty language settings --- htdocs/core/actions_massactions.inc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index ddee2ad5fb4..c673111d0d7 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1388,6 +1388,7 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) { foreach ($toselect as $toselectid) { $result = $objecttmp->fetch($toselectid); if ($result > 0) { + $objecttmp->fetch_thirdparty(); //load lang from thirdparty $outputlangs = $langs; $newlang = ''; From 3517cdf1b419c33d4aa19545ff1737dea39c4b0b Mon Sep 17 00:00:00 2001 From: Guido Schratzer Date: Sat, 24 Sep 2022 20:19:17 +0300 Subject: [PATCH 2/3] FIX: #16476 version 2 --- htdocs/core/actions_massactions.inc.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index c673111d0d7..0cef6588839 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1388,7 +1388,6 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) { foreach ($toselect as $toselectid) { $result = $objecttmp->fetch($toselectid); if ($result > 0) { - $objecttmp->fetch_thirdparty(); //load lang from thirdparty $outputlangs = $langs; $newlang = ''; @@ -1401,6 +1400,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); From 95766c478795ebbd92f8989cb296570cc2894303 Mon Sep 17 00:00:00 2001 From: Guido Schratzer Date: Sat, 24 Sep 2022 20:29:06 +0300 Subject: [PATCH 3/3] FIX: Dolibarr#16476 version 2a --- htdocs/core/actions_massactions.inc.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 0cef6588839..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'); } @@ -1401,9 +1399,9 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) { $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, ... - } + $objecttmp->fetch_thirdparty(); + $newlang = $objecttmp->thirdparty->default_lang; // for proposal, order, invoice, ... + } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang);