From: G. Richardson Date: Fri, 23 Jan 2015 16:23:18 +0000 (+0100) Subject: Presenter für GL Transaction X-Git-Tag: release-3.2.0beta~26 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=26c66e2caae4a9af6464223cbde41a74203f59ec;p=kivitendo-erp.git Presenter für GL Transaction analog zu invoice und purchase_invoice --- 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