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

Mason James szrj1m at yahoo.com
Tue May 15 22:49:32 CEST 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		dev_week
Changes by:	Mason James <sushi>	07/05/15 20:49:32

Modified files:
	C4/Circulation : Circ2.pm 

Log message:
	made a small fix? in getloanlength(), now  'if' evals correctly fail when a null is returned from the DB

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.22&r2=1.87.2.14.2.23

Patches:
Index: Circ2.pm
===================================================================
RCS file: /sources/koha/koha/C4/Circulation/Attic/Circ2.pm,v
retrieving revision 1.87.2.14.2.22
retrieving revision 1.87.2.14.2.23
diff -u -b -r1.87.2.14.2.22 -r1.87.2.14.2.23
--- Circ2.pm	15 May 2007 20:44:52 -0000	1.87.2.14.2.22
+++ Circ2.pm	15 May 2007 20:49:32 -0000	1.87.2.14.2.23
@@ -3,7 +3,7 @@
 
 package C4::Circulation::Circ2;
 
-# $Id: Circ2.pm,v 1.87.2.14.2.22 2007/05/15 20:44:52 sushi Exp $
+# $Id: Circ2.pm,v 1.87.2.14.2.23 2007/05/15 20:49:32 sushi Exp $
 
 #package to deal with Returns
 #written 3/11/99 by olwen at katipo.co.nz
@@ -998,46 +998,53 @@
 
 sub getLoanLength {
 	my ($borrowertype,$itemtype,$branchcode) = @_;
-        warn "incoming vars:".$borrowertype." ".$itemtype." ".$branchcode;
 	my $dbh = C4::Context->dbh;
 	my $sth = $dbh->prepare("select issuelength from issuingrules where categorycode=? and itemtype=? and branchcode=?");
 	# try to find issuelength & return the 1st available.
 	# check with borrowertype, itemtype and branchcode, then without one of those parameters
 	$sth->execute($borrowertype,$itemtype,$branchcode);
 	my $loanlength = $sth->fetchrow_hashref;
-	return $loanlength->{issuelength} if defined($loanlength);
-	
+    return $loanlength->{issuelength} if defined $loanlength->{issuelength};
+   warn 'lll'; 
 	$sth->execute($borrowertype,$itemtype,"");
-	$loanlength = $sth->fetchrow_hashref;
-	return $loanlength->{issuelength} if defined($loanlength);
+    my $loanlength = $sth->fetchrow_hashref;
+    return $loanlength->{issuelength} if defined $loanlength->{issuelength};
 	
+   warn 'lll'; 
 	$sth->execute($borrowertype,"*",$branchcode);
-	$loanlength = $sth->fetchrow_hashref;
-	return $loanlength->{issuelength} if defined($loanlength);
+    my $loanlength = $sth->fetchrow_hashref;
+    return $loanlength->{issuelength} if defined $loanlength->{issuelength};
 
+   warn 'lll'; 
 	$sth->execute("*",$itemtype,$branchcode);
-	$loanlength = $sth->fetchrow_hashref;
-	return $loanlength->{issuelength} if defined($loanlength);
+    my $loanlength = $sth->fetchrow_hashref;
+    return $loanlength->{issuelength} if defined $loanlength->{issuelength};
 
+   warn 'lll'; 
 	$sth->execute($borrowertype,"*","");
-	$loanlength = $sth->fetchrow_hashref;
-	return $loanlength->{issuelength} if defined($loanlength);
+    my $loanlength = $sth->fetchrow_hashref;
+    return $loanlength->{issuelength} if defined $loanlength->{issuelength};
 
+   warn 'lll'; 
 	$sth->execute("*","*",$branchcode);
-	$loanlength = $sth->fetchrow_hashref;
-	return $loanlength->{issuelength} if defined($loanlength);
+    my $loanlength = $sth->fetchrow_hashref;
+    return $loanlength->{issuelength} if defined $loanlength->{issuelength};
 
+   warn 'lll'; 
 	$sth->execute("*",$itemtype,"");
-	$loanlength = $sth->fetchrow_hashref;
-	return $loanlength->{issuelength} if defined($loanlength);
+    my $loanlength = $sth->fetchrow_hashref;
+    return $loanlength->{issuelength} if defined $loanlength->{issuelength};
 
+   warn 'lll'; 
 	$sth->execute("*","*","");
-	$loanlength = $sth->fetchrow_hashref;
-	return $loanlength->{issuelength} if defined($loanlength);
-
+    my $loanlength = $sth->fetchrow_hashref;
+    return $loanlength->{issuelength} if defined $loanlength->{issuelength};
+   warn 'lll'; 
+### return 21
 	# if no rule is set => 21 days (hardcoded)
 	return 21;
 }
+
 =head2 returnbook
 
   ($doreturn, $messages, $iteminformation, $borrower) =





More information about the Koha-cvs mailing list