Bugzilla – Attachment 159873 Details for
Bug 35581
ILL Koha classes are not consistent
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35581: QA Follow-up:
Bug-35581-QA-Follow-up.patch (text/plain), 12.15 KB, created by
Pedro Amorim
on 2023-12-15 11:04:29 UTC
(
hide
)
Description:
Bug 35581: QA Follow-up:
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2023-12-15 11:04:29 UTC
Size:
12.15 KB
patch
obsolete
>From 811ede6459abef1aae2406592341740bd59a8158 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >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) >--- > Koha/ILL/Backend.pm | 4 +- > Koha/ILL/Request/SupplierUpdateProcessor.pm | 6 +-- > Koha/ILL/Request/Workflow/TypeDisclaimer.pm | 47 +++++++++++---------- > 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, 73 insertions(+), 66 deletions(-) > >diff --git a/Koha/ILL/Backend.pm b/Koha/ILL/Backend.pm >index 5fee395b76..fabc47c38c 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 e167ca6a7e..aaedbadc9b 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 d46c8843f0..ebf5fdf903 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, >@@ -106,7 +110,7 @@ sub type_disclaimer_template_params { > illrequestsview => 1, > message => $params->{message}, > method => 'typedisclaimer', >- ) >+ ) > : () > ); > } >@@ -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 ccd69e60ec..c2338f4391 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 <http://www.gnu.org/licenses>. > > 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 d247c58edb..80052ee40a 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 e7348e85ea..8580f75dae 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 45cd727567..3e1016592d 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
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35581
:
159863
|
159864
|
159865
|
159866
|
159867
|
159868
|
159869
|
159870
|
159871
|
159872
|
159873
|
160422
|
160423
|
160424
|
160425
|
160426
|
160427
|
160428
|
160429
|
160430
|
160431
|
160432
|
160620
|
160622
|
162020
|
162021
|
162022
|
162023
|
162024
|
162025
|
162026
|
162027
|
162028
|
162029
|
162030
|
162031
|
162032
|
162817
|
162818
|
162819
|
162820
|
162821
|
162822
|
162823
|
162824
|
162825
|
162826
|
162827
|
162828
|
162829
|
162880
|
162881
|
162882
|
162883
|
162884
|
162885
|
162886
|
162887
|
162888
|
162889
|
162890
|
162891
|
162892
|
163803
|
163804
|
163805
|
163806
|
163807
|
163808
|
163809
|
163810
|
163811
|
163812
|
163813
|
163814
|
163815
|
163816
|
164069
|
164070
|
164071
|
164072
|
164073
|
164074
|
164075
|
164076
|
164077
|
164078
|
164079
|
164080
|
164081
|
164082
|
165448