Part 2: Advanced topics in the in-database approach for the configuration of circulation and hold policies. This talk picks up where Part 1 ends and provides greater detail on the database interactions with copy locations, copy flags, matchpoints, and rules, including fall-thru. Tips for using SQL to directly configure new matchpoints will also be discussed.
config.circ_matrix_matchpoint
config.hold_matrix_matchpoint
Let’s say that the consortium has decided on a 21_day_2_renew loan rule for general materials, i.e. books, etc. Most members do not charge overdue fines. System 1 charges 25 cents per day to a maximum of $3.00, but otherwise uses the default circulation duration. This situation might look like this:
org_unit | duration_rule | recurring_fine_rule | max_fine_rule |
---|---|---|---|
CONS |
21_day_2_renew |
NONE |
NONE |
SYS1 |
NULL |
25_cents |
3_dollars |
SELECT config.create_circ_matrix_matchpoint ( org := 'SYS1', grp := 'Users', circ_modifer := 'BESTSELLER', duration_rule := '7_day_0_renew', recurring_fine_rule := '1_dollar_per_day', max_fine_rule := '5_dollars' )
SELECT config.create_circ_matrix_matchpoint ( item_circ_ou := 'SYS1', usr_grp := 'Users', circ_modifer := 'BESTSELLER', holdable := FALSE )
SELECT permission.create_grp_penalty_threshold ( grp := 'Users', org := 'SYS1', penalty := 'PATRON_EXCEEDS_FINES', threshold := 10.00 )
BEGIN; INSERT INTO config.circ_matrix_circ_mod_test (matchpoint, items_out) SELECT id, 1 FROM config.circ_matrix_matchpoint WHERE org_unit = (SELECT id FROM actor.org_unit WHERE shortname = 'SYS1') AND circ_modifier = 'BESTSELLER'; INSERT INTO config.circ_matrix_circ_mod_test_map (circ_mod_test, circ_mod) SELECT ccmcmt.id, 'BESTSELLER' FROM config.circ_matrix_circ_mod_test ccmcmt join config.circ_matrix_matchpoint ccmm on ccmcmt.matchpoint = ccmm.id WHERE ccmm.org_unit = (SELECT id FROM actor.org_unit WHERE shortname = 'SYS1') AND ccmm.circ_modifier = 'BESTSELLER'; COMMIT;
BEGIN; INSERT INTO config.circ_limit_group (name, description) VALUES ('BESTSELLER', 'Limit on BESTSELLER'); INSERT INTO config.circ_limit_set (name, owning_lib, items_out, depth, global, description) VALUES ('One BESTSELLER Limit', 1, 1, 1, TRUE, 'Limit to 1 BESTSELLER at system'); INSERT INTO config.circ_limit_set_group_map (limit_set, limit_group, check_only) SELECT ccls.id, cclg.id, FALSE FROM config.circ_limit_set ccls, config.circ_limit_group cclg WHERE ccls.name like 'One BESTSELLER Limit' AND cclg.name = 'BESTSELLER'; INSERT INTO config.circ_limit_set_circ_mod_map (limit_set, circ_mod) SELECT ccls.id, 'BESTSELLER' FROM config.circ_limit_set ccls WHERE ccls.name = 'One BESTSELLER Limit'; INSERT INTO config.circ_matrix_limit_set_map (matchpoint, limit_set, fallthrough) SELECT ccmm.id, ccls.id, TRUE FROM config.circ_limit_set ccls, config.circ_matrix_matchpoint WHERE ccls.name = 'One BESTSELLER Limit' AND ccmm.org_unit = (SELECT id FROM actor.orgunit WHERE shortname = 'SYS1') AND ccmm.circ_modifier = 'BESTSELLER'; COMMIT;
TODO Create helper functions for the “new” way.