From 3af40daa339a695f11cbeddd2c6e0aeb4ed2ede7 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Fri, 4 Aug 2017 13:22:24 -0400 Subject: [PATCH] LP#1698206: Remove remaining uses of the old copy visibility cache Some Perl was still using the old cache table, so this teaches them the new style. Signed-off-by: Mike Rylander Signed-off-by: Galen Charlton Signed-off-by: Kathy Lussier --- .../Application/Storage/Publisher/action.pm | 15 +++++++++++---- .../Application/Storage/Publisher/metabib.pm | 3 ++- Open-ILS/src/support-scripts/sitemap_generator | 8 +++++++- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm index c6118f27b7..e489e26593 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm @@ -1052,10 +1052,17 @@ sub MR_records_matching_format { if ($opac_visible) { $vis_q = <<' SQL'; EXISTS( - SELECT 1 FROM asset.opac_visible_copies - WHERE record = ? AND circ_lib IN ( - SELECT id FROM actor.org_unit_descendants(?) - ) + SELECT 1 + FROM asset.patron_default_visibility_mask() mask, + asset.copy_vis_attr_cache v + JOIN asset.copy c ON ( + c.id = v.target_copy + AND v.record = ? + AND c.circ_lib IN ( + SELECT id FROM actor.org_unit_descendants(?) + ) + ) + WHERE v.vis_attr_vector @@ mask.c_attrs::query_int ) SQL } diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm index aacd6b2288..a8b216175e 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm @@ -95,7 +95,8 @@ sub ordered_records_from_metarecord { # XXX Replace with QP-based search-within- my $org = shift; my $depth = shift; - my $copies_visible = 'LEFT JOIN asset.opac_visible_copies vc ON (br.id = vc.record)'; + my $copies_visible = 'LEFT JOIN asset.copy_attr_vis_cache vc ON (br.id = vc.record '. + 'AND vc.vis_attr_vector @@ (SELECT c_attrs::query_int FROM asset.patron_default_visibility_mask() LIMIT 1))'; $copies_visible = '' if ($self->api_name =~ /staff/o); my $copies_visible_count = ',COUNT(vc.id)'; diff --git a/Open-ILS/src/support-scripts/sitemap_generator b/Open-ILS/src/support-scripts/sitemap_generator index 5c15723fb2..16fe5fd383 100755 --- a/Open-ILS/src/support-scripts/sitemap_generator +++ b/Open-ILS/src/support-scripts/sitemap_generator @@ -154,7 +154,13 @@ sub get_record_ids { ELSE bre.edit_date::date END AS edit_date FROM biblio.record_entry bre - INNER JOIN asset.opac_visible_copies aovc ON bre.id = aovc.record + INNER JOIN asset.copy_attr_vis_cache vc ON (bre.id = vc.record + AND vc.vis_attr_vector @@ ( + SELECT c_attrs::query_int + FROM asset.patron_default_visibility_mask() + LIMIT 1 + ) + ) "; if ($aou_id) { $q .= " WHERE circ_lib IN (SELECT id FROM copy_orgs)"; -- 2.43.2