my $cn_table = asset::call_number->table;
my $cp_table = asset::copy->table;
+ my $cl_table = asset::copy_location->table;
my $cs_table = config::copy_status->table;
- my $copies_visible = 'AND cp.opac_visible IS TRUE AND cs.holdable IS TRUE';
+ my $copies_visible = 'AND cp.opac_visible IS TRUE AND cs.holdable IS TRUE AND cl.opac_visible IS TRUE';
$copies_visible = '' if ($self->api_name =~ /staff/o);
my $sql = <<" SQL";
FROM $cn_table cn
JOIN $cp_table cp ON (cn.id = cp.call_number)
JOIN $cs_table cs ON (cs.id = cp.status)
+ JOIN $cl_table cs ON (cl.id = cp.location)
WHERE cn.record = ?
AND cp.status = 0
$copies_visible
FROM $cn_table cn
JOIN $cp_table cp ON (cn.id = cp.call_number)
JOIN $cs_table cs ON (cs.id = cp.status)
+ JOIN $cl_table cs ON (cl.id = cp.location)
WHERE cn.record = ?
$copies_visible
GROUP BY 1
@forms = split '', $f;
}
- my $copies_visible = 'AND cp.opac_visible IS TRUE AND cs.holdable IS TRUE';
+ my $copies_visible = 'AND cp.opac_visible IS TRUE AND cs.holdable IS TRUE AND cl.opac_visible IS TRUE';
$copies_visible = '' if ($self->api_name =~ /staff/o);
my $sm_table = metabib::metarecord_source_map->table;
my $rd_table = metabib::record_descriptor->table;
my $cn_table = asset::call_number->table;
+ my $cl_table = asset::copy_location->table;
my $cp_table = asset::copy->table;
my $cs_table = config::copy_status->table;
my $out_table = actor::org_unit_type->table;
sum((SELECT count(cp.id)
FROM $cp_table cp
JOIN $cs_table cs ON (cp.status = cs.id)
+ JOIN $cl_table cl ON (cp.location = cl.id)
WHERE cn.id = cp.call_number
$copies_visible
)) AS count
my $sm_table = metabib::metarecord_source_map->table;
my $cn_table = asset::call_number->table;
my $cp_table = asset::copy->table;
+ my $cl_table = asset::copy_location->table;
my $cs_table = config::copy_status->table;
my $out_table = actor::org_unit_type->table;
my $descendants = "actor.org_unit_descendants(u.id)";
my $ancestors = "actor.org_unit_ancestors(?)";
- my $copies_visible = 'AND cp.opac_visible IS TRUE AND cs.holdable IS TRUE';
+ my $copies_visible = 'AND cp.opac_visible IS TRUE AND cs.holdable IS TRUE AND cl.opac_visible IS TRUE';
$copies_visible = '' if ($self->api_name =~ /staff/o);
my $sql = <<" SQL";
JOIN $cn_table cn ON (cn.record = r.source)
JOIN $cp_table cp ON (cn.id = cp.call_number)
JOIN $cs_table cs ON (cp.status = cs.id)
+ JOIN $cl_table cl ON (cp.location = cl.id)
JOIN $descendants a ON (cp.circ_lib = a.id)
WHERE r.metarecord = ?
$copies_visible
JOIN $cn_table cn ON (cn.record = r.source)
JOIN $cp_table cp ON (cn.id = cp.call_number)
JOIN $cs_table cs ON (cp.status = cs.id)
+ JOIN $cl_table cl ON (cp.location = cl.id)
JOIN $descendants a ON (cp.circ_lib = a.id)
WHERE r.metarecord = ?
AND cp.status = 0
my $asset_call_number_table = asset::call_number->table;
my $asset_copy_table = asset::copy->table;
my $cs_table = config::copy_status->table;
+ my $cl_table = asset::copy_location->table;
my ($index_col) = $class->columns('FTS');
$index_col ||= 'value';
my $has_vols = 'AND cn.owning_lib = d.id';
my $has_copies = 'AND cp.call_number = cn.id';
- my $copies_visible = 'AND cp.opac_visible IS TRUE AND cs.holdable IS TRUE';
+ my $copies_visible = 'AND cp.opac_visible IS TRUE AND cs.holdable IS TRUE AND cl.opac_visible IS TRUE';
my $visible_count = ', count(DISTINCT cp.id)';
my $visible_count_test = 'HAVING count(DISTINCT cp.id) > 0';
$asset_call_number_table cn,
$asset_copy_table cp,
$cs_table cs,
+ $cl_table cl,
$metabib_record_descriptor rd,
$descendants d
WHERE $fts_where
AND cn.record = m.source
AND rd.record = m.source
AND cp.status = cs.id
+ AND cp.location = cl.id
$has_vols
$has_copies
$copies_visible
my $asset_call_number_table = asset::call_number->table;
my $asset_copy_table = asset::copy->table;
my $cs_table = config::copy_status->table;
+ my $cl_table = asset::copy_location->table;
my ($index_col) = $class->columns('FTS');
$index_col ||= 'value';
my $has_vols = 'AND cn.owning_lib = d.id';
my $has_copies = 'AND cp.call_number = cn.id';
- my $copies_visible = 'AND cp.opac_visible IS TRUE AND cs.holdable IS TRUE';
+ my $copies_visible = 'AND cp.opac_visible IS TRUE AND cs.holdable IS TRUE AND cl.opac_visible IS TRUE';
if ($self->api_name =~ /staff/o) {
$copies_visible = '';
$has_vols = '' if ($ou_type == 0);
$asset_call_number_table cn,
$asset_copy_table cp,
$cs_table cs,
+ $cl_table cl,
$metabib_record_descriptor rd,
$descendants d
WHERE $fts_where
AND cn.record = m.source
AND rd.record = m.source
AND cp.status = cs.id
+ AND cp.location = cl.id
$has_vols
$has_copies
$copies_visible