From 525658fc5b3850e48d2f4727468d33809c4042d5 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 14 Sep 2020 11:33:45 -0400 Subject: [PATCH] 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 --- .../lib/OpenILS/Application/Storage/Publisher/metabib.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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, -- 2.11.0