Advertisement
roganhamby

Testing - Single Items

May 5th, 2015
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. 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
  4. FROM asset.COPY ac
  5. JOIN asset.copy_location acl ON acl.id = ac.LOCATION
  6. JOIN actor.org_unit aou ON aou.id = ac.circ_lib
  7. JOIN actor.org_unit paou ON paou.id = aou.parent_ou
  8. WHERE ac.deleted = FALSE AND ac.status IN (0,7) AND ac.circulate = TRUE AND acl.circulate = TRUE AND aou.ou_type = 3
  9. UNION ALL
  10. 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
  11. FROM asset.COPY ac
  12. JOIN asset.copy_location acl ON acl.id = ac.LOCATION
  13. JOIN actor.org_unit aou ON aou.id = ac.circ_lib
  14. JOIN actor.org_unit paou ON paou.id = aou.parent_ou
  15. WHERE ac.deleted = FALSE AND ac.status IN (0,7) AND ac.circulate = TRUE AND acl.circulate = TRUE AND aou.ou_type = 5
  16. ;
  17.  
  18.  
  19. SELECT DISTINCT ON (au.profile, paou.shortname) pgt.NAME, aou.id AS "org id", aou.shortname, au.id AS "patron id", acard.barcode
  20. FROM actor.usr au
  21. LEFT JOIN actor.usr_standing_penalty pen ON pen.usr = au.id
  22. JOIN permission.grp_tree pgt ON pgt.id = au.profile
  23. JOIN actor.org_unit aou ON aou.id = au.home_ou
  24. JOIN actor.org_unit paou ON paou.id = aou.parent_ou
  25. JOIN actor.card acard ON acard.usr = au.id
  26. WHERE au.deleted = FALSE AND au.barred = FALSE AND au.expire_date > NOW() + INTERVAL '1 day'
  27. and au.active = TRUE AND pen.id IS NULL AND pgt.parent = 2 AND aou.ou_type = 3
  28. UNION ALL
  29. SELECT DISTINCT ON (au.profile, paou.shortname) pgt.NAME, aou.id AS "org id", aou.shortname, au.id AS "patron id", acard.barcode
  30. FROM actor.usr au
  31. LEFT JOIN actor.usr_standing_penalty pen ON pen.usr = au.id
  32. JOIN permission.grp_tree pgt ON pgt.id = au.profile
  33. JOIN actor.org_unit aou ON aou.id = au.home_ou
  34. JOIN actor.org_unit paou ON paou.id = aou.parent_ou
  35. JOIN actor.card acard ON acard.usr = au.id
  36. WHERE au.deleted = FALSE AND au.barred = FALSE AND au.expire_date > NOW() + INTERVAL '1 day'
  37. and au.active = true AND pen.id IS NULL AND pgt.parent = 2 AND aou.ou_type = 5
  38. ;
  39.  
  40. SELECT * FROM rogan.find_circ_matrix_matchpoint(141,4961929,1418572,FALSE);
  41.  
  42. FUNCTION rogan.find_circ_matrix_matchpoint( context_ou INT, match_item BIGINT, match_user INT, renewal BOOL ) ;
  43.  
  44.  
  45.  
  46. 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",
  47. pgt.id AS "Permission Group ID", ccm.circulate,
  48. pgt.NAME AS "Permission Group Name", ccm.circ_modifier AS "Circ Modifier", ccm.marc_type AS "MARC Type", ccm.marc_form AS "MARC Form",
  49. ccm.is_renewal AS "Renewable Boolean",
  50. ccm.juvenile_flag AS "Juvenile",
  51. 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",
  52. ccm.recurring_fine_rule AS "Recurring Fine Rule", recur.NAME AS "Recurring Fine Name",
  53. ccm.hard_due_date AS "Hard Due Date ID", hdd.NAME AS "Hard Due Date Name",  
  54. ccm.copy_circ_lib AS "Copy Circ Lib ID", aou3.shortname AS "Copy Circ Lib Shortname",
  55. ccm.copy_owning_lib AS "Copy Owning Lib ID", aou4.shortname AS "Copy Owning Lib Shortname",
  56. ccm.renewals AS "Renewals",
  57. 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",
  58. aoucls.shortname AS "Circ Limit Set Owning Lib Name",
  59. cls.items_out "Circ Limit Set Items Out", cls.depth AS "Circ Limit Set Depth", cls.GLOBAL AS "Circ Limit Set Global",
  60. scmm.circ_mod AS "Circ Limit Set Circ Mod", scmm.id AS "Circ Mod Map ID"
  61. FROM config.circ_matrix_matchpoint ccm
  62. LEFT JOIN actor.org_unit aou ON aou.id = ccm.org_unit
  63. LEFT JOIN actor.org_unit aou2 ON aou2.id = aou.parent_ou
  64. LEFT JOIN permission.grp_tree pgt ON pgt.id = ccm.grp
  65. LEFT JOIN config.rule_circ_duration dur ON dur.id = ccm.duration_rule
  66. LEFT JOIN config.rule_max_fine maxf ON maxf.id = ccm.max_fine_rule
  67. LEFT JOIN config.rule_recurring_fine recur ON recur.id = ccm.recurring_fine_rule
  68. LEFT JOIN config.hard_due_date hdd ON hdd.id = ccm.hard_due_date
  69. LEFT JOIN actor.org_unit aou3 ON aou3.id = ccm.copy_circ_lib
  70. LEFT JOIN actor.org_unit aou4 ON aou4.id = ccm.copy_owning_lib
  71. LEFT JOIN actor.org_unit aou5 ON aou5.id = ccm.user_home_ou
  72. LEFT JOIN config.circ_matrix_limit_set_map lsm ON lsm.matchpoint = ccm.id
  73. LEFT JOIN config.circ_limit_set cls ON cls.id = lsm.limit_set
  74. LEFT JOIN config.circ_limit_set_circ_mod_map scmm ON scmm.limit_set = lsm.id
  75. LEFT JOIN actor.org_unit aoucls ON aoucls.id = cls.owning_lib
  76. where ccm.id = 2423;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement