From bb1f9175893013faa659fbc34ff44eac52779ab2 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Sat, 14 Aug 2021 06:54:45 +0000 Subject: [PATCH] Bug 26346: (follow-up) Fixes in response to QA * Fix addressing comment #59 - Making can_be_deleted() consistent to testing Patrons::find * Fix addressing comment comment #61 - Have made the first and second lines consistent, both now return 0 Sponsord-By: Catalyst IT --- Koha/Virtualshelf.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Koha/Virtualshelf.pm b/Koha/Virtualshelf.pm index 114e36894c..ab714b8deb 100644 --- a/Koha/Virtualshelf.pm +++ b/Koha/Virtualshelf.pm @@ -187,7 +187,7 @@ sub add_biblio { # Check permissions my $patron = Koha::Patrons->find( $borrowernumber ) or return 0; - return unless ( $self->owner == $borrowernumber && $self->allow_change_from_owner ) || ( $self->allow_change_from_staff && $patron->can_patron_change_staff_only_lists ) || $self->allow_change_from_others; + return 0 unless ( $self->owner == $borrowernumber && $self->allow_change_from_owner ) || ( $self->allow_change_from_staff && $patron->can_patron_change_staff_only_lists ) || $self->allow_change_from_others; my $content = Koha::Virtualshelfcontent->new( { @@ -238,7 +238,7 @@ sub can_be_deleted { return 0 unless $borrowernumber; return 1 if $self->owner == $borrowernumber; - my $patron = Koha::Patrons->find( $borrowernumber ); + my $patron = Koha::Patrons->find( $borrowernumber ) or return 0; return 1 if $self->is_public and haspermission( $patron->userid, { lists => 'delete_public_lists' } ); @@ -260,6 +260,7 @@ sub can_biblios_be_added { my ( $self, $borrowernumber ) = @_; my $patron = Koha::Patrons->find( $borrowernumber ) or return 0; + return 1 if $borrowernumber and ( ( $self->owner == $borrowernumber && $self->allow_change_from_owner ) or ( $self->allow_change_from_staff && $patron->can_patron_change_staff_only_lists ) or $self->allow_change_from_others ); -- 2.11.0