From: Bill Erickson Date: Mon, 14 Sep 2020 15:33:45 +0000 (-0400) Subject: LP1468132 Staff MARC Search API supports copy filtering X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=525658fc5b3850e48d2f4727468d33809c4042d5;p=working%2FEvergreen.git LP1468132 Staff MARC Search API supports copy filtering Teaches the MARC search code to filter results on records with items attached (though not necessarily opac-visible) for scoped staff searches. Prior to this patch, the scope of staff searches was effectively ignored. Signed-off-by: Bill Erickson Signed-off-by: Michele Morgan Signed-off-by: Jason Boyer --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm index 3ca3751f1f..c0dc2ac478 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm @@ -465,9 +465,14 @@ sub biblio_multi_search_full_rec { my $copies_visible = 'AND d.opac_visible IS TRUE AND cp.opac_visible IS TRUE AND cs.opac_visible IS TRUE AND cl.opac_visible IS TRUE'; if ($self->api_name =~ /staff/o) { + # Staff want to see all copies regardless of visibility $copies_visible = ''; - $has_copies = '' if ($ou_type == 0); - $has_vols = '' if ($ou_type == 0); + # When searching globally for staff avoid any copy filtering. + if ((defined $args{depth} && $args{depth} == 0) + || $args{org_unit} == $U->get_org_tree->id) { + $has_copies = ''; + $has_vols = ''; + } } my ($t_filter, $f_filter) = ('',''); @@ -598,7 +603,7 @@ sub biblio_multi_search_full_rec { my $rd_join = $use_rd ? "$metabib_record_descriptor rd," : ''; my $rd_filter = $use_rd ? 'AND rd.record = f.record' : ''; - if ($copies_visible) { + if ($has_copies) { $select = <<" SQL"; SELECT f.record, $relevance, count(DISTINCT cp.id), $rank FROM $search_table f,