[open-ils-commits] [GIT] Evergreen ILS branch master updated. 6b39b42f25f358eb8d7e23af4b56afb3f029ec24

Evergreen Git git at git.evergreen-ils.org
Fri Sep 6 17:54:25 EDT 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  6b39b42f25f358eb8d7e23af4b56afb3f029ec24 (commit)
       via  f31720588f20ea03ab67247f8d87fbbe3c7bd940 (commit)
       via  84b29175b3d004d6e968c92f8c6dee11a182de32 (commit)
      from  e6a851c215e151200d02355959608c914b901a92 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6b39b42f25f358eb8d7e23af4b56afb3f029ec24
Author: Bill Erickson <berickxx at gmail.com>
Date:   Mon May 13 10:43:51 2019 -0400

    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 at gmail.com>
    Signed-off-by: Galen Charlton <gmc at 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";

commit f31720588f20ea03ab67247f8d87fbbe3c7bd940
Author: Bill Erickson <berickxx at gmail.com>
Date:   Wed Apr 10 12:45:56 2019 -0400

    LP1731021 SIP Fine detail repairs / display fields
    
    Resolve commit issues with the second commit from the source branch
    working/user/dpearl/LP1731021_fine_item_detail
    
    Migrating circ title/author lookup to use metabib display fields instead
    of MVR's.
    
    Minor code refactoring.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>

diff --git a/Open-ILS/examples/oils_sip.xml.example b/Open-ILS/examples/oils_sip.xml.example
index fd7f83112e..2146775f19 100644
--- a/Open-ILS/examples/oils_sip.xml.example
+++ b/Open-ILS/examples/oils_sip.xml.example
@@ -29,6 +29,13 @@
 	</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>
 
@@ -129,13 +136,6 @@
 						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' />
-                    -->
 
 				</options>
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
index 3118bf5290..c9b59022b6 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
@@ -846,75 +846,110 @@ 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') || '';
-       $AV_format_orig = "eg_legacy" if $AV_format_orig == '';
-
-       $AV_format = lc $AV_format_orig;  # For case-insensitivity
-
-        # Do a prescan for validity and default to eg_legacy
-       if ($AV_format ne "swyer_a" && 
-           $AV_format ne "swyer_b" && 
-           $AV_format ne "eg_legacy" && 
-           $AV_format ne "3m") {
-           syslog('LOG_WARNING', 
-                   "OILS: Unknown value for AV_format: %s", $AV_format_orig);
-           $AV_format = "eg_legacy";
-       }
-
-       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;
-       }
-    };
+
+    my $login = OpenILS::SIP->login_account();
+    my $AV_format = lc($login->{av_format}) || 'eg_legacy';
+
+    # Do a prescan for validity and default to eg_legacy
+    if ($AV_format ne "swyer_a" &&
+        $AV_format ne "swyer_b" &&
+        $AV_format ne "eg_legacy" &&
+        $AV_format ne "3m") {
+
+        syslog('LOG_WARNING',
+            "OILS: Unknown value for AV_format: ". $login->{av_format});
+        $AV_format = "eg_legacy";
+    }
+
+    my $xacts = $U->simplereq('open-ils.actor',
+        'open-ils.actor.user.transactions.history.have_balance',
+        $self->{authtoken}, $self->{user}->id);
+
+    my $line;
+    foreach my $xact (@{$xacts}) {
+
+        if ($ids_only) {
+            push @fines, $xact->id;
+            next;
+        }
+
+        # fine item details requested
+
+        my $title;
+        my $author;
+        my $line;
+
+        if ($xact->xact_type eq 'circulation') {
+            my $e = OpenILS::SIP->editor();
+            my $circ = $e->retrieve_action_circulation([
+                $xact->id, {
+                    flesh => 2,
+                    flesh_fields => {
+                        circ => ['target_copy'],
+                        acp => ['call_number']
+                    }
+                }
+            ]);
+
+            my $displays = $e->search_metabib_flat_display_entry({
+                source => $circ->target_copy->call_number->record,
+                name => ['title', 'author']
+            });
+
+            ($title) = map {$_->value} grep {$_->name eq 'title'} @$displays;
+            ($author) = map {$_->value} grep {$_->name eq 'author'} @$displays;
+
+            # Scrub "/" chars since they are used in some cases 
+            # to delineate title/author.
+            if ($title) {
+                $title =~ s/\///g;
+            } else {
+                $title = '';
+            }
+
+            if ($author) {
+                $author =~ s/\///g;
+            } else {
+                $author = '';
+            }
+        }
+
+        if ($AV_format eq "eg_legacy") {
+
+            $line = $xact->balance_owed . " " . $xact->last_billing_type . " ";
+
+            if ($xact->xact_type eq 'circulation') {
+                $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 . ' ';
+
+            if ($xact->xact_type eq 'circulation') {
+                $line .= "$title/$author";
+            } else {
+                $line .= $xact->last_billing_note;
+            }
+
+        } 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') {
+                $line .= ", Title: $title";
+            } else {
+                $line .= ", Title: " . $xact->last_billing_note;
+            }
+        }
+
+        push @fines, $line;
+    }
 
     my $log_status = $@ ? 'ERROR: ' . $@ : 'OK';
     syslog('LOG_DEBUG', 'OILS: Patron->fine_items() ' . $log_status);
