From: Bill Erickson Date: Mon, 26 Mar 2012 13:56:58 +0000 (-0400) Subject: Flattener stores might_have links as arrays X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=5c3f4d6547bbaf75185e95a2f8855ca8b480508e;p=working%2FEvergreen.git Flattener stores might_have links as arrays E.g. "aou", {"addrs" : "addresses.id"} { "addrs" : [ 1,2,3 ] } Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Flattener.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Flattener.pm index 09e20b1c8c..73d73be574 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Flattener.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Flattener.pm @@ -371,7 +371,12 @@ sub process_result { last unless ref $obj; } - $flatrow->{$key} = ref $obj ? $obj->$field : undef; + if (ref $obj eq 'ARRAY') { + # might_have links return arrays + $flatrow->{$key} = [ map {$_->$field} @$obj ]; + } else { + $flatrow->{$key} = ref $obj ? $obj->$field : undef; + } } return $flatrow;