X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FForm.pm;h=a11122c493d1d85afb14a0219be488180bca279d;hb=fb4d2ffa6aae03b36e4db77be10c3d9dce4413f8;hp=1c1956241e14fc61c5c398bc2ffc09d0418adfd7;hpb=142f7c2cd402db32f71bef206a6399c62c56bdfa;p=kivitendo-erp.git diff --git a/SL/Form.pm b/SL/Form.pm index 1c1956241..a11122c49 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -508,7 +508,6 @@ sub parse_html_template { $additional_params->{"myconfig_jsc_dateformat"} = $jsc_dateformat; } - $additional_params->{"conf_jscalendar"} = $main::jscalendar; $additional_params->{"conf_lizenzen"} = $main::lizenzen; $additional_params->{"conf_latex_templates"} = $main::latex; $additional_params->{"conf_opendocument_templates"} = $main::opendocument_templates; @@ -731,7 +730,9 @@ sub parse_template { $main::lxdebug->enter_sub(); my ($self, $myconfig, $userspath) = @_; - my $template; + my ($template, $out); + + local (*IN, *OUT); $self->{"cwd"} = getcwd(); $self->{"tmpdir"} = $self->{cwd} . "/${userspath}"; @@ -774,7 +775,19 @@ sub parse_template { # OUT is used for the media, screen, printer, email # for postscript we store a copy in a temporary file my $fileid = time; - $self->{tmpfile} ||= "$userspath/${fileid}.$self->{IN}"; + my $prepend_userspath; + + if (!$self->{tmpfile}) { + $self->{tmpfile} = "${fileid}.$self->{IN}"; + $prepend_userspath = 1; + } + + $prepend_userspath = 1 if substr($self->{tmpfile}, 0, length $userspath) eq $userspath; + + $self->{tmpfile} =~ s|.*/||; + $self->{tmpfile} =~ s/[^a-zA-Z0-9\._\ \-]//g; + $self->{tmpfile} = "$userspath/$self->{tmpfile}" if $prepend_userspath; + if ($template->uses_temp_file() || $self->{media} eq 'email') { $out = $self->{OUT}; $self->{OUT} = ">$self->{tmpfile}"; @@ -841,7 +854,7 @@ sub parse_template { } - my $err = $mail->send($out); + my $err = $mail->send(); $self->error($self->cleanup . "$err") if ($err); } else { @@ -862,7 +875,9 @@ sub parse_template { open(OUT, $self->{OUT}) or $self->error($self->cleanup . "$self->{OUT} : $!"); } else { - $self->{attachment_filename} = $self->generate_attachment_filename(); + $self->{attachment_filename} = ($self->{attachment_filename}) + ? $self->{attachment_filename} + : $self->generate_attachment_filename(); # launch application print qq|Content-Type: | . $template->get_mime_type() . qq| @@ -1667,7 +1682,7 @@ sub _get_customers { $key = "all_customers" unless ($key); - my $query = qq|SELECT * FROM customer LIMIT $main::myconfig{vclimit}|; + my $query = qq|SELECT * FROM customer|; $self->{$key} = selectall_hashref_query($self, $dbh, $query); @@ -1681,7 +1696,7 @@ sub _get_vendors { $key = "all_vendors" unless ($key); - my $query = qq|SELECT * FROM vendor|; # LIMIT $main::myconfig{vclimit}|; + my $query = qq|SELECT * FROM vendor|; $self->{$key} = selectall_hashref_query($self, $dbh, $query);