From: Jan Büren Date: Fri, 22 Oct 2021 12:07:58 +0000 (+0200) Subject: Auftragzentrische verknüpfte Belege: Leere Ergebnismengen berücksichtigen X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~318 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=4108834d98bf42418066a476b7be37ded64c9f11;p=kivitendo-erp.git Auftragzentrische verknüpfte Belege: Leere Ergebnismengen berücksichtigen Falls keine Aufträge gefunden werden, auch keinen Aufruf --- 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;