Browse Source

Changes to reserves

master
olwen 25 years ago
parent
commit
fab6e67a51
  1. 4
      C4/Circmain.pm
  2. 31
      C4/Circulation/Issues.pm
  3. 5
      C4/Circulation/Main.pm
  4. 18
      C4/Circulation/Returns.pm

4
C4/Circmain.pm

@ -106,9 +106,9 @@ sub Start_circ{
} elsif ($data eq 'Quit') {
$donext = $data;
}
debug_msg($env,"donext - $donext");
#debug_msg($env,"donext - $donext");
}
#&endint($env)
&endint($env)
}

31
C4/Circulation/Issues.pm

@ -181,9 +181,9 @@ sub issueitem{
} elsif ($item->{'wthdrawn'} == 1) {
error_msg($env,"Item Withdrawn");
$canissue = 0;
} elsif ($item->{'itemlost'} == 1) {
error_msg($env,"Item Lost");
$canissue = 0;
# } elsif ($item->{'itemlost'} == 1) {
# error_msg($env,"Item Lost");
# $canissue = 0;
} elsif ($item->{'restricted'} == 1 ){
error_msg($env,"Restricted Item");
#check borrowers status to take out restricted items
@ -206,7 +206,16 @@ sub issueitem{
#check reserve
my ($resbor,$resrec) =
&C4::Circulation::Main::checkreserve($env,$dbh,$item->{'itemnumber'});
if ($resbor ne "") {
if ($resbor=$bornum) {
my $rquery = "update reserves
set found = 'F'
where reservedate = '$resrec->{'reservedate'}'
and borrowernumber = '$resrec->{'borrowernumber'}'
and biblionumber = '$resrec->{'biblionumber'}'";
my $rsth = $dbh->prepare($rquery);
$rsth->execute;
$rsth->finish;
} elsif ($resbor ne "") {
my $bquery = "select * from borrowers
where borrowernumber = '$resbor'";
my $btsh = $dbh->prepare($bquery);
@ -219,6 +228,18 @@ sub issueitem{
# print a docket;
printreserve($env,$resrec,$resborrower,$item);
$canissue = 0;
} else {
my $ans = msg_yn($env,"Cancel reserve?");
if ($ans eq "Y") {
my $rquery = "update reserves
set found = 'F'
where reservedate = '$resrec->{'reservedate'}
and borrowernumber = '$resrec->{'borrowernumber'}
and biblionumber = '$resrec->{'biblionumber'}";
my $rsth = $dbh->prepare($rquery);
$rsth->execute;
$rsth->finish;
}
}
$btsh->finish();
};
@ -234,7 +255,7 @@ sub issueitem{
#debug_msg("","date $datedue");
&UpdateStats($env,$env->{'branchcode'},'issue',$charge);
if ($charge > 0) {
createcharge($env,$dbh,$item->{'itemnumber'},$bornum,$charge);
createcharge($env,$dbh,$item->{'itemnumber'},$bornum,$charge);
}
} elsif ($canissue == 0) {
debug_msg($env,"can't issue");

5
C4/Circulation/Main.pm

@ -150,7 +150,10 @@ sub checkreserve{
my $query = "select * from reserves,items
where (items.itemnumber = '$itemnum')
and (items.biblionumber = reserves.biblionumber)
and (reserves.found <> 'F') order by priority";
and ((reserves.found = 'W'
and items.itemnumber = reserves.itemnumber)
or (reserves.found = ''))
order by priority";
my $sth = $dbh->prepare($query);
$sth->execute();
my $resrec;

18
C4/Circulation/Returns.pm

@ -269,7 +269,11 @@ sub find_reserves {
my $resfound = "n";
my $resrec;
while (($resrec=$sth->fetchrow_hashref) && ($resfound eq "n")) {
if ($resrec->{'constrainttype'} eq "a") {
if ($resrec->{'found'} eq "W") {
if ($resrec->{'itemnumber'} eq $itemno) {
$resfound = "y";
}
} elsif ($resrec->{'constrainttype'} eq "a") {
$resfound = "y";
} else {
my $conquery = "select * from reserveconstraints
@ -291,13 +295,23 @@ sub find_reserves {
$consth->finish;
}
if ($resfound = "y") {
my $updquery = "update reserves set found = 'W'
my $updquery = "update reserves
set found = 'W',itemnumber='$itemno'
where borrowernumber = $resrec->{'borrowernumber'}
and reservedate = '$resrec->{'reservedate'}'
and biblionumber = $resrec->{'biblionumber'}";
my $updsth = $dbh->prepare($updquery);
$updsth->execute;
$updsth->finish;
my $itbr = $resrec->{'branchcode'};
if ($resrec->{'branchcode'} ne $env->{'branchcode'}) {
my $updquery = "update items
set holdingbranch = 'T'
where itemnumber = $itemno";
my $updsth = $dbh->prepare($updquery);
$updsth->execute;
$updsth->finish;
}
}
}
$sth->finish;

Loading…
Cancel
Save