From ba22ac4ae92dd092b808e7d63c90f43959404c60 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Fri, 15 Dec 2023 10:30:30 +0000 Subject: [PATCH] Bug 35581: QA Follow-up: Fix tidy warnings Fix forbidden pattern: Incorrect license statement (using postal address) Signed-off-by: David Nind --- Koha/ILL/Backend.pm | 4 +- Koha/ILL/Request/SupplierUpdateProcessor.pm | 6 +-- Koha/ILL/Request/Workflow/TypeDisclaimer.pm | 45 +++++++++++---------- Koha/REST/V1/ILL/Backends.pm | 34 ++++++++-------- t/db_dependent/Koha/ILL/Batch/Statuses.t | 8 ++-- t/db_dependent/Koha/ILL/Batches.t | 2 +- t/db_dependent/Koha/ILL/Comments.t | 38 +++++++++-------- 7 files changed, 72 insertions(+), 65 deletions(-) diff --git a/Koha/ILL/Backend.pm b/Koha/ILL/Backend.pm index 5fee395b766..fabc47c38cd 100644 --- a/Koha/ILL/Backend.pm +++ b/Koha/ILL/Backend.pm @@ -35,7 +35,7 @@ New ILL Backend sub new { my $class = shift; - my $self = {}; + my $self = {}; return bless $self, $class; } @@ -117,7 +117,7 @@ sub embed { foreach my $embed_req ( split /\s*,\s*/, $embed_header ) { if ( $embed_req eq 'statuses+strings' ) { - $return_embed->{statuses} = $self->existing_statuses( $backend_id ); + $return_embed->{statuses} = $self->existing_statuses($backend_id); } } return $return_embed; diff --git a/Koha/ILL/Request/SupplierUpdateProcessor.pm b/Koha/ILL/Request/SupplierUpdateProcessor.pm index e167ca6a7e7..aaedbadc9b1 100644 --- a/Koha/ILL/Request/SupplierUpdateProcessor.pm +++ b/Koha/ILL/Request/SupplierUpdateProcessor.pm @@ -51,11 +51,11 @@ Create a new Koha::ILL::Request::SupplierUpdateProcessor object . sub new { my ( $class, $target_source_type, $target_source_name, $processor_name ) = @_; - my $self = {}; + my $self = {}; $self->{target_source_type} = $target_source_type; $self->{target_source_name} = $target_source_name; - $self->{name} = $processor_name; + $self->{name} = $processor_name; bless $self, $class; @@ -71,7 +71,7 @@ Runs the processor =cut sub run { - my ( $self ) = @_; + my ($self) = @_; my ( $package, $filename ) = caller; warn __PACKAGE__ . " run should only be invoked by a subclass\n"; } diff --git a/Koha/ILL/Request/Workflow/TypeDisclaimer.pm b/Koha/ILL/Request/Workflow/TypeDisclaimer.pm index b9fde3d92e1..73c4639459b 100644 --- a/Koha/ILL/Request/Workflow/TypeDisclaimer.pm +++ b/Koha/ILL/Request/Workflow/TypeDisclaimer.pm @@ -54,27 +54,30 @@ sub show_type_disclaimer { my $disc_sys_pref = $self->_get_type_disclaimer_sys_pref; - my $disc_info = - $self->_get_type_disclaimer_info( $self->_get_type_disclaimer_sys_pref, - $self->{metadata}->{type} ); + my $disc_info = $self->_get_type_disclaimer_info( + $self->_get_type_disclaimer_sys_pref, + $self->{metadata}->{type} + ); return - # ILLModuleDisclaimerByType contains correct YAML - %{$disc_sys_pref} + # ILLModuleDisclaimerByType contains correct YAML + %{$disc_sys_pref} - # Check that we have info to display for this type - && $disc_info + # Check that we have info to display for this type + && $disc_info - # ILLModuleDisclaimerByType contains at least 'all' - && $disc_sys_pref->{all} + # ILLModuleDisclaimerByType contains at least 'all' + && $disc_sys_pref->{all} - # Type disclaimer has not yet been submitted - && !$self->{metadata}->{type_disclaimer_submitted} + # Type disclaimer has not yet been submitted + && !$self->{metadata}->{type_disclaimer_submitted} - # The form has been submitted and the backend is able to create the request - && $request->_backend_capability( 'can_create_request', - $self->{metadata} ); + # The form has been submitted and the backend is able to create the request + && $request->_backend_capability( + 'can_create_request', + $self->{metadata} + ); } =head3 type_disclaimer_template_params @@ -90,12 +93,13 @@ Given $params, return true if type disclaimer should be rendered sub type_disclaimer_template_params { my ( $self, $params ) = @_; - my $disc_info = - $self->_get_type_disclaimer_info( $self->_get_type_disclaimer_sys_pref, - $params->{type} ); + my $disc_info = $self->_get_type_disclaimer_info( + $self->_get_type_disclaimer_sys_pref, + $params->{type} + ); $params->{method} = 'typedisclaimer' if $self->{ui_context} eq 'staff'; - delete $params->{stage} if $self->{ui_context} eq 'staff'; + delete $params->{stage} if $self->{ui_context} eq 'staff'; return ( whole => $params, @@ -154,7 +158,7 @@ sub _get_type_disclaimer_info { my ( $self, $disc_sys_pref, $type ) = @_; my @matching_request_type = - map ( $_ eq $type ? $_ : (), keys %$disc_sys_pref ); + map ( $_ eq $type ? $_ : (), keys %$disc_sys_pref ); my $disc_info = undef; if ( scalar @matching_request_type ) { @@ -162,8 +166,7 @@ sub _get_type_disclaimer_info { $disc_info->{text} = $disc_sys_pref->{$type}->{text}; $disc_info->{av_cat} = $disc_sys_pref->{$type}->{av_category_code}; - } - elsif ( $disc_sys_pref->{all} ) { + } elsif ( $disc_sys_pref->{all} ) { $disc_info->{text} = $disc_sys_pref->{all}->{text}; $disc_info->{av_cat} = $disc_sys_pref->{all}->{av_category_code}; } diff --git a/Koha/REST/V1/ILL/Backends.pm b/Koha/REST/V1/ILL/Backends.pm index ccd69e60ecc..c2338f43917 100644 --- a/Koha/REST/V1/ILL/Backends.pm +++ b/Koha/REST/V1/ILL/Backends.pm @@ -2,18 +2,18 @@ package Koha::REST::V1::ILL::Backends; # This file is part of Koha. # -# Koha is free software; you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation; either version 3 of the License, or (at your option) any later -# version. +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. # -# Koha is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License along -# with Koha; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . use Modern::Perl; @@ -45,10 +45,10 @@ sub list { foreach my $b (@$backends) { my $backend = Koha::ILL::Request->new->load_backend($b); push @data, - { + { ill_backend_id => $b, capabilities => $backend->capabilities, - }; + }; } return $c->render( status => 200, openapi => \@data ); } @@ -73,9 +73,10 @@ sub get { my $backend_module = Koha::ILL::Backend->new; - my $embed = - $backend_module->embed( $backend_id, - $c->req->headers->header('x-koha-embed') ); + my $embed = $backend_module->embed( + $backend_id, + $c->req->headers->header('x-koha-embed') + ); #TODO: We need a to_api method in Koha::ILL::Backend my $return = { @@ -87,8 +88,7 @@ sub get { status => 200, openapi => $embed ? { %$return, %$embed } : $return, ); - } - catch { + } catch { return $c->render( status => 404, openapi => { error => "ILL backend does not exist" } diff --git a/t/db_dependent/Koha/ILL/Batch/Statuses.t b/t/db_dependent/Koha/ILL/Batch/Statuses.t index d247c58edb4..80052ee40ae 100755 --- a/t/db_dependent/Koha/ILL/Batch/Statuses.t +++ b/t/db_dependent/Koha/ILL/Batch/Statuses.t @@ -193,10 +193,10 @@ my $status5 = Koha::ILL::Batch::Status->new( $status5->create_and_log; my $batch = Koha::ILL::Batch->new( { - name => "My test batch", - patron_id => $patron->borrowernumber, - library_id => $library->branchcode, - backend => "TEST", + name => "My test batch", + patron_id => $patron->borrowernumber, + library_id => $library->branchcode, + backend => "TEST", status_code => $status5->code } ); diff --git a/t/db_dependent/Koha/ILL/Batches.t b/t/db_dependent/Koha/ILL/Batches.t index e7348e85ea4..8580f75dae7 100755 --- a/t/db_dependent/Koha/ILL/Batches.t +++ b/t/db_dependent/Koha/ILL/Batches.t @@ -54,7 +54,7 @@ my $branch = $builder->build( { source => 'Branch' } ); my $illbatch = $builder->build_object( { class => 'Koha::ILL::Batches', - value => { + value => { name => "My test batch", backend => "Mock", patron_id => $librarian->{borrowernumber}, diff --git a/t/db_dependent/Koha/ILL/Comments.t b/t/db_dependent/Koha/ILL/Comments.t index 45cd727567d..3e1016592d2 100755 --- a/t/db_dependent/Koha/ILL/Comments.t +++ b/t/db_dependent/Koha/ILL/Comments.t @@ -30,7 +30,7 @@ use Test::MockModule; use Test::More tests => 9; -my $schema = Koha::Database->new->schema; +my $schema = Koha::Database->new->schema; my $builder = t::lib::TestBuilder->new; use_ok('Koha::ILL::Comment'); use_ok('Koha::ILL::Comments'); @@ -40,29 +40,33 @@ $schema->storage->txn_begin; Koha::ILL::Requests->search->delete; # Create a patron -my $patron = $builder->build({ source => 'Borrower' }); +my $patron = $builder->build( { source => 'Borrower' } ); # Create an ILL request -my $illrq = $builder->build({ - source => 'Illrequest', - value => { borrowernumber => $patron->{borrowernumber} } -}); -my $illrq_obj = Koha::ILL::Requests->find($illrq->{illrequest_id}); +my $illrq = $builder->build( + { + source => 'Illrequest', + value => { borrowernumber => $patron->{borrowernumber} } + } +); +my $illrq_obj = Koha::ILL::Requests->find( $illrq->{illrequest_id} ); isa_ok( $illrq_obj, 'Koha::ILL::Request' ); # Create a librarian -my $librarian = $builder->build({ source => 'Borrower' }); +my $librarian = $builder->build( { source => 'Borrower' } ); # Create a comment and tie it to the request and the librarian my $comment_text = 'xyz'; -my $illcomment = $builder->build({ - source => 'Illcomment', - value => { - illrequest_id => $illrq_obj->illrequest_id, - borrowernumber => $librarian->{borrowernumber}, - comment => $comment_text, +my $illcomment = $builder->build( + { + source => 'Illcomment', + value => { + illrequest_id => $illrq_obj->illrequest_id, + borrowernumber => $librarian->{borrowernumber}, + comment => $comment_text, + } } -}); +); # Get all the comments my $comments = $illrq_obj->illcomments; @@ -76,8 +80,8 @@ isa_ok( $comment, 'Koha::ILL::Comment', "Illcomment" ); # Check the different data in the comment is( $comment->illrequest_id, $illrq_obj->illrequest_id, 'illrequest_id getter works' ); -is( $comment->borrowernumber, $librarian->{borrowernumber}, 'borrowernumber getter works'); -is( $comment->comment, $comment_text, 'comment getter works'); +is( $comment->borrowernumber, $librarian->{borrowernumber}, 'borrowernumber getter works' ); +is( $comment->comment, $comment_text, 'comment getter works' ); $illrq_obj->delete; -- 2.30.2