[open-ils-commits] [GIT] Evergreen ILS branch master updated. 2ba2c3bf0c3fe3bcccd242fa435d589fe0847bf3

Evergreen Git git at git.evergreen-ils.org
Tue Aug 9 12:50:14 EDT 2016


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  2ba2c3bf0c3fe3bcccd242fa435d589fe0847bf3 (commit)
      from  e51f6070f186e9f5504c3e1da5a93e7627738599 (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 2ba2c3bf0c3fe3bcccd242fa435d589fe0847bf3
Author: blake <blake at mobiusconsortium.org>
Date:   Mon Apr 18 16:25:46 2016 -0500

    LP1534283 SIP prevents renewal when user has any blocking standing penalties
    
    This code dives into each penalty to investigate weather or not the patron
    can renew based on the block list column. Before, SIP would block renewals with
    the presence of penalty 1 or 2 regardless.
    
    Signed-off-by: blake <blake at mobiusconsortium.org>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
index ad64b61..0845084 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
@@ -354,12 +354,46 @@ sub charge_ok {
         $u->card->active eq 't';
 }
 
-
-
-# How much more detail do we need to check here?
 sub renew_ok {
     my $self = shift;
-    return $self->charge_ok;
+    my $u = $self->{user};
+    my $e = $self->{editor};
+    my $renew_block_penalty = 'f';
+
+    # 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/;
+    }
+
+    return
+        $u->active eq 't' &&
+        $u->card->active eq 't' &&
+        $renew_block_penalty eq 'f';
 }
 
 sub recall_ok {

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm |   42 ++++++++++++++++++++--
 1 files changed, 38 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list