[Koha-cvs] koha C4/Circulation/Circ2.pm circ/returns.pl [rel_3_0]

LAURIN arnaud alaurin at ouestprovence.fr
Fri Feb 9 17:42:49 CET 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	LAURIN arnaud <alaurin>	07/02/09 16:42:49

Modified files:
	C4/Circulation : Circ2.pm 
	circ           : returns.pl 

Log message:
	reorganize the messages and method for branchtransfers, adding a new case of circulation, if the document is returned in an another location than the issuig branch, adding a messge to return the document in the original place (homebranch), if the AutomaticItemReturn switched on

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Circulation/Circ2.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.114.2.39&r2=1.114.2.40
http://cvs.savannah.gnu.org/viewcvs/koha/circ/returns.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.43.2.14&r2=1.43.2.15

Patches:
Index: C4/Circulation/Circ2.pm
===================================================================
RCS file: /sources/koha/koha/C4/Circulation/Circ2.pm,v
retrieving revision 1.114.2.39
retrieving revision 1.114.2.40
diff -u -b -r1.114.2.39 -r1.114.2.40
--- C4/Circulation/Circ2.pm	6 Feb 2007 15:10:24 -0000	1.114.2.39
+++ C4/Circulation/Circ2.pm	9 Feb 2007 16:42:49 -0000	1.114.2.40
@@ -17,7 +17,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: Circ2.pm,v 1.114.2.39 2007/02/06 15:10:24 alaurin Exp $
+# $Id: Circ2.pm,v 1.114.2.40 2007/02/09 16:42:49 alaurin Exp $
 
 use strict;
 require Exporter;
@@ -41,7 +41,7 @@
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.114.2.39 $' =~ /\d+/g; shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.114.2.40 $' =~ /\d+/g; shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
 
 =head1 NAME
 
@@ -1535,6 +1535,9 @@
     my $messages;
     my $dbh      = C4::Context->dbh;
     my $doreturn = 1;
+    my $validTransfert = 0;
+    my $reserveDone = 0;
+    
     die '$branch not defined' unless defined $branch;  # just in case (bug 170)
                                                        # get information on item
     my ($iteminformation) = getiteminformation( 0, $barcode );
@@ -1584,8 +1587,7 @@
 # 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'} )
+if ( $iteminformation->{'holdingbranch'} ne C4::Context->userenv->{'branch'} )
         {
         	UpdateHoldingbranch(C4::Context->userenv->{'branch'},$iteminformation->{'itemnumber'});
         }
@@ -1619,27 +1621,7 @@
      	$messages->{'WrongTransfer'} = $tobranch;
      	$messages->{'WrongTransferItem'} = $iteminformation->{'itemnumber'};
      }
-    }
-
-#    if we don't have a transfer on run, we check if the document is not in his homebranch and there is not a reservation, we transfer this one to his home branch directly if system preference Automaticreturn is turn on .
-    else {
-        my $checkreserves = CheckReserves( $iteminformation->{'itemnumber'} );
-        if (
-            (
-                $iteminformation->{'homebranch'} ne
-                $iteminformation->{'holdingbranch'}
-            )
-            and ( not $checkreserves )
-            and ( C4::Context->preference("AutomaticItemReturn") == 1 )
-          )
-        {
-            my $automatictransfer = dotransfer(
-                $iteminformation->{'itemnumber'},
-                $iteminformation->{'holdingbranch'},
-                $iteminformation->{'homebranch'}
-            );
-            $messages->{'WasTransfered'} = 1;
-        }
+     $validTransfert = 1;
     }
 
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
@@ -1656,6 +1638,7 @@
 #    my $tobrcd = ReserveWaiting($resrec->{'itemnumber'}, $resrec->{'borrowernumber'});
         $resrec->{'ResFound'}   = $resfound;
         $messages->{'ResFound'} = $resrec;
+        $reserveDone = 1;
     }
 
     # update stats?
@@ -1670,6 +1653,16 @@
     &logaction(C4::Context->userenv->{'number'},"CIRCULATION","RETURN",$currentborrower,$iteminformation->{'biblionumber'}) 
         if C4::Context->preference("ReturnLog");
         
+    #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 C4::Context->userenv->{'branch'}) and not $messages->{'WrongTransfer'} and ($validTransfert ne 1) and ($reserveDone ne 1) ){
+		if (C4::Context->preference("AutomaticItemReturn") == 1) {
+        	dotransfer($iteminformation->{'itemnumber'}, C4::Context->userenv->{'branch'}, $iteminformation->{'homebranch'});
+        	$messages->{'WasTransfered'} = 1;
+        	}
+    }
+        
     return ( $doreturn, $messages, $iteminformation, $borrower );
 }
 

Index: circ/returns.pl
===================================================================
RCS file: /sources/koha/koha/circ/returns.pl,v
retrieving revision 1.43.2.14
retrieving revision 1.43.2.15
diff -u -b -r1.43.2.14 -r1.43.2.15
--- circ/returns.pl	2 Feb 2007 09:57:47 -0000	1.43.2.14
+++ circ/returns.pl	9 Feb 2007 16:42:49 -0000	1.43.2.15
@@ -132,7 +132,6 @@
 #   check if we have other reservs for this document, if we have a return send the message of transfer
     my ( $messages, $nextreservinfo ) = OtherReserves($item);
 
-
     my $branchname = GetBranchName( $messages->{'transfert'} );
     my ($borr) = getpatroninformation( \%env, $nextreservinfo, 0 );
     my $borcnum = $borr->{'cardnumber'};
@@ -239,7 +238,7 @@
 
 # adding a case of wrong transfert, if the document wasn't transfered in the good library (according to branchtransfer (tobranch) BDD)
 
-if ( $messages->{'WrongTransfer'} ) {
+if ( $messages->{'WrongTransfer'} and not $messages->{'WasTransfered'}) {
 	$template->param(
         WrongTransfer  => 1,
         TransferWaitingAt => $messages->{'WrongTransfer'},





More information about the Koha-cvs mailing list