improve lost+paid handling collab/miker/lp1676608_copy_alerts-rebased-again-20170831
authorGalen Charlton <gmc@esilibrary.com>
Thu, 27 Oct 2016 21:31:36 +0000 (17:31 -0400)
committerMike Rylander <mrylander@gmail.com>
Thu, 31 Aug 2017 17:44:08 +0000 (13:44 -0400)
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm

index aa4ac33..927e3f0 100644 (file)
@@ -43,13 +43,13 @@ my $MK_ENV_FLESH = {
 # table of cases where suppressing a system-generated copy alerts
 # should generate an override of an old-style event
 my %COPY_ALERT_OVERRIDES = (
-    "CLAIMSRETURNED\tCHECKOUT" => 'CIRC_CLAIMS_RETURNED',
-    "CLAIMSRETURNED\tCHECKIN" => 'CIRC_CLAIMS_RETURNED',
-    "LOST\tCHECKOUT" => 'OPEN_CIRCULATION_EXISTS',
-    "LONGOVERDUE\tCHECKOUT" => 'OPEN_CIRCULATION_EXISTS',
-    "MISSING\tCHECKOUT" => 'COPY_STATUS_MISSING',
-    "DAMAGED\tCHECKOUT" => 'COPY_NOT_AVAILABLE',
-    "LOST_AND_PAID\tCHECKOUT" => 'COPY_NOT_AVAILABLE',
+    "CLAIMSRETURNED\tCHECKOUT" => ['CIRC_CLAIMS_RETURNED'],
+    "CLAIMSRETURNED\tCHECKIN" => ['CIRC_CLAIMS_RETURNED'],
+    "LOST\tCHECKOUT" => ['OPEN_CIRCULATION_EXISTS'],
+    "LONGOVERDUE\tCHECKOUT" => ['OPEN_CIRCULATION_EXISTS'],
+    "MISSING\tCHECKOUT" => ['COPY_STATUS_MISSING'],
+    "DAMAGED\tCHECKOUT" => ['COPY_NOT_AVAILABLE'],
+    "LOST_AND_PAID\tCHECKOUT" => ['COPY_NOT_AVAILABLE', 'OPEN_CIRCULATION_EXISTS']
 );
 
 sub initialize {}
@@ -852,12 +852,12 @@ sub add_overrides_from_system_copy_alerts {
     foreach my $condition (keys %{$self->overrides_per_copy_alerts()}) {
         if (exists $COPY_ALERT_OVERRIDES{$condition}) {
             $self->override(1);
-            push @{$self->override_args->{events}}, $COPY_ALERT_OVERRIDES{$condition};
+            push @{$self->override_args->{events}}, @{ $COPY_ALERT_OVERRIDES{$condition} };
             # special handling for long-overdue and lost checkouts
-            if ($COPY_ALERT_OVERRIDES{$condition} eq 'OPEN_CIRCULATION_EXISTS') {
+            if (grep { $_ eq 'OPEN_CIRCULATION_EXISTS' } @{ $COPY_ALERT_OVERRIDES{$condition} }) {
                 my $state = (split /\t/, $condition, -1)[0];
                 my $setting;
-                if ($state eq 'LOST') {
+                if ($state eq 'LOST' or $state eq 'LOST_AND_PAID') {
                     $setting = 'circ.copy_alerts.forgive_fines_on_lost_checkin';
                 } elsif ($state eq 'LONGOVERDUE') {
                     $setting = 'circ.copy_alerts.forgive_fines_on_long_overdue_checkin';