From a832183e6cee084934b028ae46aec44e87c11eb7 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Tue, 3 Oct 2017 16:01:15 +0200 Subject: [PATCH] Bug 19343: [16.11.X] Remove private lists with edit permission from search results If the list is not shared, it should not be listed. We only need to remove the allow_add line. Signed-off-by: Jonathan Druart Conflicts: Koha/Virtualshelves.pm --- Koha/Virtualshelves.pm | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Koha/Virtualshelves.pm b/Koha/Virtualshelves.pm index 75ccfa8297..2469167448 100644 --- a/Koha/Virtualshelves.pm +++ b/Koha/Virtualshelves.pm @@ -119,6 +119,44 @@ sub get_some_shelves { ); } +sub get_shelves_containing_record { + my ( $self, $params ) = @_; + my $borrowernumber = $params->{borrowernumber}; + my $biblionumber = $params->{biblionumber}; + + my @conditions = ( 'virtualshelfcontents.biblionumber' => $biblionumber ); + if ($borrowernumber) { + push @conditions, + { + -or => [ + { + category => 1, + -or => { + 'me.owner' => $borrowernumber, + -or => { + 'virtualshelfshares.borrowernumber' => $borrowernumber, + }, + } + }, + { category => 2 }, + ] + }; + } else { + push @conditions, { category => 2 }; + } + + return Koha::Virtualshelves->search( + { + -and => \@conditions + }, + { + join => [ 'virtualshelfcontents', 'virtualshelfshares' ], + group_by => 'shelfnumber', + order_by => { -asc => 'shelfname' }, + } + ); +} + sub _type { return 'Virtualshelve'; } -- 2.39.5