Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ee51b82f

Von Tamino Steinert vor etwa 2 Jahren hinzugefügt

  • ID ee51b82f6206a33d436cb453ebe835d6fbbb4c2c
  • Vorgänger a0a10e44
  • Nachfolger 84dfd7a5

Presenter: nutze link_tag anstelle von html im perl-code

(cherry picked aus Kundenprojekt)

Unterschiede anzeigen:

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

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

  
7 8
use Exporter qw(import);
8 9
our @EXPORT_OK = qw(sales_quotation sales_order request_quotation purchase_order);
......
42 43

  
43 44
  my $number_method = $order->quotation ? 'quonumber' : 'ordnumber';
44 45

  
45
  my $link_start = '';
46
  my $link_end   = '';
47
  unless ($params{no_link}) {
46
  my $text = escape($order->$number_method);
47
  if (! delete $params{no_link}) {
48 48
    my $action  = $::instance_conf->get_feature_experimental_order
49 49
                ? 'controller.pl?action=Order/edit'
50 50
                : 'oe.pl?action=edit';
51
    $link_start = '<a href="' . $action . '&amp;type=' . $type . '&amp;id=' . escape($order->id) . '">';
52
    $link_end   = '</a>';
51
    my $href = $action
52
               . '&type=' . $type
53
               . '&id=' . escape($order->id);
54
    $text = link_tag($href, $text, %params);
53 55
  }
54 56

  
55
  my $text = join '', ($link_start, escape($order->$number_method), $link_end);
56

  
57 57
  is_escaped($text);
58 58
}
59 59

  
......
99 99
L<SL::Presenter::EscapedText>) of the sales quotation object
100 100
C<$object>.
101 101

  
102
C<%params> can include:
102
Remaining C<%params> are passed to the function
103
C<SL::Presenter::Tag::link_tag>. It can include:
103 104

  
104 105
=over 2
105 106

  
106 107
=item * display
107 108

  
108
Either C<inline> (the default) or C<table-cell>. At the moment both
109
representations are identical and produce the objects's
110
quotation number linked to the corresponding 'edit' action.
109
Either C<inline> (the default) or C<table-cell>. Is passed to the function
110
C<SL::Presenter::Tag::link_tag>.
111 111

  
112 112
=item * no_link
113 113

  
......
121 121
Returns a rendered version (actually an instance of
122 122
L<SL::Presenter::EscapedText>) of the sales order object C<$object>.
123 123

  
124
C<%params> can include:
124
Remaining C<%params> are passed to the function
125
C<SL::Presenter::Tag::link_tag>. It can include:
125 126

  
126 127
=over 2
127 128

  
128 129
=item * display
129 130

  
130
Either C<inline> (the default) or C<table-cell>. At the moment both
131
representations are identical and produce the objects's
132
order number linked to the corresponding 'edit' action.
131
Either C<inline> (the default) or C<table-cell>. Is passed to the function
132
C<SL::Presenter::Tag::link_tag>.
133 133

  
134 134
=item * no_link
135 135

  
......
144 144
L<SL::Presenter::EscapedText>) of the request for quotation object
145 145
C<$object>.
146 146

  
147
C<%params> can include:
147
Remaining C<%params> are passed to the function
148
C<SL::Presenter::Tag::link_tag>. It can include:
148 149

  
149 150
=over 2
150 151

  
151 152
=item * display
152 153

  
153
Either C<inline> (the default) or C<table-cell>. At the moment both
154
representations are identical and produce the objects's
155
quotation number linked to the corresponding 'edit' action.
154
Either C<inline> (the default) or C<table-cell>. Is passed to the function
155
C<SL::Presenter::Tag::link_tag>.
156 156

  
157 157
=item * no_link
158 158

  
......
167 167
L<SL::Presenter::EscapedText>) of the purchase order object
168 168
C<$object>.
169 169

  
170
C<%params> can include:
170
Remaining C<%params> are passed to the function
171
C<SL::Presenter::Tag::link_tag>. It can include:
171 172

  
172 173
=over 2
173 174

  
174 175
=item * display
175 176

  
176
Either C<inline> (the default) or C<table-cell>. At the moment both
177
representations are identical and produce the objects's
178
order number linked to the corresponding 'edit' action.
177
Either C<inline> (the default) or C<table-cell>. Is passed to the function
178
C<SL::Presenter::Tag::link_tag>.
179 179

  
180 180
=item * no_link
181 181

  

Auch abrufbar als: Unified diff