diff --git a/docs/RELEASE_NOTES_NEXT/SIP/AV_format.adoc b/docs/RELEASE_NOTES_NEXT/SIP/AV_format.adoc
index f1c2a942bf..3512b6133c 100644
--- a/docs/RELEASE_NOTES_NEXT/SIP/AV_format.adoc
+++ b/docs/RELEASE_NOTES_NEXT/SIP/AV_format.adoc
@@ -1,18 +1,19 @@
 Fine Item Detail Enhancements
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-SIP now suppports enhancements for the Fine Item Detail returned by by Patron Information
-Response (code 64).  Different manufacturers of self-check systems specify the format
-of the fine item detail differently.  A new option allows you to select the format to
-return.
+SIP now suppports enhancements for the Fine Item Detail returned by
+by Patron Information Response (code 64).  Different manufacturers
+of self-check systems specify the format of the fine item detail
+differently.  A new option allows you to select the format to return.
 
 Configuration
 +++++++++++++
-After installation of Evergreen and SIP, in the Evergreen configuration directory (typically
-/openils/conf) the SIP configuration file oils_sip.xml awaits your modifications to use this
-feature.
+After installation of Evergreen and SIP, in the Evergreen configuration
+directory (typically /openils/conf) the SIP configuration file
+oils_sip.xml awaits your modifications to use this feature.
+
+In the <accounts><login> sections, you can add an attribute of the form
+    `av_format="__<value>__"`
 
-In the <implementation_config><options> section, you can place an option of the form +
-        `<option name='av_format' value='`__<value>__`'>` +
 where __<value>__ is one of thsee values:
 
 * `3m`
@@ -20,14 +21,18 @@ where __<value>__ is one of thsee values:
 * `swyer_a`
 * `swyer_b`
 
-If you omit the option, the default will act as though you wrote +
-        `<option name='av_format' value='eg_legacy'>`
+For example:
+
+<login id="sipclient" password="password" institution="gapines" av_format="3m"/>
+
+If you omit the option, 'eg_legacy' will be used as the default.
+
+Currently, the behaviour of `eg_legacy` is close to, but not precisely
+that of `3m`.  The `eg_legacy` produces the pre-enhancement behavior in
+Evergreen.  Currently, the `swyer_a` behavior is identical to that of
+`3m`, but there is no guarantee that this will always be the case.
 
-Currently, the behaviour of `eg_legacy` is close to, but not precisely that of `3m`.  The
-`eg_legacy` produces the pre-enhancement behavior in Evergreen.   Currently, the
-`swyer_a` behavior
-is identical to that of `3m`, but there is no guarantee that this will always be the case.
+If you change the brand of your self-check equipment, you may need to
+change the value of the option to be consistent with the new brand.
 
-If you change the brand of your self-check equipment, you may need to change the value
-of the option to be consistent with the new brand.
 

