From 26c66e2caae4a9af6464223cbde41a74203f59ec Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Fri, 23 Jan 2015 17:23:18 +0100 Subject: [PATCH] =?utf8?q?Presenter=20f=C3=BCr=20GL=20Transaction?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit analog zu invoice und purchase_invoice --- SL/Presenter.pm | 1 + SL/Presenter/GL.pm | 79 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 SL/Presenter/GL.pm diff --git a/SL/Presenter.pm b/SL/Presenter.pm index a9c73f8a2..7b83e3693 100644 --- a/SL/Presenter.pm +++ b/SL/Presenter.pm @@ -12,6 +12,7 @@ use SL::Presenter::CustomerVendor; use SL::Presenter::DeliveryOrder; use SL::Presenter::EscapedText; use SL::Presenter::Invoice; +use SL::Presenter::GL; use SL::Presenter::Order; use SL::Presenter::Part; use SL::Presenter::Project; diff --git a/SL/Presenter/GL.pm b/SL/Presenter/GL.pm new file mode 100644 index 000000000..5a9c15b02 --- /dev/null +++ b/SL/Presenter/GL.pm @@ -0,0 +1,79 @@ +package SL::Presenter::GL; + +use strict; + +use parent qw(Exporter); + +use Exporter qw(import); +our @EXPORT = qw(gl_transaction); + +use Carp; + +sub gl_transaction { + my ($self, $gl_transaction, %params) = @_; + + $params{display} ||= 'inline'; + + croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/; + + my $text = join '', ( + $params{no_link} ? '' : '', + $self->escape($gl_transaction->id), + $params{no_link} ? '' : '', + ); + return $self->escaped_text($text); +} + +1; + +__END__ + +=pod + +=encoding utf8 + +=head1 NAME + +SL::Presenter::GL - Presenter module for GL transaction + +=head1 SYNOPSIS + + my $object = SL::DB::Manager::GLTransaction->get_first(); + my $html = SL::Presenter->get->gl_transaction($object, display => 'inline'); + +=head1 FUNCTIONS + +=over 4 + +=item C + +Returns a rendered version (actually an instance of +L) of a gl 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 trans_id number linked +to the corresponding 'edit' action. + +=item * no_link + +If falsish (the default) then the trans_id number will be linked to the +"edit gl" dialog. + + +=back + +=head1 BUGS + +Nothing here yet. + +=head1 AUTHOR + +G. Richardson Einformation@kivitendo-premium.deE + +=cut -- 2.20.1