From: Mike Rylander Date: Tue, 16 Jan 2018 19:39:08 +0000 (-0500) Subject: LP#1743639: opac_visible on acplg is not what it seems X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=02cfe27d07cf93b612825e45a6975bcb2d5e80b8;p=Evergreen.git LP#1743639: opac_visible on acplg is not what it seems The asset.copy_location_group table has a column called opac_visible. However, unlike other tables with a column of that name, it controls the visibility of the location group itself, not the visibility of the copies within the group. This is regretable because the 3.0+ search code thinks that it should hide copies. This commit adjusts the default location group filter applied to patron searches so that they act as expected. Signed-off-by: Mike Rylander Signed-off-by: Kathy Lussier --- diff --git a/Open-ILS/src/sql/Pg/300.schema.staged_search.sql b/Open-ILS/src/sql/Pg/300.schema.staged_search.sql index c6cfdf4c49..5735263bbc 100644 --- a/Open-ILS/src/sql/Pg/300.schema.staged_search.sql +++ b/Open-ILS/src/sql/Pg/300.schema.staged_search.sql @@ -755,9 +755,12 @@ $f$ LANGUAGE SQL STABLE; -- Copy-oriented defaults for search CREATE OR REPLACE FUNCTION asset.location_group_default () RETURNS TEXT AS $f$ + SELECT '!()'::TEXT; -- For now, as there's no way to cause a location group to hide all copies. +/* SELECT '!(' || ARRAY_TO_STRING(ARRAY_AGG(search.calculate_visibility_attribute(id, 'location_group')),'|') || ')' FROM asset.copy_location_group WHERE NOT opac_visible; +*/ $f$ LANGUAGE SQL STABLE; CREATE OR REPLACE FUNCTION asset.location_default () RETURNS TEXT AS $f$ diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.copy_location_group_visible.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.copy_location_group_visible.sql new file mode 100644 index 0000000000..7b457c6f71 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.copy_location_group_visible.sql @@ -0,0 +1,13 @@ +BEGIN; + +CREATE OR REPLACE FUNCTION asset.location_group_default () RETURNS TEXT AS $f$ + SELECT '!()'::TEXT; -- For now, as there's no way to cause a location group to hide all copies. +/* + SELECT '!(' || ARRAY_TO_STRING(ARRAY_AGG(search.calculate_visibility_attribute(id, 'location_group')),'|') || ')' + FROM asset.copy_location_group + WHERE NOT opac_visible; +*/ +$f$ LANGUAGE SQL STABLE; + +COMMIT; +