[Koha-patches] [PATCH] [HEAD](bug #2750) Cannot return to another branch if the independantbranch option is set as ON

Nahuel ANGELINETTI nahuel.angelinetti at biblibre.com
Tue Dec 23 15:14:27 CET 2008


The code was modified to change the holding branch ONLY if the return to the right branch is done. If you set IndependantBranch to on, you must return the document to the HomeBranch.
And verify the return is done before show the message that allow to transfert the document to another branch.
---
 C4/Circulation.pm |   31 ++++++++++++++++---------------
 1 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index fb0cbb0..643e75a 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -1354,22 +1354,23 @@ sub AddReturn {
 			}
             MarkIssueReturned($borrower->{'borrowernumber'}, $iteminformation->{'itemnumber'},$circControlBranch);
             $messages->{'WasReturned'} = 1;    # FIXME is the "= 1" right?
-        }
-    
-    # continue to deal with returns cases, but not only if we have an issue
+
     
-        # the holdingbranch is updated if the document is returned in an other location .
-        if ( $iteminformation->{'holdingbranch'} ne C4::Context->userenv->{'branch'} ) {
-		        UpdateHoldingbranch(C4::Context->userenv->{'branch'},$iteminformation->{'itemnumber'});	
-		        #         	reload iteminformation holdingbranch with the userenv value
-		        $iteminformation->{'holdingbranch'} = C4::Context->userenv->{'branch'};
+            # continue to deal with returns cases, but not only if we have an issue
+        
+            # the holdingbranch is updated if the document is returned in an other location .
+            if ( $iteminformation->{'holdingbranch'} ne C4::Context->userenv->{'branch'} ) {
+		            UpdateHoldingbranch(C4::Context->userenv->{'branch'},$iteminformation->{'itemnumber'});
+		            #         	reload iteminformation holdingbranch with the userenv value
+		            $iteminformation->{'holdingbranch'} = C4::Context->userenv->{'branch'};
+            }
+            ModDateLastSeen( $iteminformation->{'itemnumber'} );
+            ModItem({ onloan => undef }, $biblio->{'biblionumber'}, $iteminformation->{'itemnumber'});
+          
+		        if ($iteminformation->{borrowernumber}){
+			    ($borrower) = C4::Members::GetMemberDetails( $iteminformation->{borrowernumber}, 0 );
+            }
         }
-        ModDateLastSeen( $iteminformation->{'itemnumber'} );
-        ModItem({ onloan => undef }, $biblio->{'biblionumber'}, $iteminformation->{'itemnumber'});
-		    
-		    if ($iteminformation->{borrowernumber}){
-			  ($borrower) = C4::Members::GetMemberDetails( $iteminformation->{borrowernumber}, 0 );
-        }       
         # fix up the accounts.....
         if ( $iteminformation->{'itemlost'} ) {
             $messages->{'WasLost'} = 1;
@@ -1433,7 +1434,7 @@ sub AddReturn {
         #adding message if holdingbranch is non equal a userenv branch to return the document to homebranch
         #we check, if we don't have reserv or transfert for this document, if not, return it to homebranch .
         
-        if ( ($iteminformation->{'holdingbranch'} ne $iteminformation->{'homebranch'}) and not $messages->{'WrongTransfer'} and ($validTransfert ne 1) and ($reserveDone ne 1) ){
+        if ($doreturn and ($iteminformation->{'holdingbranch'} ne $iteminformation->{'homebranch'}) and not $messages->{'WrongTransfer'} and ($validTransfert ne 1) and ($reserveDone ne 1) ){
 			if (C4::Context->preference("AutomaticItemReturn") == 1) {
 				ModItemTransfer($iteminformation->{'itemnumber'}, C4::Context->userenv->{'branch'}, $iteminformation->{'homebranch'});
 				$messages->{'WasTransfered'} = 1;
-- 
1.5.6.3




More information about the Koha-patches mailing list