From 5c3f4d6547bbaf75185e95a2f8855ca8b480508e Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 26 Mar 2012 09:56:58 -0400 Subject: [PATCH] Flattener stores might_have links as arrays E.g. "aou", {"addrs" : "addresses.id"} { "addrs" : [ 1,2,3 ] } Signed-off-by: Bill Erickson --- Open-ILS/src/perlmods/lib/OpenILS/Application/Flattener.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; -- 2.11.0