Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 36d7ceb2

Von Tamino Steinert vor etwa 1 Jahr hinzugefügt

  • ID 36d7ceb2d203115fe890f1a47e252e20c5e5a1d2
  • Vorgänger f596739c
  • Nachfolger e2e5606d

S:Presenter:Record: Alias Funktion "show" in verwendeten Objekten

Verknüpfte Belege nutzt folgende Objekte:
DeliveryOrder, Dunning, EmailJournal, GL, Invoice, Letter, Order,
Reclamation, RequirementSpec, ShopOrder

Unterschiede anzeigen:

SL/Presenter/Reclamation.pm
3 3
use strict;
4 4

  
5 5
use SL::Presenter::EscapedText qw(escape is_escaped);
6
use SL::Presenter::Tag qw(html_tag);
6
use SL::Presenter::Tag qw(link_tag);
7 7

  
8 8
use Exporter qw(import);
9
our @EXPORT_OK = qw(sales_reclamation purchase_reclamation);
9
our @EXPORT_OK = qw(show sales_reclamation purchase_reclamation);
10 10

  
11 11
use Carp;
12 12

  
13
sub sales_reclamation {
14
  my ($reclamation, %params) = @_;
13
sub show {goto &reclamation};
15 14

  
16
  return _reclamation_record($reclamation, 'sales_reclamation', %params);
17
}
15
sub sales_reclamation {goto &reclamation}
16
sub purchase_reclamation {goto &reclamation}
18 17

  
19
sub purchase_reclamation {
18
sub reclamation {
20 19
  my ($reclamation, %params) = @_;
21 20

  
22
  return _reclamation_record($reclamation, 'purchase_reclamation', %params);
23
}
24

  
25
sub _reclamation_record {
26
  my ($reclamation, $type, %params) = @_;
27

  
28 21
  $params{display} ||= 'inline';
29 22

  
30
  croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
31

  
32 23
  my $text = escape($reclamation->record_number);
33 24
  unless ($params{no_link}) {
34
    my $id = $reclamation->id;
35
    $text =  html_tag('a', $text, href => escape("controller.pl?action=Reclamation/edit&type=${type}&id=${id}"));
25
    my $href = 'controller.pl?action=Reclamation/edit&id=' . escape($reclamation->id);
26
    $text =  link_tag($href, $text, %params);
36 27
  }
37 28

  
38 29
  is_escaped($text);
......
57 48
  my $object = SL::DB::Manager::Reclamation->get_first(
58 49
    where => [ SL::DB::Manager::Reclamation->type_filter('sales_reclamation') ]
59 50
  );
60
  my $html   = SL::Presenter::Reclamation::sales_reclamation(
61
    $object, display => 'inline'
62
  );
51
  my $html   = SL::Presenter::Reclamation::sales_reclamation($object);
63 52

  
64 53
  # Purchase reclamations:
65 54
  my $object = SL::DB::Manager::Reclamation->get_first(
66 55
    where => [ SL::DB::Manager::Reclamation->type_filter('purchase_reclamation') ]
67 56
  );
68
  my $html   = SL::Presenter::Reclamation::purchase_reclamation(
57
  my $html   = SL::Presenter::Reclamation::purchase_reclamation($object);
58

  
59
  # or for all types:
60
  my $html   = SL::Presenter::Reclamation::reclamation(
69 61
    $object, display => 'inline'
70 62
  );
63
  my $html   = $object->presenter->show();
71 64

  
72 65
=head1 FUNCTIONS
73 66

  
74 67
=over 4
75 68

  
76
=item C<sales_reclamation $object, %params>
69
=item C<show $object %params>
77 70

  
78
Returns a rendered version (actually an instance of
79
L<SL::Presenter::EscapedText>) of the sales reclamation object C<$object>.
80

  
81
C<%params> can include:
71
Alias for C<reclamation $object %params>.
82 72

  
83
=over 2
84

  
85
=item * display
73
=item C<sales_reclamation $object, %params>
86 74

  
87
Either C<inline> (the default) or C<table-cell>. At the moment both
88
representations are identical and produce the objects's
89
reclamation number linked to the corresponding 'edit' action.
75
Alias for C<reclamation $object %params>.
90 76

  
91
=item * no_link
77
=item C<purchase_reclamation $object, %params>
92 78

  
93
If falsish (the default) then the  reclamation number will be linked to the
94
"edit reclamation" dialog from the sales menu.
79
Alias for C<reclamation $object %params>.
95 80

  
96
=back
97

  
98
=item C<purchase_reclamation $object, %params>
81
=item C<reclamation $object %params>
99 82

  
100 83
Returns a rendered version (actually an instance of
101
L<SL::Presenter::EscapedText>) of the purchase reclamation object C<$object>.
84
L<SL::Presenter::EscapedText>) of the sales reclamation object C<$object>.
102 85

  
103 86
C<%params> can include:
104 87

  
105 88
=over 2
106 89

  
107
=item * display
108

  
109
Either C<inline> (the default) or C<table-cell>. At the moment both
110
representations are identical and produce the objects's reclamation number
111
linked to the corresponding 'edit' action.
112

  
113 90
=item * no_link
114 91

  
115 92
If falsish (the default) then the  reclamation number will be linked to the
116
"edit reclamation" dialog from the purchase menu.
93
"edit reclamation" dialog.
117 94

  
118 95
=back
119 96

  
97
When C<$params{no_link}> is falsish, other C<%params> get passed to
98
L<SL::Presenter::Tag/link_tag> .
99

  
120 100
=back
121 101

  
122 102
=head1 BUGS

Auch abrufbar als: Unified diff