From d6d08d5ee343b6552656a9bb7450374897a16e1a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Wed, 4 Jun 2014 16:28:20 +0200 Subject: [PATCH] RecordLinks: Anzeige etwas verbessert --- SL/Controller/RecordLinks.pm | 2 +- SL/DB/Helper/LinkedRecords.pm | 7 +++++-- SL/Presenter/Record.pm | 7 ++++++- locale/de/all | 1 + 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/SL/Controller/RecordLinks.pm b/SL/Controller/RecordLinks.pm index ea0c7782b..08a95bd8b 100644 --- a/SL/Controller/RecordLinks.pm +++ b/SL/Controller/RecordLinks.pm @@ -53,7 +53,7 @@ sub action_ajax_list { my ($self) = @_; eval { - my $linked_records = $self->object->linked_records(direction => 'both', recursive => 1); + my $linked_records = $self->object->linked_records(direction => 'both', recursive => 1, save_path => 1); push @{ $linked_records }, $self->object->sepa_export_items if $self->object->can('sepa_export_items'); my $output = SL::Presenter->get->grouped_record_list( $linked_records, diff --git a/SL/DB/Helper/LinkedRecords.pm b/SL/DB/Helper/LinkedRecords.pm index b75597abb..cca9fe3c1 100644 --- a/SL/DB/Helper/LinkedRecords.pm +++ b/SL/DB/Helper/LinkedRecords.pm @@ -154,8 +154,11 @@ sub _linked_records_implementation { if ($params{save_path}) { my %links_by_id = map { $_->{id} => $_ } @$links; for (@objects) { - $_->{_record_link_path} = $links_by_id{$_->{_record_link}->id}->{path}; - $_->{_record_link_depth} = $links_by_id{$_->{_record_link}->id}->{depth}; + my $link = $links_by_id{$_->{_record_link}->id}; + my $intermediate_links = SL::DB::Manager::RecordLink->get_all(query => [ id => $link->{path} ]); + $_->{_record_link_path} = $link->{path}; + $_->{_record_link_obj_path} = [ map { $get_objects->($_) } @$intermediate_links ]; + $_->{_record_link_depth} = $link->{depth}; } } diff --git a/SL/Presenter/Record.pm b/SL/Presenter/Record.pm index 2bbaaf611..368a05d7c 100644 --- a/SL/Presenter/Record.pm +++ b/SL/Presenter/Record.pm @@ -75,7 +75,12 @@ sub record_list { if ($with_columns{record_link_direction}) { push @columns, { title => $::locale->text('Link direction'), - data => sub { $_[0]->{_record_link_direction} eq 'from' ? $::locale->text('Row was source for current record') : $::locale->text('Row was created from current record') }, + data => sub { + $_[0]->{_record_link_depth} > 1 + ? $::locale->text('Row was linked to another record') + : $_[0]->{_record_link_direction} eq 'from' + ? $::locale->text('Row was source for current record') + : $::locale->text('Row was created from current record') }, }; } diff --git a/locale/de/all b/locale/de/all index 9c2a9fc17..56d5255d8 100755 --- a/locale/de/all +++ b/locale/de/all @@ -1964,6 +1964,7 @@ $self->{texts} = { 'Row #1: amount has to be different from zero.' => 'Zeile #1: Der Wert darf nicht 0 sein.', 'Row number' => 'Zeilennummer', 'Row was created from current record' => 'Zeile wurde aus aktuellem Beleg erstellt', + 'Row was linked to another record' => 'Zeile wurde über einen anderen Beleg verlinkt', 'Row was source for current record' => 'Zeile war Quelle für aktuellen Beleg', 'Run at' => 'Ausgeführt um', 'SAVED' => 'Gespeichert', -- 2.20.1