<field reporter:label="Name" name="name" reporter:datatype="text"/>
<field reporter:label="Capture Lib to Pickup Lib Proximity" name="pprox" reporter:datatype="int" />
<field reporter:label="Circ Lib to Request Lib Proximity" name="hprox" reporter:datatype="int" />
+ <field reporter:label="Owning Lib to Patron Home Lib Proximity" name="owning_lib_to_home_lib_prox" reporter:datatype="int" />
<field reporter:label="Adjusted Circ Lib to Pickup Lib Proximity" name="aprox" reporter:datatype="int" />
<field reporter:label="Adjusted Capture Location to Pickup Lib Proximity" name="approx" reporter:datatype="int" />
<field reporter:label="Hold Priority" name="priority" reporter:datatype="int" />
my %HOLD_SORT_ORDER_BY = (
pprox => 'p.prox',
hprox => 'actor.org_unit_proximity(%d, h.pickup_lib)', # $cp->call_number->owning_lib
+ owning_lib_to_home_lib_prox => 'actor.org_unit_proximity(%d, au.home_ou)', # $cp->call_number->owning_lib
aprox => 'COALESCE(hm.proximity, p.prox)',
approx => 'action.hold_copy_calculated_proximity(h.id, %d, %d)', # $cp,$here
priority => 'pgt.hold_priority',
my $row = $dbh->selectrow_hashref(
q!
SELECT
- cbho.pprox, cbho.hprox, cbho.aprox, cbho.approx, cbho.priority,
- cbho.cut, cbho.depth, cbho.htime, cbho.shtime, cbho.rtime
+ cbho.pprox, cbho.hprox, cbho.owning_lib_to_home_lib_prox, cbho.aprox,
+ cbho.approx, cbho.priority, cbho.cut, cbho.depth, cbho.htime,
+ cbho.shtime, cbho.rtime
FROM config.best_hold_order cbho
WHERE id = (
SELECT oils_json_to_text(value)::INT
my %order_by_sprintf_args = (
hprox => [$cp->call_number->owning_lib],
+ owning_lib_to_home_lib_prox => [$cp->call_number->owning_lib],
approx => [$cp->id, $here],
htime => [$cp->call_number->owning_lib, $cp->call_number->owning_lib],
shtime => [$cp->call_number->owning_lib, $cp->call_number->owning_lib]
name TEXT UNIQUE, -- i18n
pprox INT, -- copy capture <-> pickup lib prox
hprox INT, -- copy circ lib <-> request lib prox
+ owning_lib_to_home_lib_prox INT, -- copy owning lib <-> user home lib prox
aprox INT, -- copy circ lib <-> pickup lib ADJUSTED prox on ahcm
approx INT, -- copy capture <-> pickup lib ADJUSTED prox from function
priority INT, -- group hold priority
ALTER TABLE config.best_hold_order ADD CHECK ((
pprox IS NOT NULL OR
hprox IS NOT NULL OR
+ owning_lib_to_home_lib_prox IS NOT NULL OR
aprox IS NOT NULL OR
priority IS NOT NULL OR
cut IS NOT NULL OR
1, 2, 3, 4, 5, 6, 7, 8
);
+INSERT INTO config.best_hold_order (
+ name,
+ owning_lib_to_home_lib_prox, hprox, approx, pprox, aprox, priority, cut, depth, rtime
+) VALUES (
+ 'Traditional with Holds-chase-home-lib-patrons',
+ 1, 2, 3, 4, 5, 6, 7, 8, 9
+);
+
INSERT INTO actor.org_unit_setting (
org_unit, name, value
) VALUES (
--- /dev/null
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+ALTER TABLE config.best_hold_order ADD COLUMN owning_lib_to_home_lib_prox INT; -- copy owning lib <-> user home lib prox
+
+ALTER table config.best_hold_order DROP CONSTRAINT best_hold_order_check;
+
+-- At least one of these columns must contain a non-null value
+ALTER TABLE config.best_hold_order ADD CHECK ((
+ pprox IS NOT NULL OR
+ hprox IS NOT NULL OR
+ owning_lib_to_home_lib_prox IS NOT NULL OR
+ aprox IS NOT NULL OR
+ priority IS NOT NULL OR
+ cut IS NOT NULL OR
+ depth IS NOT NULL OR
+ htime IS NOT NULL OR
+ rtime IS NOT NULL
+));
+
+INSERT INTO config.best_hold_order (
+ name,
+ owning_lib_to_home_lib_prox, hprox, approx, pprox, aprox, priority, cut, depth, rtime
+) VALUES (
+ 'Traditional with Holds-chase-home-lib-patrons',
+ 1, 2, 3, 4, 5, 6, 7, 8, 9
+);
+
+COMMIT;
/* We could get these from the IDL, but if we add more fields to that
* later, we have no particular mechanism for determining what is or
* isn't metadata. */
- module.fields = ["pprox", "hprox", "aprox", "priority", "cut", "depth",
- "htime", "rtime", "approx", "shtime"];
+ module.fields = ["pprox", "hprox", "owning_lib_to_home_lib_prox",
+ "aprox", "priority", "cut", "depth", "htime", "rtime", "approx",
+ "shtime"];
module.init = function() {
module.progress_dialog = dijit.byId("progress-dialog");
--- /dev/null
+New Hold Sort Order: Traditional with Holds-chase-home-lib-patrons
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+This is a new entry under Administration -> Server Administration -> Best-Hold Selection Sort Order in the staff client. It prioritizes holds such that a given item, based on its owning library, will prefer patrons with a matching home library, no matter the pickup library.
+
name TEXT UNIQUE, -- i18n (metadata)
pprox INT, -- copy capture <-> pickup lib prox
hprox INT, -- copy circ lib <-> request lib prox
+ owning_lib_to_home_lib_prox INT, -- copy owning lib <-> user home lib prox
aprox INT, -- copy circ lib <-> pickup lib ADJUSTED prox on ahcm
priority INT, -- group hold priority
cut INT, -- cut-in-line
ALTER TABLE config.best_hold_order ADD CHECK ((
pprox IS NOT NULL OR
hprox IS NOT NULL OR
+ owning_lib_to_home_lib_prox IS NOT NULL OR
aprox IS NOT NULL OR
priority IS NOT NULL OR
cut IS NOT NULL OR
1, 2, 3, 4, 5, 6, 7, 8
);
+INSERT INTO config.best_hold_order (
+ name,
+ owning_lib_to_home_lib_prox, hprox, approx, pprox, aprox, priority, cut, depth, rtime
+) VALUES (
+ 'Traditional with Holds-chase-home-lib-patrons',
+ 1, 2, 3, 4, 5, 6, 7, 8, 9
+);
+
INSERT INTO config.org_unit_setting_type (
name, label, description, datatype, fm_class, update_perm
) VALUES (