From edff34950b489a16a8d49d7d583479e23cb5d6c7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Wed, 17 Mar 2021 16:31:52 +0100 Subject: [PATCH] =?utf8?q?Mahnungen:=20beim=20erneuten=20Drucken=20ggf.=20?= =?utf8?q?auch=20originale=20Rechnung=20mit=20drucken,=20=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit … sofern diese beim Mahnlauf mit gedruckt wurde. --- SL/DN.pm | 8 +++++--- bin/mozilla/dn.pl | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) 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; -- 2.20.1