From: Bernd Bleßmann Date: Wed, 17 Mar 2021 15:31:52 +0000 (+0100) Subject: Mahnungen: beim erneuten Drucken ggf. auch originale Rechnung mit drucken, … X-Git-Tag: kivitendo-mebil_0.1-0~9^2~424 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=edff34950b489a16a8d49d7d583479e23cb5d6c7;p=kivitendo-erp.git Mahnungen: beim erneuten Drucken ggf. auch originale Rechnung mit drucken, … … sofern diese beim Mahnlauf mit gedruckt wurde. --- diff --git a/SL/DN.pm b/SL/DN.pm index ed196c08b..9016aaad4 100644 --- a/SL/DN.pm +++ b/SL/DN.pm @@ -342,7 +342,7 @@ sub _save_dunning { my $q_insert_dunning = qq|INSERT INTO dunning (id, dunning_id, dunning_config_id, dunning_level, trans_id, - fee, interest, transdate, duedate) + fee, interest, transdate, duedate, original_invoice_printed) VALUES (?, ?, ?, (SELECT dunning_level FROM dunning_config WHERE id = ?), ?, @@ -353,7 +353,8 @@ sub _save_dunning { * (SELECT interest_rate FROM dunning_config WHERE id = ?) / 360, current_date, - current_date + (SELECT payment_terms FROM dunning_config WHERE id = ?))|; + current_date + (SELECT payment_terms FROM dunning_config WHERE id = ?), + ?)|; my $h_insert_dunning = prepare_query($form, $dbh, $q_insert_dunning); my @invoice_ids; @@ -387,7 +388,8 @@ sub _save_dunning { @values = ($row_id, $dunning_id, $next_config_id, $next_config_id, $invoice_id, $next_config_id, - $invoice_id, $next_config_id, $next_config_id); + $invoice_id, $next_config_id, $next_config_id, + $print_invoice); do_statement($form, $h_insert_dunning, $q_insert_dunning, @values); RecordLinks->create_links( diff --git a/bin/mozilla/dn.pl b/bin/mozilla/dn.pl index 5634c90f9..376b56efb 100644 --- a/bin/mozilla/dn.pl +++ b/bin/mozilla/dn.pl @@ -561,6 +561,11 @@ sub print_multiple { $form->{dunning_id} = $dunning_id; DN->print_invoice_for_fees(\%myconfig, $form, $dunning_id); DN->print_dunning(\%myconfig, $form, $dunning_id); + + # print original dunned invoices, if they where printed on dunning run + my $dunnings = SL::DB::Manager::Dunning->get_all(where => [dunning_id => $dunning_id, original_invoice_printed => 1]); + DN->print_original_invoice(\%myconfig, $form, $_->trans_id) for @$dunnings; + $i++; } $form->{language_id} = $saved_language_id;