Also check for standing penalties and expired cards when checking
if it is ok for the patron to checkout, charge_ok.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
Signed-off-by: Sarah E. Chodrow (sarah.chodrow@bibliotheca-itg.com)
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
}
# How much more detail do we need to check here?
+# sec: adding logic to return false if user is barred, has a circulation block
+# or an expired card
sub charge_ok {
my $self = shift;
my $u = $self->{user};
- return
- $u->barred eq 'f' and
+
+ # compute expiration date for borrowing privileges
+ my $expire = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($u->expire_date));
+
+ # determine whether patron should be allowed to circulate materials:
+ # not barred, doesn't owe too much wrt fines/fees, privileges haven't
+ # expired
+ my $no_circ = 't' if
+ (($u->barred eq 't') or
+ ($u->standing_penalties and @{$u->standing_penalties}) or
+ (CORE::time > $expire->epoch));
+
+ return
+ !$no_circ and
$u->active eq 't' and
$u->card->active eq 't';
}
+
+
# How much more detail do we need to check here?
sub renew_ok {
my $self = shift;