X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FForm.pm;h=196d828cd9bf7ec031a1595998173b65ce593f15;hb=ee3ab257a5a8f5d4d20ffcf5f3b8259b822037f2;hp=5a9272465e7fc3d41e1b36f3f953ba2476aa8a41;hpb=7e6d7935ef67bfb97d4aa8b6fb44b26e9a3d3e04;p=kivitendo-erp.git diff --git a/SL/Form.pm b/SL/Form.pm index 5a9272465..196d828cd 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -294,11 +294,7 @@ sub error { } else { - if ($self->{error_function}) { - &{ $self->{error_function} }($msg); - } else { - die "Error: $msg\n"; - } + die "Error: $msg\n"; } $main::lxdebug->leave_sub(); @@ -595,7 +591,9 @@ sub parse_html_template2 { map { $additional_params->{$_} ||= $self->{$_} } keys %{ $self }; my $output; - $template->process($file, $additional_params, \$output); + if (!$template->process($file, $additional_params, \$output)) { + print STDERR $template->error(); + } $output = $main::locale->{iconv}->convert($output) if ($main::locale); @@ -762,6 +760,22 @@ sub format_amount { return $amount; } # + +sub format_string { + $main::lxdebug->enter_sub(2); + + my $self = shift; + my $input = shift; + + $input =~ s/(^|[^\#]) \# (\d+) /$1$_[$2 - 1]/gx; + $input =~ s/(^|[^\#]) \#\{(\d+)\}/$1$_[$2 - 1]/gx; + $input =~ s/\#\#/\#/g; + + $main::lxdebug->leave_sub(2); + + return $input; +} + sub parse_amount { $main::lxdebug->enter_sub(2); @@ -1880,6 +1894,20 @@ sub _get_departments { $main::lxdebug->leave_sub(); } +sub _get_price_factors { + $main::lxdebug->enter_sub(); + + my ($self, $dbh, $key) = @_; + + $key ||= "all_price_factors"; + + my $query = qq|SELECT * FROM price_factors ORDER BY sortkey|; + + $self->{$key} = selectall_hashref_query($self, $dbh, $query); + + $main::lxdebug->leave_sub(); +} + sub get_lists { $main::lxdebug->enter_sub(); @@ -1962,6 +1990,10 @@ sub get_lists { $self->_get_departments($dbh, $params{"departments"}); } + if ($params{price_factors}) { + $self->_get_price_factors($dbh, $params{price_factors}); + } + $main::lxdebug->leave_sub(); }