From e50570361da1898bccd5f37a0439fcec44f2ddf5 Mon Sep 17 00:00:00 2001
From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Date: Thu, 9 Jun 2022 09:12:18 +0000
Subject: [PATCH] Bug 11889: (follow-up) We did not need get_shared_shelves
 after all
Content-Type: text/plain; charset=utf-8

Test plan:
Run t/db_dependent/Virtualshelves.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
---
 Koha/Virtualshelves.pm          | 17 -----------------
 t/db_dependent/Virtualshelves.t |  4 ++--
 2 files changed, 2 insertions(+), 19 deletions(-)

diff --git a/Koha/Virtualshelves.pm b/Koha/Virtualshelves.pm
index 53a5ec5b5c..8b40596167 100644
--- a/Koha/Virtualshelves.pm
+++ b/Koha/Virtualshelves.pm
@@ -191,23 +191,6 @@ sub get_shelves_containing_record {
     );
 }
 
-=head3 get_shared_shelves
-
-=cut
-
-sub get_shared_shelves {
-    my ( $self, $params ) = @_;
-    my $borrowernumber = $params->{borrowernumber} || 0;
-
-    $self->search(
-        {
-            'me.owner' => $borrowernumber,
-            'me.shelfnumber' => { -ident => 'virtualshelfshares.shelfnumber' }
-        },
-        { prefetch => 'virtualshelfshares' }
-    );
-}
-
 =head3 _type
 
 =cut
diff --git a/t/db_dependent/Virtualshelves.t b/t/db_dependent/Virtualshelves.t
index 1de7ddc580..9cb32d98d3 100755
--- a/t/db_dependent/Virtualshelves.t
+++ b/t/db_dependent/Virtualshelves.t
@@ -497,8 +497,8 @@ subtest 'Get shelves' => sub {
     is( $public_shelves->count, 2, 'get_public_shelves should return all public shelves, no matter who is the owner' );
 
     my $shared_shelf = eval { $shelf_to_share->share("valid key") };
-    my $shared_shelves = Koha::Virtualshelves->get_shared_shelves({ borrowernumber => $patron1->{borrowernumber} });
-    is( $shared_shelves->count, 1, 'get_shared_shelves should return shared shelves' );
+    my $shared_shelves = Koha::Virtualshelfshares->search({ borrowernumber => $patron1->{borrowernumber} });
+    is( $shared_shelves->count, 1, 'Found the share for patron1' );
 
     teardown();
 };
-- 
2.20.1