Merge branch 'master' of vc.linet-services.de:public/lx-office-erp
[kivitendo-erp.git] / SL / AM.pm
index ba15e7f..b2730ce 100644 (file)
--- a/SL/AM.pm
+++ b/SL/AM.pm
@@ -965,7 +965,9 @@ sub prepare_template_filename {
     }
 
     $filename .= "." . ($form->{format} eq "html" ? "html" : "tex");
-    $filename =~ s|.*/||;
+    if ($form->{"formname"} =~ m|\.\.| || $form->{"formname"} =~ m|^/|) {
+      $filename =~ s|.*/||;
+    }
     $display_filename = $filename;
     $filename = "$myconfig->{templates}/$filename";
   }
@@ -1333,6 +1335,7 @@ sub retrieve_units {
   $main::lxdebug->enter_sub();
 
   my ($self, $myconfig, $form, $prefix) = @_;
+  $prefix ||= '';
 
   my $dbh = $form->get_standard_dbh;
 
@@ -1386,13 +1389,13 @@ sub retrieve_all_units {
 
   my $self = shift;
 
-  if (!$main::all_units) {
-    $main::all_units = $self->retrieve_units(\%main::myconfig, $main::form);
+  if (!$::request->{cache}{all_units}) {
+    $::request->{cache}{all_units} = $self->retrieve_units(\%main::myconfig, $main::form);
   }
 
   $main::lxdebug->leave_sub();
 
-  return $main::all_units;
+  return $::request->{cache}{all_units};
 }