Revision 7d8de6d3
Von Jan Büren vor etwa 10 Jahren hinzugefügt
SL/Controller/DeliveryPlan.pm | ||
---|---|---|
11 | 11 |
|
12 | 12 |
use Rose::Object::MakeMethods::Generic ( |
13 | 13 |
scalar => [ qw(db_args flat_filter) ], |
14 |
'scalar --get_set_init' => [ qw(models all_edit_right) ], |
|
14 |
'scalar --get_set_init' => [ qw(models all_edit_right vc) ],
|
|
15 | 15 |
); |
16 | 16 |
|
17 | 17 |
__PACKAGE__->run_before(sub { $::auth->assert('delivery_plan'); }); |
... | ... | |
30 | 30 |
value_of_goods => t8('Value of goods'), |
31 | 31 |
); |
32 | 32 |
|
33 |
my $vc; |
|
34 | 33 |
|
35 | 34 |
sub action_list { |
36 | 35 |
my ($self) = @_; |
37 |
|
|
38 |
$vc = "customer"; |
|
39 |
$self->make_filter_summary; |
|
40 |
$self->prepare_report; |
|
41 |
|
|
42 |
my $orderitems = $self->models->get; |
|
43 |
|
|
44 |
$self->report_generator_list_objects(report => $self->{report}, objects => $orderitems); |
|
45 |
} |
|
46 |
|
|
47 |
sub action_list_ap { |
|
48 |
my ($self) = @_; |
|
49 |
|
|
50 |
$vc = "vendor"; |
|
51 | 36 |
$self->make_filter_summary; |
52 | 37 |
$self->prepare_report; |
53 | 38 |
|
... | ... | |
61 | 46 |
sub prepare_report { |
62 | 47 |
my ($self) = @_; |
63 | 48 |
|
49 |
my $vc = $self->vc; |
|
64 | 50 |
my $report = SL::ReportGenerator->new(\%::myconfig, $::form); |
65 | 51 |
$self->{report} = $report; |
66 | 52 |
|
... | ... | |
101 | 87 |
); |
102 | 88 |
$report->set_columns(%column_defs); |
103 | 89 |
$report->set_column_order(@columns); |
104 |
$report->set_export_options(qw(list filter)); |
|
90 |
$report->set_export_options(qw(list filter vc));
|
|
105 | 91 |
$report->set_options_from_form; |
106 | 92 |
$self->models->disable_plugin('paginated') if $report->{options}{output_format} =~ /^(pdf|csv)$/i; |
107 | 93 |
$self->models->finalize; # for filter laundering |
... | ... | |
114 | 100 |
|
115 | 101 |
sub make_filter_summary { |
116 | 102 |
my ($self) = @_; |
103 |
my $vc = $self->vc; |
|
117 | 104 |
|
118 | 105 |
my $filter = $::form->{filter} || {}; |
119 | 106 |
my @filter_strings; |
... | ... | |
147 | 134 |
} |
148 | 135 |
|
149 | 136 |
sub delivery_plan_query { |
137 |
my ($self) = @_; |
|
138 |
my $vc = $self->vc; |
|
150 | 139 |
my $employee_id = SL::DB::Manager::Employee->current->id; |
151 | 140 |
my $oe_owner = $_[0]->all_edit_right ? '' : " oe.employee_id = $employee_id AND"; |
152 | 141 |
# check delivered state for delivery_orders (transferred out) if enabled |
... | ... | |
254 | 243 |
|
255 | 244 |
sub init_models { |
256 | 245 |
my ($self) = @_; |
246 |
my $vc = $self->vc; |
|
257 | 247 |
|
258 | 248 |
SL::Controller::Helper::GetModels->new( |
259 | 249 |
controller => $self, |
... | ... | |
273 | 263 |
sub init_all_edit_right { |
274 | 264 |
$::auth->assert('sales_all_edit', 1) |
275 | 265 |
} |
266 |
sub init_vc { |
|
267 |
return $::form->{vc} || croak "self (DeliveryPlan) has no vc defined"; |
|
268 |
} |
|
276 | 269 |
|
277 | 270 |
sub link_to { |
278 | 271 |
my ($self, $object, %params) = @_; |
Auch abrufbar als: Unified diff
Verbesserungen Einkaufs-Lieferplan
a) keinen Fallunterschied für $vc im Template, sondern ein einfaches hidden flag vc
b) kein copy & paste von action_list(_ap), sondern parameter in erp.ini
c) performanteres grep, statt foreach in OrderItem (Details s.a. devel-liste)
d) my $vc nicht als statische Klassenvariable gesetzt
e) CSV-Export für beide Fälle richtig (filter vc übergeben)