Signed-off-by: Mike Rylander <mrylander@gmail.com>
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);