From a86254b937a0aa5cdd9ee5d112ce8f3cbf6981f1 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 10 Jan 2018 14:26:23 -0500 Subject: [PATCH] JBAS-1929 Browse mattype filter see link counts Signed-off-by: Bill Erickson --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm | 25 +++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm index 6bbdd20992..c3f0a5922b 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm @@ -174,7 +174,7 @@ sub find_authority_headings_and_notes { } sub map_authority_headings_to_results { - my ($self, $linked, $results, $auth_ids, $authority_field_name) = @_; + my ($self, $linked, $results, $auth_ids, $authority_field_name, @params) = @_; # Use the linked authority records' control sets to find and pick # out non-main-entry headings. Build the headings and make a @@ -191,6 +191,20 @@ sub map_authority_headings_to_results { ]; } + my $abl_join = {}; + if (my $mattype = $params[7]) { # KCLS JBAS-1929 + $abl_join = { + mraf => { + field => 'id', + fkey => 'bib', + filter => { + attr => 'mattype', + value => $mattype + } + } + }; + } + # Get linked-bib counts for each of those authorities, and put THAT # information into place in the data structure. my $counts = $self->editor->json_query({ @@ -201,7 +215,7 @@ sub map_authority_headings_to_results { "authority" ] }, - from => {abl => {}}, + from => {abl => $abl_join}, where => { "+abl" => { authority => [ @@ -237,7 +251,7 @@ sub map_authority_headings_to_results { # case $self->editor->event should always point to the reason for failure). # $results must be an arrayref of result rows from the DB's metabib.browse() sub flesh_browse_results { - my ($self, $results) = @_; + my ($self, $results, @params) = @_; for my $authority_field_name ( qw/authorities sees/ ) { for my $r (@$results) { @@ -274,7 +288,8 @@ sub flesh_browse_results { where => {"+are" => {id => \@auth_ids}} }) or return; - $self->map_authority_headings_to_results($linked, $results, \@auth_ids, $authority_field_name); + $self->map_authority_headings_to_results( + $linked, $results, \@auth_ids, $authority_field_name, @params); } } @@ -296,7 +311,7 @@ sub load_browse_impl { $self->ctx->{browse_error} = 1; return; - } elsif (not $self->flesh_browse_results($results)) { + } elsif (not $self->flesh_browse_results($results, @params)) { $logger->warn( "error in browse (flesh): " . $self->editor->event->{textcode} ); -- 2.11.0