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
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";
'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);
$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 '<br>', 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};