# The holds queue is defined as the distinct set of holds that share at
# least one potential copy with the context hold, plus any holds that
# share the same hold type and target. The latter part exists to
- # accomodate holds that currently have no potential copies
+ # accomodate holds that currently have no potential copies.
+ #
+ # The global flag circ.holds.queue_position_relative_to_pickup_lib
+ # controls whether or not to restrict that set of holds to the
+ # ones that also share the same pickup library. Restricting the set
+ # to the pickup library offers a modest performance benefit and
+ # makes the queue position in the public catalog match the position
+ # displayed in the staff hold shelf list. However, if resources
+ # are shared across the entire consortium, a pickup-library-restricted
+ # queue position may make patrons think that they are going to
+ # get their materials sooner than they should expect; this is why
+ # the global flag is provided.
+
+ my $relative_to_pickup_lib = $e->retrieve_config_global_flag('circ.holds.queue_position_relative_to_pickup_lib');
+ $relative_to_pickup_lib = ($relative_to_pickup_lib and $U->is_true($relative_to_pickup_lib->enabled));
+
my $q_holds = $e->json_query({
# fetch cut_in_line and request_time since they're in the order_by
select => {ahr => ['id', 'cut_in_line', 'request_time']},
from => 'ahr',
where => {
- pickup_lib => $hold->pickup_lib,
+ ($relative_to_pickup_lib) ? ( pickup_lib => $hold->pickup_lib ) : (),
id => { in => {
select => { ahcm => ['hold'] },
from => {
{ "class" => "ahr", "field" => "request_time" }
],
where => {
- pickup_lib => $hold->pickup_lib,
+ ($relative_to_pickup_lib) ? ( pickup_lib => $hold->pickup_lib ) : (),
hold_type => $hold->hold_type,
target => $hold->target,
capture_time => undef,