Implement Envisionware Fine Item Details Hack for Chicopee. user/dyrcona/sip2-envisionware-fid
authorJason Stephenson <jstephenson@cwmars.org>
Thu, 1 Nov 2018 16:49:47 +0000 (12:49 -0400)
committerJason Stephenson <jason@sigio.com>
Thu, 1 Nov 2018 20:30:03 +0000 (16:30 -0400)
Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm

index 3b458cb..166febb 100644 (file)
@@ -846,6 +846,8 @@ sub charged_items_impl {
 sub fine_items {
     my ($self, $start, $end, $ids_only) = @_;
     my @fines;
+    # Check for Envisionware extension:
+    my $envisionware_ext = OpenILS::SIP->get_option_value('msg64_fine_items_envisionware') || '';
     eval {
        my $xacts = $U->simplereq('open-ils.actor', 'open-ils.actor.user.transactions.history.have_balance', $self->{authtoken}, $self->{user}->id);
        foreach my $xact (@{$xacts}) {
@@ -853,10 +855,24 @@ sub fine_items {
                push @fines, $xact;
                next;
            }
-           my $line = $xact->balance_owed . " " . $xact->last_billing_type . " ";
+           my $line;
+           if ($envisionware_ext) {
+               $line = $xact->id . ' $' . $xact->balance_owed . " ";
+               if ($xact->last_billing_type =~ /^Lost/) {
+                   $line .= '"LOST"';
+               } elsif ($xact->last_billing_type =~ /^Overdue/) {
+                   $line .= '"FINE"';
+               } else {
+                   $line .= '"FEE"';
+               }
+               $line .= " ";
+           } else {
+             $line = $xact->balance_owed . " " . $xact->last_billing_type . " ";
+           }
            if ($xact->xact_type eq 'circulation') {
                my $mods = $U->simplereq('open-ils.circ', 'open-ils.circ.circ_transaction.find_title', $self->{authtoken}, $xact->id);
-               $line .= $mods->title . ' / ' . $mods->author;
+               $line .= $mods->title;
+               $line .= ' / ' . $mods->author unless ($envisionware_ext);
            } else {
                $line .= $xact->last_billing_note;
            }