[Koha-cvs] CVS: koha/C4/Circulation Circ2.pm,1.75,1.76
doXulting
doxulting at users.sourceforge.net
Mon May 24 14:14:41 CEST 2004
Update of /cvsroot/koha/koha/C4/Circulation
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31283/C4/Circulation
Modified Files:
Circ2.pm
Log Message:
Premier commit JB34. Verification du nombre maximum de livre a emprunter.
Index: Circ2.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Circulation/Circ2.pm,v
retrieving revision 1.75
retrieving revision 1.76
diff -C2 -r1.75 -r1.76
*** Circ2.pm 4 May 2004 16:15:56 -0000 1.75
--- Circ2.pm 24 May 2004 12:14:38 -0000 1.76
***************
*** 590,593 ****
--- 590,597 ----
sticky due date is invalid
+ =head3 TOO_MUCH
+
+ if the borrower borrows to much things
+
=cut
***************
*** 595,598 ****
--- 599,639 ----
# returns an array with errors if any
+ sub HowManyBurrows ($){
+ my $borrower = shift;
+ my $dbh = C4::Context->dbh;
+
+ my $sth = $dbh->prepare('select COUNT(borrowernumber) nombre_livre_emprunte from issues where borrowernumber = ?');
+ $sth->execute($borrower->{'borrowernumber'});
+ my $data = $sth->fetchrow;
+ return $data;
+ }
+
+ sub NumberBurrowsOk(@)
+ {
+ (my $biblionbr, my $cat) = @_;
+ my $dbh = C4::Context->dbh;
+
+ my $sth = $dbh->prepare('select itemtype from biblioitems where biblionumber = ?');
+ $sth->execute($biblionbr);
+ my $data = $sth->fetchrow;
+ $sth = $dbh->prepare('select maxissueqty from issuingrules where categorycode = ? and itemtype = ?');
+ $sth->execute($cat, $data);
+ my $value = $sth->fetchrow;
+ return $value if (defined($value));
+ $sth = $dbh->prepare('select maxissueqty from issuingrules where categorycode = "*" and itemtype = ?');
+ $sth->execute($data);
+ $value = $sth->fetchrow;
+ return $value if (defined($value));
+ $sth = $dbh->prepare('select maxissueqty from issuingrules where categorycode = ? and itemtype = "*"');
+ $sth->execute($cat);
+ $value = $sth->fetchrow;
+ return $value if (defined($value));
+ $sth = $dbh->prepare('select maxissueqty from issuingrules where categorycode = "*" and itemtype = "*"');
+ $sth->execute();
+ $value = $sth->fetchrow;
+ return $value if (defined($value));
+ return 5; # valeur max par default si la base est endommagee
+ }
+
sub canbookbeissued {
my ($env,$borrower,$barcode,$year,$month,$day) = @_;
***************
*** 630,633 ****
--- 671,683 ----
}
+
+ #
+ # JB34 CHECK IF BORROWERS DONT HAVE ISSUE TOO MANY BOOKS
+ #
+
+ $needsconfirmation{TOO_MUCH} = 1
+ if (HowManyBurrows($borrower) > NumberBurrowsOk($iteminformation->{'biblionumber'},
+ $borrower->{'categorycode'}));
+
#
# ITEM CHECKING
***************
*** 649,652 ****
--- 699,704 ----
}
+
+
#
# CHECK IF BOOK ALREADY ISSUED TO THIS BORROWER
***************
*** 665,669 ****
# issued to someone else
my $currborinfo = getpatroninformation(0,$currentborrower);
! warn "=>.$currborinfo->{'firstname'} $currborinfo->{'surname'} ($currborinfo->{'cardnumber'})";
$needsconfirmation{ISSUED_TO_ANOTHER} = "$currborinfo->{'reservedate'} : $currborinfo->{'firstname'} $currborinfo->{'surname'} ($currborinfo->{'cardnumber'})";
}
--- 717,721 ----
# issued to someone else
my $currborinfo = getpatroninformation(0,$currentborrower);
! # warn "=>.$currborinfo->{'firstname'} $currborinfo->{'surname'} ($currborinfo->{'cardnumber'})";
$needsconfirmation{ISSUED_TO_ANOTHER} = "$currborinfo->{'reservedate'} : $currborinfo->{'firstname'} $currborinfo->{'surname'} ($currborinfo->{'cardnumber'})";
}
***************
*** 716,720 ****
# my ($borrower, $flags) = &getpatroninformation($env, $borrowernumber, 0);
my $iteminformation = getiteminformation($env, 0, $barcode);
! warn "B : ".$borrower->{borrowernumber}." / I : ".$iteminformation->{'itemnumber'};
#
# check if we just renew the issue.
--- 768,772 ----
# my ($borrower, $flags) = &getpatroninformation($env, $borrowernumber, 0);
my $iteminformation = getiteminformation($env, 0, $barcode);
! # warn "B : ".$borrower->{borrowernumber}." / I : ".$iteminformation->{'itemnumber'};
#
# check if we just renew the issue.
More information about the Koha-cvs
mailing list