Improve existing slot detection in the CurbsideSlot reactor
authorMike Rylander <mrylander@gmail.com>
Wed, 3 Jun 2020 21:41:02 +0000 (17:41 -0400)
committerMike Rylander <mrylander@gmail.com>
Wed, 3 Jun 2020 21:41:02 +0000 (17:41 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/CurbsideSlot.pm

index e95b09f..763e041 100644 (file)
@@ -23,7 +23,18 @@ sub handler {
     my $e = new_editor(xact => 1);
 
     my $h = $$env{target};
-    my ($slot) = $e->search_action_curbside({patron => $h->usr, org => $h->pickup_lib, slot => undef});
+
+    # see if there's an undelivered appointment in the future
+    my ($slot) = $e->search_action_curbside({
+        patron => $h->usr,
+        org => $h->pickup_lib,
+        delivered => undef,
+        '-or' => [
+            { slot => { '>=' => 'now' } },
+            { slot => undef }
+        ]
+    });
+
     if (!$slot) {
         $slot = Fieldmapper::action::curbside->new;
         $slot->org($h->pickup_lib);