10 |
10 |
use SL::ClientJS;
|
11 |
11 |
use SL::Common ();
|
12 |
12 |
use SL::Controller::Helper::GetModels;
|
13 |
|
use SL::Controller::Helper::Filtered;
|
14 |
|
use SL::Controller::Helper::Paginated;
|
15 |
|
use SL::Controller::Helper::Sorted;
|
16 |
|
use SL::Controller::Helper::ParseFilter;
|
17 |
13 |
use SL::Controller::Helper::ReportGenerator;
|
18 |
14 |
use SL::Controller::Helper::RequirementSpec;
|
19 |
15 |
use SL::DB::Customer;
|
... | ... | |
33 |
29 |
(
|
34 |
30 |
scalar => [ qw(requirement_spec_item visible_item visible_section) ],
|
35 |
31 |
'scalar --get_set_init' => [ qw(requirement_spec customers types statuses complexities risks projects project_types project_statuses default_project_type default_project_status copy_source js
|
36 |
|
current_text_block_output_position) ],
|
|
32 |
current_text_block_output_position models) ],
|
37 |
33 |
);
|
38 |
34 |
|
39 |
35 |
__PACKAGE__->run_before('setup');
|
40 |
36 |
|
41 |
|
__PACKAGE__->make_filtered(
|
42 |
|
MODEL => 'RequirementSpec',
|
43 |
|
LAUNDER_TO => 'filter'
|
44 |
|
);
|
45 |
|
__PACKAGE__->make_paginated(
|
46 |
|
MODEL => 'RequirementSpec',
|
47 |
|
ONLY => [ qw(list) ],
|
48 |
|
);
|
49 |
|
__PACKAGE__->make_sorted(
|
50 |
|
MODEL => 'RequirementSpec',
|
51 |
|
ONLY => [ qw(list) ],
|
52 |
|
|
53 |
|
DEFAULT_BY => 'customer',
|
54 |
|
DEFAULT_DIR => 1,
|
55 |
|
|
|
37 |
my %sort_columns = (
|
56 |
38 |
customer => t8('Customer'),
|
57 |
39 |
title => t8('Title'),
|
58 |
40 |
type => t8('Requirement Spec Type'),
|
... | ... | |
70 |
52 |
sub action_list {
|
71 |
53 |
my ($self) = @_;
|
72 |
54 |
|
73 |
|
my $requirement_specs = $self->get_models(
|
74 |
|
query => [
|
75 |
|
and => [
|
76 |
|
working_copy_id => undef,
|
77 |
|
is_template => $::form->{is_template} ? 1 : 0,
|
78 |
|
]],
|
79 |
|
with_objects => [ 'customer', 'type', 'status', 'project' ],
|
80 |
|
);
|
81 |
|
|
82 |
55 |
$self->prepare_report;
|
83 |
|
$self->report_generator_list_objects(report => $self->{report}, objects => $requirement_specs);
|
|
56 |
$self->report_generator_list_objects(report => $self->{report}, objects => $self->models->get);
|
84 |
57 |
}
|
85 |
58 |
|
86 |
59 |
sub action_new {
|
... | ... | |
395 |
368 |
sub prepare_report {
|
396 |
369 |
my ($self) = @_;
|
397 |
370 |
|
398 |
|
my $callback = $self->get_callback;
|
399 |
|
|
400 |
371 |
my $is_template = $::form->{is_template};
|
401 |
372 |
my $report = SL::ReportGenerator->new(\%::myconfig, $::form);
|
|
373 |
|
|
374 |
$self->models->disable_plugin('paginated') if $report->{options}{output_format} =~ /^(pdf|csv)$/i;
|
|
375 |
$self->models->finalize; # for filter laundering
|
|
376 |
my $callback = $self->models->get_callback;
|
|
377 |
|
402 |
378 |
$self->{report} = $report;
|
403 |
379 |
|
404 |
380 |
my @columns = $is_template ? qw(title mtime) : qw(title customer status type projectnumber mtime version);
|
... | ... | |
422 |
398 |
);
|
423 |
399 |
}
|
424 |
400 |
|
425 |
|
map { $column_defs{$_}->{text} ||= $::locale->text( $self->get_sort_spec->{$_}->{title} ) } keys %column_defs;
|
|
401 |
map { $column_defs{$_}->{text} ||= $::locale->text( $self->models->get_sort_spec->{$_}->{title} ) } keys %column_defs;
|
426 |
402 |
|
427 |
403 |
$report->set_options(
|
428 |
404 |
std_column_visibility => 1,
|
429 |
405 |
controller_class => 'RequirementSpec',
|
430 |
406 |
output_format => 'HTML',
|
431 |
407 |
raw_top_info_text => $self->render('requirement_spec/report_top', { output => 0 }, is_template => $is_template),
|
432 |
|
raw_bottom_info_text => $self->render('requirement_spec/report_bottom', { output => 0 }),
|
|
408 |
raw_bottom_info_text => $self->render('requirement_spec/report_bottom', { output => 0 }, models => $self->models),
|
433 |
409 |
title => $is_template ? t8('Requirement Spec Templates') : t8('Requirement Specs'),
|
434 |
410 |
allow_pdf_export => 1,
|
435 |
411 |
allow_csv_export => 1,
|
... | ... | |
438 |
414 |
$report->set_column_order(@columns);
|
439 |
415 |
$report->set_export_options(qw(list filter));
|
440 |
416 |
$report->set_options_from_form;
|
441 |
|
$self->set_report_generator_sort_options(report => $report, sortable_columns => \@sortable);
|
442 |
|
|
443 |
|
$self->disable_pagination if $report->{options}{output_format} =~ /^(pdf|csv)$/i;
|
|
417 |
$self->models->set_report_generator_sort_options(report => $report, sortable_columns => \@sortable);
|
444 |
418 |
}
|
445 |
419 |
|
446 |
420 |
sub invalidate_version {
|
... | ... | |
567 |
541 |
->render($self);
|
568 |
542 |
}
|
569 |
543 |
|
|
544 |
sub init_models {
|
|
545 |
my ($self) = @_;
|
|
546 |
|
|
547 |
SL::Controller::Helper::GetModels->new(
|
|
548 |
controller => $self,
|
|
549 |
sorted => {
|
|
550 |
_default => {
|
|
551 |
by => 'customer',
|
|
552 |
dir => 1,
|
|
553 |
},
|
|
554 |
%sort_columns,
|
|
555 |
},
|
|
556 |
query => [
|
|
557 |
and => [
|
|
558 |
working_copy_id => undef,
|
|
559 |
is_template => $::form->{is_template} ? 1 : 0,
|
|
560 |
],
|
|
561 |
],
|
|
562 |
with_objects => [ 'customer', 'type', 'status', 'project' ],
|
|
563 |
);
|
|
564 |
}
|
|
565 |
|
570 |
566 |
1;
|
RequirementSpec Suche auf GetModels umgestellt.