From 8977fb70f12832d81c5228a9a5e61344a1fdc9e5 Mon Sep 17 00:00:00 2001 From: Christopher Brannon Date: Mon, 1 Oct 2018 00:48:31 +0000 Subject: [PATCH] Bug 18355: Modifies location on details pages. TEST PLAN: 1) Make sure ReturnToShelvingCart is set to Move. 2) Check in an item. 3) View the item in detail.pl and opac-detail.pl and see that only the cart location shows. 4) Apply patch and view the item again in check detail and opac-detail.pl. You should now see the permanent location, and the cart location in parenthesis. 5) Try removing descriptions from locations. Codes should replace descriptions when not available. Nothing should show if a value (code is missing. 6) Check another item that was not checked in. You should see the permanent location and not a secondary location. --- catalogue/detail.pl | 4 +++- opac/opac-detail.pl | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index fe59fa1..2582c69 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -254,7 +254,9 @@ foreach my $item (@items) { #get shelf location and collection code description if they are authorised value. # same thing for copy number my $shelfcode = $item->{'location'}; - $item->{'location'} = $shelflocations->{$shelfcode} if ( defined( $shelfcode ) && defined($shelflocations) && exists( $shelflocations->{$shelfcode} ) ); + my $permshelfcode = $item->{'permanent_location'}; + $item->{'location'} = ( $shelflocations->{$permshelfcode} ne '' ) ? $shelflocations->{$permshelfcode} : ( $permshelfcode ) ? $permshelfcode : undef; + $item->{'location'} .= ( ( $shelflocations->{$shelfcode} ne '' ) && ( $shelfcode ne $permshelfcode ) ) ? ' (' . $shelflocations->{$shelfcode} . ')' : ( ( $shelfcode ) && ( $shelfcode ne $permshelfcode ) ) ? ' (' . $shelfcode . ')' : undef; my $ccode = $item->{'ccode'}; $item->{'ccode'} = $collections->{$ccode} if ( defined( $ccode ) && defined($collections) && exists( $collections->{$ccode} ) ); my $copynumber = $item->{'copynumber'}; diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 6f10c6b..9ce3068 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -682,9 +682,10 @@ if ( not $viewallitems and @items > $max_items_to_display ) { $itm->{'ccode'} = $collections->{$ccode} if defined($ccode) && $collections && exists( $collections->{$ccode} ); my $copynumber = $itm->{'copynumber'}; $itm->{'copynumber'} = $copynumbers->{$copynumber} if ( defined($copynumbers) && defined($copynumber) && exists( $copynumbers->{$copynumber} ) ); - if ( defined $itm->{'location'} ) { - $itm->{'location_description'} = $shelflocations->{ $itm->{'location'} }; - } + my $shelfcode = $itm->{'location'}; + my $permshelfcode = $itm->{'permanent_location'}; + $itm->{'location_description'} = ( $shelflocations->{$permshelfcode} ne '' ) ? $shelflocations->{$permshelfcode} : ( $permshelfcode ) ? $permshelfcode : undef;$itm->{'location_description'} = ( $shelflocations->{$permshelfcode} ne '' ) ? $shelflocations->{$permshelfcode} : ( $permshelfcode ) ? $permshelfcode : undef; + $itm->{'location_description'} .= ( ( $shelflocations->{$shelfcode} ne '' ) && ( $shelfcode ne $permshelfcode ) ) ? ' (' . $shelflocations->{$shelfcode} . ')' : ( ( $shelfcode ) && ( $shelfcode ne $permshelfcode ) ) ? ' (' . $shelfcode . ')' : undef; if (exists $itm->{itype} && defined($itm->{itype}) && exists $itemtypes->{ $itm->{itype} }) { $itm->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{ $itm->{itype} }->{'imageurl'} ); $itm->{'description'} = $itemtypes->{ $itm->{itype} }->{translated_description}; -- 2.1.4