X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FForm.pm;h=15d66cec9b785564916aa7304ecc661f51a55f88;hb=388a2ff5471adc27084f77e60fe154f25790dc9e;hp=b21f94c71c8c16209e52a43fa868bab796d19d65;hpb=cb3a2467f28049de15810f7ddf1b04632639e530;p=kivitendo-erp.git
diff --git a/SL/Form.pm b/SL/Form.pm
index b21f94c71..15d66cec9 100644
--- a/SL/Form.pm
+++ b/SL/Form.pm
@@ -464,11 +464,11 @@ sub hide_form {
my $self = shift;
if (@_) {
- map({ print($main::cgi->hidden("-name" => $_, "-default" => $self->{$_}) . "\n"); } @_);
+ map({ print($::request->{cgi}->hidden("-name" => $_, "-default" => $self->{$_}) . "\n"); } @_);
} else {
for (sort keys %$self) {
next if (($_ eq "header") || (ref($self->{$_}) ne ""));
- print($main::cgi->hidden("-name" => $_, "-default" => $self->{$_}) . "\n");
+ print($::request->{cgi}->hidden("-name" => $_, "-default" => $self->{$_}) . "\n");
}
}
$main::lxdebug->leave_sub();
@@ -624,8 +624,7 @@ sub create_http_response {
my $self = shift;
my %params = @_;
- my $cgi = $main::cgi;
- $cgi ||= CGI->new('');
+ my $cgi = $::request->{cgi};
my $session_cookie;
if (defined $main::auth) {
@@ -675,7 +674,7 @@ sub header {
# extra code is currently only used by menuv3 and menuv4 to set their css.
# it is strongly deprecated, and will be changed in a future version.
- my ($self, $extra_code) = @_;
+ my ($self, %params) = @_;
my $db_charset = $::lx_office_conf{system}->{dbcharset} || Common::DEFAULT_CHARSET;
my @header;
@@ -697,13 +696,13 @@ sub header {
push @header, "" if -f $self->{favicon};
push @header, '',
'',
- '',
+ '',
'',
'',
'',
'',
'',
- '';
+ '';
push @header, $self->{javascript} if $self->{javascript};
push @header, map { $_->show_javascript } @{ $self->{AJAX} || [] };
push @header, "" if $self->{fokus};
@@ -723,10 +722,15 @@ sub header {
|;
}
+ my %doctypes = (
+ strict => qq||,
+ transitional => qq||,
+ frameset => qq||,
+ );
+
# output
print $self->create_http_response(content_type => 'text/html', charset => $db_charset);
- print "\n"
- if $ENV{'HTTP_USER_AGENT'} =~ m/MSIE\s+\d/; # Other browsers may choke on menu scripts with DOCTYPE.
+ print $doctypes{$params{doctype} || 'transitional'}, $/;
print <
@@ -735,9 +739,9 @@ sub header {
EOT
print " $_\n" for @header;
print <
-
-
+
+
+
- $extra_code
+ $params{extra_code}
$title_hack
@@ -762,8 +766,7 @@ sub ajax_response_header {
my ($self) = @_;
my $db_charset = $::lx_office_conf{system}->{dbcharset} || Common::DEFAULT_CHARSET;
- my $cgi = $main::cgi || CGI->new('');
- my $output = $cgi->header('-charset' => $db_charset);
+ my $output = $::request->{cgi}->header('-charset' => $db_charset);
$main::lxdebug->leave_sub();
@@ -780,8 +783,7 @@ sub redirect_header {
die "Headers already sent" if $self->{header};
$self->{header} = 1;
- my $cgi = $main::cgi || CGI->new('');
- return $cgi->redirect($new_uri);
+ return $::request->{cgi}->redirect($new_uri);
}
sub set_standard_title {
@@ -1411,7 +1413,7 @@ sub parse_template {
for my $i (1 .. $self->{copies}) {
if ($self->{OUT}) {
open OUT, '>', $self->{OUT} or $self->error($self->cleanup . "$self->{OUT} : $!");
- print OUT while ;
+ print OUT $_ while ;
close OUT;
seek IN, 0, 0;
@@ -2339,7 +2341,7 @@ sub _get_taxcharts {
$key = $params;
}
- my $where = ' WHERE ' . join(' AND ', map { "($_)" } @where) if (@where);
+ my $where = @where ? ' WHERE ' . join(' AND ', map { "($_)" } @where) : '';
my $query = qq|SELECT * FROM tax $where ORDER BY taxkey|;
@@ -2454,7 +2456,7 @@ sub _get_customers {
my $options = ref $key eq 'HASH' ? $key : { key => $key };
$options->{key} ||= "all_customers";
- my $limit_clause = "LIMIT $options->{limit}" if $options->{limit};
+ my $limit_clause = $options->{limit} ? "LIMIT $options->{limit}" : '';
my @where;
push @where, qq|business_id IN (SELECT id FROM business WHERE salesman)| if $options->{business_is_salesman};
@@ -2757,19 +2759,11 @@ sub all_vc {
@{ $self->{all_employees} } =
sort { $a->{name} cmp $b->{name} } @{ $self->{all_employees} };
- if ($module eq 'AR') {
# prepare query for departments
- $query = qq|SELECT id, description
- FROM department
- WHERE role = 'P'
- ORDER BY description|;
-
- } else {
$query = qq|SELECT id, description
FROM department
ORDER BY description|;
- }
$self->{all_departments} = selectall_hashref_query($self, $dbh, $query);
@@ -2840,15 +2834,9 @@ sub all_departments {
my ($self, $myconfig, $table) = @_;
my $dbh = $self->get_standard_dbh($myconfig);
- my $where;
-
- if ($table eq 'customer') {
- $where = "WHERE role = 'P' ";
- }
my $query = qq|SELECT id, description
FROM department
- $where
ORDER BY description|;
$self->{all_departments} = selectall_hashref_query($self, $dbh, $query);
@@ -2968,6 +2956,9 @@ sub create_links {
$self->{$key} = $ref->{$key};
}
+ # remove any trailing whitespace
+ $self->{currency} =~ s/\s*$//;
+
my $transdate = "current_date";
if ($self->{transdate}) {
$transdate = $dbh->quote($self->{transdate});
@@ -3144,6 +3135,9 @@ sub lastname_used {
map { $self->{$_} = $ref->{$_} } values %column_map;
+ # remove any trailing whitespace
+ $self->{currency} =~ s/\s*$// if $self->{currency};
+
$main::lxdebug->leave_sub();
}
@@ -3671,8 +3665,8 @@ sub prepare_for_printing {
$extension = 'xls';
}
- my $printer_code = '_' . $self->{printer_code} if $self->{printer_code};
- my $email_extension = '_email' if -f "$self->{templates}/$self->{formname}_email${language}${printer_code}.${extension}";
+ my $printer_code = $self->{printer_code} ? '_' . $self->{printer_code} : '';
+ my $email_extension = -f "$::myconfig{templates}/$self->{formname}_email${language}.${extension}" ? '_email' : '';
$self->{IN} = "$self->{formname}${email_extension}${language}${printer_code}.${extension}";
# Format dates.