X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FTemplate%2FOpenDocument.pm;h=a90a9aeea89ff164f263ea038c693a9e360f0664;hb=73a58f3dceeb378343ceb151942828eea686b75a;hp=e0523d3463a363f3297f1d86380e8d76a88a374d;hpb=c09eb68d9142eab98d2815fa73435bdf1c45aedc;p=kivitendo-erp.git diff --git a/SL/Template/OpenDocument.pm b/SL/Template/OpenDocument.pm index e0523d346..a90a9aeea 100644 --- a/SL/Template/OpenDocument.pm +++ b/SL/Template/OpenDocument.pm @@ -22,7 +22,6 @@ sub new { my $self = $type->SUPER::new(@_); $self->{"rnd"} = int(rand(1000000)); - $self->{"iconv"} = SL::Iconv->new($::lx_office_conf{system}->{dbcharset}, "UTF-8"); $self->set_tag_style('<%', '%>'); $self->{quot_re} = '"'; @@ -260,7 +259,14 @@ sub parse { $contents =~ s||${new_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 +463,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 +489,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"); @@ -554,7 +574,6 @@ sub convert_to_pdf { sub format_string { my ($self, $variable) = @_; my $form = $self->{"form"}; - my $iconv = $self->{"iconv"}; $variable = $main::locale->quote_special_chars('Template/OpenDocument', $variable); @@ -570,7 +589,7 @@ sub format_string { $variable =~ s|\</${key}\>||gi; } - return $iconv->convert($variable); + return $variable; } sub get_mime_type() {