From: Jan Büren Date: Tue, 10 Mar 2015 17:03:38 +0000 (+0100) Subject: Merge branch 'master' of github.com:kivitendo/kivitendo-erp X-Git-Tag: release-3.2.1~37 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=fea73b796d2289979be90dfc808346ec10a008f6;hp=3ca78c165eb22113110ab1f1cc716ac7e18cdbdc;p=kivitendo-erp.git Merge branch 'master' of github.com:kivitendo/kivitendo-erp --- diff --git a/SL/BackgroundJob/CreatePeriodicInvoices.pm b/SL/BackgroundJob/CreatePeriodicInvoices.pm index bdf536346..9f116becb 100644 --- a/SL/BackgroundJob/CreatePeriodicInvoices.pm +++ b/SL/BackgroundJob/CreatePeriodicInvoices.pm @@ -316,6 +316,14 @@ sub _print_invoice { $form->{OUT} = $config->printer->printer_command; $form->{OUT_MODE} = '|-'; + $form->{TEMPLATE_DRIVER_OPTIONS} = { + variable_content_types => { + longdescription => 'html', + partnotes => 'html', + notes => 'html', + }, + }; + $form->prepare_for_printing; $form->throw_on_error(sub { diff --git a/SL/Helper/CreatePDF.pm b/SL/Helper/CreatePDF.pm index dda4b0df3..1460ecffd 100644 --- a/SL/Helper/CreatePDF.pm +++ b/SL/Helper/CreatePDF.pm @@ -6,6 +6,7 @@ use Carp; use Cwd; use English qw(-no_match_vars); use File::Slurp (); +use File::Spec (); use File::Temp (); use List::MoreUtils qw(uniq); use List::Util qw(first); @@ -28,7 +29,7 @@ our %EXPORT_TAGS = ( sub create_pdf { my ($class, %params) = @_; - return $class->create_parsed_file( + return __PACKAGE__->create_parsed_file( format => 'pdf', template_type => 'LaTeX', %params, @@ -47,12 +48,13 @@ sub create_parsed_file { $form->{templates} = $::instance_conf->get_templates; $form->{IN} = $params{template}; $form->{tmpdir} = $form->{cwd} . '/' . $userspath; + my $tmpdir = $form->{tmpdir}; my ($suffix) = $params{template} =~ m{\.(.+)}; my ($temp_fh, $tmpfile) = File::Temp::tempfile( 'kivitendo-printXXXXXX', SUFFIX => ".${suffix}", - DIR => $userspath, + DIR => $form->{tmpdir}, UNLINK => ($::lx_office_conf{debug} && $::lx_office_conf{debug}->{keep_temp_files})? 0 : 1, ); @@ -63,7 +65,7 @@ sub create_parsed_file { source => $form->{IN}, form => $form, myconfig => \%::myconfig, - userspath => $userspath, + userspath => $tmpdir, ); my $result = $parser->parse($temp_fh); @@ -76,16 +78,22 @@ sub create_parsed_file { die $parser->get_error; } + # SL::Template:** modify $form->{tmpfile} by removing its + # $form->{userspath} prefix. They also store the final file's actual + # file name in $form->{tmpfile} – but it is now relative to + # $form->{userspath}. Other modules return the full file name… + my ($volume, $directory, $file_name) = File::Spec->splitpath($form->{tmpfile}); + my $full_file_name = File::Spec->catfile($tmpdir, $file_name); if (($params{return} || 'content') eq 'file_name') { - my $new_name = $userspath . '/keep-' . $tmpfile; - rename $tmpfile, $new_name; + my $new_name = File::Spec->catfile($tmpdir, 'keep-' . $form->{tmpfile}); + rename $full_file_name, $new_name; $form->cleanup; return $new_name; } - my $content = File::Slurp::read_file($tmpfile); + my $content = File::Slurp::read_file($full_file_name); $form->cleanup;