LP#1698206: Remove remaining uses of the old copy visibility cache
authorMike Rylander <mrylander@gmail.com>
Fri, 4 Aug 2017 17:22:24 +0000 (13:22 -0400)
committerKathy Lussier <klussier@masslnc.org>
Mon, 28 Aug 2017 15:14:53 +0000 (11:14 -0400)
Some Perl was still using the old cache table, so this teaches them the new
style.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm
Open-ILS/src/support-scripts/sitemap_generator

index c6118f2..e489e26 100644 (file)
@@ -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
     }
index aacd6b2..a8b2161 100644 (file)
@@ -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)';
index 5c15723..16fe5fd 100755 (executable)
@@ -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)";