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 <mrylander@gmail.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
-- 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$
--- /dev/null
+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;
+