Online Renewal - add temp renewal flag to quipu response
authorTerran McCanna <tmccanna@georgialibraries.org>
Tue, 22 Nov 2022 19:38:29 +0000 (14:38 -0500)
committerTerran McCanna <tmccanna@georgialibraries.org>
Tue, 22 Nov 2022 19:38:29 +0000 (14:38 -0500)
Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm

index 3d9b2cd..afd9a7e 100644 (file)
@@ -219,7 +219,20 @@ sub load_ecard_submit {
         #New expiration date
         $ctx->{response}->{expire_date} = $ctx->{user}->expire_date;
         #Mark whether this is a temporary renewal or not
-        # TERRAN - TO DO
+        my $findpenalty_temp = $e->search_config_standing_penalty({name => 'PATRON_TEMP_RENEWAL'})->[0];
+        my $searchpenalty_temp = $e->search_actor_user_standing_penalty({
+            usr => $cgi->param('patron_id'),
+            standing_penalty => $findpenalty_temp->id,
+            '-or' => [
+                {stop_date => undef},
+                {stop_date => {'>' => 'now'}}
+            ]
+        });
+        if (@$searchpenalty_temp) {
+            $ctx->{response}->{temp_renew} = 1;
+        } else {
+            $ctx->{response}->{temp_renew} = 0;
+        }
     } else {
         $ctx->{response}->{barcode} = $ctx->{user}->card->barcode;
        }