LP1901930 Patron info repairs
authorBill Erickson <berickxx@gmail.com>
Mon, 2 Nov 2020 15:47:21 +0000 (10:47 -0500)
committerBill Erickson <berickxx@gmail.com>
Mon, 2 Nov 2020 15:47:21 +0000 (10:47 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/SIP2/Patron.pm

index 40d118a..b9d3ea3 100644 (file)
@@ -45,17 +45,7 @@ sub get_patron_details {
     return undef if defined $password &&
         !$U->verify_migrated_user_password($e, $patron->id, $password);
 
-    my $penalties = get_patron_penalties($session, $patron);
-
-    set_patron_privileges($session, $details, $penalties);
-
-    $details->{too_many_overdue} = 1 if
-        grep {$_->{id} == OILS_PENALTY_PATRON_EXCEEDS_OVERDUE_COUNT}
-        @$penalties;
-
-    $details->{too_many_fines} = 1 if
-        grep {$_->{id} == OILS_PENALTY_PATRON_EXCEEDS_FINES}
-        @$penalties;
+    set_patron_privileges($session, $details);
 
     my $summary = $e->retrieve_money_open_user_summary($patron->id);
     $details->{balance_owed} = ($summary) ? $summary->balance_owed : 0;
@@ -333,7 +323,7 @@ sub find_copy_for_hold {
 
 
 sub set_patron_privileges {
-    my ($session, $details, $penalties) = @_;
+    my ($session, $details) = @_;
     my $patron = $details->{patron};
 
     my $expire = DateTime::Format::ISO8601->new
@@ -352,6 +342,16 @@ sub set_patron_privileges {
     # patron_status_permit_all is true.
     return if $session->config->{patron_status_permit_all};
 
+    my $penalties = get_patron_penalties($session, $patron);
+
+    $details->{too_many_overdue} = 1 if
+        grep {$_->{id} == OILS_PENALTY_PATRON_EXCEEDS_OVERDUE_COUNT}
+        @$penalties;
+
+    $details->{too_many_fines} = 1 if
+        grep {$_->{id} == OILS_PENALTY_PATRON_EXCEEDS_FINES}
+        @$penalties;
+
     my $blocked = (
            $patron->barred eq 't'
         || $patron->active eq 'f'
@@ -376,6 +376,7 @@ sub set_patron_privileges {
     # checkout and holds privilege, since both would be needed for recalls.
     $details->{recall_denied} = 
         ($details->{charge_denied} || $details->{holds_denied});
+
 }
 
 # Returns an array of penalty hashes with keys "id" and "block_list"
@@ -426,7 +427,7 @@ sub add_fine_items {
     foreach my $xact (@{$xacts}) {
         my ($title, $author, $line, $fee_type);
 
-        if ($xact->last_billing_type =~ /^Lost/) {
+        if ($xact->last_billing_type eq 'Lost Materials') {
             $fee_type = 'LOST';
         } elsif ($xact->last_billing_type =~ /^Overdue/) {
             $fee_type = 'FINE';
@@ -482,7 +483,7 @@ sub add_fine_items {
             if ($xact->xact_type eq 'circulation') {
                 $line .= "$title / $author";
             } else {
-                $line .= $xact->last_billing_note;
+                $line .= $xact->last_billing_type;
             }
 
         } elsif ($AV_format eq "3m" or $AV_format eq "swyer_a") {
@@ -492,7 +493,7 @@ sub add_fine_items {
             if ($xact->xact_type eq 'circulation') {
                 $line .= "$title";
             } else {
-                $line .= $xact->last_billing_note;
+                $line .= $xact->last_billing_type;
             }
 
         } elsif ($AV_format eq "swyer_b") {
@@ -504,7 +505,7 @@ sub add_fine_items {
             if ($xact->xact_type eq 'circulation') {
                 $line .= ", Title: $title";
             } else {
-                $line .= ", Title: " . $xact->last_billing_note;
+                $line .= ", Title: " . $xact->last_billing_type;
             }
         }