3 CREATE TABLE config.best_hold_order(
4 id SERIAL PRIMARY KEY, -- (metadata)
5 name TEXT UNIQUE, -- i18n (metadata)
6 pprox INT, -- copy capture <-> pickup lib prox
7 hprox INT, -- copy circ lib <-> request lib prox
8 aprox INT, -- copy circ lib <-> pickup lib ADJUSTED prox on ahcm
9 approx INT, -- copy capture <-> pickup lib ADJUSTED prox from function
10 priority INT, -- group hold priority
11 cut INT, -- cut-in-line
12 depth INT, -- selection depth
13 htime INT, -- time since last home-lib circ exceeds org-unit setting
14 rtime INT, -- request time
15 shtime INT -- time since copy last trip home exceeds org-unit setting
18 -- At least one of these columns must contain a non-null value
19 ALTER TABLE config.best_hold_order ADD CHECK ((
23 priority IS NOT NULL OR
30 INSERT INTO config.best_hold_order (
32 pprox, aprox, priority, cut, depth, rtime, htime, hprox
35 1, 2, 3, 4, 5, 6, 7, 8
38 INSERT INTO config.best_hold_order (
40 hprox, pprox, aprox, priority, cut, depth, rtime, htime
42 'Traditional with Holds-always-go-home',
43 1, 2, 3, 4, 5, 6, 7, 8
46 INSERT INTO config.best_hold_order (
48 htime, hprox, pprox, aprox, priority, cut, depth, rtime
50 'Traditional with Holds-go-home',
51 1, 2, 3, 4, 5, 6, 7, 8
54 INSERT INTO config.best_hold_order (
56 priority, cut, rtime, depth, pprox, hprox, aprox, htime
59 1, 2, 3, 4, 5, 6, 7, 8
62 INSERT INTO config.best_hold_order (
64 hprox, priority, cut, rtime, depth, pprox, aprox, htime
66 'FIFO with Holds-always-go-home',
67 1, 2, 3, 4, 5, 6, 7, 8
70 INSERT INTO config.best_hold_order (
72 htime, priority, cut, rtime, depth, pprox, aprox, hprox
74 'FIFO with Holds-go-home',
75 1, 2, 3, 4, 5, 6, 7, 8
78 INSERT INTO permission.perm_list (
82 'ADMIN_HOLD_CAPTURE_SORT',
85 'Allows a user to make changes to best-hold selection sort order',
91 INSERT INTO config.org_unit_setting_type (
92 name, label, description, datatype, fm_class, update_perm, grp
94 'circ.hold_capture_order',
96 'circ.hold_capture_order',
97 'Best-hold selection sort order',
102 'circ.hold_capture_order',
103 'Defines the sort order of holds when selecting a hold to fill using a given copy at capture time',
113 INSERT INTO config.org_unit_setting_type (
114 name, label, description, datatype, update_perm, grp
116 'circ.hold_go_home_interval',
118 'circ.hold_go_home_interval',
119 'Max foreign-circulation time',
124 'circ.hold_go_home_interval',
125 'Time a copy can spend circulating away from its circ lib before returning there to fill a hold (if one exists there)',
134 INSERT INTO actor.org_unit_setting (
135 org_unit, name, value
137 (SELECT id FROM actor.org_unit WHERE parent_ou IS NULL),
138 'circ.hold_go_home_interval',
142 UPDATE actor.org_unit_setting SET
143 name = 'circ.hold_capture_order',
144 value = (SELECT id FROM config.best_hold_order WHERE name = 'FIFO')
146 name = 'circ.holds_fifo' AND value ILIKE '%true%';