AND acpl.holdable
AND acpl.circulate
AND acp.active_date > NOW() - ?::INTERVAL
+ -- LOC AND acp.location IN (LOC_LIST)
AND (EXISTS (SELECT 1 FROM asset.copy_vis_attr_cache WHERE record = acn.record AND vis_attr_vector @@ c_attr.vis_test))
AND (NOT EXISTS (SELECT 1 FROM metabib.record_attr_vector_list WHERE source = acn.record AND vlist @@ metabib.compile_composite_attr(' {"1":[{"_val":"s","_attr":"bib_level"}]}')::query_int))
GROUP BY acn.record
AND acpl.circulate
AND circ.checkin_time > NOW() - ?::INTERVAL
AND circ.checkin_time IS NOT NULL
+ -- LOC AND acp.location IN (LOC_LIST)
AND (EXISTS (SELECT 1 FROM asset.copy_vis_attr_cache WHERE record = acn.record AND vis_attr_vector @@ c_attr.vis_test))
AND (NOT EXISTS (SELECT 1 FROM metabib.record_attr_vector_list WHERE source = acn.record AND vlist @@ metabib.compile_composite_attr(' {"1":[{"_val":"s","_attr":"bib_level"}]}')::query_int))
GROUP BY acn.record
AND acpl.holdable
AND acpl.circulate
AND circ.xact_start > NOW() - ?::INTERVAL
+ -- LOC AND acp.location IN (LOC_LIST)
AND (EXISTS (SELECT 1 FROM asset.copy_vis_attr_cache WHERE record = acn.record AND vis_attr_vector @@ c_attr.vis_test))
AND (NOT EXISTS (SELECT 1 FROM metabib.record_attr_vector_list WHERE source = acn.record AND vlist @@ metabib.compile_composite_attr(' {"1":[{"_val":"s","_attr":"bib_level"}]}')::query_int))
GROUP BY acn.record
WHERE acn.owning_lib IN (ORG_LIST)
AND acp.circ_lib IN (ORG_LIST)
AND acp.active_date > NOW() - ?::INTERVAL
- AND acp.location IN (LOC_LIST)
+ -- LOC AND acp.location IN (LOC_LIST)
AND acp.holdable
AND acp.circulate
AND ccs.holdable
return 0;
}
my $loc_placeholders = join(',', map { '?' } @$locs);
+ $query =~ s/-- LOC //g;
$query =~ s/LOC_LIST/$loc_placeholders/g;
} else {
$locs = []; # we'll ignore any superflous supplied values