[Koha-cvs] CVS: koha/C4/Circulation Circ2.pm,1.76,1.77

doXulting doxulting at users.sourceforge.net
Mon May 24 16:20:19 CEST 2004


Update of /cvsroot/koha/koha/C4/Circulation
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25702/koha/C4/Circulation

Modified Files:
	Circ2.pm 
Log Message:
This time we only check books that borrowers still have

Index: Circ2.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Circulation/Circ2.pm,v
retrieving revision 1.76
retrieving revision 1.77
diff -C2 -r1.76 -r1.77
*** Circ2.pm	24 May 2004 12:14:38 -0000	1.76
--- Circ2.pm	24 May 2004 14:20:15 -0000	1.77
***************
*** 590,594 ****
  sticky due date is invalid
  
! =head3 TOO_MUCH
  
  if the borrower borrows to much things
--- 590,594 ----
  sticky due date is invalid
  
! =head3 TOO_MANY
  
  if the borrower borrows to much things
***************
*** 599,607 ****
  # 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;
--- 599,608 ----
  # returns an array with errors if any
  
! sub HowManyIssues ($){
      my $borrower = shift;
      my $dbh = C4::Context->dbh;
      
!     my $sth = $dbh->prepare('select COUNT(borrowernumber) from issues where borrowernumber = ?
! 			    and returndate is null');
      $sth->execute($borrower->{'borrowernumber'});
      my $data = $sth->fetchrow;
***************
*** 609,637 ****
  }
  
! 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
  }
  
--- 610,637 ----
  }
  
! sub NumberIssuesOk(@)
  {
!     (my $biblionumber, my $cat) = @_;
      my $dbh = C4::Context->dbh;
  
      my $sth = $dbh->prepare('select itemtype from biblioitems where biblionumber = ?');
!     $sth->execute($biblionumber);
      my $data = $sth->fetchrow;
!     $sth = $dbh->prepare('select * from issuingrules where categorycode = ? and itemtype = ?');
      $sth->execute($cat, $data);
!     my $value = $sth->fetchrow_hashref;
!     return $value->{'maxissueqty'}, $value->{'issuelength'} 
!     if (defined($value));   
!     $sth->execute("*", $data);
!     $value = $sth->fetchrow_hashref;
!     return $value->{'maxissueqty'}, $value->{'issuelength'}
!     if (defined($value));
!     $sth->execute($cat, "*");
!     $value = $sth->fetchrow_hashref;
!     return $value->{'maxissueqty'}, $value->{'issuelength'}
!     if (defined($value));
!     $sth->execute("*", "*");
!     $value = $sth->fetchrow_hashref;
!     return $value->{'maxissueqty'}, $value->{'issuelength'};
  }
  
***************
*** 673,682 ****
  
  #
! # JB34 CHECK IF BORROWERS DONT HAVE ISSUE TOO MANY BOOKS
  #
! 
! 	$needsconfirmation{TOO_MUCH} = 1 
! 	if (HowManyBurrows($borrower) > NumberBurrowsOk($iteminformation->{'biblionumber'}, 
! 							    $borrower->{'categorycode'}));
  
  #
--- 673,684 ----
  
  #
! # JB34 CHECKS IF BORROWERS DONT HAVE ISSUE TOO MANY BOOKS
  #
! 	
! 	(my $maxissueqty, my $issuelength) = 
! 	    NumberIssuesOk($iteminformation->{'biblionumber'}, 
! 			   $borrower->{'categorycode'});
! 	$needsconfirmation{TOO_MANY} = 1 
! 	    if (HowManyIssues($borrower) > $maxissueqty);
  
  #





More information about the Koha-cvs mailing list