LP1808006 - Sitemap generator fix to allow shortname parameter.
[evergreen-equinox.git] / Open-ILS / src / support-scripts / sitemap_generator
index 5c15723..22bdd8f 100755 (executable)
@@ -154,10 +154,19 @@ 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_vis_attr_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)";
+        $q .= "
+       INNER JOIN asset.copy ac ON (vc.target_copy = ac.id)
+       WHERE ac.circ_lib IN (SELECT id FROM copy_orgs)
+    ";
     }
     $q .= "
             UNION