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.
This commit is contained in:
finlayt 2002-03-13 21:13:42 +00:00
parent 501da7db0d
commit 314e80a9e9

View file

@ -24,7 +24,7 @@ $VERSION = 0.01;
@ISA = qw(Exporter); @ISA = qw(Exporter);
@EXPORT = qw(&getbranches &getprinters &getpatroninformation &currentissues &getiteminformation &findborrower &issuebook &returnbook @EXPORT = qw(&getbranches &getprinters &getpatroninformation &currentissues &getiteminformation &findborrower &issuebook &returnbook
&find_reserves); &find_reserves &transferbook);
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here, # 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 { sub issuebook {
my ($env, $patroninformation, $barcode, $responses, $date) = @_; my ($env, $patroninformation, $barcode, $responses, $date) = @_;
my $dbh=&C4Connect; my $dbh=&C4Connect;