[open-ils-commits] r15608 - branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Circ (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Feb 22 09:19:29 EST 2010
Author: erickson
Date: 2010-02-22 09:19:27 -0500 (Mon, 22 Feb 2010)
New Revision: 15608
Modified:
branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
Log:
keep in-db circ consistent with script circs WRT dissallowing checkouts and renewals for inactive patrons, inactive cards, and expired patrons
Modified: branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
===================================================================
--- branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm 2010-02-22 14:18:21 UTC (rev 15607)
+++ branches/rel_1_6/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm 2010-02-22 14:19:27 UTC (rev 15608)
@@ -657,16 +657,21 @@
# Grab the patron
# --------------------------------------------------------------------------
my $patron;
+ my $flesh = {
+ flesh => 1,
+ flesh_fields => {au => [ qw/ card / ]}
+ };
+
if( $self->patron_id ) {
- $patron = $e->retrieve_actor_user($self->patron_id) or return $e->event;
+ $patron = $e->retrieve_actor_user([$self->patron_id, $flesh]) or return $e->event;
} elsif( $self->patron_barcode ) {
my $card = $e->search_actor_card(
{barcode => $self->patron_barcode})->[0] or return $e->event;
- $patron = $e->search_actor_user(
- {card => $card->id})->[0] or return $e->event;
+ $patron = $e->search_actor_user([
+ {card => $card->id}, $flesh])->[0] or return $e->event;
} else {
if( my $copy = $self->copy ) {
@@ -674,7 +679,7 @@
{target_copy => $copy->id, checkin_time => undef});
if( my $circ = $circs->[0] ) {
- $patron = $e->retrieve_actor_user($circ->usr)
+ $patron = $e->retrieve_actor_user([$circ->usr, $flesh])
or return $e->event;
}
}
@@ -682,6 +687,23 @@
return $self->bail_on_events(OpenILS::Event->new('ACTOR_USER_NOT_FOUND'))
unless $self->patron($patron) or $self->is_checkin;
+
+ unless($self->is_checkin) {
+
+ # Check for inactivity and patron reg. expiration
+
+ $self->bail_on_events(OpenILS::Event->new('PATRON_INACTIVE'))
+ unless $U->is_true($patron->active);
+
+ $self->bail_on_events(OpenILS::Event->new('PATRON_CARD_INACTIVE'))
+ unless $U->is_true($patron->card->active);
+
+ my $expire = DateTime::Format::ISO8601->new->parse_datetime(
+ cleanse_ISO8601($patron->expire_date));
+
+ $self->bail_on_events(OpenILS::Event->new('PATRON_ACCOUNT_EXPIRED'))
+ if( CORE::time > $expire->epoch ) ;
+ }
}
# --------------------------------------------------------------------------
More information about the open-ils-commits
mailing list