Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT DISTINCT ON (ac.circ_modifier, paou.shortname) ac.barcode, ac.id AS "item id", ac.circ_modifier, aou.id AS "org id", aou.shortname
- FROM asset.COPY ac
- JOIN asset.copy_location acl ON acl.id = ac.LOCATION
- JOIN actor.org_unit aou ON aou.id = ac.circ_lib
- JOIN actor.org_unit paou ON paou.id = aou.parent_ou
- WHERE ac.deleted = FALSE AND ac.status IN (0,7) AND ac.circulate = TRUE AND acl.circulate = TRUE AND aou.ou_type = 3
- UNION ALL
- SELECT DISTINCT ON (ac.circ_modifier, paou.shortname) ac.barcode, ac.id AS "item id", ac.circ_modifier, aou.id AS "org id", aou.shortname
- FROM asset.COPY ac
- JOIN asset.copy_location acl ON acl.id = ac.LOCATION
- JOIN actor.org_unit aou ON aou.id = ac.circ_lib
- JOIN actor.org_unit paou ON paou.id = aou.parent_ou
- WHERE ac.deleted = FALSE AND ac.status IN (0,7) AND ac.circulate = TRUE AND acl.circulate = TRUE AND aou.ou_type = 5
- ;
- SELECT DISTINCT ON (au.profile, paou.shortname) pgt.NAME, aou.id AS "org id", aou.shortname, au.id AS "patron id", acard.barcode
- FROM actor.usr au
- LEFT JOIN actor.usr_standing_penalty pen ON pen.usr = au.id
- JOIN permission.grp_tree pgt ON pgt.id = au.profile
- JOIN actor.org_unit aou ON aou.id = au.home_ou
- JOIN actor.org_unit paou ON paou.id = aou.parent_ou
- JOIN actor.card acard ON acard.usr = au.id
- WHERE au.deleted = FALSE AND au.barred = FALSE AND au.expire_date > NOW() + INTERVAL '1 day'
- and au.active = TRUE AND pen.id IS NULL AND pgt.parent = 2 AND aou.ou_type = 3
- UNION ALL
- SELECT DISTINCT ON (au.profile, paou.shortname) pgt.NAME, aou.id AS "org id", aou.shortname, au.id AS "patron id", acard.barcode
- FROM actor.usr au
- LEFT JOIN actor.usr_standing_penalty pen ON pen.usr = au.id
- JOIN permission.grp_tree pgt ON pgt.id = au.profile
- JOIN actor.org_unit aou ON aou.id = au.home_ou
- JOIN actor.org_unit paou ON paou.id = aou.parent_ou
- JOIN actor.card acard ON acard.usr = au.id
- WHERE au.deleted = FALSE AND au.barred = FALSE AND au.expire_date > NOW() + INTERVAL '1 day'
- and au.active = true AND pen.id IS NULL AND pgt.parent = 2 AND aou.ou_type = 5
- ;
- SELECT * FROM rogan.find_circ_matrix_matchpoint(141,4961929,1418572,FALSE);
- FUNCTION rogan.find_circ_matrix_matchpoint( context_ou INT, match_item BIGINT, match_user INT, renewal BOOL ) ;
- SELECT ccm.id AS "Circ Matrix Matchpoint ID", ccm.active AS "Active", ccm.org_unit AS "Circ Org Unit", aou.shortname AS "Circ Short Org Unit Name",
- pgt.id AS "Permission Group ID", ccm.circulate,
- pgt.NAME AS "Permission Group Name", ccm.circ_modifier AS "Circ Modifier", ccm.marc_type AS "MARC Type", ccm.marc_form AS "MARC Form",
- ccm.is_renewal AS "Renewable Boolean",
- ccm.juvenile_flag AS "Juvenile",
- ccm.duration_rule AS "Duration Rule", dur.NAME AS "Duration Name", ccm.max_fine_rule AS "Max Fine Rule", maxf.NAME AS "Max Fine Name",
- ccm.recurring_fine_rule AS "Recurring Fine Rule", recur.NAME AS "Recurring Fine Name",
- ccm.hard_due_date AS "Hard Due Date ID", hdd.NAME AS "Hard Due Date Name",
- ccm.copy_circ_lib AS "Copy Circ Lib ID", aou3.shortname AS "Copy Circ Lib Shortname",
- ccm.copy_owning_lib AS "Copy Owning Lib ID", aou4.shortname AS "Copy Owning Lib Shortname",
- ccm.renewals AS "Renewals",
- lsm.id AS "Circ Limit Set Map ID", cls.owning_lib AS "Circ Limit Set Owning Lib", lsm.limit_set AS "Circ Limit Set ID",
- aoucls.shortname AS "Circ Limit Set Owning Lib Name",
- cls.items_out "Circ Limit Set Items Out", cls.depth AS "Circ Limit Set Depth", cls.GLOBAL AS "Circ Limit Set Global",
- scmm.circ_mod AS "Circ Limit Set Circ Mod", scmm.id AS "Circ Mod Map ID"
- FROM config.circ_matrix_matchpoint ccm
- LEFT JOIN actor.org_unit aou ON aou.id = ccm.org_unit
- LEFT JOIN actor.org_unit aou2 ON aou2.id = aou.parent_ou
- LEFT JOIN permission.grp_tree pgt ON pgt.id = ccm.grp
- LEFT JOIN config.rule_circ_duration dur ON dur.id = ccm.duration_rule
- LEFT JOIN config.rule_max_fine maxf ON maxf.id = ccm.max_fine_rule
- LEFT JOIN config.rule_recurring_fine recur ON recur.id = ccm.recurring_fine_rule
- LEFT JOIN config.hard_due_date hdd ON hdd.id = ccm.hard_due_date
- LEFT JOIN actor.org_unit aou3 ON aou3.id = ccm.copy_circ_lib
- LEFT JOIN actor.org_unit aou4 ON aou4.id = ccm.copy_owning_lib
- LEFT JOIN actor.org_unit aou5 ON aou5.id = ccm.user_home_ou
- LEFT JOIN config.circ_matrix_limit_set_map lsm ON lsm.matchpoint = ccm.id
- LEFT JOIN config.circ_limit_set cls ON cls.id = lsm.limit_set
- LEFT JOIN config.circ_limit_set_circ_mod_map scmm ON scmm.limit_set = lsm.id
- LEFT JOIN actor.org_unit aoucls ON aoucls.id = cls.owning_lib
- where ccm.id = 2423;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement