From: Janusz Dobrowolski Date: Sat, 26 Sep 2020 21:13:47 +0000 (+0200) Subject: [0004756] Amounts in words on documents were printed in user language instead of... X-Git-Url: https://delta.frontaccounting.com/gitweb/?p=fa-stable.git;a=commitdiff_plain;h=d8582e452b443b4cb363c3d02d2b45a65de5a3b5 [0004756] Amounts in words on documents were printed in user language instead of document contact language. Fixed. --- diff --git a/includes/hooks.inc b/includes/hooks.inc index 393fc872..609eac31 100644 --- a/includes/hooks.inc +++ b/includes/hooks.inc @@ -218,18 +218,20 @@ class hooks { /* Installs hooks provided by extension modules */ -function install_hooks() +function install_hooks($lang_code=null) { global $path_to_root, $Hooks, $installed_extensions; $Hooks = array(); - // include current language related $Hooks object if locale file exists - $lang_code = clean_file_name($_SESSION['language']->code); + if (!$lang_code) + $lang_code = $_SESSION['language']->code; + $lang_code = clean_file_name($lang_code); + if (file_exists($path_to_root . "/lang/" . $lang_code . "/locale.inc")) { include_once($path_to_root . "/lang/" . $lang_code . "/locale.inc"); - $code = $_SESSION['language']->code; + $code = $lang_code; $hook_class = 'hooks_'.$code; $Hooks[$code] = new $hook_class; unset($code, $hook_class); diff --git a/reporting/includes/class.pdf.inc b/reporting/includes/class.pdf.inc index 4f34ab7d..fb4cbf62 100644 --- a/reporting/includes/class.pdf.inc +++ b/reporting/includes/class.pdf.inc @@ -83,6 +83,8 @@ class Cpdf extends FPDI { if (!$code) $code = $dflt_lang; + else + install_hooks($code); $lang = array_search_value($code, $installed_languages, 'code'); $GetText->set_language($lang['code'], strtoupper($lang['encoding']));