Provide a full "reset" subaction to support "select another date"
authorMike Rylander <mrylander@gmail.com>
Wed, 3 Jun 2020 18:27:05 +0000 (14:27 -0400)
committerMike Rylander <mrylander@gmail.com>
Wed, 3 Jun 2020 18:30:00 +0000 (14:30 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm

index 1ddf1df..9f7868d 100644 (file)
@@ -1297,6 +1297,7 @@ sub handle_hold_update {
                 $time ||= $dt->strftime('%T');
             }
         }
+
         $ctx->{cs_org} = $org;
         $ctx->{cs_date} = $date;
         $ctx->{cs_time} = $time;
@@ -1304,7 +1305,14 @@ sub handle_hold_update {
         $ctx->{cs_slot_id} = $slot->id if ($slot);
         $ctx->{cs_slot} = $slot;
 
-        if ($cs_action eq 'save' && $org && $date && $time) {
+        if ($cs_action eq 'reset') {
+            $ctx->{cs_org} = $org = undef;
+            $ctx->{cs_date} = $date = undef;
+            $ctx->{cs_time} = $time = undef;
+            $ctx->{cs_notes} = $notes = undef;
+            $ctx->{cs_slot_id} = $slot_id = undef;
+            $ctx->{cs_slot} = $slot = undef;
+        } elsif ($cs_action eq 'save' && $org && $date && $time) {
             my $mode = $slot ? 'update' : 'create';
             $slot = $circ->request(
                 "open-ils.curbside.${mode}_appointment",