X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FForm.pm;h=d155a0d7f13d9c775b8f54e8b1137ef40bc8bd54;hb=5df2b57a097f66f6cecba0aa577c7aaba3422ab6;hp=59e01de07e2c8c0149498486e9047c5f13d9b53d;hpb=56ed64675501781efea751581d146d5bc49fad6a;p=kivitendo-erp.git diff --git a/SL/Form.pm b/SL/Form.pm index 59e01de07..d155a0d7f 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -41,6 +41,7 @@ use Data::Dumper; use CGI; use CGI::Ajax; use Cwd; +use IO::File; use SL::Auth; use SL::Auth::DB; use SL::Auth::LDAP; @@ -470,7 +471,7 @@ sub isblank { my ($self, $name, $msg) = @_; my $curr = $self; - foreach my $part (split /\./, $name) { + foreach my $part (split m/\./, $name) { if (!$curr->{$part} || ($curr->{$part} =~ /^\s*$/)) { $self->error($msg); } @@ -729,13 +730,26 @@ sub parse_html_template { map { $additional_params->{$_} ||= $self->{$_} } keys %{ $self }; + my $in = IO::File->new($file, 'r'); + + if (!$in) { + print STDERR "Error opening template file: $!"; + $main::lxdebug->leave_sub(); + return ''; + } + + my $input = join('', <$in>); + $in->close(); + + if ($main::locale) { + $input = $main::locale->{iconv}->convert($input); + } + my $output; - if (!$template->process($file, $additional_params, \$output)) { + if (!$template->process(\$input, $additional_params, \$output)) { print STDERR $template->error(); } - $output = $main::locale->{iconv}->convert($output) if ($main::locale); - $main::lxdebug->leave_sub(); return $output; @@ -919,16 +933,19 @@ sub format_amount_units { my $self = shift; my %params = @_; - Common::check_params(\%params, qw(amount part_unit)); - my $myconfig = \%main::myconfig; - my $amount = $params{amount}; + my $amount = $params{amount} * 1; my $places = $params{places}; my $part_unit_name = $params{part_unit}; my $amount_unit_name = $params{amount_unit}; my $conv_units = $params{conv_units}; my $max_places = $params{max_places}; + if (!$part_unit_name) { + $main::lxdebug->leave_sub(); + return ''; + } + AM->retrieve_all_units(); my $all_units = $main::all_units;