From 4108834d98bf42418066a476b7be37ded64c9f11 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Fri, 22 Oct 2021 14:07:58 +0200 Subject: [PATCH] =?utf8?q?Auftragzentrische=20verkn=C3=BCpfte=20Belege:=20?= =?utf8?q?Leere=20Ergebnismengen=20ber=C3=BCcksichtigen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Falls keine Aufträge gefunden werden, auch keinen Aufruf --- SL/Controller/RecordLinks.pm | 7 +++++++ 1 file changed, 7 insertions(+) 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; -- 2.20.1