[Koha-cvs] koha/C4/Circulation Circ2.pm [dev_week]

Mason James szrj1m at yahoo.com
Wed May 16 07:01:35 CEST 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		dev_week
Changes by:	Mason James <sushi>	07/05/16 05:01:34

Modified files:
	C4/Circulation : Circ2.pm 

Log message:
	commiting ryan's correct toomany() sub

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Circulation/Circ2.pm?cvsroot=koha&only_with_tag=dev_week&r1=1.87.2.14.2.28&r2=1.87.2.14.2.29

Patches:
Index: Circ2.pm
===================================================================
RCS file: /sources/koha/koha/C4/Circulation/Attic/Circ2.pm,v
retrieving revision 1.87.2.14.2.28
retrieving revision 1.87.2.14.2.29
diff -u -b -r1.87.2.14.2.28 -r1.87.2.14.2.29
--- Circ2.pm	15 May 2007 23:58:58 -0000	1.87.2.14.2.28
+++ Circ2.pm	16 May 2007 05:01:34 -0000	1.87.2.14.2.29
@@ -3,7 +3,7 @@
 
 package C4::Circulation::Circ2;
 
-# $Id: Circ2.pm,v 1.87.2.14.2.28 2007/05/15 23:58:58 sushi Exp $
+# $Id: Circ2.pm,v 1.87.2.14.2.29 2007/05/16 05:01:34 sushi Exp $
 
 #package to deal with Returns
 #written 3/11/99 by olwen at katipo.co.nz
@@ -657,69 +657,69 @@
 	if (defined($result)) {
 		$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
 		my $alreadyissued = $sth2->fetchrow;
-		return ("a $alreadyissued / ".($result->{maxissueqty}+0)) if ($result->{'maxissueqty'} <= $alreadyissued);
+        return (($result->{'maxissueqty'} <= $alreadyissued) ? "a $alreadyissued / ".($result->{maxissueqty}+0) : 0 ) ;
 	}
 	# check for branch=*
 	$sth->execute($cat_borrower, $type, "");
-	$result = $sth->fetchrow_hashref;
+    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);
+        return (($result->{'maxissueqty'} <= $alreadyissued) ? "b $alreadyissued / ".($result->{maxissueqty}+0) : 0 ) ;
 	}
 	# check for itemtype=*
 	$sth->execute($cat_borrower, "*", $branch_borrower);
-	$result = $sth->fetchrow_hashref;
+    my $result = $sth->fetchrow_hashref;
 	if (defined($result)) {
 		$sth3->execute($borrower->{'borrowernumber'});
 		my ($alreadyissued) = $sth3->fetchrow;
-		warn "HERE : $alreadyissued / ($result->{maxissueqty} for $borrower->{'borrowernumber'}";
-		return ("c $alreadyissued / ".($result->{maxissueqty}+0)) if ($result->{'maxissueqty'} <= $alreadyissued);
+        return (($result->{'maxissueqty'} <= $alreadyissued) ? "c $alreadyissued / ".($result->{maxissueqty}+0) : 0 ) ;
 	}
 	#check for borrowertype=*
 	$sth->execute("*", $type, $branch_borrower);
-	$result = $sth->fetchrow_hashref;
+    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);
+        return (($result->{'maxissueqty'} <= $alreadyissued) ? "d $alreadyissued / ".($result->{maxissueqty}+0) : 0 ) ;
 	}
 
 	$sth->execute("*", "*", $branch_borrower);
-	$result = $sth->fetchrow_hashref;
+    my $result = $sth->fetchrow_hashref;
 	if (defined($result)) {
 		$sth3->execute($borrower->{'borrowernumber'});
 		my $alreadyissued = $sth3->fetchrow;
-		return ("e $alreadyissued / ".($result->{maxissueqty}+0)) if ($result->{'maxissueqty'} <= $alreadyissued);
+        return (($result->{'maxissueqty'} <= $alreadyissued) ? "e $alreadyissued / ".($result->{maxissueqty}+0) : 0 ) ;
 	}
 
 	$sth->execute("*", $type, "");
-	$result = $sth->fetchrow_hashref;
+    my $result = $sth->fetchrow_hashref;
 	if (defined($result) && $result->{maxissueqty} ge 0) {
 		$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
 		my $alreadyissued = $sth2->fetchrow;
-		return ("f $alreadyissued / ".($result->{maxissueqty}+0)) if ($result->{'maxissueqty'} <= $alreadyissued);
+        return (($result->{'maxissueqty'} <= $alreadyissued) ? "f $alreadyissued / ".($result->{maxissueqty}+0) : 0 ) ;
 	}
 
 	$sth->execute($cat_borrower, "*", "");
-	$result = $sth->fetchrow_hashref;
+    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);
+        return (($result->{'maxissueqty'} <= $alreadyissued) ? "g $alreadyissued / ".($result->{maxissueqty}+0) : 0 ) ;
 	}
 
 	$sth->execute("*", "*", "");
-	$result = $sth->fetchrow_hashref;
+    my $result = $sth->fetchrow_hashref;
 	if (defined($result)) {
 		$sth3->execute($borrower->{'borrowernumber'});
 		my $alreadyissued = $sth3->fetchrow;
-		return ("h $alreadyissued / ".($result->{maxissueqty}+0)) if ($result->{'maxissueqty'} <= $alreadyissued);
+        return (($result->{'maxissueqty'} <= $alreadyissued) ? "h $alreadyissued / ".($result->{maxissueqty}+0) : 0 ) ;
 	}
 	return;
 }
 
 
+
 sub canbookbeissued {
 	my ($env,$borrower,$barcode,$year,$month,$day) = @_;
 	my %needsconfirmation; # filled with problems that needs confirmations





More information about the Koha-cvs mailing list