Revision 3705b374
Von Kivitendo Admin vor fast 8 Jahren hinzugefügt
SL/Controller/Project.pm | ||
---|---|---|
28 | 28 |
|
29 | 29 |
use Rose::Object::MakeMethods::Generic |
30 | 30 |
( |
31 |
scalar => [ qw(project linked_records) ],
|
|
32 |
'scalar --get_set_init' => [ qw(models customers project_types project_statuses projects) ], |
|
31 |
scalar => [ qw(project) ], |
|
32 |
'scalar --get_set_init' => [ qw(models customers project_types project_statuses projects linked_records) ],
|
|
33 | 33 |
); |
34 | 34 |
|
35 | 35 |
__PACKAGE__->run_before('check_auth', except => [ qw(ajax_autocomplete) ]); |
... | ... | |
75 | 75 |
sub action_edit { |
76 | 76 |
my ($self) = @_; |
77 | 77 |
|
78 |
$self->get_linked_records; |
|
79 | 78 |
$self->display_form(title => $::locale->text('Edit project #1', $self->project->projectnumber), |
80 | 79 |
callback => $::form->{callback} || $self->url_for(action => 'edit', id => $self->project->id)); |
81 | 80 |
} |
... | ... | |
164 | 163 |
sub init_project_statuses { SL::DB::Manager::ProjectStatus->get_all_sorted } |
165 | 164 |
sub init_project_types { SL::DB::Manager::ProjectType->get_all_sorted } |
166 | 165 |
|
166 |
sub init_linked_records { |
|
167 |
my ($self) = @_; |
|
168 |
return [ |
|
169 |
map { @{ $_ } } |
|
170 |
grep { $_ } ( |
|
171 |
SL::DB::Manager::Invoice-> get_all(where => [ invoice => 1, or => [ globalproject_id => $self->project->id, 'invoiceitems.project_id' => $self->project->id ] ], |
|
172 |
with_objects => [ 'invoiceitems', 'customer' ], |
|
173 |
distinct => [ 'customer' ], |
|
174 |
sort_by => 'transdate ASC'), |
|
175 |
SL::DB::Manager::Invoice-> get_all(where => [ invoice => 0, or => [ globalproject_id => $self->project->id, 'transactions.project_id' => $self->project->id ] ], |
|
176 |
with_objects => [ 'transactions', 'customer' ], |
|
177 |
distinct => [ 'customer' ], |
|
178 |
sort_by => 'transdate ASC'), |
|
179 |
SL::DB::Manager::PurchaseInvoice->get_all(where => [ invoice => 1, |
|
180 |
or => [ globalproject_id => $self->project->id, 'invoiceitems.project_id' => $self->project->id ] |
|
181 |
], |
|
182 |
with_objects => [ 'invoiceitems', 'vendor' ], |
|
183 |
distinct => [ 'customer' ], |
|
184 |
sort_by => 'transdate ASC'), |
|
185 |
SL::DB::Manager::PurchaseInvoice->get_all(where => [ invoice => 0, |
|
186 |
or => [ globalproject_id => $self->project->id, 'transactions.project_id' => $self->project->id ] |
|
187 |
], |
|
188 |
with_objects => [ 'transactions', 'vendor' ], |
|
189 |
distinct => [ 'customer' ], |
|
190 |
sort_by => 'transdate ASC'), |
|
191 |
SL::DB::Manager::GLTransaction-> get_all(where => [ 'transactions.project_id' => $self->project->id ], |
|
192 |
with_objects => [ 'transactions' ], |
|
193 |
distinct => 1, |
|
194 |
sort_by => 'transdate ASC'), |
|
195 |
SL::DB::Manager::Order-> get_all(where => [ or => [ globalproject_id => $self->project->id, 'orderitems.project_id' => $self->project->id ] ], |
|
196 |
with_objects => [ 'orderitems', 'customer', 'vendor' ], |
|
197 |
distinct => [ 'customer', 'vendor' ], |
|
198 |
sort_by => 'transdate ASC' ), |
|
199 |
SL::DB::Manager::DeliveryOrder-> get_all(where => [ or => [ globalproject_id => $self->project->id, 'orderitems.project_id' => $self->project->id ] ], |
|
200 |
with_objects => [ 'orderitems', 'customer', 'vendor' ], |
|
201 |
distinct => [ 'customer', 'vendor' ], |
|
202 |
sort_by => 'transdate ASC'), |
|
203 |
)]; |
|
204 |
} |
|
205 |
|
|
206 |
|
|
167 | 207 |
sub init_projects { |
168 | 208 |
if ($::form->{no_paginate}) { |
169 | 209 |
$_[0]->models->disable_plugin('paginated'); |
... | ... | |
233 | 273 |
$self->project(SL::DB::Project->new(id => $::form->{id})->load); |
234 | 274 |
} |
235 | 275 |
|
236 |
sub get_linked_records { |
|
237 |
my ($self) = @_; |
|
238 |
|
|
239 |
$self->linked_records([ |
|
240 |
map { @{ $_ } } |
|
241 |
grep { $_ } ( |
|
242 |
SL::DB::Manager::Order-> get_all(where => [ globalproject_id => $self->project->id ], with_objects => [ 'customer', 'vendor' ], sort_by => 'transdate ASC'), |
|
243 |
SL::DB::Manager::DeliveryOrder-> get_all(where => [ globalproject_id => $self->project->id ], with_objects => [ 'customer', 'vendor' ], sort_by => 'transdate ASC'), |
|
244 |
SL::DB::Manager::Invoice-> get_all(where => [ globalproject_id => $self->project->id ], with_objects => [ 'customer' ], sort_by => 'transdate ASC'), |
|
245 |
SL::DB::Manager::PurchaseInvoice->get_all(where => [ globalproject_id => $self->project->id ], with_objects => [ 'vendor' ], sort_by => 'transdate ASC'), |
|
246 |
)]); |
|
247 |
} |
|
248 | 276 |
|
249 | 277 |
sub prepare_report { |
250 | 278 |
my ($self) = @_; |
Auch abrufbar als: Unified diff
Project verknüpfte Belege - auch project_id durchsuchen
Bisher wurde nur auf globalproject_id in ar/ap/oe/do geprüft.
Jetzt wird zusätzlich gelistet:
Projekteintrag hat, aber nicht unbedingt die globalproject_id gesetzt ist