[Koha-cvs] CVS: koha/C4/Circulation Circ2.pm,1.79,1.80

Paul POULAIN tipaul at users.sourceforge.net
Wed Aug 18 17:52:17 CEST 2004


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

Modified Files:
	Circ2.pm 
Log Message:
fixes in circulation module

Index: Circ2.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Circulation/Circ2.pm,v
retrieving revision 1.79
retrieving revision 1.80
diff -C2 -r1.79 -r1.80
*** Circ2.pm	29 Jun 2004 13:02:34 -0000	1.79
--- Circ2.pm	18 Aug 2004 15:52:14 -0000	1.80
***************
*** 309,320 ****
  =back
  
- =head3 loanlength
- 
- =over 4
- 
- The length of time for which the item can be borrowed, in days.
- 
- =back
- 
  =head3 notforloan
  
--- 309,312 ----
***************
*** 358,362 ****
  		$sth->execute($iteminformation->{'itemtype'});
  		my $itemtype=$sth->fetchrow_hashref;
- 		$iteminformation->{'loanlength'}=$itemtype->{'loanlength'};
  		# if specific item notforloan, don't use itemtype notforloan field.
  		# otherwise, use itemtype notforloan value to see if item can be issued.
--- 350,353 ----
***************
*** 600,683 ****
  
  sub TooMany ($$){
!     my $borrower = shift;
!     my $iteminformation = shift;
!     my $cat_borrower = $borrower->{'categorycode'};
!     my $branch_borrower = $borrower->{'branchcode'};
!     my $dbh = C4::Context->dbh;
!     
! 
!     my $sth = $dbh->prepare('select itemtype from biblioitems where biblionumber = ?');
!     $sth->execute($iteminformation->{'biblionumber'});
!     my $type = $sth->fetchrow;
! 
!     $sth = $dbh->prepare('select * from issuingrules where categorycode = ? and itemtype = ? and branchcode = ?');
!     my $sth2 = $dbh->prepare("select COUNT(i.borrowernumber) from issues i, biblioitems s where i.borrowernumber = ? and i.returndate is null and i.itemnumber = s.biblioitemnumber and s.itemtype like ?");
!     my $sth3 = $dbh->prepare('select COUNT(borrowernumber) from issues where borrowernumber = ? and returndate is null');
!     
!     $sth->execute($cat_borrower, $type, $branch_borrower);
!     my $result = $sth->fetchrow_hashref;
!     if (defined($result))
!     {
! 	$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
! 	return (0) if ($result->{'maxissueqty'} <= $sth2->fetchrow);
!     }
! 
!     $sth->execute($cat_borrower, $type, "*");
!     my $result = $sth->fetchrow_hashref;
!     if (defined($result))
!     {
! 	$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
! 	return (0) if ($result->{'maxissueqty'} <= $sth2->fetchrow);
!     }
! 
!     $sth->execute($cat_borrower, "*", $branch_borrower);
!     my $result = $sth->fetchrow_hashref;
!     if (defined($result))
!     {
! 	$sth3->execute($borrower->{'borrowernumber'});
! 	return (0) if ($result->{'maxissueqty'} <= $sth3->fetchrow);
!     }
! 
!     $sth->execute("*", $type, $branch_borrower);
!     my $result = $sth->fetchrow_hashref;
!     if (defined($result))
!     {
! 	$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
! 	return (0) if ($result->{'maxissueqty'} <= $sth2->fetchrow);
!     }
! 
!     $sth->execute("*", "*", $branch_borrower);
!     my $result = $sth->fetchrow_hashref;
!     if (defined($result))
!     {
! 	$sth3->execute($borrower->{'borrowernumber'});
! 	return (0) if ($result->{'maxissueqty'} <= $sth3->fetchrow);
!     }
! 
!     $sth->execute("*", $type, "*");
!     my $result = $sth->fetchrow_hashref;
!     if (defined($result))
!     {
! 	$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
! 	return (0) if ($result->{'maxissueqty'} <= $sth2->fetchrow);
!     }
! 
!     $sth->execute($cat_borrower, "*", "*");
!     my $result = $sth->fetchrow_hashref;
!     if (defined($result))
!     {
! 	$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
! 	return (0) if ($result->{'maxissueqty'} <= $sth2->fetchrow);
!     }
! 
!     $sth->execute("*", "*", "*");
!     my $result = $sth->fetchrow_hashref;
!     if (defined($result))
!     {
! 	$sth3->execute($borrower->{'borrowernumber'});
! 	return (0) if ($result->{'maxissueqty'} <= $sth3->fetchrow);
!     }
  
!     return (1);
  }
  
