]> wagnertech.de Git - mfinanz.git/blob - SL/Presenter/Reclamation.pm
date error in mapping
[mfinanz.git] / SL / Presenter / Reclamation.pm
1 package SL::Presenter::Reclamation;
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 sales_reclamation purchase_reclamation);
10
11 use Carp;
12
13 sub show {goto &reclamation};
14
15 sub sales_reclamation {goto &reclamation}
16 sub purchase_reclamation {goto &reclamation}
17
18 sub reclamation {
19   my ($reclamation, %params) = @_;
20
21   $params{display} ||= 'inline';
22
23   my $text = escape($reclamation->record_number);
24   unless ($params{no_link}) {
25     my $href = 'controller.pl?action=Reclamation/edit&id=' . escape($reclamation->id);
26     $text =  link_tag($href, $text, %params);
27   }
28
29   is_escaped($text);
30 }
31
32 1;
33
34 __END__
35
36 =pod
37
38 =encoding utf8
39
40 =head1 NAME
41
42 SL::Presenter::Reclamation - Presenter module for Rose::DB objects for sales
43 reclamations and purchase reclamations
44
45 =head1 SYNOPSIS
46
47   # Sales reclamations:
48   my $object = SL::DB::Manager::Reclamation->get_first(
49     where => [ SL::DB::Manager::Reclamation->type_filter('sales_reclamation') ]
50   );
51   my $html   = SL::Presenter::Reclamation::sales_reclamation($object);
52
53   # Purchase reclamations:
54   my $object = SL::DB::Manager::Reclamation->get_first(
55     where => [ SL::DB::Manager::Reclamation->type_filter('purchase_reclamation') ]
56   );
57   my $html   = SL::Presenter::Reclamation::purchase_reclamation($object);
58
59   # or for all types:
60   my $html   = SL::Presenter::Reclamation::reclamation(
61     $object, display => 'inline'
62   );
63   my $html   = $object->presenter->show();
64
65 =head1 FUNCTIONS
66
67 =over 4
68
69 =item C<show $object %params>
70
71 Alias for C<reclamation $object %params>.
72
73 =item C<sales_reclamation $object, %params>
74
75 Alias for C<reclamation $object %params>.
76
77 =item C<purchase_reclamation $object, %params>
78
79 Alias for C<reclamation $object %params>.
80
81 =item C<reclamation $object %params>
82
83 Returns a rendered version (actually an instance of
84 L<SL::Presenter::EscapedText>) of the sales reclamation object C<$object>.
85
86 C<%params> can include:
87
88 =over 2
89
90 =item * no_link
91
92 If falsish (the default) then the  reclamation number will be linked to the
93 "edit reclamation" dialog.
94
95 =back
96
97 When C<$params{no_link}> is falsish, other C<%params> get passed to
98 L<SL::Presenter::Tag/link_tag> .
99
100 =back
101
102 =head1 BUGS
103
104 Nothing here yet.
105
106 =head1 AUTHOR
107
108 Tamino Steinert E<lt>tamino.steinert@tamino.stE<gt>
109
110 =cut