LP1731021 Rework fine-item detail for SIP. user/dpearl/LP1731021_fine_item_detail
authorDan Pearl <dpearl@cwmars.org>
Wed, 4 Apr 2018 18:44:46 +0000 (14:44 -0400)
committerDan Pearl <dpearl@cwmars.org>
Wed, 4 Apr 2018 18:44:46 +0000 (14:44 -0400)
Open-ILS/examples/oils_sip.xml.example
Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm

index fd7f831..0b5b3ec 100644 (file)
        </listeners>
 
        <accounts>
+               <!-- 
+               Fine Item Detail returned by the Patron Information Request is  
+               manufacturer-specific.  We support the following formats: 
+               3m,  Swyer_A, Swyer_B, and EG_Legacy (default)
+               Specify which treatment you want in the av_format attribute.
+               For example: <login id="sc" password="pwd" institution="main" av_format="3m"> 
+                -->
+
                <login id="scclient" password="clientpwd" institution="gapines"/>
+
        </accounts>
 
        <!-- Institution tags will hold stuff used to interface to -->
                                                flag instead of always returning not-OK
                                        <option name='patron_calculate_recal_ok' value='true' />
                                        -->
-                   <!-- 
-                       Fine Item Detail returned by the Patron Information Request is  
-                       manufacturer-specific.  We support the following formats: 
-                          3m,  Swyer_A, Swyer_B, and EG_Legacy (default)
-                       Specify which treatment you want in the av_format option.
-                   <option name='av_format' value='eg_legacy' />
-                    -->
+<<<<<<< Updated upstream
 
+=======
+>>>>>>> Stashed changes
                                </options>
 
                 <checkin_override>
index 5c2e639..1d8fc30 100644 (file)
@@ -846,10 +846,11 @@ sub charged_items_impl {
 sub fine_items {
     my ($self, $start, $end, $ids_only) = @_;
     my @fines;
-    my ($AV_format_orig, $AV_format, $line);
-
     eval {
-       $AV_format_orig = OpenILS::SIP->get_option_value('av_format') || '';
+<<<<<<< Updated upstream
+=======
+       my $login = OpenILS::SIP->login_account();
+       $AV_format_orig = $login->{av_format} || '';
        $AV_format_orig = "eg_legacy" if $AV_format_orig == '';
 
        $AV_format = lc $AV_format_orig;  # For case-insensitivity
@@ -864,58 +865,23 @@ sub fine_items {
            $AV_format = "eg_legacy";
        }
 
+>>>>>>> Stashed changes
        my $xacts = $U->simplereq('open-ils.actor', 'open-ils.actor.user.transactions.history.have_balance', $self->{authtoken}, $self->{user}->id);
-
        foreach my $xact (@{$xacts}) {
            if ($ids_only) {
-                $line = $xact;
-           
-           #-------------------
-          #  eg_legacy 
-           #-------------------
-           } elsif ($AV_format eq "eg_legacy") {
-              $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;
-              } else {
-                  $line .= $xact->last_billing_note;
-              }        
-       
-           #-------------------
-          #  3m  or  swyer_a
-           #-------------------
-          } elsif ($AV_format eq "3m" or $AV_format eq "swyer_a") {
-              $line = $xact->id . ' $' . $xact->balance_owed . ' "FINE" ' . $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;
-              } else {
-                  $line .= $xact->last_billing_note;
-              }
-
-
-           #-------------------
-          #  swyer_b
-           #-------------------
-          } elsif ($AV_format eq "swyer_b") {
-              $line =   "Charge-Number: " . $xact->id;
-              $line .=  ", Amount-Due: "  . $xact->balance_owed;
-              $line .=  ", Fine-Type: FINE";
-
-              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 .= ", Title: " . $mods->title;
-              } else {
-                  $line .= ", Title: " . $xact->last_billing_note;
-              }
-
-           }
-
-            push @fines, $line;
+               push @fines, $xact;
+               next;
+           }
+           my $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;
+           } else {
+               $line .= $xact->last_billing_note;
+           }
+           push @fines, $line;
        }
     };
-
     my $log_status = $@ ? 'ERROR: ' . $@ : 'OK';
     syslog('LOG_DEBUG', 'OILS: Patron->fine_items() ' . $log_status);
     return (defined $start and defined $end) ?