there is no transfert alert if you make a return in another branch than the 
homebranch.
---
 C4/Circulation.pm |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index 07a52ec..6b0e2ab 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -1315,17 +1315,18 @@ sub AddReturn {
         $doreturn = 0;
     } else {
         # find the borrower
-        if ( ( not $iteminformation->{borrowernumber} ) && $doreturn ) {
+        if ( not $iteminformation->{borrowernumber} ) {
             $messages->{'NotIssued'} = $barcode;
-            # even though item is not on loan, it may still
-            # be transferred; therefore, get current branch information
-            my $curr_iteminfo = GetItem($iteminformation->{'itemnumber'});
-            $iteminformation->{'homebranch'} = $curr_iteminfo->{'homebranch'};
-            $iteminformation->{'holdingbranch'} = 
$curr_iteminfo->{'holdingbranch'};
-            $iteminformation->{'itemlost'} = $curr_iteminfo->{'itemlost'};
             $doreturn = 0;
         }
-    
+        
+        # even though item is not on loan, it may still
+        # be transferred; therefore, get current branch information
+        my $curr_iteminfo = GetItem($iteminformation->{'itemnumber'});
+        $iteminformation->{'homebranch'} = $curr_iteminfo->{'homebranch'};
+        $iteminformation->{'holdingbranch'} = 
$curr_iteminfo->{'holdingbranch'};
+        $iteminformation->{'itemlost'} = $curr_iteminfo->{'itemlost'};
+        
         # check if the book is in a permanent collection....
         my $hbr      = 
$iteminformation->{C4::Context->preference("HomeOrHoldingBranch")};
         my $branches = GetBranches();
@@ -1436,7 +1437,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 ($doreturn and ($branch ne $iteminformation->{$hbr}) and not 
$messages->{'WrongTransfer'} and ($validTransfert ne 1) and ($reserveDone ne 1) 
){
+        if (($doreturn or $messages->{'NotIssued'}) and ($branch ne 
$iteminformation->{$hbr}) 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->{$hbr});
                                $messages->{'WasTransfered'} = 1;
-- 
1.6.0.4

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to