kivitendo/SL/Presenter/GL.pm @ 6b3d35b1
26c66e2c | Geoffrey Richardson | package SL::Presenter::GL;
|
||
use strict;
|
||||
0e5e3501 | Sven Schöling | use SL::Presenter::EscapedText qw(escape is_escaped);
|
||
ee51b82f | Tamino Steinert | use SL::Presenter::Tag qw(link_tag);
|
||
26c66e2c | Geoffrey Richardson | |||
use Exporter qw(import);
|
||||
0e5e3501 | Sven Schöling | our @EXPORT_OK = qw(gl_transaction);
|
||
26c66e2c | Geoffrey Richardson | |||
use Carp;
|
||||
sub gl_transaction {
|
||||
0e5e3501 | Sven Schöling | my ($gl_transaction, %params) = @_;
|
||
26c66e2c | Geoffrey Richardson | |||
$params{display} ||= 'inline';
|
||||
croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
|
||||
ee51b82f | Tamino Steinert | my $text = escape($gl_transaction->reference);
|
||
if (! delete $params{no_link}) {
|
||||
my $href = 'gl.pl?action=edit&id=' . escape($gl_transaction->id);
|
||||
$text = link_tag($href, $text, %params);
|
||||
}
|
||||
0e5e3501 | Sven Schöling | |||
is_escaped($text);
|
||||
26c66e2c | Geoffrey Richardson | }
|
||
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();
|
||||
0e5e3501 | Sven Schöling | my $html = SL::Presenter::GL::gl_transaction($object, display => 'inline');
|
||
26c66e2c | Geoffrey Richardson | |||
=head1 FUNCTIONS
|
||||
=over 4
|
||||
=item C<gl_transaction $object, %params>
|
||||
Returns a rendered version (actually an instance of
|
||||
L<SL::Presenter::EscapedText>) of a gl object C<$object>.
|
||||
ee51b82f | Tamino Steinert | Remaining C<%params> are passed to the function
|
||
C<SL::Presenter::Tag::link_tag>. It can include:
|
||||
26c66e2c | Geoffrey Richardson | |||
=over 2
|
||||
=item * display
|
||||
ee51b82f | Tamino Steinert | Either C<inline> (the default) or C<table-cell>. Is passed to the function
|
||
C<SL::Presenter::Tag::link_tag>.
|
||||
26c66e2c | Geoffrey Richardson | |||
=item * no_link
|
||||
If falsish (the default) then the trans_id number will be linked to the
|
||||
"edit gl" dialog.
|
||||
42bf4142 | Bernd Bleßmann | =back
|
||
26c66e2c | Geoffrey Richardson | =back
|
||
=head1 BUGS
|
||||
Nothing here yet.
|
||||
=head1 AUTHOR
|
||||
G. Richardson E<lt>information@kivitendo-premium.deE<gt>
|
||||
=cut
|