use Carp;
use List::Util qw(max);
+use Scalar::Util qw(blessed);
use SL::Common;
use SL::MoreCommon;
my @columns = $params{report}->get_visible_columns('HTML');
for my $obj (@{ $params{objects} || [] }) {
- my %data = map {
- my $def = $column_defs->{$_};
- $_ => {
- raw_data => $def->{raw_data} ? $def->{raw_data}->($obj) : '',
- data => $def->{sub} ? $def->{sub}->($obj)
- : $obj->can($_) ? $obj->$_
- : $obj->{$_},
- link => $def->{obj_link} ? $def->{obj_link}->($obj) : '',
- },
- } @columns;
+ my %data;
+
+ if (blessed($obj) && $obj->isa('SL::Controller::Helper::ReportGenerator::ControlRow::Base')) {
+ $obj->set_data($params{report});
+ next;
+
+ } else {
+ %data = map {
+ my $def = $column_defs->{$_};
+ my $tmp;
+ $tmp->{raw_data} = $def->{raw_data} ? $def->{raw_data}->($obj) : '';
+ $tmp->{data} = $def->{sub} ? $def->{sub}->($obj)
+ : $obj->can($_) ? $obj->$_
+ : $obj->{$_};
+ $tmp->{link} = $def->{obj_link} ? $def->{obj_link}->($obj) : '';
+ $_ => $tmp;
+ } @columns;
+ }
$params{data_callback}->(\%data) if $params{data_callback};
Mandatory. An array reference of RDBO models to output.
+An element of the array can also be an instance of a control row, i.e.
+an instance of a class derived from
+C<SL::Controller::Helper::ReportGenerator::ControlRow::Base>.
+See also:
+
+L<SL::Controller::Helper::ReportGenerator::ControlRow>
+L<SL::Controller::Helper::ReportGenerator::ControlRow::*>
+
=item C<data_callback>
Optional. A callback handler (code reference) that gets called for