From c18a652e2cd4409fce9c8383a9fbcc0e31e6a83f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Mon, 26 Mar 2018 14:10:03 +0200 Subject: [PATCH] vergessener Presenter::EmailJournal MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Der Betreff der E-Mail soll anklickbar sein und direkt zum Detaileintrag des Mail-Journals führen. Überwiegend übernommen von Presenter::Letter --- SL/Presenter/EmailJournal.pm | 89 ++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 SL/Presenter/EmailJournal.pm diff --git a/SL/Presenter/EmailJournal.pm b/SL/Presenter/EmailJournal.pm new file mode 100644 index 000000000..5bdfcd887 --- /dev/null +++ b/SL/Presenter/EmailJournal.pm @@ -0,0 +1,89 @@ +package SL::Presenter::EmailJournal; + +use strict; + +use SL::Presenter::EscapedText qw(escape is_escaped); + +use Exporter qw(import); +our @EXPORT_OK = qw(email_journal); + +use Carp; + +sub email_journal { + my ($email_journal_entry, %params) = @_; + + $params{display} ||= 'inline'; + + croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/; + + my $text = join '', ( + $params{no_link} ? '' : '', + escape($email_journal_entry->subject), + $params{no_link} ? '' : '', + ); + + is_escaped($text); +} + +1; + +__END__ + +=pod + +=encoding utf8 + +=head1 NAME + +SL::Presenter::EmailJournal - Presenter module for mail entries in email_journal + +=head1 SYNOPSIS + + use SL::Presenter::EmailJournal; + + my $journal_entry = SL::DB::Manager::EmailJournal->get_first(); + my $html = SL::Presenter::EmailJournal::email_journal($journal_entry, display => 'inline'); + + # pp $html + # IDEV Daten fuer webdav/idev/2017-KW-26.csv erzeugt + +=head1 FUNCTIONS + +=over 4 + +=item C + +Returns a rendered version (actually an instance of +L) of the email journal object C<$object> +. + + +C<%params> can include: + +=over 2 + +=item * display + +Either C (the default) or C. At the moment both +representations are identical and produce the invoice number linked +to the corresponding 'edit' action. + +=item * no_link + +If falsish (the default) then the mail subject will be linked to the +'view details of email' dialog from the email journal report. + +=back + +=back + +=head1 BUGS + +Nothing here yet. + +=head1 AUTHOR + +copied from Moritz Bunkus Em.bunkus@linet-services.deE +by Jan Büren Ejan@kivitendo-premium.deE + +=cut -- 2.20.1