From: Bernd Bleßmann Date: Tue, 23 Mar 2021 13:21:49 +0000 (+0100) Subject: Mahnungsbericht: E-Mails f. Mahnungen anzeigen X-Git-Tag: kivitendo-mebil_0.1-0~9^2~399 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=b4c84c7e755cbd74d579b0910aeb794f60804e9d;p=kivitendo-erp.git Mahnungsbericht: E-Mails f. Mahnungen anzeigen --- diff --git a/SL/DN.pm b/SL/DN.pm index bd002ad65..8224172bf 100644 --- a/SL/DN.pm +++ b/SL/DN.pm @@ -820,6 +820,7 @@ sub get_dunning { ct.name AS customername, ct.id AS customer_id, a.duedate, da.fee, 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, + da.id AS dunning_table_id, e2.name AS salesman FROM ar a JOIN customer ct ON (a.customer_id = ct.id) diff --git a/bin/mozilla/dn.pl b/bin/mozilla/dn.pl index 93e57d02e..29d20c2c4 100644 --- a/bin/mozilla/dn.pl +++ b/bin/mozilla/dn.pl @@ -44,6 +44,7 @@ use SL::DB::Dunning; use SL::File; use SL::Helper::Flash qw(flash); use SL::Locale::String qw(t8); +use SL::Presenter::EmailJournal; use SL::Presenter::FileObject; use SL::Presenter::WebdavObject; use SL::ReportGenerator; @@ -404,13 +405,14 @@ 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 }, - 'webdav' => { 'text' => $locale->text('WebDAV'), 'visible' => $::instance_conf->get_webdav ? 1 : 0 }, + 'documents' => { 'text' => $locale->text('Documents'), 'visible' => $::instance_conf->get_doc_storage ? 1 : 0 }, + 'webdav' => { 'text' => $locale->text('WebDAV'), 'visible' => $::instance_conf->get_webdav ? 1 : 0 }, + 'mails' => { 'text' => $locale->text('Mails'), 'visible' => $::instance_conf->get_email_journal ? 1 : 0 }, ); $report->set_columns(%column_defs); $report->set_column_order(qw(checkbox dunning_description dunning_id customername language invnumber transdate - duedate amount dunning_date dunning_duedate fee interest salesman)); + duedate amount dunning_date dunning_duedate fee interest salesman departmentname mails webdav documents)); $report->set_sort_indicator($form->{sort}, $form->{sortdir}); my $edit_url = sub { build_std_url('script=' . ($_[0]->{invoice} ? 'is' : 'ar') . '.pl', 'action=edit', 'callback') . '&id=' . $::form->escape($_[0]->{id}) }; @@ -500,6 +502,18 @@ sub show_dunning { } } + if ($::instance_conf->get_email_journal) { + my @mail_links = RecordLinks->get_links(from_table => 'dunning', to_table => 'email_journal', from_id => $ref->{dunning_table_id}); + if (scalar @mail_links) { + my $email_journals = SL::DB::Manager::EmailJournal->get_all(where => [id => [ map { $_->{to_id} } @mail_links ]]); + my $html = join '
', map { SL::Presenter::EmailJournal::email_journal($_) } @$email_journals; + my $text = join "\n", map { $_->subject } @$email_journals; + $row->{mails} = { 'raw_data' => $html, data => $text }; + } else { + $row->{mails} = { }; + } + } + push @{ $current_dunning_rows }, $row; $previous_dunning_id = $ref->{dunning_id};