From 6dd39a2945110b7034788a3dbd4a241030be05bb Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 26 Oct 2016 12:47:35 +0200 Subject: [PATCH] Bug 17500: Index category_type to make searchable and display from the ES results --- Koha/Patron.pm | 6 ++++++ misc/search_tools/reindex_patrons.pl | 1 + 2 files changed, 7 insertions(+) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index b79b58a..a314a37 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -48,6 +48,12 @@ Koha::Patron - Koha Patron Object class =cut +sub category { + my ( $self ) = @_; + my $category = $self->_result->categorycode; + return Koha::Patron::Category->_new_from_dbic( $category ); +} + =head3 delete $patron->delete diff --git a/misc/search_tools/reindex_patrons.pl b/misc/search_tools/reindex_patrons.pl index ed581b7..4d1b689 100644 --- a/misc/search_tools/reindex_patrons.pl +++ b/misc/search_tools/reindex_patrons.pl @@ -17,6 +17,7 @@ while ( my $patron = $patrons->next ) { my $id = $patron->borrowernumber; my $record = $patron->unblessed; $record->{_id} = $id; + $record->{category_type} = $patron->category->category_type; push @id_buffer, $id; push @commit_buffer, $record; } -- 2.1.4