X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=SL%2FDN.pm;h=e1a634202946aedf4503031fb5abdbcaffdf5642;hb=f2354caba6501475fb0f09c8fb1fe970ea430c22;hp=bd4b5092fd2068b42cb0453410a2ccf353f8efac;hpb=fa7a78e6ef90dbde7f1a7f4bef3d693bfac1f007;p=kivitendo-erp.git diff --git a/SL/DN.pm b/SL/DN.pm index bd4b5092f..e1a634202 100644 --- a/SL/DN.pm +++ b/SL/DN.pm @@ -41,6 +41,8 @@ use SL::Mailer; use SL::MoreCommon; use SL::Template; +use strict; + sub get_config { $main::lxdebug->enter_sub(); @@ -457,7 +459,7 @@ sub get_invoices { push(@values, $form->{minamount}); } - $query = + my $query = qq|SELECT id FROM dunning_config WHERE dunning_level = (SELECT MAX(dunning_level) FROM dunning_config)|; @@ -512,7 +514,7 @@ sub get_invoices { $form->{DUNNINGS} = []; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { next if ($ref->{pastdue} < $ref->{terms}); $ref->{interest} = $form->round_amount($ref->{interest}, 2); @@ -537,7 +539,7 @@ sub get_dunning { # connect to database my $dbh = $form->dbconnect($myconfig); - $where = qq| WHERE (da.trans_id = a.id)|; + my $where = qq| WHERE (da.trans_id = a.id)|; my @values; @@ -663,9 +665,10 @@ sub melt_pdfs { $form->error($main::locale->text('Could not spawn the printer command.')) unless $out; } else { + my $dunning_filename = $form->get_formname_translation('dunning'); $out = IO::File->new('>-'); $out->print(qq|Content-Type: Application/PDF\n| . - qq|Content-Disposition: attachment; filename="dunning_${dunning_id}.pdf"\n\n|); + qq|Content-Disposition: attachment; filename="${dunning_filename}_${dunning_id}.pdf"\n\n|); } while (my $line = <$in>) { @@ -712,7 +715,7 @@ sub print_dunning { my $sth = prepare_execute_query($form, $dbh, $query, $dunning_id); my $first = 1; - while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { + while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { if ($first) { $form->{TEMPLATE_ARRAYS} = {}; map({ $form->{TEMPLATE_ARRAYS}->{"dn_$_"} = []; } keys(%{$ref})); @@ -737,7 +740,7 @@ sub print_dunning { LEFT JOIN contacts co ON (ar.cp_id = co.cp_id) WHERE (d.dunning_id = ?) LIMIT 1|; - $ref = selectfirst_hashref_query($form, $dbh, $query, $dunning_id); + my $ref = selectfirst_hashref_query($form, $dbh, $query, $dunning_id); map { $form->{$_} = $ref->{$_} } keys %{ $ref }; $query = @@ -832,7 +835,7 @@ sub print_invoice_for_fees { FROM ar LEFT JOIN customer c ON (ar.customer_id = c.id) WHERE ar.id = ?|; - $ref = selectfirst_hashref_query($form, $dbh, $query, $ar_id); + my $ref = selectfirst_hashref_query($form, $dbh, $query, $ar_id); map { $form->{$_} = $ref->{$_} } keys %{ $ref }; $query = qq|SELECT * FROM employee WHERE login = ?|;