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) ?
--- /dev/null
+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.
+