commit 84b29175b3d004d6e968c92f8c6dee11a182de32
Author: Dan Pearl <dpearl at cwmars.org>
Date:   Thu May 25 14:10:01 2017 -0400

    LP#1731021: Support fine detail enhancement to SIP.
    
    The particular flavor of fine detail output is manufacturer dependent,
    although 3m is popular, and the default.  To configure the selection,
    modify the /openils/conf/oils_sip.xml file.
    
    Testing: See the /openils/conf/oils_sip.xml file and test all supported
    values for the av_format option.  You should also test the case where
    the option is omitted, or a non-supported value.  I am not sure what
    happens if you supply more than one option with same or different
    values, but this is a non-supported degenerate case.
    
    For each test value, ensure tha the fine item detail is the expected
    format.
    
    Signed-off-by: Dan Pearl <dpearl at cwmars.org>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>

diff --git a/Open-ILS/examples/oils_sip.xml.example b/Open-ILS/examples/oils_sip.xml.example
index 57ebda4596..fd7f83112e 100644
--- a/Open-ILS/examples/oils_sip.xml.example
+++ b/Open-ILS/examples/oils_sip.xml.example
@@ -129,6 +129,13 @@
 						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' />
+                    -->
 
 				</options>
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
index 3b458cb784..3118bf5290 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm
@@ -846,23 +846,76 @@ 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') || '';
+       $AV_format_orig = "eg_legacy" if $AV_format_orig == '';
+
+       $AV_format = lc $AV_format_orig;  # For case-insensitivity
+
+        # Do a prescan for validity and default to eg_legacy
+       if ($AV_format ne "swyer_a" && 
+           $AV_format ne "swyer_b" && 
+           $AV_format ne "eg_legacy" && 
+           $AV_format ne "3m") {
+           syslog('LOG_WARNING', 
+                   "OILS: Unknown value for AV_format: %s", $AV_format_orig);
+           $AV_format = "eg_legacy";
+       }
+
        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) {
-               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;
+                $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;
        }
     };
+
     my $log_status = $@ ? 'ERROR: ' . $@ : 'OK';
     syslog('LOG_DEBUG', 'OILS: Patron->fine_items() ' . $log_status);
     return (defined $start and defined $end) ? 
diff --git a/docs/RELEASE_NOTES_NEXT/SIP/AV_format.adoc b/docs/RELEASE_NOTES_NEXT/SIP/AV_format.adoc
new file mode 100644
index 0000000000..f1c2a942bf
--- /dev/null
+++ b/docs/RELEASE_NOTES_NEXT/SIP/AV_format.adoc
@@ -0,0 +1,33 @@
+Fine Item Detail Enhancements
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+SIP now suppports enhancements for the Fine Item Detail returned by by Patron Information
+Response (code 64).  Different manufacturers of self-check systems specify the format
+of the fine item detail differently.  A new option allows you to select the format to
+return.
+
+Configuration
++++++++++++++
+After installation of Evergreen and SIP, in the Evergreen configuration directory (typically
+/openils/conf) the SIP configuration file oils_sip.xml awaits your modifications to use this
+feature.
+
+In the <implementation_config><options> section, you can place an option of the form +
+        `<option name='av_format' value='`__<value>__`'>` +
+where __<value>__ is one of thsee values:
+
+* `3m`
+* `eg_legacy`
+* `swyer_a`
+* `swyer_b`
+
+If you omit the option, the default will act as though you wrote +
+        `<option name='av_format' value='eg_legacy'>`
+
+Currently, the behaviour of `eg_legacy` is close to, but not precisely that of `3m`.  The
+`eg_legacy` produces the pre-enhancement behavior in Evergreen.   Currently, the
+`swyer_a` behavior
+is identical to that of `3m`, but there is no guarantee that this will always be the case.
+
+If you change the brand of your self-check equipment, you may need to change the value
+of the option to be consistent with the new brand.
+

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/examples/oils_sip.xml.example          |   7 ++
 Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm | 131 +++++++++++++++++++++---
 docs/RELEASE_NOTES_NEXT/SIP/AV_format.adoc      |  38 +++++++
 3 files changed, 159 insertions(+), 17 deletions(-)
 create mode 100644 docs/RELEASE_NOTES_NEXT/SIP/AV_format.adoc


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list