croak "Parameter 'objects' must exist and be an array reference" if ref($params{objects}) ne 'ARRAY';
croak "Parameter 'report' must exist and be an instance of SL::ReportGenerator" if ref($params{report}) ne 'SL::ReportGenerator';
croak "Parameter 'options', if exists, must be a hash reference" if $params{options} && (ref($params{options}) ne 'HASH');
+ $params{layout} //= 1;
my $column_defs = $params{report}->{columns};
my @columns = $params{report}->get_visible_columns;
$params{report}->add_data(\%data);
}
- return $params{report}->generate_with_headers(%{ $params{options} || {}});
+ if ($params{layout}) {
+ return $params{report}->generate_with_headers(%{ $params{options} || {}});
+ } else {
+ my $html = $params{report}->generate_html_content(%{ $params{options} || {}});
+ $self->render(\$html , { layout => 0, process => 0 });
+ }
}
1;
);
my $db_args = $self->setup_for_list(%list_params);
- $self->{pages} = SL::DB::Manager::OrderItem->paginate(%list_params, args => $db_args, per_page => 10);
+ $self->{pages} = SL::DB::Manager::OrderItem->paginate(%list_params, args => $db_args, per_page => 5);
my $bottom = $::form->parse_html_template('price_information/report_bottom', { SELF => $self });
my $orderitems = SL::DB::Manager::OrderItem->get_all(%$db_args);
- $self->report_generator_list_objects(report => $self->{report}, objects => $orderitems, options => { no_layout => 1 });
+ $self->report_generator_list_objects(report => $self->{report}, objects => $orderitems, layout => 0, header => 0);
}
# private functions