Revision 36d7ceb2
Von Tamino Steinert vor etwa 1 Jahr hinzugefügt
SL/Presenter/DeliveryOrder.pm | ||
---|---|---|
8 | 8 |
use SL::Presenter::Tag qw(link_tag); |
9 | 9 |
|
10 | 10 |
use Exporter qw(import); |
11 |
our @EXPORT_OK = qw(sales_delivery_order purchase_delivery_order delivery_order_status_line); |
|
11 |
our @EXPORT_OK = qw( |
|
12 |
show delivery_order delivery_order_status_line |
|
13 |
sales_delivery_order purchase_delivery_order |
|
14 |
rma_delivery_order supplier_delivery_order |
|
15 |
); |
|
12 | 16 |
|
13 | 17 |
use Carp; |
14 | 18 |
|
15 |
sub sales_delivery_order { |
|
16 |
my ($delivery_order, %params) = @_; |
|
19 |
sub show {goto &delivery_order}; |
|
17 | 20 |
|
18 |
return _do_record($delivery_order, 'sales_delivery_order', %params); |
|
19 |
} |
|
21 |
sub sales_delivery_order {goto &delivery_order} |
|
20 | 22 |
|
21 |
sub rma_delivery_order { |
|
22 |
my ($delivery_order, %params) = @_; |
|
23 |
|
|
24 |
return _do_new_record($delivery_order, 'rma_delivery_order', %params); |
|
25 |
} |
|
23 |
sub rma_delivery_order {goto &delivery_order}; |
|
26 | 24 |
|
27 |
sub purchase_delivery_order { |
|
28 |
my ($delivery_order, %params) = @_; |
|
25 |
sub purchase_delivery_order {goto &delivery_order}; |
|
29 | 26 |
|
30 |
return _do_record($delivery_order, 'purchase_delivery_order', %params); |
|
31 |
} |
|
27 |
sub supplier_delivery_order {goto &delivery_order}; |
|
32 | 28 |
|
33 |
sub supplier_delivery_order {
|
|
29 |
sub delivery_order { |
|
34 | 30 |
my ($delivery_order, %params) = @_; |
35 | 31 |
|
36 |
return _do_new_record($delivery_order, 'supplier_delivery_order', %params); |
|
37 |
} |
|
38 |
|
|
39 |
sub _do_new_record { |
|
40 |
my ($delivery_order, $type, %params) = @_; |
|
41 |
|
|
42 |
$params{display} ||= 'inline'; |
|
43 |
|
|
44 |
croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/; |
|
45 |
|
|
46 |
my $text = join '', ( |
|
47 |
$params{no_link} ? '' : '<a href="controller.pl?action=DeliveryOrder/edit&type=' . $type . '&id=' . escape($delivery_order->id) . '">', |
|
48 |
escape($delivery_order->donumber), |
|
49 |
$params{no_link} ? '' : '</a>', |
|
50 |
); |
|
51 |
is_escaped($text); |
|
52 |
} |
|
53 |
|
|
54 |
sub _do_record { |
|
55 |
my ($delivery_order, $type, %params) = @_; |
|
56 |
|
|
57 | 32 |
$params{display} ||= 'inline'; |
58 | 33 |
|
59 | 34 |
croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/; |
... | ... | |
121 | 96 |
my $object = SL::DB::Manager::DeliveryOrder->get_first(where => [ record_type => PURCHASE_DELIVERY_ORDER_TYPE ]); |
122 | 97 |
my $html = SL::Presenter::DeliveryOrder::purchase_delivery_order($object, display => 'inline'); |
123 | 98 |
|
99 |
#... |
|
100 |
|
|
101 |
# or for all types: |
|
102 |
my $html = SL::Presenter::DeliveryOrder::delivery_order($object); |
|
103 |
my $html = $object->presenter->show(); |
|
104 |
|
|
124 | 105 |
=head1 FUNCTIONS |
125 | 106 |
|
126 | 107 |
=over 4 |
127 | 108 |
|
128 |
=item C<sales_delivery_order $object, %params>
|
|
109 |
=item C<show $object %params>
|
|
129 | 110 |
|
130 |
Returns a rendered version (actually an instance of |
|
131 |
L<SL::Presenter::EscapedText>) of the sales delivery order object |
|
132 |
C<$object>. |
|
111 |
Alias for C<delivery_order $object %params>. |
|
133 | 112 |
|
134 |
Remaining C<%params> are passed to the function |
|
135 |
C<SL::Presenter::Tag::link_tag>. It can include: |
|
113 |
=item C<sales_delivery_order $object, %params> |
|
136 | 114 |
|
137 |
=over 2
|
|
115 |
Alias for C<delivery_order $object %params>.
|
|
138 | 116 |
|
139 |
=item * display
|
|
117 |
=item C<purchase_delivery_order $object, %params>
|
|
140 | 118 |
|
141 |
Either C<inline> (the default) or C<table-cell>. Is passed to the function |
|
142 |
C<SL::Presenter::Tag::link_tag>. |
|
119 |
Alias for C<delivery_order $object %params>. |
|
143 | 120 |
|
144 |
=item * no_link
|
|
121 |
=item C<rma_delivery_order $object, %params>
|
|
145 | 122 |
|
146 |
If falsish (the default) then the delivery order number will be linked |
|
147 |
to the "edit delivery order" dialog from the sales menu. |
|
123 |
Alias for C<delivery_order $object %params>. |
|
148 | 124 |
|
149 |
=back
|
|
125 |
=item C<supplier_delivery_order $object, %params>
|
|
150 | 126 |
|
151 |
=item C<purchase_delivery_order $object, %params> |
|
127 |
Alias for C<delivery_order $object %params>. |
|
128 |
|
|
129 |
=item C<delivery_order $object, %params> |
|
152 | 130 |
|
153 | 131 |
Returns a rendered version (actually an instance of |
154 |
L<SL::Presenter::EscapedText>) of the purchase delivery order object
|
|
132 |
L<SL::Presenter::EscapedText>) of the sales delivery order object
|
|
155 | 133 |
C<$object>. |
156 | 134 |
|
157 | 135 |
Remaining C<%params> are passed to the function |
158 |
C<SL::Presenter::Tag::link_tag>. It can include:
|
|
136 |
L<SL::Presenter::Tag/link_tag>. It can include:
|
|
159 | 137 |
|
160 | 138 |
=over 2 |
161 | 139 |
|
... | ... | |
167 | 145 |
=item * no_link |
168 | 146 |
|
169 | 147 |
If falsish (the default) then the delivery order number will be linked |
170 |
to the "edit delivery order" dialog from the purchase menu.
|
|
148 |
to the "edit delivery order" dialog from the sales menu.
|
|
171 | 149 |
|
172 | 150 |
=back |
173 | 151 |
|
Auch abrufbar als: Unified diff
S:Presenter:Record: Alias Funktion "show" in verwendeten Objekten