X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDN.pm;h=a4eb1276929f770110fdbae3b276e3f93ae6735b;hb=a386ea48944a5fff408862f5c6622ddfd5cde736;hp=435f57873b24f8f929bffc7d7dbaaefde6e529cb;hpb=05f4e6ebf1257a454290c04e5e7ede90eca0e465;p=kivitendo-erp.git diff --git a/SL/DN.pm b/SL/DN.pm index 435f57873..a4eb12769 100644 --- a/SL/DN.pm +++ b/SL/DN.pm @@ -737,6 +737,11 @@ sub get_dunning { push(@values, like($form->{$key})); } + if ($form->{dunning_id}) { + $where .= qq| AND da.dunning_id = ?|; + push(@values, conv_i($form->{dunning_id})); + } + if ($form->{dunning_level}) { $where .= qq| AND a.dunning_config_id = ?|; push(@values, conv_i($form->{dunning_level})); @@ -780,19 +785,20 @@ sub get_dunning { } my %sort_columns = ( - 'dunning_description' => [ qw(dn.dunning_description customername invnumber) ], - 'customername' => [ qw(customername invnumber) ], + 'dunning_description' => [ qw(dn.dunning_description da.dunning_id customername invnumber) ], + 'customername' => [ qw(customername da.dunning_id invnumber) ], 'invnumber' => [ qw(a.invnumber) ], 'transdate' => [ qw(a.transdate a.invnumber) ], 'duedate' => [ qw(a.duedate a.invnumber) ], - 'dunning_date' => [ qw(dunning_date a.invnumber) ], - 'dunning_duedate' => [ qw(dunning_duedate a.invnumber) ], + 'dunning_date' => [ qw(dunning_date da.dunning_id a.invnumber) ], + 'dunning_duedate' => [ qw(dunning_duedate da.dunning_id a.invnumber) ], + 'dunning_id' => [ qw(dunning_id a.invnumber) ], 'salesman' => [ qw(salesman) ], ); my $sortdir = !defined $form->{sortdir} ? 'ASC' : $form->{sortdir} ? 'ASC' : 'DESC'; my $sortkey = $sort_columns{$form->{sort}} ? $form->{sort} : 'customername'; - my $sortorder = join ', ', map { "$_ $sortdir" } (@{ $sort_columns{$sortkey} }, 'da.dunning_id'); + my $sortorder = join ', ', map { "$_ $sortdir" } @{ $sort_columns{$sortkey} }; my $query = qq|SELECT a.id, a.ordnumber, a.invoice, a.transdate, a.invnumber, a.amount, a.language_id, @@ -843,10 +849,10 @@ sub melt_pdfs { $out = IO::File->new("| $form->{printer_command}"); } - $::locale->with_raw_io($out, sub { $out->print($_) while <$in> }); - $form->error($main::locale->text('Could not spawn the printer command.')) unless $out; + $::locale->with_raw_io($out, sub { $out->print($_) while <$in> }); + } else { my $dunning_filename = $form->get_formname_translation('dunning'); print qq|Content-Type: Application/PDF\n| .