LP1980978: Improve SIP2 Patron Status Field
authorJason Stephenson <jason@sigio.com>
Thu, 7 Jul 2022 17:40:55 +0000 (13:40 -0400)
committerJason Stephenson <jason@sigio.com>
Wed, 8 Feb 2023 18:03:50 +0000 (13:03 -0500)
Set Y in the "too many items charged" subfield (05) of the SIP2 Patron
Status field if the patron has the PATRON_EXCEEDS_CHECKOUT_COUNT
penalty.

Set Y in the "too many items lost" subfield (09) of the SIP2 Patron
Status field if the patron has the PATRON_EXCEEDS_LOST_COUNT
penalty.

Include the PATRON_EXCEEDS_LONGOVERDUE_COUNT penalty when checking for
the "too many items overdue" subfield (06) of the Patron Status field.

Too test this bug:

1. Find a patron with either too many items checked out or too many
lost items.

2. Use your favorite SIP client to look them up in Evergreen with a
patron information message (63).

3. Verify that the patron comes with their ability to checkout
blocked, i.e there is a Y in field 00 of the Patron Status field of
the message 64 returned by the SIP server.

4. Verify that fields 05 and 09 are both blank even though one of them
should have a Y in it.

After applying the patch, begin with step 2, above.  When you get to step
4, either 05 or 09 (possilby both) should have a Y in it depending on
the patron's penalties.

Repeat the above steps with a patron who has the
PATRON_EXCEEDS_LONGOVERDUE_COUNT penalty but not the
PATRON_EXCEEDS_OVERDUE_COUNT penalty.  You will look for a Y or a
space in subfield 06.

Signed-off-by: Jason Stephenson <jason@sigio.com>
Open-ILS/src/perlmods/lib/OpenILS/Const.pm
Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm

index 0ff4880..fccfd14 100644 (file)
@@ -128,8 +128,10 @@ econst OILS_ACQ_DEBIT_TYPE_TRANSFER => 'xfer';
 econst OILS_PENALTY_AUTO_ID => 100;
 econst OILS_PENALTY_PATRON_EXCEEDS_FINES => 1;
 econst OILS_PENALTY_PATRON_EXCEEDS_OVERDUE_COUNT => 2;
+econst OILS_PENALTY_PATRON_EXCEEDS_CHECKOUT_COUNT => 3;
+econst OILS_PENALTY_PATRON_EXCEEDS_LOST_COUNT => 5;
 econst OILS_PENALTY_INVALID_PATRON_ADDRESS => 29;
-
+econst OILS_PENALTY_PATRON_EXCEEDS_LONGOVERDUE_COUNT => 35;
 
 econst OILS_BILLING_TYPE_NOTIFICATION_FEE => 9;
 
index e7ba27a..16e80d7 100644 (file)
@@ -491,15 +491,18 @@ sub print_line {            # not implemented
     return '';
 }
 
-sub too_many_charged {      # not implemented
+sub too_many_charged {
     my $self = shift;
-    return 0;
+    return scalar(
+        grep { $_->id == OILS_PENALTY_PATRON_EXCEEDS_CHECKOUT_COUNT } @{$self->{user}->standing_penalties}
+    );
 }
 
-sub too_many_overdue { 
+sub too_many_overdue {
     my $self = shift;
-    return scalar( # PATRON_EXCEEDS_OVERDUE_COUNT
-        grep { $_->id == OILS_PENALTY_PATRON_EXCEEDS_OVERDUE_COUNT } @{$self->{user}->standing_penalties}
+    return scalar( # PATRON_EXCEEDS_OVERDUE_COUNT || PATRON_EXCEEDS_LONGOVERDUE_COUNT
+        grep { $_->id == OILS_PENALTY_PATRON_EXCEEDS_OVERDUE_COUNT
+           || $_->id == OILS_PENALTY_PATRON_EXCEEDS_LONGOVERDUE_COUNT } @{$self->{user}->standing_penalties}
     );
 }
 
@@ -515,10 +518,11 @@ sub too_many_claim_return {
     return 0;
 }
 
-# not relevant, handled by fines/fees
 sub too_many_lost {
     my $self = shift;
-    return 0;
+    return scalar(
+        grep { $_->id == OILS_PENALTY_PATRON_EXCEEDS_LOST_COUNT } @{$self->{user}->standing_penalties}
+    );
 }
 
 sub excessive_fines {