10 |
10 |
use Carp;
|
11 |
11 |
use List::Util qw(first);
|
12 |
12 |
|
|
13 |
sub _arrayify {
|
|
14 |
my ($array) = @_;
|
|
15 |
return [] if !defined $array;
|
|
16 |
return $array if ref $array;
|
|
17 |
return [ $array ];
|
|
18 |
}
|
|
19 |
|
13 |
20 |
sub grouped_record_list {
|
14 |
21 |
my ($self, $list, %params) = @_;
|
15 |
22 |
|
|
23 |
%params = map { exists $params{$_} ? ($_ => $params{$_}) : () } qw(selectable with_columns);
|
|
24 |
|
16 |
25 |
my %groups = _group_records($list);
|
17 |
26 |
my $output = '';
|
18 |
27 |
|
19 |
|
$output .= _sales_quotation_list( $self, $groups{sales_quotations}) if $groups{sales_quotations};
|
20 |
|
$output .= _sales_order_list( $self, $groups{sales_orders}) if $groups{sales_orders};
|
21 |
|
$output .= _sales_delivery_order_list( $self, $groups{sales_delivery_orders}) if $groups{sales_delivery_orders};
|
22 |
|
$output .= _sales_invoice_list( $self, $groups{sales_invoices}) if $groups{sales_invoices};
|
23 |
|
$output .= _ar_transaction_list( $self, $groups{ar_transactions}) if $groups{ar_transactions};
|
|
28 |
$output .= _sales_quotation_list( $self, $groups{sales_quotations}, %params) if $groups{sales_quotations};
|
|
29 |
$output .= _sales_order_list( $self, $groups{sales_orders}, %params) if $groups{sales_orders};
|
|
30 |
$output .= _sales_delivery_order_list( $self, $groups{sales_delivery_orders}, %params) if $groups{sales_delivery_orders};
|
|
31 |
$output .= _sales_invoice_list( $self, $groups{sales_invoices}, %params) if $groups{sales_invoices};
|
|
32 |
$output .= _ar_transaction_list( $self, $groups{ar_transactions}, %params) if $groups{ar_transactions};
|
24 |
33 |
|
25 |
|
$output .= _request_quotation_list( $self, $groups{purchase_quotations}) if $groups{purchase_quotations};
|
26 |
|
$output .= _purchase_order_list( $self, $groups{purchase_orders}) if $groups{purchase_orders};
|
27 |
|
$output .= _purchase_delivery_order_list($self, $groups{purchase_delivery_orders}) if $groups{purchase_delivery_orders};
|
28 |
|
$output .= _purchase_invoice_list( $self, $groups{purchase_invoices}) if $groups{purchase_invoices};
|
29 |
|
$output .= _ar_transaction_list( $self, $groups{ar_transactions}) if $groups{ar_transactions};
|
|
34 |
$output .= _request_quotation_list( $self, $groups{purchase_quotations}, %params) if $groups{purchase_quotations};
|
|
35 |
$output .= _purchase_order_list( $self, $groups{purchase_orders}, %params) if $groups{purchase_orders};
|
|
36 |
$output .= _purchase_delivery_order_list($self, $groups{purchase_delivery_orders}, %params) if $groups{purchase_delivery_orders};
|
|
37 |
$output .= _purchase_invoice_list( $self, $groups{purchase_invoices}, %params) if $groups{purchase_invoices};
|
|
38 |
$output .= _ar_transaction_list( $self, $groups{ar_transactions}, %params) if $groups{ar_transactions};
|
30 |
39 |
|
31 |
40 |
return $output || $self->empty_record_list;
|
32 |
41 |
}
|
... | ... | |
54 |
63 |
croak "Wrong type for 'columns' argument: not an array reference";
|
55 |
64 |
}
|
56 |
65 |
|
|
66 |
my %with_columns = map { ($_ => 1) } @{ _arrayify($params{with_columns}) };
|
|
67 |
if ($with_columns{record_link_direction}) {
|
|
68 |
push @columns, {
|
|
69 |
title => $::locale->text('Link direction'),
|
|
70 |
data => sub { $_[0]->{_record_link_direction} eq 'from' ? $::locale->text('Row was source for current record') : $::locale->text('Row was created from current record') },
|
|
71 |
};
|
|
72 |
}
|
|
73 |
|
57 |
74 |
my %column_meta = map { $_->name => $_ } @{ $list->[0]->meta->columns };
|
58 |
75 |
my %relationships = map { $_->name => $_ } @{ $list->[0]->meta->relationships };
|
59 |
76 |
|
... | ... | |
141 |
158 |
}
|
142 |
159 |
|
143 |
160 |
sub _sales_quotation_list {
|
144 |
|
my ($self, $list) = @_;
|
|
161 |
my ($self, $list, %params) = @_;
|
145 |
162 |
|
146 |
163 |
return $self->record_list(
|
147 |
164 |
$list,
|
... | ... | |
155 |
172 |
[ $::locale->text('Project'), 'globalproject', ],
|
156 |
173 |
[ $::locale->text('Closed'), 'closed' ],
|
157 |
174 |
],
|
|
175 |
%params,
|
158 |
176 |
);
|
159 |
177 |
}
|
160 |
178 |
|
161 |
179 |
sub _request_quotation_list {
|
162 |
|
my ($self, $list) = @_;
|
|
180 |
my ($self, $list, %params) = @_;
|
163 |
181 |
|
164 |
182 |
return $self->record_list(
|
165 |
183 |
$list,
|
... | ... | |
173 |
191 |
[ $::locale->text('Project'), 'globalproject', ],
|
174 |
192 |
[ $::locale->text('Closed'), 'closed' ],
|
175 |
193 |
],
|
|
194 |
%params,
|
176 |
195 |
);
|
177 |
196 |
}
|
178 |
197 |
|
179 |
198 |
sub _sales_order_list {
|
180 |
|
my ($self, $list) = @_;
|
|
199 |
my ($self, $list, %params) = @_;
|
181 |
200 |
|
182 |
201 |
return $self->record_list(
|
183 |
202 |
$list,
|
... | ... | |
192 |
211 |
[ $::locale->text('Project'), 'globalproject', ],
|
193 |
212 |
[ $::locale->text('Closed'), 'closed' ],
|
194 |
213 |
],
|
|
214 |
%params,
|
195 |
215 |
);
|
196 |
216 |
}
|
197 |
217 |
|
198 |
218 |
sub _purchase_order_list {
|
199 |
|
my ($self, $list) = @_;
|
|
219 |
my ($self, $list, %params) = @_;
|
200 |
220 |
|
201 |
221 |
return $self->record_list(
|
202 |
222 |
$list,
|
... | ... | |
211 |
231 |
[ $::locale->text('Project'), 'globalproject', ],
|
212 |
232 |
[ $::locale->text('Closed'), 'closed' ],
|
213 |
233 |
],
|
|
234 |
%params,
|
214 |
235 |
);
|
215 |
236 |
}
|
216 |
237 |
|
217 |
238 |
sub _sales_delivery_order_list {
|
218 |
|
my ($self, $list) = @_;
|
|
239 |
my ($self, $list, %params) = @_;
|
219 |
240 |
|
220 |
241 |
return $self->record_list(
|
221 |
242 |
$list,
|
... | ... | |
230 |
251 |
[ $::locale->text('Delivered'), 'delivered' ],
|
231 |
252 |
[ $::locale->text('Closed'), 'closed' ],
|
232 |
253 |
],
|
|
254 |
%params,
|
233 |
255 |
);
|
234 |
256 |
}
|
235 |
257 |
|
236 |
258 |
sub _purchase_delivery_order_list {
|
237 |
|
my ($self, $list) = @_;
|
|
259 |
my ($self, $list, %params) = @_;
|
238 |
260 |
|
239 |
261 |
return $self->record_list(
|
240 |
262 |
$list,
|
... | ... | |
249 |
271 |
[ $::locale->text('Delivered'), 'delivered' ],
|
250 |
272 |
[ $::locale->text('Closed'), 'closed' ],
|
251 |
273 |
],
|
|
274 |
%params,
|
252 |
275 |
);
|
253 |
276 |
}
|
254 |
277 |
|
255 |
278 |
sub _sales_invoice_list {
|
256 |
|
my ($self, $list) = @_;
|
|
279 |
my ($self, $list, %params) = @_;
|
257 |
280 |
|
258 |
281 |
return $self->record_list(
|
259 |
282 |
$list,
|
... | ... | |
268 |
291 |
[ $::locale->text('Paid'), 'paid' ],
|
269 |
292 |
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
270 |
293 |
],
|
|
294 |
%params,
|
271 |
295 |
);
|
272 |
296 |
}
|
273 |
297 |
|
274 |
298 |
sub _purchase_invoice_list {
|
275 |
|
my ($self, $list) = @_;
|
|
299 |
my ($self, $list, %params) = @_;
|
276 |
300 |
|
277 |
301 |
return $self->record_list(
|
278 |
302 |
$list,
|
... | ... | |
287 |
311 |
[ $::locale->text('Paid'), 'paid' ],
|
288 |
312 |
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
289 |
313 |
],
|
|
314 |
%params,
|
290 |
315 |
);
|
291 |
316 |
}
|
292 |
317 |
|
293 |
318 |
sub _ar_transaction_list {
|
294 |
|
my ($self, $list) = @_;
|
|
319 |
my ($self, $list, %params) = @_;
|
295 |
320 |
|
296 |
321 |
return $self->record_list(
|
297 |
322 |
$list,
|
... | ... | |
304 |
329 |
[ $::locale->text('Paid'), 'paid' ],
|
305 |
330 |
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
306 |
331 |
],
|
|
332 |
%params,
|
307 |
333 |
);
|
308 |
334 |
}
|
309 |
335 |
|
310 |
336 |
sub _ap_transaction_list {
|
311 |
|
my ($self, $list) = @_;
|
|
337 |
my ($self, $list, %params) = @_;
|
312 |
338 |
|
313 |
339 |
return $self->record_list(
|
314 |
340 |
$list,
|
... | ... | |
321 |
347 |
[ $::locale->text('Paid'), 'paid' ],
|
322 |
348 |
[ $::locale->text('Transaction description'), 'transaction_description' ],
|
323 |
349 |
],
|
|
350 |
%params,
|
324 |
351 |
);
|
325 |
352 |
}
|
326 |
353 |
|
Verknüpfte Belege: Spalte "Verknüpfungsrichtung" anzeigen