X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/60e1aa5531badb7f7ff81b6ebfc577060b8f3cfe..d0172f91bb58d5aac0748d673f29b0565631447e:/SL/Presenter/Record.pm diff --git a/SL/Presenter/Record.pm b/SL/Presenter/Record.pm index 64cb21ba7..db0caa542 100644 --- a/SL/Presenter/Record.pm +++ b/SL/Presenter/Record.pm @@ -20,7 +20,8 @@ sub _arrayify { sub grouped_record_list { my ($self, $list, %params) = @_; - %params = map { exists $params{$_} ? ($_ => $params{$_}) : () } qw(selectable with_columns); + %params = map { exists $params{$_} ? ($_ => $params{$_}) : () } qw(edit_record_links form_prefix with_columns object_id object_model); + $params{form_prefix} ||= 'record_links'; my %groups = _group_records($list); my $output = ''; @@ -37,6 +38,8 @@ sub grouped_record_list { $output .= _purchase_invoice_list( $self, $groups{purchase_invoices}, %params) if $groups{purchase_invoices}; $output .= _ar_transaction_list( $self, $groups{ar_transactions}, %params) if $groups{ar_transactions}; + $output = $self->render('presenter/record/grouped_record_list', %params, output => $output, nownow => DateTime->now) if $output; + return $output || $self->empty_record_list; } @@ -110,14 +113,16 @@ sub record_list { push @row, \%cell; } - push @data, \@row; + push @data, { columns => \@row, record_link => $obj->{_record_link} }; } my @header = map +{ value => $columns[$_]->{title}, - alignment => $data[0]->[$_]->{alignment}, + alignment => $data[0]->{columns}->[$_]->{alignment}, }, (0..scalar(@columns) - 1); + $params{form_prefix} ||= 'record_links'; + return $self->render( 'presenter/record/record_list', %params, @@ -425,6 +430,9 @@ The order in which the records are grouped is: Objects of unknown types are skipped. +Parameters are passed to C include C and +C. + =item C Returns a rendered version (actually an instance of @@ -465,6 +473,26 @@ If the column spec is a hash reference then the same arguments are expected. The corresponding hash keys are C, C<data> and C<link>. +=item C<with_columns> + +Can be set by the caller to indicate additional columns to +list. Currently supported: + +=over 2 + +=item C<record_link_destination> + +The record link destination. Requires that the records to list have +been retrieved via the L<SL::DB::Helper::LinkedRecords> helper. + +=back + +=item C<edit_record_links> + +If trueish additional controls will be rendered that allow the user to +remove and add record links. Requires that the records to list have +been retrieved via the L<SL::DB::Helper::LinkedRecords> helper. + =back =back