LP#1879983: Fetch what's needed to display curbside from history
authorMike Rylander <mrylander@gmail.com>
Tue, 16 Jun 2020 16:06:55 +0000 (12:06 -0400)
committerMike Rylander <mrylander@gmail.com>
Tue, 16 Jun 2020 16:06:55 +0000 (12:06 -0400)
We know to show the curbside subtab when extant, available holds are at
pickup libs that have curbside enabled.  So, let's fetch those and test
when gathering the history subtab data.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm

index 2fc2b70..ee45cc3 100644 (file)
@@ -2228,6 +2228,15 @@ sub load_myopac_hold_history {
         where => {id => $e->requestor->id}
     });
 
+    # This is used to detect whether we want to show the curbside tab
+    my $extant_holds_object = $self->fetch_user_holds();
+    if($extant_holds_object->{holds}) {
+        $ctx->{curbside_pickup_libs} = [];
+        for my $pul (@{$extant_holds_object->{pickup_libs}}) {
+            push(@{$ctx->{curbside_pickup_libs}}, $pul) if $ctx->{get_org_setting}->($pul, 'circ.curbside');
+        }
+    }
+
     my $holds_object = $self->fetch_user_holds([map { $_->{id} } @$hold_ids], 0, 1, 0, $limit, $offset);
     if($holds_object->{holds}) {
         $ctx->{holds} = $holds_object->{holds};