$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;
$main::lxdebug->enter_sub();
my ($self, $myconfig, $userspath) = @_;
- my $template;
+ my ($template, $out);
+
+ local (*IN, *OUT);
$self->{"cwd"} = getcwd();
$self->{"tmpdir"} = $self->{cwd} . "/${userspath}";
# 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}";
}
- my $err = $mail->send($out);
+ my $err = $mail->send();
$self->error($self->cleanup . "$err") if ($err);
} else {
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|
$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);
$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);