]> wagnertech.de Git - mfinanz.git/blob - SL/Presenter/GL.pm
restart apache2 in postinst
[mfinanz.git] / SL / Presenter / GL.pm
1 package SL::Presenter::GL;
2
3 use strict;
4
5 use SL::Presenter::EscapedText qw(escape is_escaped);
6 use SL::Presenter::Tag         qw(link_tag);
7
8 use Exporter qw(import);
9 our @EXPORT_OK = qw(show gl_transaction);
10
11 use Carp;
12
13 sub show {goto &gl_transaction};
14
15 sub gl_transaction {
16   my ($gl_transaction, %params) = @_;
17
18   $params{display} ||= 'inline';
19
20   croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
21
22   my $text = escape($gl_transaction->reference);
23   if (! delete $params{no_link}) {
24     my $href = 'gl.pl?action=edit&id=' . escape($gl_transaction->id);
25     $text = link_tag($href, $text, %params);
26   }
27
28   is_escaped($text);
29 }
30
31 1;
32
33 __END__
34
35 =pod
36
37 =encoding utf8
38
39 =head1 NAME
40
41 SL::Presenter::GL - Presenter module for GL transaction
42
43 =head1 SYNOPSIS
44
45   my $object = SL::DB::Manager::GLTransaction->get_first();
46   my $html   = SL::Presenter::GL::gl_transaction($object, display => 'inline');
47   # or
48   my $html   = $object->presenter->show();
49
50 =head1 FUNCTIONS
51
52 =over 4
53
54 =item C<show $object %params>
55
56 Alias for C<gl_transaction $object %params>.
57
58 =item C<gl_transaction $object, %params>
59
60 Returns a rendered version (actually an instance of
61 L<SL::Presenter::EscapedText>) of a gl object C<$object>.
62
63 Remaining C<%params> are passed to the function
64 C<SL::Presenter::Tag::link_tag>. It can include:
65
66 =over 2
67
68 =item * display
69
70 Either C<inline> (the default) or C<table-cell>. Is passed to the function
71 C<SL::Presenter::Tag::link_tag>.
72
73 =item * no_link
74
75 If falsish (the default) then the trans_id number will be linked to the
76 "edit gl" dialog.
77
78
79 =back
80
81 =back
82
83 =head1 BUGS
84
85 Nothing here yet.
86
87 =head1 AUTHOR
88
89 G. Richardson E<lt>information@kivitendo-premium.deE<gt>
90
91 =cut