[Koha-cvs] koha/circ returns.pl

Robert Lyon bob at katipo.co.nz
Wed Jun 7 06:39:37 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Changes by:	Robert Lyon <bob_lyon>	06/06/07 04:39:37

Modified files:
	circ           : returns.pl 

Log message:
	merging katipo changes...
	
	adding in new set_transit sub 

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

Patches:
Index: returns.pl
===================================================================
RCS file: /sources/koha/koha/circ/returns.pl,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- returns.pl	6 Jun 2006 12:46:52 -0000	1.39
+++ returns.pl	7 Jun 2006 04:39:37 -0000	1.40
@@ -35,6 +35,7 @@
 use C4::Interface::CGI::Output;
 use HTML::Template;
 use C4::Koha;
+use C4::Context;
 
 my $query = new CGI;
 
@@ -111,19 +112,22 @@
 
     # set to waiting....
     my $iteminfo = getiteminformation( \%env, $item );
+    my $tobranchcd = ReserveWaiting( $item, $borrnum );
 #     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 = $branches->{$tobranchcd}->{'branchname'}; - not sure if this line + $tobranchcd line do the same thing
+    # as the $messages{'transfert'} code
     my $branchname = getbranchname($messages->{'transfert'});
     my ($borr) = getpatroninformation( \%env, $nextreservinfo, 0 );
     my $borcnum = $borr->{'cardnumber'};
     my $name    =
-      $borr->{'surname'} . " " . $borr->{'title'} . " " . $borr->{'firstname'};
+      $borr->{'surname'} . ", " . $borr->{'title'} . " " . $borr->{'firstname'};
     my $slip = $query->param('resslip');
-#    printslip( \%env, $slip ); #removed by paul
-
+    printreserve( \%env, $branchname, $borr, $iteminfo );
+#   if ( $tobranchcd ne $branch ) { - not sure if line below is doing the same
     if ( $messages->{'transfert'} ) {
 # 	add the transfer routine
 # 	C4::Circulation::Circ2::dotransfer($item,$iteminfo->{'holdingbranch'},$tobranchcd);
@@ -138,6 +142,7 @@
             borsurname    => $borr->{'surname'},
             diffbranch => 1
         );
+	set_transit($item);
     }
 }
 
@@ -164,6 +169,11 @@
         $input{duedate} = $riduedate{0};
         $input{bornum}  = $riborrowernumber{0};
         push ( @inputloop, \%input );
+        # check if the branch is the same as homebranch
+	# if not, we want to put a message
+	if ($iteminformation->{'homebranch'} ne $branch){
+	     $template->param( homebranch =>$iteminformation->{'homebranch'});
+	}
     }
     elsif ( !$messages->{'BadBarcode'} ) {
         my %input;
@@ -284,6 +294,7 @@
         $template->param(
             found       => 1,
 		currentbranch => $branches->{ $branch }->{'branchname'},
+	    name        => $name,
             branchname  => $branches->{ $res->{'branchcode'} }->{'branchname'},
             reserved    => 1,
             today       => $todaysdate,
@@ -516,6 +527,26 @@
     }
 }
 
+
+sub set_transit {
+        my ($itemnumber) = @_;
+        my $dbh=C4::Context->dbh();
+        my $query = "UPDATE items SET holdingbranch='TRA' WHERE itemnumber = ?";
+        my $sth=$dbh->prepare($query);
+        $sth->execute($itemnumber);
+        $sth->finish();
+    }
+
+sub set_transit {
+        my ($itemnumber) = @_;
+        my $dbh=C4::Context->dbh();
+        my $query = "UPDATE items SET holdingbranch='TRA' WHERE itemnumber = ?";
+        my $sth=$dbh->prepare($query);
+        $sth->execute($itemnumber);
+        $sth->finish();
+}
+
+
 # Local Variables:
 # tab-width: 4
 # End:





More information about the Koha-cvs mailing list