[open-ils-commits] [GIT] Evergreen ILS branch master updated. f32b455a1b0a99333e77044358d2d082bd5a222f
Evergreen Git
git at git.evergreen-ils.org
Thu Aug 10 17:06:11 EDT 2017
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, master has been updated
via f32b455a1b0a99333e77044358d2d082bd5a222f (commit)
via 7307537bb0c1c5bcd702313547f5521781ad5a7b (commit)
from a903911387ca31e49f115f5eb2aa4605b7600aaf (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit f32b455a1b0a99333e77044358d2d082bd5a222f
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date: Thu Aug 10 16:43:36 2017 -0400
LP#1659928: (follow-up) the flesh stays on...
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
index 54f5fdb..23e234c 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
@@ -216,7 +216,7 @@ sub flesh_user_penalties {
if (ref($raw_penalties) eq 'ARRAY' && @$raw_penalties) {
my $here_prox = ($here) ? $U->get_org_unit_proximity($e, $here, $user->home_ou())
: undef;
- # Filter out those that do not apply and deflesh the standing_penalty.
+ # Filter out those that do not apply
$applied_penalties = [map
{ $_->standing_penalty }
grep {
commit 7307537bb0c1c5bcd702313547f5521781ad5a7b
Author: blake <blake at mobiusconsortium.org>
Date: Thu Jun 15 13:39:08 2017 -0500
LP1659928 SIP is not respecting standing penalties for charge ok and hold ok
This will include the block_list data in the blessed user object. This allows
charge_ok, renew_ok and hold_ok to determine if any of the respective blocks are
present in any of the applied penalties.
To test
-------
[1] Using a SIP emulator, issue a 63 message to fetch information
about a patron that has nothing preventing it from doing loans,
renewals, or hold requests, e.g.,
6300020060329 201700Y AOevergreen|AA99999384262||
[2] Verify that the first six positions of the response are
'64 Y '
[3] Apply a standing penalty that blocks circulation and repeat
step 1. This time, the response should start with '64Y Y '
[4] Apply other standing penalties that block holds or renewals
and repeate step 1, verifying that the various privileges
denied positions in the 64 response have expected values.
[5] Archive all of the penalties used during testing, then
verify that the response returns to '64 Y ...'
Signed-off-by: blake <blake at mobiusconsortium.org>
Signed-off-by: Dan Pearl <dpearl at cwmars.org>
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
index 34972cc..54f5fdb 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
@@ -218,7 +218,7 @@ sub flesh_user_penalties {
: undef;
# Filter out those that do not apply and deflesh the standing_penalty.
$applied_penalties = [map
- { $_->standing_penalty($_->standing_penalty->id()) }
+ { $_->standing_penalty }
grep {
!defined($_->standing_penalty->ignore_proximity())
|| ((defined($here_prox))
@@ -336,64 +336,39 @@ sub language {
sub charge_ok {
my $self = shift;
my $u = $self->{user};
+ my $circ_is_blocked = 0;
# 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 $circ_is_blocked =
+ $circ_is_blocked =
(($u->barred eq 't') or
- ($u->standing_penalties and @{$u->standing_penalties}) or
- (CORE::time > $expire->epoch));
+ (@{$u->standing_penalties} and grep { ( $_->block_list // '') =~ /CIRC/ } @{$u->standing_penalties}) or
+ (CORE::time > $expire->epoch));
return
- !$circ_is_blocked and
- $u->active eq 't' and
+ !$circ_is_blocked &&
+ $u->active eq 't' &&
$u->card->active eq 't';
}
sub renew_ok {
my $self = shift;
my $u = $self->{user};
- my $e = $self->{editor};
- my $renew_block_penalty = 'f';
+ my $renew_is_blocked = 0;
# compute expiration date for borrowing privileges
my $expire = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($u->expire_date));
- # if barred or expired, forget it and save us the CPU
- return 0 if(($u->barred eq 't') or (CORE::time > $expire->epoch));
-
- # flesh penalties so we can look close at the block list
- my $penalty_flesh = {
- flesh => 2,
- flesh_fields => {
- au => [
- "standing_penalties",
- ],
- ausp => [
- "standing_penalty",
- ],
- csp => [
- "block_list",
- ],
- }
- };
- my $user = $e->retrieve_actor_user([ $u->id, $penalty_flesh ]);
- foreach( @{ $user->standing_penalties } )
- {
- # archived penalty - ignore
- next if ( $_->stop_date && ( CORE::time > DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($_->stop_date))->epoch ) );
- # check to see if this penalty blocks renewals
- $renew_block_penalty = 't' if $_->standing_penalty->block_list =~ /RENEW/;
- }
+ $renew_is_blocked =
+ (($u->barred eq 't') or
+ (@{$u->standing_penalties} and grep { ( $_->block_list // '') =~ /RENEW/ } @{$u->standing_penalties}) or
+ (CORE::time > $expire->epoch));
return
+ !$renew_is_blocked &&
$u->active eq 't' &&
- $u->card->active eq 't' &&
- $renew_block_penalty eq 'f';
+ $u->card->active eq 't';
}
sub recall_ok {
@@ -405,7 +380,21 @@ sub recall_ok {
sub hold_ok {
my $self = shift;
- return $self->charge_ok;
+ my $u = $self->{user};
+ my $hold_is_blocked = 0;
+
+ # compute expiration date for borrowing privileges
+ my $expire = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($u->expire_date));
+
+ $hold_is_blocked =
+ (($u->barred eq 't') or
+ (@{$u->standing_penalties} and grep { ( $_->block_list // '') =~ /HOLD/ } @{$u->standing_penalties}) or
+ (CORE::time > $expire->epoch));
+
+ return
+ !$hold_is_blocked &&
+ $u->active eq 't' &&
+ $u->card->active eq 't';
}
# return true if the card provided is marked as lost
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm | 71 ++++++++++-------------
1 files changed, 30 insertions(+), 41 deletions(-)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list