From 1de1bd8a34baddd17bff8d1ce373c9c4ae4080b0 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 29 Oct 2024 11:44:10 +0000 Subject: [PATCH] Bug 28965: (QA follow-up) Fix misc qa issues * Tidy code * Fix number of unit tests * Fix use of delete Signed-off-by: Kyle M Hall Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer --- Koha/REST/V1/Lists.pm | 6 ++++-- Koha/Virtualshelf.pm | 4 ++-- Koha/Virtualshelves.pm | 4 ++-- t/db_dependent/Virtualshelves.t | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Koha/REST/V1/Lists.pm b/Koha/REST/V1/Lists.pm index c6ea8594c0..a557627e7e 100644 --- a/Koha/REST/V1/Lists.pm +++ b/Koha/REST/V1/Lists.pm @@ -36,8 +36,10 @@ sub list_public { my $user = $c->stash('koha.user'); - my $only_mine = delete $c->param('only_mine'); - my $only_public = delete $c->param('only_public'); + my $only_mine = $c->param('only_mine'); + my $only_public = $c->param('only_public'); + + $c->req->params->remove('only_mine')->remove('only_public'); if ( !$user && $only_mine ) { return $c->render( diff --git a/Koha/Virtualshelf.pm b/Koha/Virtualshelf.pm index fea70466f3..6cddd84fd3 100644 --- a/Koha/Virtualshelf.pm +++ b/Koha/Virtualshelf.pm @@ -424,8 +424,8 @@ This method returns the list of publicly readable database fields for both API a sub public_read_list { return [ - 'created_on', 'lastmodified', 'shelfname', - 'shelfnumber', 'public', 'sortfield', + 'created_on', 'lastmodified', 'shelfname', + 'shelfnumber', 'public', 'sortfield', 'allow_change_from_owner', 'allow_change_from_others' ]; } diff --git a/Koha/Virtualshelves.pm b/Koha/Virtualshelves.pm index 384ed45ce6..58653130a4 100644 --- a/Koha/Virtualshelves.pm +++ b/Koha/Virtualshelves.pm @@ -257,7 +257,7 @@ Returns a resultset of lists marked as public. sub filter_by_public { my ($self) = @_; - return $self->search({ public => 1 }); + return $self->search( { public => 1 } ); } =head3 filter_by_readable @@ -272,7 +272,7 @@ sub filter_by_readable { my ( $self, $params ) = @_; Koha::Exceptions::MissingParameter->throw("Mandatory patron_id parameter missing") - unless $params->{patron_id}; + unless $params->{patron_id}; return $self->search( { '-or' => { public => 1, owner => $params->{patron_id} } } ); } diff --git a/t/db_dependent/Virtualshelves.t b/t/db_dependent/Virtualshelves.t index 5861e1dbb3..25eb2e4bdc 100755 --- a/t/db_dependent/Virtualshelves.t +++ b/t/db_dependent/Virtualshelves.t @@ -16,7 +16,7 @@ # along with Koha; if not, see . use Modern::Perl; -use Test::More tests => 7; +use Test::More tests => 9; use Test::Exception; use DateTime::Duration; -- 2.39.5