[Patches] [PATCH] bug_6489: Do not raise WrongTransfer if it is transrerring to reserve

koha-patchbot at kohaaloha.com koha-patchbot at kohaaloha.com
Wed Dec 21 21:05:03 NZDT 2011


From: Srdjan Jankovic <srdjan at catalyst.net.nz>
Date: Wed, 21 Dec 2011 20:57:42 +1300
Subject: [PATCH] bug_6489: Do not raise WrongTransfer if it is transrerring to reserve
 branch

---
 C4/Circulation.pm |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index 9a6f4f2..f1b54d0 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -1574,6 +1574,14 @@ sub AddReturn {
     # check if we have a transfer for this document
     my ($datesent,$frombranch,$tobranch) = GetTransfers( $item->{'itemnumber'} );
 
+    # find reserves.....
+    # if we don't have a reserve with the status W, we launch the Checkreserves routine
+    my ($resfound, $resrec) = C4::Reserves::CheckReserves( $item->{'itemnumber'} );
+    if ($resfound) {
+          $resrec->{'ResFound'} = $resfound;
+        $messages->{'ResFound'} = $resrec;
+    }
+
     # if we have a transfer to do, we update the line of transfers with the datearrived
     if ($datesent) {
         if ( $tobranch eq $branch ) {
@@ -1583,7 +1591,8 @@ sub AddReturn {
             $sth->execute( $item->{'itemnumber'} );
             # if we have a reservation with valid transfer, we can set it's status to 'W'
             C4::Reserves::ModReserveStatus($item->{'itemnumber'}, 'W');
-        } else {
+        } elsif ( !($resrec && $resrec->{branchcode} eq $tobranch) ) {
+            # Do not raise WrongTransfer if it is transrerring to reserve branch
             $messages->{'WrongTransfer'}     = $tobranch;
             $messages->{'WrongTransferItem'} = $item->{'itemnumber'};
         }
@@ -1606,14 +1615,6 @@ sub AddReturn {
         $messages->{'Debarred'} = $debardate if ($debardate);
     }
 
-    # find reserves.....
-    # if we don't have a reserve with the status W, we launch the Checkreserves routine
-    my ($resfound, $resrec, undef) = C4::Reserves::CheckReserves( $item->{'itemnumber'} );
-    if ($resfound) {
-          $resrec->{'ResFound'} = $resfound;
-        $messages->{'ResFound'} = $resrec;
-    }
-
     # update stats?
     # Record the fact that this book was returned.
     UpdateStats(
-- 
1.6.5




More information about the Patches mailing list