Last active
January 4, 2016 09:39
-
-
Save mark-cooper/8603961 to your computer and use it in GitHub Desktop.
Evergreen ILS: SQL for viewing circulation policies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- NO LIMIT SETS (example limit to PERM GROUP) | |
SELECT | |
m.id, m.active, a.shortname as org_unit, p.name as profile, circ_modifier, | |
copy_circ_lib, copy_owning_lib, user_home_ou, ref_flag, juvenile_flag, | |
is_renewal, circulate, d.name as duration, r.name as recurring, | |
mx.name as max, m.grace_period | |
FROM config.circ_matrix_matchpoint m | |
LEFT JOIN actor.org_unit a ON m.org_unit = a.id | |
LEFT JOIN permission.grp_tree p ON m.grp = p.id | |
LEFT JOIN config.rule_circ_duration d ON m.duration_rule = d.id | |
LEFT JOIN config.rule_recurring_fine r ON m.recurring_fine_rule = r.id | |
LEFT JOIN config.rule_max_fine mx ON m.max_fine_rule = mx.id | |
WHERE p.name = 'Interloan' | |
ORDER BY org_unit ASC, circ_modifier; | |
-- NO LIMIT SETS (example limit to ORG SHORTNAME) | |
SELECT | |
m.id, m.active, a.shortname as org_unit, p.name as profile, circ_modifier, | |
copy_circ_lib, copy_owning_lib, user_home_ou, ref_flag, juvenile_flag, | |
is_renewal, circulate, d.name as duration, r.name as recurring, | |
mx.name as max, m.grace_period | |
FROM config.circ_matrix_matchpoint m | |
LEFT JOIN actor.org_unit a ON m.org_unit = a.id | |
LEFT JOIN permission.grp_tree p ON m.grp = p.id | |
LEFT JOIN config.rule_circ_duration d ON m.duration_rule = d.id | |
LEFT JOIN config.rule_recurring_fine r ON m.recurring_fine_rule = r.id | |
LEFT JOIN config.rule_max_fine mx ON m.max_fine_rule = mx.id | |
WHERE a.shortname = 'NDL' | |
ORDER BY org_unit ASC, circ_modifier; | |
-- WITH LIMIT SETS | |
SELECT | |
m.id, m.active, a.shortname as org_unit, p.name as profile, circ_modifier, | |
copy_circ_lib, copy_owning_lib, user_home_ou, ref_flag, juvenile_flag, | |
is_renewal, circulate, d.name as duration, r.name as recurring, | |
mx.name as max, m.grace_period, s.name as limit_set | |
FROM config.circ_matrix_matchpoint m | |
LEFT JOIN actor.org_unit a ON m.org_unit = a.id | |
LEFT JOIN permission.grp_tree p ON m.grp = p.id | |
LEFT JOIN config.rule_circ_duration d ON m.duration_rule = d.id | |
LEFT JOIN config.rule_recurring_fine r ON m.recurring_fine_rule = r.id | |
LEFT JOIN config.rule_max_fine mx ON m.max_fine_rule = mx.id | |
LEFT JOIN config.circ_matrix_limit_set_map l ON m.id = l.matchpoint | |
LEFT JOIN config.circ_limit_set s ON l.limit_set = s.id | |
ORDER BY org_unit ASC, circ_modifier; | |
-- NOTE: MULTIPLE LIMIT SETS CAN BE ATTACHED TO A SINGLE POLICY |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment