LP1613335: OK in Patron Status Screen Message
authorJason Boyer <jboyer@equinoxinitiative.org>
Mon, 9 Sep 2019 14:43:07 +0000 (10:43 -0400)
committerJason Boyer <jboyer@equinoxinitiative.org>
Mon, 9 Sep 2019 14:43:07 +0000 (10:43 -0400)
Conditionally return a screen message of OK if the client
expects it, otherwise there will be no screen message for
a user in good standing.

Signed-off-by: Jason Boyer <jboyer@equinoxinitiative.org>
Open-ILS/examples/oils_sip.xml.example
Open-ILS/src/perlmods/lib/OpenILS/SIP.pm
Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm

index 57ebda4..aa9008c 100644 (file)
@@ -30,6 +30,7 @@
 
        <accounts>
                <login id="scclient" password="clientpwd" institution="gapines"/>
+               <login id="cmptrlab" password="clientpwd" institution="gapines" want_patron_ok="true"/>
        </accounts>
 
        <!-- Institution tags will hold stuff used to interface to -->
index 500efa2..7529f2d 100644 (file)
@@ -250,9 +250,11 @@ sub find_patron {
     my $self = shift;
     my $key  =  (@_ > 1) ? shift : 'barcode';  # if we have multiple args, the first is the key index (default barcode)
     my $patron_id = shift;
+    # want_patron_ok is per-login depending on the needs of your selfcheck or PC management systems.
+    my $want_patron_ok = ( $self->{login}->{want_patron_ok} && $self->{login}->{want_patron_ok} =~ /true|yes|enabled/i );
 
     $self->verify_session;
-    return OpenILS::SIP::Patron->new($key => $patron_id, authtoken => $self->{authtoken}, @_);
+    return OpenILS::SIP::Patron->new($key => $patron_id, authtoken => $self->{authtoken}, want_ok => $want_patron_ok, @_);
 }
 
 
index 3b458cb..4c9e538 100644 (file)
@@ -118,6 +118,9 @@ sub new {
     $self->{id}     = ($key eq 'barcode') ? $patron_id : $user->card->barcode;   # The barcode IS the ID to SIP.  
     # We give back the passed barcode if the key was indeed a barcode, just to be safe.  Otherwise pull it from the card.
 
+    # Return 'OK' in the screen message? Likely used primarily by PC management systems.
+    $self->{want_ok} = $args{want_ok};
+
     syslog("LOG_DEBUG", "OILS: new OpenILS Patron(%s => %s): found patron : barred=%s, card:active=%s", 
         $key, $patron_id, $user->barred, $user->card->active );
 
@@ -453,7 +456,7 @@ sub screen_msg {
     my $expire = DateTime::Format::ISO8601->new->parse_datetime(clean_ISO8601($u->expire_date));
     return $b if CORE::time > $expire->epoch;
 
-    return '';
+    return ($self->{want_ok} ? 'OK' : '');
 }
 
 sub print_line {            # not implemented