# share the same hold type and target. The latter part exists to
# 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
+ # The org setting circ.holds.queue_position_relative_to_pickup_depth
+ # controls the org depth used to restrict that set of holds to the
+ # ones that also share the same pickup library ranged to the depth
+ # specified by the setting. Restricting the set to the pickup library
+ # modulo the specifed depth 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.
+ # get their materials sooner than they should expect; this setting
+ # allows administrators to specify the effective share depth for any
+ # given set of libraries. The default is the pickup library and its
+ # descendants when no setting value is present.
- 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 $relative_to_pickup_lib = $U->ou_ancestor_setting_value(
+ $hold->pickup_lib,
+ 'circ.holds.queue_position_relative_to_pickup_depth', $e);
+
+ if (!defined($relative_to_pickup_lib) or $relative_to_pickup_library > 0) {
+ # restricted sharing b/c depth is not set (pickup lib) or is set but > 0
+ $relative_to_pickup_lib = $U->get_org_descendants(
+ $hold->pickup_lib, $relative_to_pickup_lib); # returns an id list, which is what we want
+ } else {
+ # consortial-wide sharing b/c depth == 0
+ $relative_to_pickup_lib = undef;
+ };
my $q_holds = $e->json_query({
select => {ahr => ['id', 'cut_in_line', 'request_time']},
from => 'ahr',
where => {
- ($relative_to_pickup_lib) ? ( pickup_lib => $hold->pickup_lib ) : (),
+ ($relative_to_pickup_lib) ? ( pickup_lib => $relative_to_pickup_lib ) : (),
id => { in => {
select => { ahcm => ['hold'] },
from => {
{ "class" => "ahr", "field" => "request_time" }
],
where => {
- ($relative_to_pickup_lib) ? ( pickup_lib => $hold->pickup_lib ) : (),
+ ($relative_to_pickup_lib) ? ( pickup_lib => $relative_to_pickup_lib ) : (),
hold_type => $hold->hold_type,
target => $hold->target,
capture_time => undef,
'description'
),
'string'
+
), (
'ui.grid_columns.actor.user.event_log',
'gui',
),
'circ',
'bool'
+ ), (
+ 'circ.holds.queue_position_relative_to_pickup_depth',
+ oils_i18n_gettext(
+ 'circ.holds.queue_position_relative_to_pickup_depth',
+ 'Patron-visible Hold Queue Position Calculation Depth',
+ 'coust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'circ.holds.queue_position_relative_to_pickup_depth',
+ 'For patron-visible hold queue position calculation, adjust the org unit depth used to find peer holds. Unset means pickup library and descendants, 0 means "full org tree".',
+ 'coust',
+ 'description'
+ ),
+ 'hold',
+ 'integer'
);
INSERT INTO config.org_unit_setting_type
)
);
-INSERT INTO config.global_flag (name, label, enabled) VALUES (
- 'circ.holds.queue_position_relative_to_pickup_lib',
- oils_i18n_gettext(
- 'circ.holds.queue_position_relative_to_pickup_lib',
- 'Calculate hold queue position relative to pickup library (as opposed to entire consortium)',
- 'cgf',
- 'label'
- ),
- TRUE
-);