return $self->load_mylist_email if $path =~ m|opac/mylist/doemail|;
return $self->load_print_or_email_preview('email') if $path =~ m|opac/record/email_preview|;
return $self->load_email_record if $path =~ m|opac/record/email|;
+ return $self->load_sms_cn if $path =~ m|opac/sms_cn|;
return $self->load_place_hold if $path =~ m|opac/place_hold|;
+
+ # centralize check for curbside tab display
+ $self->load_current_curbside_libs;
+
return $self->load_myopac_holds if $path =~ m|opac/myopac/holds|;
return $self->load_myopac_circs if $path =~ m|opac/myopac/circs|;
return $self->load_myopac_messages if $path =~ m|opac/myopac/messages|;
return $self->load_myopac_prefs_my_lists if $path =~ m|opac/myopac/prefs_my_lists|;
return $self->load_myopac_prefs if $path =~ m|opac/myopac/prefs|;
return $self->load_myopac_reservations if $path =~ m|opac/myopac/reservations|;
- return $self->load_sms_cn if $path =~ m|opac/sms_cn|;
return Apache2::Const::OK;
}
# put the holds back into the original server sort order
my @sorted;
- my %pickup_libs;
for my $id (@$hold_ids) {
push @sorted, grep { $_->{hold}->{hold}->id == $id } @holds;
-
- my $h = $sorted[-1]->{hold}->{hold};
- # if available, report the pickup lib in the list
- $pickup_libs{$h->pickup_lib} = 1 if (
- $h && $h->pickup_lib == $h->current_shelf_lib &&
- $h->shelf_time && !$h->cancel_time && !$h->fulfillment_time
- );
}
my $curbsides = [];
);
} catch Error with {};
- my @pickup_libs = sort { $U->find_org($U->get_org_tree,$a)->name cmp $U->find_org($U->get_org_tree,$b)->name } keys %pickup_libs;
+ return { holds => \@sorted, ids => $hold_ids, all_ids => $all_ids, curbsides => $curbsides };
+}
+
+sub load_current_curbside_libs {
+ my $self = shift;
+ my $ctx = $self->ctx;
+ my $e = $self->editor;
+ my $holds = $e->search_action_hold_request({
+ usr => $e->requestor->id,
+ shelf_time => { '!=' => undef },
+ cancel_time => undef,
+ fulfillment_time => undef
+ });
- return { holds => \@sorted, ids => $hold_ids, all_ids => $all_ids, pickup_libs => \@pickup_libs, curbsides => $curbsides };
+ my %pickup_libs;
+ for my $h (@$holds) {
+ next if ($h->pickup_lib != $h->current_shelf_lib);
+ $pickup_libs{$h->pickup_lib} = 1;
+ }
+
+ my @curbside_pickup_libs;
+ for my $pul (keys %pickup_libs) {
+ push(@curbside_pickup_libs, $pul) if $ctx->{get_org_setting}->($pul, 'circ.curbside');
+ }
+
+ $ctx->{curbside_pickup_libs} = [
+ sort { $U->find_org($U->get_org_tree,$a)->name cmp $U->find_org($U->get_org_tree,$b)->name } @curbside_pickup_libs
+ ];
}
sub handle_hold_update {
}
$ctx->{curbside_appointments}{$cs->org} = $cs;
}
-
- $ctx->{curbside_pickup_libs} = [];
- for my $pul (@{$holds_object->{pickup_libs}}) {
- push(@{$ctx->{curbside_pickup_libs}}, $pul) if $ctx->{get_org_setting}->($pul, 'circ.curbside');
- }
}
$ctx->{holds_ids} = $holds_object->{all_ids};
$ctx->{holds_limit} = $limit;
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};
{url => "messages", name => l("Messages")},
{url => "circs", name => l("Items Checked Out")},
{url => "holds", name => l("Holds")},
- {url => "holds_curbside", name => l("Curbside Pickup")},
{url => "prefs", name => l("Account Preferences")},
{url => "lists", name => l("My Lists")}
];
IF (ctx.show_reservations_tab == 'true');
myopac_pages.push({url => "reservations", name => l("Reservations")});
END;
+ IF ctx.curbside_pickup_libs.size;
+ myopac_pages.push({url => "holds_curbside", name => l("Curbside Pickup")});
+ END;
skin_root = "../"
%]
<h2 class="sr-only">[% l('My Account') %]</h2>