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-Tag: sprint4-merge-nov22~5128^2~72^2~148^2~2 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=57dbda297636895f2b9d715ba868c25a05c5fe9e;p=working%2FEvergreen.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 e2b967fa0a..fdf5abc014 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm @@ -1801,6 +1801,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; @@ -1834,8 +1835,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;