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>
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
}
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)';
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)";