Druckerverwaltung auf Admin-Controller umgestellt
[kivitendo-erp.git] / SL / Template / OpenDocument.pm
index e0523d3..4eed5ea 100644 (file)
@@ -260,7 +260,14 @@ sub parse {
   $contents =~ s|</office:automatic-styles>|${new_styles}</office:automatic-styles>|;
   $contents =~ s|[\n\r]||gm;
 
-  my $new_contents = $self->parse_block($contents);
+  my $new_contents;
+  if ($self->{use_template_toolkit}) {
+    my $additional_params = $::form;
+
+    $::form->init_template->process(\$contents, $additional_params, \$new_contents) || die $::form->template->error;
+  } else {
+    $new_contents = $self->parse_block($contents);
+  }
   if (!defined($new_contents)) {
     $main::lxdebug->leave_sub();
     return 0;
@@ -457,10 +464,19 @@ sub spawn_openoffice {
       last;
     }
 
+    if ($::dispatcher->interface_type eq 'FastCGI') {
+      $::dispatcher->{request}->Detach;
+    }
+
     if (!$spawned_oo) {
       my $pid = fork();
       if (0 == $pid) {
         $main::lxdebug->message(LXDebug->DEBUG2(), "  Child daemonizing\n");
+
+        if ($::dispatcher->interface_type eq 'FastCGI') {
+          $::dispatcher->{request}->Finish;
+          $::dispatcher->{request}->LastCall;
+        }
         chdir('/');
         open(STDIN, '/dev/null');
         open(STDOUT, '>/dev/null');
@@ -474,6 +490,11 @@ sub spawn_openoffice {
                        "-accept=socket,host=localhost,port=" .
                        $::lx_office_conf{print_templates}->{openofficeorg_daemon_port} . ";urp;");
         exec(@cmdline);
+      } else {
+        # parent
+        if ($::dispatcher->interface_type eq 'FastCGI') {
+          $::dispatcher->{request}->Attach;
+        }
       }
 
       $main::lxdebug->message(LXDebug->DEBUG2(), "  Parent after fork\n");