$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_webdav"} = $main::webdav;
+ $additional_params->{"conf_lizenzen"} = $main::lizenzen;
+ $additional_params->{"conf_latex_templates"} = $main::latex;
$additional_params->{"conf_opendocument_templates"} = $main::opendocument_templates;
my @additional_param_names = keys(%{$additional_params});
$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_shipto" unless ($key);
# get shipping addresses
- my $query =
- qq|SELECT shipto_id, shiptoname, shiptodepartment_1 | .
- qq|FROM shipto | .
- qq|WHERE trans_id = ?|;
+ my $query = qq|SELECT * FROM shipto WHERE trans_id = ?|;
$self->{$key} = selectall_hashref_query($self, $dbh, $query, $vc_id);
$main::lxdebug->leave_sub();
}
+sub _get_departments {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $dbh, $key) = @_;
+
+ $key = "all_departments" unless ($key);
+
+ my $query = qq|SELECT * FROM department|;
+
+ $self->{$key} = selectall_hashref_query($self, $dbh, $query);
+
+ $main::lxdebug->leave_sub();
+}
+
sub get_lists {
$main::lxdebug->enter_sub();
$self->_get_payments($dbh, $params{"payments"});
}
+ if($params{"departments"}) {
+ $self->_get_departments($dbh, $params{"departments"});
+ }
+
$dbh->disconnect();
$main::lxdebug->leave_sub();
sub get_history {
$main::lxdebug->enter_sub();
- my $self = shift();
- my $dbh = shift();
- my $trans_id = shift();
- my $restriction = shift();
+ my ($self, $dbh, $trans_id, $restriction, $order) = @_;
+ my ($orderBy, $desc) = split(/\-\-/, $order);
+ $order = " ORDER BY " . ($order eq "" ? " h.itime " : ($desc == 1 ? $orderBy . " DESC " : $orderBy . " "));
my @tempArray;
my $i = 0;
if ($trans_id ne "") {
qq|SELECT h.employee_id, h.itime::timestamp(0) AS itime, h.addition, h.what_done, emp.name, h.snumbers, h.trans_id AS id | .
qq|FROM history_erp h | .
qq|LEFT JOIN employee emp ON (emp.id = h.employee_id) | .
- qq|WHERE trans_id = ? |
- . $restriction;
-
+ qq|WHERE trans_id = | . $trans_id
+ . $restriction . qq| |
+ . $order;
+
my $sth = $dbh->prepare($query) || $self->dberror($query);
- $sth->execute($trans_id) || $self->dberror("$query ($trans_id)");
+ $sth->execute() || $self->dberror("$query");
while(my $hash_ref = $sth->fetchrow_hashref()) {
$hash_ref->{addition} = $main::locale->text($hash_ref->{addition});