X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FRecordLinks.pm;h=900123ef835df96037212fd0a27a4f785cd58916;hb=50b0d77d76ce3e5b6eb0b637386d540672a59234;hp=aceb57f1eed37565338f1d3dfd5fb993ffea8ad9;hpb=f1dd4b47874f1c231e539ad5a6e918fdffbb539c;p=kivitendo-erp.git diff --git a/SL/Controller/RecordLinks.pm b/SL/Controller/RecordLinks.pm index aceb57f1e..900123ef8 100644 --- a/SL/Controller/RecordLinks.pm +++ b/SL/Controller/RecordLinks.pm @@ -252,6 +252,13 @@ sub get_order_centric_linked_records { my $all_linked_records = $self->object->linked_records(direction => 'from', recursive => 1); my $filtered_orders = [ grep { 'SL::DB::Order' eq ref $_ && $_->is_type('sales_order') } @$all_linked_records ]; + + # no orders no call to linked_records via batch mode + # but instead return default list + return $self->object->linked_records(direction => 'both', recursive => 1, save_path => 1) + unless scalar @$filtered_orders; + + # we have a order, therefore get the tree view from the top (order) my $id_ref = [ map { $_->id } @$filtered_orders ]; my $linked_records = SL::DB::Order->new->linked_records(direction => 'to', recursive => 1, batch => $id_ref); push @{ $linked_records }, @$filtered_orders;