Revision 3d1ae2d9
Von Moritz Bunkus vor fast 12 Jahren hinzugefügt
SL/Controller/SellPriceInformation.pm | ||
---|---|---|
32 | 32 |
db_args => $db_args, |
33 | 33 |
); |
34 | 34 |
|
35 |
$self->{orderitems} = SL::DB::Manager::OrderItem->get_all(%$db_args);
|
|
35 |
my $orderitems = SL::DB::Manager::OrderItem->get_all(%$db_args);
|
|
36 | 36 |
|
37 |
$self->list_objects;
|
|
37 |
$self->report_generator_list_objects(report => $self->{report}, objects => $orderitems, options => { no_layout => 1 });
|
|
38 | 38 |
} |
39 | 39 |
|
40 | 40 |
# private functions |
... | ... | |
124 | 124 |
title => $::locale->text('Sales Price information'), |
125 | 125 |
); |
126 | 126 |
$report->set_options_from_form; |
127 |
|
|
128 |
$self->{report_data} = { |
|
129 |
column_defs => $column_defs, |
|
130 |
columns => \@columns, |
|
131 |
visible => \@visible, |
|
132 |
sortable => \@sortable, |
|
133 |
}; |
|
134 |
} |
|
135 |
|
|
136 |
sub list_objects { |
|
137 |
my ($self) = @_; |
|
138 |
my $column_defs = $self->{report_data}{column_defs}; |
|
139 |
for my $obj (@{ $self->{orderitems} || [] }) { |
|
140 |
$self->{report}->add_data({ |
|
141 |
map { |
|
142 |
$_ => { |
|
143 |
data => $column_defs->{$_}{sub} ? $column_defs->{$_}{sub}->($obj) |
|
144 |
: $obj->can($_) ? $obj->$_ |
|
145 |
: $obj->{$_}, |
|
146 |
link => $column_defs->{$_}{obj_link} ? $column_defs->{$_}{obj_link}->($obj) : '', |
|
147 |
}, |
|
148 |
} @{ $self->{report_data}{columns} || {} } |
|
149 |
}); |
|
150 |
} |
|
151 |
|
|
152 |
return $self->{report}->generate_with_headers(no_layout => 1); |
|
153 | 127 |
} |
154 | 128 |
|
155 | 129 |
sub link_to { |
Auch abrufbar als: Unified diff
Refactoring: list_objects() aus Controllern in ReportGenerator-Helfer verschieben