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

Paul POULAIN tipaul at users.sourceforge.net
Tue Sep 14 14:37:06 CEST 2004


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

Modified Files:
	Circ2.pm 
Log Message:
fix for circulation rules test : the default branch is "", not "*" (* is for "any borrowertype" and "any itemtype")

Index: Circ2.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Circulation/Circ2.pm,v
retrieving revision 1.80
retrieving revision 1.81
diff -C2 -r1.80 -r1.81
*** Circ2.pm	18 Aug 2004 15:52:14 -0000	1.80
--- Circ2.pm	14 Sep 2004 12:37:04 -0000	1.81
***************
*** 64,68 ****
  @ISA = qw(Exporter);
  @EXPORT = qw(&getpatroninformation
! 	&currentissues &getissues &getiteminformation
  	&canbookbeissued &issuebook &returnbook &find_reserves &transferbook &decode
  	&calc_charges &listitemsforinventory &itemseen &fixdate);
--- 64,68 ----
  @ISA = qw(Exporter);
  @EXPORT = qw(&getpatroninformation
! 	&currentissues &getissues &getiteminformation &renewstatus
  	&canbookbeissued &issuebook &returnbook &find_reserves &transferbook &decode
  	&calc_charges &listitemsforinventory &itemseen &fixdate);
***************
*** 601,626 ****
  	$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;
--- 601,626 ----
  	$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(*) 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;
+ 	# check the 3 parameters
  	$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 ("$alreadyissued / ".($result->{maxissueqty}+0)) if ($result->{'maxissueqty'} <= $alreadyissued);
  	}
! 	# check for branch=*
! 	$sth->execute($cat_borrower, $type, "");
  	my $result = $sth->fetchrow_hashref;
  	if (defined($result)) {
  		$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
  		my $alreadyissued = $sth2->fetchrow;
! 		return ("$alreadyissued / ".($result->{maxissueqty}+0)) if ($result->{'maxissueqty'} <= $alreadyissued);
  	}
! 	# check for itemtype=*
  	$sth->execute($cat_borrower, "*", $branch_borrower);
  	my $result = $sth->fetchrow_hashref;
***************
*** 628,634 ****
  		$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;
--- 628,634 ----
  		$sth3->execute($borrower->{'borrowernumber'});
  		my $alreadyissued = $sth2->fetchrow;
! 		return ("$alreadyissued / ".($result->{maxissueqty}+0)) if ($result->{'maxissueqty'} <= $alreadyissued);
  	}
! 	#check for borrowertype=*
  	$sth->execute("*", $type, $branch_borrower);
  	my $result = $sth->fetchrow_hashref;
***************
*** 636,640 ****
  		$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
  		my $alreadyissued = $sth2->fetchrow;
! 		return ("D $alreadyissued / ".($result->{maxissueqty}+0)) if ($result->{'maxissueqty'} <= $alreadyissued);
  	}
  
--- 636,640 ----
  		$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
  		my $alreadyissued = $sth2->fetchrow;
! 		return ("$alreadyissued / ".($result->{maxissueqty}+0)) if ($result->{'maxissueqty'} <= $alreadyissued);
  	}
  
***************
*** 644,672 ****
  		$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;
--- 644,672 ----
  		$sth3->execute($borrower->{'borrowernumber'});
  		my $alreadyissued = $sth2->fetchrow;
! 		return ("$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 ("$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 ("$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 ("$alreadyissued / ".($result->{maxissueqty}+0)) if ($result->{'maxissueqty'} <= $alreadyissued);
  	}
  	return;
***************
*** 1428,1435 ****
  	my $borrowernumber = $borrower->{'borrowernumber'};
  	my %currentissues;
! 	my $select = "SELECT issues.timestamp      AS timestamp,
  				issues.date_due       AS date_due,
- 				items.biblionumber    AS biblionumber,
- 				items.itemnumber    AS itemnumber,
  				items.barcode         AS barcode,
  				biblio.title          AS title,
--- 1428,1433 ----
  	my $borrowernumber = $borrower->{'borrowernumber'};
  	my %currentissues;
! 	my $select = "SELECT items.*,issues.timestamp      AS timestamp,
  				issues.date_due       AS date_due,
  				items.barcode         AS barcode,
  				biblio.title          AS title,





More information about the Koha-cvs mailing list