use SL::ClientJS;
use SL::Controller::Helper::GetModels;
+use SL::Controller::Helper::Filtered;
use SL::Controller::Helper::Paginated;
use SL::Controller::Helper::Sorted;
use SL::Controller::Helper::ParseFilter;
use Rose::Object::MakeMethods::Generic
(
- scalar => [ qw(requirement_spec_item customers types statuses db_args flat_filter visible_item visible_section) ],
+ scalar => [ qw(requirement_spec_item customers types statuses visible_item visible_section) ],
'scalar --get_set_init' => [ qw(requirement_spec complexities risks projects copy_source js current_text_block_output_position) ],
);
__PACKAGE__->run_before('setup');
__PACKAGE__->run_before('load_select_options', only => [ qw(new ajax_edit create update list) ]);
-
-__PACKAGE__->get_models_url_params('flat_filter');
+__PACKAGE__->make_filtered(
+ MODEL => 'RequirementSpec',
+ LAUNDER_TO => 'filter'
+);
__PACKAGE__->make_paginated(
- MODEL => 'RequirementSpec',
- PAGINATE_ARGS => 'db_args',
- ONLY => [ qw(list) ],
+ MODEL => 'RequirementSpec',
+ ONLY => [ qw(list) ],
);
-
__PACKAGE__->make_sorted(
MODEL => 'RequirementSpec',
ONLY => [ qw(list) ],
sub action_list {
my ($self) = @_;
- $self->setup_db_args_from_filter;
- $self->flat_filter({ map { $_->{key} => $_->{value} } $::form->flatten_variables('filter') });
+ my $requirement_specs = $self->get_models(
+ query => [
+ and => [
+ working_copy_id => undef,
+ is_template => $::form->{is_template} ? 1 : 0,
+ ]],
+ with_objects => [ 'customer', 'type', 'status', 'project' ],
+ );
$self->prepare_report;
-
- my $requirement_specs = $self->get_models(%{ $self->db_args });
-
$self->report_generator_list_objects(report => $self->{report}, objects => $requirement_specs);
}
$self->redirect_to(action => 'show', id => $self->requirement_spec->id);
}
-sub setup_db_args_from_filter {
- my ($self) = @_;
-
- $self->{filter} = {};
- my %args = parse_filter(
- $::form->{filter},
- with_objects => [ 'customer', 'type', 'status', 'project' ],
- launder_to => $self->{filter},
- );
-
- $args{where} = [
- and => [
- @{ $args{where} || [] },
- working_copy_id => undef,
- is_template => $::form->{is_template} ? 1 : 0,
- ]];
-
- $self->db_args(\%args);
-}
-
sub prepare_report {
my ($self) = @_;