Fixed custom reports includes issue.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 17 Sep 2010 12:10:41 +0000 (12:10 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 17 Sep 2010 12:10:41 +0000 (12:10 +0000)
includes/main.inc
reporting/prn_redirect.php

index fd4aa97759f8f26fd6e4c06cebccd6562034c38c..55a97b2bc80d0c01dbbd8a00f23886e0bf273919 100644 (file)
@@ -312,10 +312,10 @@ function find_custom_file($rep)
 
        // customized per company version
        $path = company_path();
-       $file = $path.'/'.$rep;
+       $file = $path.$rep;
        if (file_exists($file)) {
                // add local include path
-               set_include_path($path.PATH_SEPARATOR.get_include_path());
+               set_include_path(dirname($file).PATH_SEPARATOR.get_include_path());
                return $file;
        }
        // file added by active extension modules
@@ -340,5 +340,4 @@ function find_custom_file($rep)
        return null;
 }
 
-
 ?>
\ No newline at end of file
index a9f4d336f45092d330976b771a7a938b58896d83..ce525ea1ff788253acabaf994fdb5f8a644013f1 100644 (file)
@@ -58,8 +58,7 @@ $rep = $_POST['REP_ID'];
 $rep_file = find_custom_file("/reporting/rep$rep.php");
 
 if ($rep_file) {
-       chdir(dirname($rep_file));
-       require(basename($rep_file));
+       require($rep_file);
 } else
        display_error("Cannot find report file '$rep'");
 exit();