From 1fead6956d4b72193eba06680dec492d5806c813 Mon Sep 17 00:00:00 2001 From: Chris Sharp Date: Tue, 21 Aug 2018 14:22:05 -0400 Subject: [PATCH] LP#1788260 - Break out in-house-use non-cat circulations. Previously, all non-cataloged circulations were grouped together, causing problems for libraries who need to exclude in-house circulations from circ counts. Signed-off-by: Chris Sharp Signed-off-by: Rogan Hamby Signed-off-by: Galen Charlton --- Open-ILS/src/sql/Pg/090.schema.action.sql | 2 +- ...8260.schema.non-cat-in-house-use-aacct.sql | 60 +++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.lp1788260.schema.non-cat-in-house-use-aacct.sql diff --git a/Open-ILS/src/sql/Pg/090.schema.action.sql b/Open-ILS/src/sql/Pg/090.schema.action.sql index 7826a41a02..960e6ee840 100644 --- a/Open-ILS/src/sql/Pg/090.schema.action.sql +++ b/Open-ILS/src/sql/Pg/090.schema.action.sql @@ -1733,7 +1733,7 @@ UNION ALL ancihu.staff AS circ_staff, ancihu.use_time AS create_time, cnct_ancihu.name AS item_type, - 'non-cat_circ'::text AS circ_type + 'non-cat-in-house_use'::text AS circ_type FROM action.non_cat_in_house_use ancihu, config.non_cataloged_type cnct_ancihu WHERE ancihu.item_type = cnct_ancihu.id diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.lp1788260.schema.non-cat-in-house-use-aacct.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.lp1788260.schema.non-cat-in-house-use-aacct.sql new file mode 100644 index 0000000000..853d0bd089 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.lp1788260.schema.non-cat-in-house-use-aacct.sql @@ -0,0 +1,60 @@ +BEGIN; + +CREATE OR REPLACE VIEW action.all_circulation_combined_types AS + SELECT acirc.id AS id, + acirc.xact_start, + acirc.circ_lib, + acirc.circ_staff, + acirc.create_time, + ac_acirc.circ_modifier AS item_type, + 'regular_circ'::text AS circ_type + FROM action.circulation acirc, + asset.copy ac_acirc + WHERE acirc.target_copy = ac_acirc.id +UNION ALL + SELECT ancc.id::BIGINT AS id, + ancc.circ_time AS xact_start, + ancc.circ_lib, + ancc.staff AS circ_staff, + ancc.circ_time AS create_time, + cnct_ancc.name AS item_type, + 'non-cat_circ'::text AS circ_type + FROM action.non_cataloged_circulation ancc, + config.non_cataloged_type cnct_ancc + WHERE ancc.item_type = cnct_ancc.id +UNION ALL + SELECT aihu.id::BIGINT AS id, + aihu.use_time AS xact_start, + aihu.org_unit AS circ_lib, + aihu.staff AS circ_staff, + aihu.use_time AS create_time, + ac_aihu.circ_modifier AS item_type, + 'in-house_use'::text AS circ_type + FROM action.in_house_use aihu, + asset.copy ac_aihu + WHERE aihu.item = ac_aihu.id +UNION ALL + SELECT ancihu.id::BIGINT AS id, + ancihu.use_time AS xact_start, + ancihu.org_unit AS circ_lib, + ancihu.staff AS circ_staff, + ancihu.use_time AS create_time, + cnct_ancihu.name AS item_type, + 'non-cat-in-house_use'::text AS circ_type + FROM action.non_cat_in_house_use ancihu, + config.non_cataloged_type cnct_ancihu + WHERE ancihu.item_type = cnct_ancihu.id +UNION ALL + SELECT aacirc.id AS id, + aacirc.xact_start, + aacirc.circ_lib, + aacirc.circ_staff, + aacirc.create_time, + ac_aacirc.circ_modifier AS item_type, + 'aged_circ'::text AS circ_type + FROM action.aged_circulation aacirc, + asset.copy ac_aacirc + WHERE aacirc.target_copy = ac_aacirc.id; + +COMMIT; + -- 2.43.2