@@ -, +, @@ --- Koha/Virtualshelf.pm | 2 +- t/db_dependent/Virtualshelves.t | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) --- a/Koha/Virtualshelf.pm +++ a/Koha/Virtualshelf.pm @@ -188,7 +188,7 @@ sub remove_biblios { my $number_removed = 0; for my $biblionumber ( @$biblionumbers ) { - if ( $self->allow_delete_own ) { + if ( $self->owner == $borrowernumber or $self->allow_delete_own ) { $number_removed += $self->get_contents->search( { biblionumber => $biblionumber, --- a/t/db_dependent/Virtualshelves.t +++ a/t/db_dependent/Virtualshelves.t @@ -207,9 +207,10 @@ subtest 'Shelf content' => sub { $shelf->allow_delete_own(0); $shelf->store; $number_of_deleted_biblios = $shelf->remove_biblios( { biblionumbers => [ $biblio2->{biblionumber} ], borrowernumber => $patron1->{borrowernumber} } ); - is( $number_of_deleted_biblios, 0, ); + is( $number_of_deleted_biblios, 1, ); $number_of_contents = Koha::Virtualshelfcontents->search->count; - is( $number_of_contents, 1, 'The biblio should not have been deleted to the shelf by the patron, even if it is his own content (allow_delete_own=0)' ); + is( $number_of_contents, 0, 'The biblio should have been deleted to the shelf by the patron, it is his own content (allow_delete_own=0)' ); + $shelf->add_biblio( $biblio2->{biblionumber}, $patron1->{borrowernumber} ); # allow_add = 1, allow_delete_own = 1 $shelf->allow_add(1); --