From 576c928c0829062050409c4fe0cf3ce13856b3b0 Mon Sep 17 00:00:00 2001
From: Christopher Brannon <cbrannon@cdalibrary.org>
Date: Thu, 27 Sep 2018 19:55:34 +0000
Subject: [PATCH] Bug 21444: Adds the permanent location

To Test:
1) Be sure ReturnToShelvingCart is set to Move.
2) Check out an item.
3) Check in the item.
4) Note that only the CART location shows in the Shelving location
column.
5) Apply the patch.
6) Check out an item.
7) Check in the item.
8) Note that the permant location now shows with the cart location next
to in in parenthesis.
9) Try combinations of missing descriptions or missing locations from
the LOC table for the item permanent location and cart.  If there is no
description, it should show the code in its place.  If there is no
location defined, it will show either the code that is stored in the
item or be blank.
---
 circ/returns.pl | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/circ/returns.pl b/circ/returns.pl
index c2f20ef..3b2a7a4 100755
--- a/circ/returns.pl
+++ b/circ/returns.pl
@@ -598,10 +598,13 @@ foreach ( sort { $a <=> $b } keys %returneditems ) {
         $ri{barcode}             = $bar_code;
         $ri{homebranch}          = $item->homebranch;
         $ri{holdingbranch}       = $item->holdingbranch;
+        $ri{location}            = $item->location;
+        $ri{permlocation}        = $item->permanent_location;
 
-        $ri{location} = $item->location;
         my $shelfcode = $ri{'location'};
-        $ri{'location'} = $shelflocations->{$shelfcode} if ( defined( $shelfcode ) && defined($shelflocations) && exists( $shelflocations->{$shelfcode} ) );
+        my $permshelfcode = $ri{'permlocation'};
+        $ri{'location'} = ( $shelflocations->{$permshelfcode} ne '' ) ? $shelflocations->{$permshelfcode} : ( $permshelfcode ) ? $permshelfcode : undef;
+        $ri{'location'} .= ( ( $shelflocations->{$shelfcode} ne '' ) && ( $shelfcode ne $permshelfcode ) ) ? ' (' . $shelflocations->{$shelfcode} . ')' : ( ( $shelfcode ) && ( $shelfcode ne $permshelfcode ) ) ? ' (' . $shelfcode . ')' : undef;
 
     }
     else {
-- 
2.1.4