From 2568e165e654c94e6a702e58e9d1d8241d551955 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Sat, 1 May 2010 11:58:23 -0400 Subject: [PATCH] bug 4036: do not count item overdue if it is due today * use curdate() instead of now() to test whether item is overdue * enhanced POD of IsMemberBlocked Signed-off-by: Galen Charlton --- C4/Members.pm | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 60a3164e64..848fdd1c10 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -579,16 +579,25 @@ sub GetMember { =over 4 -my $blocked = IsMemberBlocked( $borrowernumber ); +my ($block_status, $count) = IsMemberBlocked( $borrowernumber ); -return the status, and the number of day or documents, depends his punishment +=back -return : --1 if the user have overdue returns -1 if the user is punished X days -0 if the user is authorised to loan +Returns whether a patron has overdue items that may result +in a block or whether the patron has active fine days +that would block circulation privileges. -=back +C<$block_status> can have the following values: + +-1 if the patron has overdue items, in which case C<$count> is the number of them + +1 if the patron has outstanding fine days, in which case C<$count> is the number of them + +0 if the patron has no overdue items or outstanding fine days, in which case C<$count> is 0 + +FIXME: this needs to be split into two functions; a potential block +based on the number of current overdue items could be orthogonal +to a block based on whether the patron has any fine days accrued. =cut @@ -600,7 +609,7 @@ sub IsMemberBlocked { "SELECT COUNT(*) as latedocs FROM issues WHERE borrowernumber = ? - AND date_due < now()" + AND date_due < curdate()" ); $sth->execute($borrowernumber); my $latedocs = $sth->fetchrow_hashref->{'latedocs'}; @@ -638,7 +647,7 @@ sub IsMemberBlocked { return (1, $blockedcount) if $blockedcount > 0; - return 0 + return (0, 0); } =head2 GetMemberIssuesAndFines -- 2.39.5