X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FHelper%2FLinkedRecords.pm;h=dd22863d124fc28b9a458892c23af3b81ea4b301;hb=701674940c1daf886257a14c5e933fcda2a1883d;hp=3fb594848164cf17c2c55bb63966a327bbd56a03;hpb=460cd14ecfb30a599884bb7dffbcdcdca9e7c432;p=kivitendo-erp.git diff --git a/SL/DB/Helper/LinkedRecords.pm b/SL/DB/Helper/LinkedRecords.pm index 3fb594848..dd22863d1 100644 --- a/SL/DB/Helper/LinkedRecords.pm +++ b/SL/DB/Helper/LinkedRecords.pm @@ -64,10 +64,15 @@ sub _linked_records_implementation { my @get_objects_query = ref($params{query}) eq 'ARRAY' ? @{ $params{query} } : (); my $get_objects = sub { - my $manager_class = SL::DB::Helper::Mappings::get_manager_package_for_table($_[0]->$sub_wanted_table); - my $object_class = SL::DB::Helper::Mappings::get_package_for_table($_[0]->$sub_wanted_table); + my ($link) = @_; + my $manager_class = SL::DB::Helper::Mappings::get_manager_package_for_table($link->$sub_wanted_table); + my $object_class = SL::DB::Helper::Mappings::get_package_for_table($link->$sub_wanted_table); eval "require " . $object_class . "; 1;"; - return @{ $manager_class->get_all(query => [ id => $_[0]->$sub_wanted_id, @get_objects_query ]) }; + return map { + $_->{_record_link_direction} = $wanted; + $_->{_record_link} = $link; + $_ + } @{ $manager_class->get_all(query => [ id => $link->$sub_wanted_id, @get_objects_query ]) }; }; # If no 'via' is given then use a simple(r) method for querying the wanted objects. @@ -295,7 +300,22 @@ the current employee. =back -Returns an array reference. +Returns an array reference. Each element returned is a Rose::DB +instance. Additionally several elements in the element returned are +set to special values: + +=over 2 + +=item C<_record_link_direction> + +Either C or C indicating the direction. C means that +this object is the source in the link. + +=item C<_record_link> + +The actual database link object (an instance of L). + +=back =item C