Make inactive cards/patrons "not exist" via SIP2
authorThomas Berezansky <tsbere@mvlc.org>
Mon, 18 Jul 2011 00:28:14 +0000 (20:28 -0400)
committerChris Sharp <csharp@georgialibraries.org>
Thu, 13 Dec 2012 13:40:36 +0000 (08:40 -0500)
And make sure if we do get a deleted patron for some reason they are ignored too.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm

index 1f0ed7c..fddce14 100644 (file)
@@ -81,7 +81,7 @@ sub new {
 
         my $card = $e->search_actor_card([{barcode => $patron_id}, $usr_flesh])->[0];
 
-        if(!$card) {
+        if(!$card or !$U->is_true($card->active)) {
             syslog("LOG_WARNING", "No such patron barcode: $patron_id");
             return undef;
         }
@@ -92,11 +92,16 @@ sub new {
            $user = $e->retrieve_actor_user([$patron_id, $usr_flesh]);
     }
 
-    if(!$user) {
+    if(!$user or $U->is_true($user->deleted)) {
         syslog("LOG_WARNING", "OILS: Unable to find patron %s => %s", $key, $patron_id);
         return undef;
     }
 
+    if(!$U->is_true($user->active)) {
+        syslog("LOG_WARNING", "OILS: Patron is inactive %s => %s", $key, $patron_id);
+        return undef;
+    }
+
     # now grab the user's penalties
 
     $self->flesh_user_penalties($user, $e) unless $args{slim_user};