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>
FROM asset.copy_location_group
WHERE NOT opac_visible;
*/
-$f$ LANGUAGE SQL IMMUTABLE;
+$f$ LANGUAGE SQL STABLE;
CREATE OR REPLACE FUNCTION asset.location_default () RETURNS TEXT AS $f$
SELECT '!(' || ARRAY_TO_STRING(ARRAY_AGG(search.calculate_visibility_attribute(id, 'location')),'|') || ')'
--- /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;
+