[Koha-patches] [PATCH 1/3] bug 4036: do not count item overdue if it is due today
Galen Charlton
gmcharlt at gmail.com
Sat May 1 20:42:03 CEST 2010
* use curdate() instead of now() to test whether item is overdue
* enhanced POD of IsMemberBlocked
Signed-off-by: Galen Charlton <gmcharlt at gmail.com>
---
C4/Members.pm | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/C4/Members.pm b/C4/Members.pm
index 60a3164..848fdd1 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
--
1.7.0
More information about the Koha-patches
mailing list