From 4e896da9cab2daba2cb925fc2a8bf61a70c6ea10 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Wed, 23 Jul 2014 10:49:01 +0200 Subject: [PATCH] Bug 11425: Display location label instead of code Signed-off-by: Bernardo Gonzalez Kriegel Minor conflicts solved Last three patches signed No koha-qa errors. Signed-off-by: Kyle M Hall --- catalogue/itemsearch.pl | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/catalogue/itemsearch.pl b/catalogue/itemsearch.pl index 280f35a486..35d1a0039d 100755 --- a/catalogue/itemsearch.pl +++ b/catalogue/itemsearch.pl @@ -90,6 +90,9 @@ my ($template, $borrowernumber, $cookie) = get_template_and_user({ my $notforloan_avcode = GetAuthValCode('items.notforloan'); my $notforloan_values = GetAuthorisedValues($notforloan_avcode); +my $location_avcode = GetAuthValCode('items.location'); +my $location_values = GetAuthorisedValues($location_avcode); + if (scalar keys %params > 0) { # Parameters given, it's a search @@ -193,10 +196,19 @@ if (scalar keys %params > 0) { $notforloan_map->{$nfl_value->{authorised_value}} = $nfl_value->{lib}; } + # Get location labels + my $location_map = {}; + foreach my $loc_value (@$location_values) { + $location_map->{$loc_value->{authorised_value}} = $loc_value->{lib}; + } + foreach my $item (@$results) { $item->{biblio} = GetBiblio($item->{biblionumber}); ($item->{biblioitem}) = GetBiblioItemByBiblioNumber($item->{biblionumber}); $item->{status} = $notforloan_map->{$item->{notforloan}}; + if (defined $item->{location}) { + $item->{location} = $location_map->{$item->{location}}; + } } } @@ -236,12 +248,11 @@ if ($format eq 'html') { label => $branches->{$branchcode}->{branchname}, }; } - my $locations = GetAuthorisedValues('LOC'); my @locations; - foreach my $location (@$locations) { + foreach my $location (@$location_values) { push @locations, { value => $location->{authorised_value}, - label => $location->{lib}, + label => $location->{lib} // $location->{authorised_value}, }; } my @itemtypes = C4::ItemType->all(); -- 2.39.5