X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fdn.pl;h=1992ce8108cec2916c09750db8aa363cd7a40239;hb=840aea131eef33512dccc13184e01affafaafb37;hp=bd96d3edc29db009f45eb5b066be86a297a543b7;hpb=7dab0cbdf9c8d9f1463290ad577e90865d632e93;p=kivitendo-erp.git diff --git a/bin/mozilla/dn.pl b/bin/mozilla/dn.pl index bd96d3edc..1992ce810 100644 --- a/bin/mozilla/dn.pl +++ b/bin/mozilla/dn.pl @@ -163,9 +163,8 @@ sub edit_config { $column_data{dunning_level} = qq|$i|; $column_data{dunning_description} = qq||; - my $active = ""; $column_data{active} = - qq||; + qq||; my $email = ""; $column_data{email} = qq||; @@ -465,12 +464,12 @@ sub show_invoices { |; $form->{selectdunning} =~ s/ selected//g; - if ($ref->{next_dunning_id} ne "") { - $form->{selectdunning} =~ s/value=$ref->{next_dunning_id}/value=$ref->{next_dunning_id} selected/; + if ($ref->{next_dunning_config_id} ne "") { + $form->{selectdunning} =~ s/value=$ref->{next_dunning_config_id}/value=$ref->{next_dunning_config_id} selected/; } - $dunning = qq||; + $dunning = qq||; $column_data{dunning_description} = qq|$ref->{dunning_level}: $dunning|; @@ -589,7 +588,7 @@ sub save_dunning { } } if (scalar(@{ $form->{inv_ids} }) != 0) { - DN->save_dunning(\%myconfig, \%$form, \@rows, $userspath,$spool, $sendmail); + DN->save_dunning(\%myconfig, \%$form, \@rows, $userspath, $spool, $sendmail); } } } else { @@ -598,7 +597,7 @@ sub save_dunning { @rows = (); $form->{inv_ids} = [ $form->{"inv_id_$i"} ]; push(@rows, $i); - DN->save_dunning(\%myconfig, \%$form, \@rows, $userspath,$spool, $sendmail); + DN->save_dunning(\%myconfig, \%$form, \@rows, $userspath, $spool, $sendmail); } } } @@ -887,14 +886,28 @@ sub show_dunning { print qq| |; + + my %columns = ( + "dunning_duedate" => "next_duedate", + "duedate" => "inv_duedate", + "transdate" => "invdate", + "amount" => "invamount", + ); + my $i = 0; my $j = 0; - my $previous_customer_id; + my ($previous_dunning_id, $first_row_for_dunning); foreach $ref (@{ $form->{DUNNINGS} }) { $i++; - $j++ if ($previous_customer_id != $ref->{customer_id}); - $j = $j % 2; - $previous_customer_id = $ref->{customer_id}; + + if ($previous_dunning_id != $ref->{dunning_id}) { + $j++; + $j = $j % 2; + $first_row_for_dunning = 1; + } else { + $first_row_for_dunning = 0; + } + $previous_dunning_id = $ref->{dunning_id}; print qq| @@ -902,27 +915,28 @@ sub show_dunning { - $dunning = qq||; - my $script = ""; - if ($ref->{invoice}) { - $script = "is.pl"; - } else { - $script = "ar.pl"; + foreach (qw(dunning_date dunning_duedate duedate transdate customername + amount fee interest)) { + my $col = $columns{$_} ? $columns{$_} : $_; + $column_data{$col} = "" . H($ref->{$_}) . ""; } - $column_data{dunning_description} = qq|{dunning_id}&customer_id=$ref->{customer_id}&format=pdf&media=screen&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$form->{callback}>$ref->{dunning_description}|; - my $active = "checked"; - $column_data{dunning_date} = qq|$ref->{dunning_date}|; - $column_data{next_duedate} = qq|$ref->{dunning_duedate}|; - - $column_data{inv_duedate} = qq|$ref->{duedate}|; - $column_data{invdate} = qq|$ref->{transdate}|; - $column_data{invnumber} = qq|{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$form->{callback}>$ref->{invnumber}|; - $column_data{customername} = qq|$ref->{customername}|; - $column_data{invamount} = qq|$ref->{amount}|; - $column_data{fee} = qq|$ref->{fee}|; - $column_data{interest} = qq|$ref->{interest}|; + if ($first_row_for_dunning) { + $column_data{dunning_description} = + qq|| . H($ref->{dunning_description}) . qq||; + } else { + $column_data{dunning_description} = qq| |; + $column_data{customername} = qq| |; + } + $column_data{invnumber} = + qq|{id}) . + join(map({ "&${_}=" . E($form->{$_}) } qw(login path password callback))) . + qq|">| . H($ref->{invnumber}) . qq||; map { print "$column_data{$_}\n" } @column_index; @@ -968,7 +982,7 @@ sub show_dunning { sub print_dunning { $lxdebug->enter_sub(); - DN->print_dunning(\%myconfig, \%$form, $form->{dunning_id}, $form->{customer_id}, $userspath, $spool, $sendmail); + DN->print_dunning(\%myconfig, \%$form, $form->{dunning_id}, $userspath, $spool, $sendmail); if($form->{DUNNING_PDFS}) { DN->melt_pdfs(\%myconfig, \%$form,$spool);