From: Bill Erickson <berickxx@gmail.com>
Date: Mon, 13 May 2019 14:43:51 +0000 (-0400)
Subject: LP1731021 SIP fine detail fee type additions
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=6b39b42f25f358eb8d7e23af4b56afb3f029ec24;p=evergreen%2Fjoelewis.git

LP1731021 SIP fine detail fee type additions

Adds support for specifying different fee types in the fine/fee response
based on the most recent billing type of each transaction.

Thanks to Jason Stephenson for the initial implementation.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
---

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
index c9b59022b6..9de94b82e3 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
@@ -879,6 +879,16 @@ sub fine_items {
         my $author;
         my $line;
 
+        my $fee_type;
+
+        if ($xact->last_billing_type =~ /^Lost/) {
+            $fee_type = 'LOST';
+        } elsif ($xact->last_billing_type =~ /^Overdue/) {
+            $fee_type = 'FINE';
+        } else {
+            $fee_type = 'FEE';
+        }
+
         if ($xact->xact_type eq 'circulation') {
             my $e = OpenILS::SIP->editor();
             my $circ = $e->retrieve_action_circulation([
@@ -919,18 +929,17 @@ sub fine_items {
             $line = $xact->balance_owed . " " . $xact->last_billing_type . " ";
 
             if ($xact->xact_type eq 'circulation') {
-                $line .= "$title/$author";
+                $line .= "$title / $author";
             } else {
                 $line .= $xact->last_billing_note;
             }
 
         } elsif ($AV_format eq "3m" or $AV_format eq "swyer_a") {
 
-            $line = $xact->id . ' $' . $xact->balance_owed .
-                ' "FINE" ' . $xact->last_billing_type . ' ';
+            $line = $xact->id . ' $' . $xact->balance_owed . " \"$fee_type\" ";
 
             if ($xact->xact_type eq 'circulation') {
-                $line .= "$title/$author";
+                $line .= "$title";
             } else {
                 $line .= $xact->last_billing_note;
             }
@@ -939,7 +948,7 @@ sub fine_items {
 
             $line =   "Charge-Number: " . $xact->id;
             $line .=  ", Amount-Due: "  . $xact->balance_owed;
-            $line .=  ", Fine-Type: FINE";
+            $line .=  ", Fine-Type: $fee_type";
 
             if ($xact->xact_type eq 'circulation') {
                 $line .= ", Title: $title";