From 191478f87e972dbd8d3ddbb68202016748678e42 Mon Sep 17 00:00:00 2001 From: Jason Boyer Date: Thu, 13 Feb 2014 15:44:44 -0500 Subject: [PATCH] Limit circ_modifier selection to items owned by submission lib(s) Without limiting the items considered to the submission library it's possible that the circ_modifier chosen may not be in use anywhere at that library. Signed-off-by: Jason Boyer Signed-off-by: Galen Charlton --- collectionHQ/functions.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collectionHQ/functions.sql b/collectionHQ/functions.sql index 36925ad..84028da 100644 --- a/collectionHQ/functions.sql +++ b/collectionHQ/functions.sql @@ -246,7 +246,7 @@ CREATE OR REPLACE FUNCTION collectionHQ.write_bib_rows_to_stdout (TEXT, INT) RET FROM biblio.record_entry WHERE id = lms_bib_id; - SELECT circ_modifier INTO lms_item_type FROM asset.copy c, asset.call_number cn WHERE cn.record = lms_bib_id AND cn.id = c.call_number AND NOT cn.deleted AND NOT c.deleted LIMIT 1; + SELECT circ_modifier INTO lms_item_type FROM asset.copy c, asset.call_number cn WHERE cn.record = lms_bib_id AND c.circ_lib IN (SELECT id FROM actor.org_unit_descendants(org_unit_id)) AND cn.id = c.call_number AND NOT cn.deleted AND NOT c.deleted LIMIT 1; SELECT REPLACE(NOW()::DATE::TEXT, '-', '') INTO extract_date; output := -- 2.11.0