$self->prepare_report;
- $self->{projects} = $self->get_models(%{ $self->db_args });
+ my $projects = $self->get_models(%{ $self->db_args });
- $self->list_objects;
+ $self->report_generator_list_objects(report => $self->{report}, objects => $projects);
}
sub action_new {
$params{CUSTOM_VARIABLES} = CVar->get_custom_variables(module => 'Projects', trans_id => $self->project->id);
CVar->render_inputs(variables => $params{CUSTOM_VARIABLES}) if @{ $params{CUSTOM_VARIABLES} };
- $::request->{layout}->focus('#projectnumber');
-
$self->render('project/form', %params);
}
controller_class => 'Project',
output_format => 'HTML',
top_info_text => $::locale->text('Projects'),
- raw_bottom_info_text => $self->render('project/report_bottom', { no_output => 1, partial => 1 }),
+ raw_bottom_info_text => $self->render('project/report_bottom', { output => 0 }),
title => $::locale->text('Projects'),
allow_pdf_export => 1,
allow_csv_export => 1,
$self->set_report_generator_sort_options(report => $report, sortable_columns => \@sortable);
$self->disable_pagination if $report->{options}{output_format} =~ /^(pdf|csv)$/i;
-
- $self->{report_data} = {
- column_defs => \%column_defs,
- columns => \@columns,
- };
-}
-
-sub list_objects {
- my ($self) = @_;
- my $column_defs = $self->{report_data}->{column_defs};
-
- for my $obj (@{ $self->{projects} || [] }) {
- my %data = map {
- $_ => {
- data => $column_defs->{$_}{sub} ? $column_defs->{$_}{sub}->($obj)
- : $obj->can($_) ? $obj->$_
- : $obj->{$_},
- link => $column_defs->{$_}{obj_link} ? $column_defs->{$_}{obj_link}->($obj) : '',
- },
- } @{ $self->{report_data}{columns} || {} };
-
- $self->{report}->add_data(\%data);
- }
-
- return $self->{report}->generate_with_headers;
}
1;