From a422e87f5acc0cb9ecbc76f46b416c6d99f27a38 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Mon, 15 Mar 2021 15:25:29 +0100 Subject: [PATCH] Mahnungsbericht: Erzeugte Dokumente anzeigen --- SL/DN.pm | 2 +- bin/mozilla/dn.pl | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/SL/DN.pm b/SL/DN.pm index 260b12e50..460d2311c 100644 --- a/SL/DN.pm +++ b/SL/DN.pm @@ -783,7 +783,7 @@ sub get_dunning { my $query = qq|SELECT a.id, a.ordnumber, a.invoice, a.transdate, a.invnumber, a.amount, a.language_id, ct.name AS customername, ct.id AS customer_id, a.duedate, da.fee, - da.interest, dn.dunning_description, da.transdate AS dunning_date, + da.interest, dn.dunning_description, dn.dunning_level, da.transdate AS dunning_date, da.duedate AS dunning_duedate, da.dunning_id, da.dunning_config_id, e2.name AS salesman FROM ar a diff --git a/bin/mozilla/dn.pl b/bin/mozilla/dn.pl index 3124362e2..8f8efc5b6 100644 --- a/bin/mozilla/dn.pl +++ b/bin/mozilla/dn.pl @@ -38,8 +38,10 @@ use SL::IS; use SL::DN; use SL::DB::Department; use SL::DB::Dunning; +use SL::File; use SL::Helper::Flash qw(flash); use SL::Locale::String qw(t8); +use SL::Presenter::FileObject; use SL::ReportGenerator; require "bin/mozilla/common.pl"; @@ -378,6 +380,7 @@ sub show_dunning { 'fee' => { 'text' => $locale->text('Total Fees') }, 'interest' => { 'text' => $locale->text('Interest') }, 'salesman' => { 'text' => $locale->text('Salesperson'), 'visible' => $form->{l_salesman} ? 1 : 0 }, + 'documents' => { 'text' => $locale->text('Documents') , 'visible' => $::instance_conf->get_doc_storage ? 1 : 0 }, ); $report->set_columns(%column_defs); @@ -444,6 +447,19 @@ sub show_dunning { $row->{language} = { }; } + if ($::instance_conf->get_doc_storage) { + my @files = SL::File->get_all_versions(object_id => $ref->{id}, + object_type => 'dunning' . $ref->{dunning_level}, + file_type => 'document',); + if (scalar @files) { + my $html = join '
', map { SL::Presenter::FileObject::file_object($_) } @files; + my $text = join "\n", map { $_->file_name } @files; + $row->{documents} = { 'raw_data' => $html, data => $text }; + } else { + $row->{documents} = { }; + } + } + push @{ $current_dunning_rows }, $row; $previous_dunning_id = $ref->{dunning_id}; -- 2.20.1