From 0a8fcfe53ac553ff11bc87db23f799424877725f Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Sun, 30 Dec 2007 13:41:35 -0600 Subject: [PATCH] Fix for item level itypes and toomany subroutine Signed-off-by: Joshua Ferraro --- C4/Circulation.pm | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index a689f8b6d0..e0fbbea1d1 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -397,7 +397,11 @@ sub TooMany { AND i.returndate IS NULL AND i.itemnumber = s2.itemnumber AND s1.biblioitemnumber = s2.biblioitemnumber"; - (C4::Context->preference('item-level_itypes')) ? $query2.=" AND s2.itype=? " : $query2.=" AND s1.itemtype= ? "; + if (C4::Context->preference('item-level_itypes')){ + $query2.=" AND s2.itype=? "; + } else { + $query2.=" AND s1.itemtype= ? "; + } my $sth2= $dbh->prepare($query2); my $sth3 = $dbh->prepare( @@ -491,19 +495,20 @@ sub TooMany { if ( $result->{'maxissueqty'} <= $alreadyissued ) { return ( "$alreadyissued / ".( $result->{maxissueqty} + 0 )." (rule on default branch / default category / itemtype failed)" ); } - # now checking for total - $sth->execute( '*', '*', '*' ); - my $result = $sth->fetchrow_hashref; - if ( $result->{maxissueqty} ne '' ) { - $sth2->execute( $borrower->{'borrowernumber'}, $type ); - my $alreadyissued = $sth2->fetchrow; - if ( $result->{'maxissueqty'} <= $alreadyissued ) { - return ( "$alreadyissued / ".( $result->{maxissueqty} + 0 )." (rule on default branch / default category / total failed)" ); - } - } - } + } + # now checking for total + $sth->execute( '*', '*', '*' ); + my $result = $sth->fetchrow_hashref; + if ( $result->{maxissueqty} ne '' ) { + warn "checking total"; + $sth2->execute( $borrower->{'borrowernumber'}, $type ); + my $alreadyissued = $sth2->fetchrow; + if ( $result->{'maxissueqty'} <= $alreadyissued ) { + return ( "$alreadyissued / ".( $result->{maxissueqty} + 0 )." (rule on default branch / default category / total failed)" ); + } + } - #OK, the patron can issue !!! + # OK, the patron can issue !!! return; } -- 2.39.5