From: berick Date: Fri, 18 Mar 2011 18:31:07 +0000 (-0400) Subject: in bib attr (mra) fetcher, get the display label from the ccvm where appropriate... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=1a0dda8ca9b1f2660c90e813a63dcc8943e403be;p=evergreen%2Fequinox.git in bib attr (mra) fetcher, get the display label from the ccvm where appropriate and add to response object --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm index 0ac5d775d4..e7dc1786ca 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm @@ -1822,6 +1822,7 @@ sub create_circ_chain_summary { # Returns "mra" attribute key/value pairs for a set of bre's # Takes a list of bre IDs, returns a hash of hashes, # {bre1=> {key1 => value1, key2 => value2, ...}, bre2 => {...}, ...} +my $ccvm_cache; sub get_bre_attrs { my ($class, $bre_ids, $e) = @_; $e = $e || OpenILS::Utils::CStoreEditor->new; @@ -1855,8 +1856,19 @@ sub get_bre_attrs { return $attrs unless $mra; + $ccvm_cache = $ccvm_cache || $e->search_config_coded_value_map({id => {'!=' => undef}}); + for my $id (@$bre_ids) { - $attrs->{$id} = { map {$_->{key} => $_->{value}} grep { $_->{bre} eq $id } @$mra }; + $attrs->{$id} = {}; + for my $mra (grep { $_->{bre} eq $id } @$mra) { + my $ctype = $mra->{key}; + my $code = $mra->{value}; + $attrs->{$id}->{$ctype} = {code => $code}; + if($code) { + my ($ccvm) = grep { $_->ctype eq $ctype and $_->code eq $code } @$ccvm_cache; + $attrs->{$id}->{$ctype}->{label} = $ccvm->value if $ccvm; + } + } } return $attrs;