Fixing reserve handling.
Mulitple copy reserves now handled correctly, and correct charges are being applied
This commit is contained in:
parent
501cc61c85
commit
79ebd030d6
|
|
@ -23,7 +23,8 @@ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
|
|||
$VERSION = 0.01;
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(&getbranches &getprinters &getpatroninformation ¤tissues &getiteminformation &findborrower &issuebook &returnbook);
|
||||
@EXPORT = qw(&getbranches &getprinters &getpatroninformation ¤tissues &getiteminformation &findborrower &issuebook &returnbook
|
||||
&find_reserves);
|
||||
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
|
||||
|
||||
# your exported package globals go here,
|
||||
|
|
@ -476,7 +477,7 @@ sub returnbook {
|
|||
$usth = $dbh->prepare($uquery);
|
||||
$usth->execute;
|
||||
$usth->finish;
|
||||
$uquery="update items set itemnotes='' where itemnumber=$iteminformation->{'itemnumber'}";
|
||||
$uquery="update items set paidfor='' where itemnumber=$iteminformation->{'itemnumber'}";
|
||||
$usth = $dbh->prepare($uquery);
|
||||
$usth->execute;
|
||||
$usth->finish;
|
||||
|
|
@ -887,30 +888,32 @@ sub find_reserves {
|
|||
my $resfound = "n";
|
||||
my $resrec;
|
||||
my $lastrec;
|
||||
# print $query;
|
||||
while (($resrec=$sth->fetchrow_hashref) && ($resfound eq "n")) {
|
||||
$lastrec=$resrec;
|
||||
if ($resrec->{'found'} eq "W") {
|
||||
if ($resrec->{'itemnumber'} eq $itemno) {
|
||||
$resfound = "y";
|
||||
}
|
||||
}
|
||||
if ($resrec->{'constrainttype'} eq "a") {
|
||||
$resfound = "y";
|
||||
}
|
||||
} else {
|
||||
my $conquery = "select * from reserveconstraints where borrowernumber
|
||||
= $resrec->{'borrowernumber'} and reservedate = '$resrec->{'reservedate'}' and biblionumber = $resrec->{'biblionumber'} and biblioitemnumber = $itemdata->{'biblioitemnumber'}";
|
||||
my $consth = $dbh->prepare($conquery);
|
||||
$consth->execute;
|
||||
if (my $conrec=$consth->fetchrow_hashref) {
|
||||
if ($resrec->{'constrainttype'} eq "o") {
|
||||
$resfound = "y";
|
||||
}
|
||||
if ($resrec->{'constrainttype'} eq "a") {
|
||||
$resfound = "y";
|
||||
} else {
|
||||
if ($resrec->{'constrainttype'} eq "e") {
|
||||
$resfound = "y";
|
||||
}
|
||||
my $conquery = "select * from reserveconstraints where borrowernumber
|
||||
= $resrec->{'borrowernumber'} and reservedate = '$resrec->{'reservedate'}' and biblionumber = $resrec->{'biblionumber'} and biblioitemnumber = $itemdata->{'biblioitemnumber'}";
|
||||
my $consth = $dbh->prepare($conquery);
|
||||
$consth->execute;
|
||||
if (my $conrec=$consth->fetchrow_hashref) {
|
||||
if ($resrec->{'constrainttype'} eq "o") {
|
||||
$resfound = "y";
|
||||
}
|
||||
} else {
|
||||
if ($resrec->{'constrainttype'} eq "e") {
|
||||
$resfound = "y";
|
||||
}
|
||||
}
|
||||
$consth->finish;
|
||||
}
|
||||
$consth->finish;
|
||||
}
|
||||
if ($resfound eq "y") {
|
||||
my $updquery = "update reserves
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ my $priv_func = sub {
|
|||
sub FindReserves {
|
||||
my ($bib,$bor)=@_;
|
||||
my $dbh=C4Connect;
|
||||
my $query="Select *,reserves.branchcode
|
||||
my $query="Select *,reserves.branchcode,biblio.title as btitle
|
||||
from reserves,borrowers,biblio ";
|
||||
if ($bib ne ''){
|
||||
if ($bor ne ''){
|
||||
|
|
@ -175,8 +175,15 @@ sub CalcReserveFee {
|
|||
}
|
||||
$x++;
|
||||
}
|
||||
if ($const eq 'o') {if ($found == 1) {push @biblioitems,$data;}
|
||||
} else {if ($found == 0) {push @biblioitems,$data;} }
|
||||
if ($const eq 'o') {
|
||||
if ( $found == 1) {
|
||||
push @biblioitems,$data1;
|
||||
}
|
||||
} else {
|
||||
if ($found == 0) {
|
||||
push @biblioitems,$data1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$sth1->finish;
|
||||
|
|
@ -193,11 +200,14 @@ sub CalcReserveFee {
|
|||
while (my $itdata=$sth2->fetchrow_hashref) {
|
||||
my $query3 = "select * from issues
|
||||
where itemnumber = '$itdata->{'itemnumber'}' and
|
||||
returndate is null";
|
||||
returndate is null";
|
||||
|
||||
my $sth3 = $dbh->prepare($query3);
|
||||
$sth3->execute();
|
||||
if (my $isdata=$sth3->fetchrow_hashref) { } else
|
||||
{$allissued = 0; }
|
||||
if (my $isdata=$sth3->fetchrow_hashref) {
|
||||
} else {
|
||||
$allissued = 0;
|
||||
}
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
|
|
@ -206,7 +216,8 @@ sub CalcReserveFee {
|
|||
where biblionumber = '$biblionumber'";
|
||||
my $rsth = $dbh->prepare($rquery);
|
||||
$rsth->execute();
|
||||
if (my $rdata = $rsth->fetchrow_hashref) { } else {
|
||||
if (my $rdata = $rsth->fetchrow_hashref) {
|
||||
} else {
|
||||
$fee = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue