Item Tax Types: fixed inactive item tax types display switching.
[fa-stable.git] / reporting / includes / pdf_report.inc
index e64b7f5a5a13a4688bfa28c4dc0c8adf1e2dba8d..c8bd32550b1204d028fdf0305cf1ff34b2af6c35 100644 (file)
@@ -20,6 +20,7 @@
 */
 include_once(dirname(__FILE__)."/class.pdf.inc");
 include_once(dirname(__FILE__)."/printer_class.inc");
+include_once($path_to_root . "/reporting/includes/reporting.inc");
 include_once($path_to_root . "/admin/db/company_db.inc");
 include_once($path_to_root . "/admin/db/fiscalyears_db.inc");
 include_once($path_to_root . "/admin/db/printers_db.inc");
@@ -425,11 +426,13 @@ class FrontReport extends Cpdf
        {
                global $dflt_lang; // FIXME should be passed as params
 
+               $this->SetLang(@$this->formData['rep_lang'] ? $this->formData['rep_lang'] : $dflt_lang);
                $doctype = $this->formData['doctype'];
                $header2type = true;
 
+               $lang = user_language();
                $this->SetLang(@$this->formData['rep_lang'] ? $this->formData['rep_lang']
-                       : ($_SESSION["wa_current_user"]->prefs->language ? $_SESSION["wa_current_user"]->prefs->language : $dflt_lang));
+                       : ( $lang ? $lang : $dflt_lang));
 
                 // leave layout files names without path to enable including
                 // modified versions from company/x/reporting directory
@@ -951,7 +954,7 @@ class FrontReport extends Cpdf
                if ($SysPrefs->pdf_debug == 1)
                {
                        $pdfcode = $this->Output('','S');
-                       $pdfcode = str_replace("\n", "\n<br>", htmlspecialchars($pdfcode));
+                       $pdfcode = str_replace("\n", "\n<br>", html_specials_encode($pdfcode));
                        echo '<html><body>';
                        echo trim($pdfcode);
                        echo '</body></html>';