From 9bee96d49524f6030a49186df39a981cdf4b9b96 Mon Sep 17 00:00:00 2001
From: Nick Clemens <nick@bywatersolutions.com>
Date: Mon, 12 Apr 2021 14:18:20 +0000
Subject: [PATCH] Bug 28136: Handle Transferred status for ResFound

bug 25690 added a new 'Transferred' status to 'ResFound', this status
needs to be handled in circ/returns.pl

To test:
1 - Place a hold on an item at Branch B for pickup at Branch A
2 - Check in the item at Branch B - confirm hold and transfer
3 - Check in the item at Branch A - nothing happens?
4 - Apply patch
5 - Checkin in the item at Branch A - hold popup appears
6 - Clear the hold and place it again
7 - Set system preference 'HoldsAutoFill' to do
8 - Check in the item at Branch B - hold is found and confirmed
9 - Check in the item at Branch A - hold is found and confirmed
---
 circ/returns.pl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/circ/returns.pl b/circ/returns.pl
index b58e340f85..28c0b832f3 100755
--- a/circ/returns.pl
+++ b/circ/returns.pl
@@ -417,7 +417,7 @@ if ( $messages->{'ResFound'}) {
     my $patron = Koha::Patrons->find( $reserve->{borrowernumber} );
     my $holdmsgpreferences =  C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $reserve->{'borrowernumber'}, message_name   => 'Hold_Filled' } );
     my $branchCheck = ( $userenv_branch eq $reserve->{branchcode} );
-    if ( $reserve->{'ResFound'} eq "Reserved" && C4::Context->preference('HoldsAutoFill') ) {
+    if ( ( $reserve->{'ResFound'} eq "Reserved" || $reserve->{'ResFound'} eq "Transferred" ) && C4::Context->preference('HoldsAutoFill') ) {
         my $item = Koha::Items->find( $itemnumber );
         my $biblio = $item->biblio;
 
@@ -443,7 +443,7 @@ if ( $messages->{'ResFound'}) {
         $template->param(
             waiting      => $branchCheck ? 1 : undef,
         );
-    } elsif ( $reserve->{'ResFound'} eq "Reserved" || $reserve->{'ResFound'} eq "Processing" ) {
+    } elsif ( $reserve->{'ResFound'} eq "Reserved" || $reserve->{'ResFound'} eq "Processing" || $reserve->{'ResFound'} eq "Transferred" ) {
         $template->param(
             intransit    => $branchCheck ? undef : 1,
             transfertodo => $branchCheck ? undef : 1,
-- 
2.11.0