} else {
- if ($self->{error_function}) {
- &{ $self->{error_function} }($msg);
- } else {
- die "Error: $msg\n";
- }
+ die "Error: $msg\n";
}
$main::lxdebug->leave_sub();
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);
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);
$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();
$self->_get_departments($dbh, $params{"departments"});
}
+ if ($params{price_factors}) {
+ $self->_get_price_factors($dbh, $params{price_factors});
+ }
+
$main::lxdebug->leave_sub();
}