Revision 8388c9bf
Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt
SL/Controller/RequirementSpec.pm | ||
---|---|---|
7 | 7 |
|
8 | 8 |
use SL::ClientJS; |
9 | 9 |
use SL::Controller::Helper::GetModels; |
10 |
use SL::Controller::Helper::Filtered; |
|
10 | 11 |
use SL::Controller::Helper::Paginated; |
11 | 12 |
use SL::Controller::Helper::Sorted; |
12 | 13 |
use SL::Controller::Helper::ParseFilter; |
... | ... | |
25 | 26 |
|
26 | 27 |
use Rose::Object::MakeMethods::Generic |
27 | 28 |
( |
28 |
scalar => [ qw(requirement_spec_item customers types statuses db_args flat_filter visible_item visible_section) ],
|
|
29 |
scalar => [ qw(requirement_spec_item customers types statuses visible_item visible_section) ], |
|
29 | 30 |
'scalar --get_set_init' => [ qw(requirement_spec complexities risks projects copy_source js current_text_block_output_position) ], |
30 | 31 |
); |
31 | 32 |
|
32 | 33 |
__PACKAGE__->run_before('setup'); |
33 | 34 |
__PACKAGE__->run_before('load_select_options', only => [ qw(new ajax_edit create update list) ]); |
34 | 35 |
|
35 |
|
|
36 |
__PACKAGE__->get_models_url_params('flat_filter'); |
|
36 |
__PACKAGE__->make_filtered( |
|
37 |
MODEL => 'RequirementSpec', |
|
38 |
LAUNDER_TO => 'filter' |
|
39 |
); |
|
37 | 40 |
__PACKAGE__->make_paginated( |
38 |
MODEL => 'RequirementSpec', |
|
39 |
PAGINATE_ARGS => 'db_args', |
|
40 |
ONLY => [ qw(list) ], |
|
41 |
MODEL => 'RequirementSpec', |
|
42 |
ONLY => [ qw(list) ], |
|
41 | 43 |
); |
42 |
|
|
43 | 44 |
__PACKAGE__->make_sorted( |
44 | 45 |
MODEL => 'RequirementSpec', |
45 | 46 |
ONLY => [ qw(list) ], |
... | ... | |
64 | 65 |
sub action_list { |
65 | 66 |
my ($self) = @_; |
66 | 67 |
|
67 |
$self->setup_db_args_from_filter; |
|
68 |
$self->flat_filter({ map { $_->{key} => $_->{value} } $::form->flatten_variables('filter') }); |
|
68 |
my $requirement_specs = $self->get_models( |
|
69 |
query => [ |
|
70 |
and => [ |
|
71 |
working_copy_id => undef, |
|
72 |
is_template => $::form->{is_template} ? 1 : 0, |
|
73 |
]], |
|
74 |
with_objects => [ 'customer', 'type', 'status', 'project' ], |
|
75 |
); |
|
69 | 76 |
|
70 | 77 |
$self->prepare_report; |
71 |
|
|
72 |
my $requirement_specs = $self->get_models(%{ $self->db_args }); |
|
73 |
|
|
74 | 78 |
$self->report_generator_list_objects(report => $self->{report}, objects => $requirement_specs); |
75 | 79 |
} |
76 | 80 |
|
... | ... | |
363 | 367 |
$self->redirect_to(action => 'show', id => $self->requirement_spec->id); |
364 | 368 |
} |
365 | 369 |
|
366 |
sub setup_db_args_from_filter { |
|
367 |
my ($self) = @_; |
|
368 |
|
|
369 |
$self->{filter} = {}; |
|
370 |
my %args = parse_filter( |
|
371 |
$::form->{filter}, |
|
372 |
with_objects => [ 'customer', 'type', 'status', 'project' ], |
|
373 |
launder_to => $self->{filter}, |
|
374 |
); |
|
375 |
|
|
376 |
$args{where} = [ |
|
377 |
and => [ |
|
378 |
@{ $args{where} || [] }, |
|
379 |
working_copy_id => undef, |
|
380 |
is_template => $::form->{is_template} ? 1 : 0, |
|
381 |
]]; |
|
382 |
|
|
383 |
$self->db_args(\%args); |
|
384 |
} |
|
385 |
|
|
386 | 370 |
sub prepare_report { |
387 | 371 |
my ($self) = @_; |
388 | 372 |
|
Auch abrufbar als: Unified diff
Pflichtenheft: Liste auf Filtered-Helfer umgestellt