[0004756] Amounts in words on documents were printed in user language instead of...
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Sat, 26 Sep 2020 21:13:47 +0000 (23:13 +0200)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sat, 26 Sep 2020 21:18:18 +0000 (23:18 +0200)
includes/hooks.inc
reporting/includes/class.pdf.inc

index 393fc8720a96a1d45116931554b76576c25304c4..609eac31203b49b4a2efdac51f2aaf54d1161232 100644 (file)
@@ -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);
index 4f34ab7d2c99c1432f387c116119f2944b47b63f..fb4cbf62d8f3425611e6718669e776da4e74522e 100644 (file)
@@ -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']));