3 SELECT evergreen.upgrade_deps_block_check('0760', :eg_version);
5 CREATE TABLE config.best_hold_order(
6 id SERIAL PRIMARY KEY, -- (metadata)
7 name TEXT UNIQUE, -- i18n (metadata)
8 pprox INT, -- copy capture <-> pickup lib prox
9 hprox INT, -- copy circ lib <-> request lib prox
10 aprox INT, -- copy circ lib <-> pickup lib ADJUSTED prox on ahcm
11 approx INT, -- copy capture <-> pickup lib ADJUSTED prox from function
12 priority INT, -- group hold priority
13 cut INT, -- cut-in-line
14 depth INT, -- selection depth
15 htime INT, -- time since last home-lib circ exceeds org-unit setting
16 rtime INT, -- request time
17 shtime INT -- time since copy last trip home exceeds org-unit setting
20 -- At least one of these columns must contain a non-null value
21 ALTER TABLE config.best_hold_order ADD CHECK ((
25 priority IS NOT NULL OR
32 INSERT INTO config.best_hold_order (
34 pprox, aprox, priority, cut, depth, rtime, htime, hprox
37 1, 2, 3, 4, 5, 6, 7, 8
40 INSERT INTO config.best_hold_order (
42 hprox, pprox, aprox, priority, cut, depth, rtime, htime
44 'Traditional with Holds-always-go-home',
45 1, 2, 3, 4, 5, 6, 7, 8
48 INSERT INTO config.best_hold_order (
50 htime, hprox, pprox, aprox, priority, cut, depth, rtime
52 'Traditional with Holds-go-home',
53 1, 2, 3, 4, 5, 6, 7, 8
56 INSERT INTO config.best_hold_order (
58 priority, cut, rtime, depth, pprox, hprox, aprox, htime
61 1, 2, 3, 4, 5, 6, 7, 8
64 INSERT INTO config.best_hold_order (
66 hprox, priority, cut, rtime, depth, pprox, aprox, htime
68 'FIFO with Holds-always-go-home',
69 1, 2, 3, 4, 5, 6, 7, 8
72 INSERT INTO config.best_hold_order (
74 htime, priority, cut, rtime, depth, pprox, aprox, hprox
76 'FIFO with Holds-go-home',
77 1, 2, 3, 4, 5, 6, 7, 8
80 INSERT INTO permission.perm_list (
84 'ADMIN_HOLD_CAPTURE_SORT',
87 'Allows a user to make changes to best-hold selection sort order',
93 INSERT INTO config.org_unit_setting_type (
94 name, label, description, datatype, fm_class, update_perm, grp
96 'circ.hold_capture_order',
98 'circ.hold_capture_order',
99 'Best-hold selection sort order',
104 'circ.hold_capture_order',
105 'Defines the sort order of holds when selecting a hold to fill using a given copy at capture time',
115 INSERT INTO config.org_unit_setting_type (
116 name, label, description, datatype, update_perm, grp
118 'circ.hold_go_home_interval',
120 'circ.hold_go_home_interval',
121 'Max foreign-circulation time',
126 'circ.hold_go_home_interval',
127 'Time a copy can spend circulating away from its circ lib before returning there to fill a hold (if one exists there)',
136 INSERT INTO actor.org_unit_setting (
137 org_unit, name, value
139 (SELECT id FROM actor.org_unit WHERE parent_ou IS NULL),
140 'circ.hold_go_home_interval',
144 UPDATE actor.org_unit_setting SET
145 name = 'circ.hold_capture_order',
146 value = (SELECT id FROM config.best_hold_order WHERE name = 'FIFO')
148 name = 'circ.holds_fifo' AND value ILIKE '%true%';