--- 591,674 ----
  
  sub TooMany ($$){
! 	my $borrower = shift;
! 	my $iteminformation = shift;
! 	my $cat_borrower = $borrower->{'categorycode'};
! 	my $branch_borrower = $borrower->{'branchcode'};
! 	my $dbh = C4::Context->dbh;
! 	
  
! 	my $sth = $dbh->prepare('select itemtype from biblioitems where biblionumber = ?');
! 	$sth->execute($iteminformation->{'biblionumber'});
! 	my $type = $sth->fetchrow;
! 	warn "checking $branch_borrower / $cat_borrower / $type";
! 	$sth = $dbh->prepare('select * from issuingrules where categorycode = ? and itemtype = ? and branchcode = ?');
! 	my $sth2 = $dbh->prepare("select COUNT(*) from issues i, biblioitems s where i.borrowernumber = ? and i.returndate is null and i.itemnumber = s.biblioitemnumber and s.itemtype like ?");
! 	my $sth3 = $dbh->prepare('select COUNT(*) from issues where borrowernumber = ? and returndate is null');
! 	my $alreadyissued;
! 	$sth->execute($cat_borrower, $type, $branch_borrower);
! 	my $result = $sth->fetchrow_hashref;
! 	warn "==>".$result->{maxissueqty};
! 	if (defined($result)) {
! 		$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
! 		my $alreadyissued = $sth2->fetchrow;
! 		return ("A $alreadyissued / ".($result->{maxissueqty}+0)) if ($result->{'maxissueqty'} <= $alreadyissued);
! 	}
! 
! 	$sth->execute($cat_borrower, $type, "*");
! 	my $result = $sth->fetchrow_hashref;
! 	if (defined($result)) {
! 		$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
! 		my $alreadyissued = $sth2->fetchrow;
! 		return ("B $alreadyissued / ".($result->{maxissueqty}+0)) if ($result->{'maxissueqty'} <= $alreadyissued);
! 	}
! 
! 	$sth->execute($cat_borrower, "*", $branch_borrower);
! 	my $result = $sth->fetchrow_hashref;
! 	if (defined($result)) {
! 		$sth3->execute($borrower->{'borrowernumber'});
! 		my $alreadyissued = $sth2->fetchrow;
! 		return ("C $alreadyissued / ".($result->{maxissueqty}+0)) if ($result->{'maxissueqty'} <= $alreadyissued);
! 	}
! 
! 	$sth->execute("*", $type, $branch_borrower);
! 	my $result = $sth->fetchrow_hashref;
! 	if (defined($result)) {
! 		$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
! 		my $alreadyissued = $sth2->fetchrow;
! 		return ("D $alreadyissued / ".($result->{maxissueqty}+0)) if ($result->{'maxissueqty'} <= $alreadyissued);
! 	}
! 
! 	$sth->execute("*", "*", $branch_borrower);
! 	my $result = $sth->fetchrow_hashref;
! 	if (defined($result)) {
! 		$sth3->execute($borrower->{'borrowernumber'});
! 		my $alreadyissued = $sth2->fetchrow;
! 		return ("E $alreadyissued / ".($result->{maxissueqty}+0)) if ($result->{'maxissueqty'} <= $alreadyissued);
! 	}
! 
! 	$sth->execute("*", $type, "*");
! 	my $result = $sth->fetchrow_hashref;
! 	if (defined($result)) {
! 		$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
! 		my $alreadyissued = $sth2->fetchrow;
! 		return ("F $alreadyissued / ".($result->{maxissueqty}+0)) if ($result->{'maxissueqty'} <= $alreadyissued);
! 	}
! 
! 	$sth->execute($cat_borrower, "*", "*");
! 	my $result = $sth->fetchrow_hashref;
! 	if (defined($result)) {
! 		$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
! 		my $alreadyissued = $sth2->fetchrow;
! 		return ("G $alreadyissued / ".($result->{maxissueqty}+0)) if ($result->{'maxissueqty'} <= $alreadyissued);
! 	}
! 
! 	$sth->execute("*", "*", "*");
! 	my $result = $sth->fetchrow_hashref;
! 	if (defined($result)) {
! 		$sth3->execute($borrower->{'borrowernumber'});
! 		my $alreadyissued = $sth2->fetchrow;
! 		return ("H $alreadyissued / ".($result->{maxissueqty}+0)) if ($result->{'maxissueqty'} <= $alreadyissued);
! 	}
! 	return;
  }
  
***************
*** 685,689 ****
  sub canbookbeissued {
  	my ($env,$borrower,$barcode,$year,$month,$day) = @_;
- 	warn "CHECKING CANBEISSUED for $borrower->{'borrowernumber'}, $barcode";
  	my %needsconfirmation; # filled with problems that needs confirmations
  	my %issuingimpossible; # filled with problems that causes the issue to be IMPOSSIBLE
--- 676,679 ----
***************
*** 699,709 ****
  # BORROWER STATUS
  #
! 	if ($borrower->{flags}->{'gonenoaddress'}) {
  		$issuingimpossible{GNA} = 1;
  	}
! 	if ($borrower->{flags}->{'lost'}) {
  		$issuingimpossible{CARD_LOST} = 1;
  	}
! 	if ($borrower->{flags}->{'debarred'}) {
  		$issuingimpossible{DEBARRED} = 1;
  	}
--- 689,699 ----
  # BORROWER STATUS
  #
! 	if ($borrower->{flags}->{GNA}) {
  		$issuingimpossible{GNA} = 1;
  	}
! 	if ($borrower->{flags}->{'LOST'}) {
  		$issuingimpossible{CARD_LOST} = 1;
  	}
! 	if ($borrower->{flags}->{'DBARRED'}) {
  		$issuingimpossible{DEBARRED} = 1;
  	}
***************
*** 722,729 ****
  # JB34 CHECKS IF BORROWERS DONT HAVE ISSUE TOO MANY BOOKS
  #
! 	
! 	$needsconfirmation{TOO_MANY} = 1 
! 	    if (!TooMany($borrower, $iteminformation));
! 
  
  #
--- 712,717 ----
  # JB34 CHECKS IF BORROWERS DONT HAVE ISSUE TOO MANY BOOKS
  #
! 	my $toomany = TooMany($borrower, $iteminformation);
! 	$needsconfirmation{TOO_MANY} =  $toomany if $toomany;
  
  #
***************
*** 746,750 ****
  	}
  
! 	    
  
  #
--- 734,738 ----
  	}
  
! 
  
  #





More information about the Koha-cvs mailing list