X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FTemplate%2FOpenDocument.pm;h=b4ea1f2a5d24d2f4a64da6c224766354a8c9f562;hb=3b4068e20d8f7b044b9f85eccacac99ba3d453b3;hp=552bc2f421a4a5848869f189d00ac90fd3d1be42;hpb=e055700faea1906bea6c03184ba4516b57cac887;p=kivitendo-erp.git diff --git a/SL/Template/OpenDocument.pm b/SL/Template/OpenDocument.pm index 552bc2f42..b4ea1f2a5 100644 --- a/SL/Template/OpenDocument.pm +++ b/SL/Template/OpenDocument.pm @@ -37,7 +37,7 @@ sub parse_foreach { my $ary = $self->_get_loop_variable($var, 1, @indices); - for (my $i = 0; $i < scalar(@{$ary}); $i++) { + for (my $i = 0; $i < scalar(@{$ary || []}); $i++) { $form->{"__first__"} = $i == 0; $form->{"__last__"} = ($i + 1) == scalar(@{$ary}); $form->{"__odd__"} = (($i + 1) % 2) == 1; @@ -270,14 +270,14 @@ sub parse { $zip->contents("content.xml", Encode::encode('utf-8-strict', $new_contents)); - my $styles = $zip->contents("styles.xml"); + my $styles = Encode::decode('utf-8-strict', $zip->contents("styles.xml")); if ($contents) { my $new_styles = $self->parse_block($styles); if (!defined($new_contents)) { $main::lxdebug->leave_sub(); return 0; } - $zip->contents("styles.xml", $new_styles); + $zip->contents("styles.xml", Encode::encode('utf-8-strict', $new_styles)); } $zip->writeToFileNamed($form->{"tmpfile"}, 1); @@ -389,7 +389,7 @@ sub spawn_xvfb { local *OUT; my $dfname = $self->{"userspath"} . "/xvfb_display"; - if (!open(OUT, ">$dfname")) { + if (!open(OUT, ">", $dfname)) { $self->{"error"} = "Conversion to PDF failed because OpenOffice could not be started ($dfname: $!)"; unlink($xauthority); kill($pid);