[Koha-cvs] koha/circ returns.pl

LAURIN arnaud alaurin at ouestprovence.fr
Tue Jun 6 14:46:52 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Changes by:	LAURIN arnaud <alaurin>	06/06/06 12:46:52

Modified files:
	circ           : returns.pl 

Log message:
	new fonctions for returns.pl :
	
	- the system check if we don't have another reserv for the document returned, we return the document to his homebranch, ......
	- improvement of returns,  adapt item reservation , loan rules, and transfer rules ....

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/circ/returns.pl?cvsroot=koha&r1=1.38&r2=1.39

Patches:
Index: returns.pl
===================================================================
RCS file: /sources/koha/koha/circ/returns.pl,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- returns.pl	26 Oct 2005 09:13:11 -0000	1.38
+++ returns.pl	6 Jun 2006 12:46:52 -0000	1.39
@@ -59,8 +59,8 @@
 my $branches = getbranches();
 my $printers = getprinters( \%env );
 
-my $branch  = getbranch( $query,  $branches );
-my $printer = getprinter( $query, $printers );
+my $branch  = C4::Context->userenv->{'branch'};
+my $printer = C4::Context->userenv->{'branchprinter'};
 
 #
 # Some code to handle the error if there is no branch or printer setting.....
@@ -111,16 +111,22 @@
 
     # set to waiting....
     my $iteminfo = getiteminformation( \%env, $item );
-    my $tobranchcd = ReserveWaiting( $item, $borrnum );
-    my $branchname = $branches->{$tobranchcd}->{'branchname'};
-    my ($borr) = getpatroninformation( \%env, $borrnum, 0 );
+#     if($iteminfo->{'holdingbranch'} ne $branch){
+# 	UpdateHoldingbranch($branch,$item);
+# 	}
+#   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'};
     my $name    =
       $borr->{'surname'} . " " . $borr->{'title'} . " " . $borr->{'firstname'};
     my $slip = $query->param('resslip');
 #    printslip( \%env, $slip ); #removed by paul
 
-    if ( $tobranchcd ne $branch ) {
+    if ( $messages->{'transfert'} ) {
+# 	add the transfer routine
+# 	C4::Circulation::Circ2::dotransfer($item,$iteminfo->{'holdingbranch'},$tobranchcd);
         $template->param(
             itemtitle  => $iteminfo->{'title'},
             iteminfo   => $iteminfo->{'author'},
@@ -128,6 +134,8 @@
             name       => $name,
             bornum     => $borrnum,
             borcnum    => $borcnum,
+	    borfirstname  => $borr->{'firstname'},
+            borsurname    => $borr->{'surname'},
             diffbranch => 1
         );
     }
@@ -141,7 +149,6 @@
 
 # actually return book and prepare item table.....
 if ($barcode) {
-
     # decode cuecat
     $barcode = cuecatbarcodedecode($barcode);
     ( $returned, $messages, $iteminformation, $borrower ) =
@@ -193,6 +200,32 @@
 my $waiting  = 0;
 my $reserved = 0;
 
+# new op dev : we check if the document must be returned to his homebranch directly,
+#  if the document is transfered, we have warning message .
+
+if ( $messages->{'WasTransfered'} ) {
+#     my $res        = $messages->{'ResFound'};
+#     my $branchname = $branches->{ $res->{'branchcode'} }->{'branchname'};
+#     my ($borr) = getpatroninformation( \%env, $res->{'borrowernumber'}, 0 );
+#     my $name =
+#       $borr->{'surname'} . " " . $borr->{'title'} . " " . $borr->{'firstname'};
+    my ($iteminfo) = getiteminformation( \%env, 0, $barcode );
+
+#     if ( $res->{'ResFound'} eq "Waiting" ) {
+# 		if($branch eq $res->{'branchcode'}){
+# 			$template->param(intransit => 0);
+# 		} else {
+# 			$template->param(intransit => 1);
+# 		}
+	
+        $template->param(
+            	found         => 1,
+             	transfer     => 1,
+		itemhomebranch => $branches->{$iteminfo->{'homebranch'} }->{'branchname'}
+        );
+
+    }
+
 if ( $messages->{'ResFound'} ) {
     my $res        = $messages->{'ResFound'};
     my $branchname = $branches->{ $res->{'branchcode'} }->{'branchname'};





More information about the Koha-cvs mailing list