From 314e80a9e98519770975034a4f559456d5895201 Mon Sep 17 00:00:00 2001 From: finlayt Date: Wed, 13 Mar 2002 21:13:42 +0000 Subject: [PATCH] Added a transferbook subroutine that is called from /circ/branchtransfers.pl It writes a new line in the branchtransfers table and changes the currentbranch field in items. --- C4/Circulation/Circ2.pm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/C4/Circulation/Circ2.pm b/C4/Circulation/Circ2.pm index 59a27a113c..5b23990171 100755 --- a/C4/Circulation/Circ2.pm +++ b/C4/Circulation/Circ2.pm @@ -24,7 +24,7 @@ $VERSION = 0.01; @ISA = qw(Exporter); @EXPORT = qw(&getbranches &getprinters &getpatroninformation ¤tissues &getiteminformation &findborrower &issuebook &returnbook -&find_reserves); +&find_reserves &transferbook); %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], # your exported package globals go here, @@ -186,6 +186,24 @@ sub findborrower { } +sub transferbook { + my ($env, $iteminformation, $barcode) = @_; + my $messages; + my $dbh=&C4Connect; + #new entry in branchtransfers.... + my $sth = $dbh->prepare("insert into branchtransfers (itemnumber, frombranch, datearrived, tobranch) values($iteminformation->{'itemnumber'}, '$env->{'frbranchcd'}', now(), '$env->{'tobranchcd'}')"); + $sth->execute || return (0,"database error: $sth->errstr"); + $sth->finish; + #update holdingbranch in items ..... + $sth = $dbh->prepare("update items set holdingbranch='$env->{'tobranchcd'}' where items.itemnumber=$iteminformation->{'itemnumber'}"); + $sth->execute || return (0,"database error: $sth->errstr"); + $sth->execute; + $sth->finish; + $dbh->disconnect; + return (1, $messages); +} + + sub issuebook { my ($env, $patroninformation, $barcode, $responses, $date) = @_; my $dbh=&C4Connect; -- 2.39.5