Update of /cvsroot/koha/koha/C4/Circulation In directory usw-pr-cvs1:/tmp/cvs-serv19044/C4/Circulation Modified Files: Circ2.pm Log Message: 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. Index: Circ2.pm =================================================================== RCS file: /cvsroot/koha/koha/C4/Circulation/Circ2.pm,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** Circ2.pm 25 Nov 2001 20:17:53 -0000 1.20 --- Circ2.pm 13 Mar 2002 21:13:42 -0000 1.21 *************** *** 25,29 **** @ISA = qw(Exporter); @EXPORT = qw(&getbranches &getprinters &getpatroninformation ¤tissues &getiteminformation &findborrower &issuebook &returnbook ! &find_reserves); %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], --- 25,29 ---- @ISA = qw(Exporter); @EXPORT = qw(&getbranches &getprinters &getpatroninformation ¤tissues &getiteminformation &findborrower &issuebook &returnbook ! &find_reserves &transferbook); %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], *************** *** 184,187 **** --- 184,205 ---- $dbh->disconnect; return(\@borrowers); + } + + + 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); }