Bugzilla – Attachment 163803 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: Koha::Illbackend -> Koha::ILL::Backend
Bug-35581-KohaIllbackend---KohaILLBackend.patch (text/plain), 7.57 KB, created by
Tomás Cohen Arazi (tcohen)
on 2024-03-25 13:27:39 UTC
(
hide
)
Description:
Bug 35581: Koha::Illbackend -> Koha::ILL::Backend
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2024-03-25 13:27:39 UTC
Size:
7.57 KB
patch
obsolete
>From c050b7a4d92eabea2fb717a08bdce956da653a1a Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Thu, 14 Dec 2023 14:16:01 +0000 >Subject: [PATCH] Bug 35581: Koha::Illbackend -> Koha::ILL::Backend > >Koha/Illbackend.pm -> Koha/ILL/Backend.pm >Koha/REST/V1/Illbackends.pm -> Koha/REST/V1/ILL/Backends.pm > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/{Illbackend.pm => ILL/Backend.pm} | 12 ++--- > .../V1/{Illbackends.pm => ILL/Backends.pm} | 48 +++++++++---------- > api/v1/swagger/paths/ill_backends.yaml | 8 ++-- > .../Koha/{Illbackend.t => ILL/Backend.t} | 6 +-- > 4 files changed, 37 insertions(+), 37 deletions(-) > rename Koha/{Illbackend.pm => ILL/Backend.pm} (95%) > rename Koha/REST/V1/{Illbackends.pm => ILL/Backends.pm} (60%) > rename t/db_dependent/Koha/{Illbackend.t => ILL/Backend.t} (97%) > >diff --git a/Koha/Illbackend.pm b/Koha/ILL/Backend.pm >similarity index 95% >rename from Koha/Illbackend.pm >rename to Koha/ILL/Backend.pm >index 5be0c6efd72..1c712320506 100644 >--- a/Koha/Illbackend.pm >+++ b/Koha/ILL/Backend.pm >@@ -1,4 +1,4 @@ >-package Koha::Illbackend; >+package Koha::ILL::Backend; > > # Copyright PTFS Europe 2023 > # >@@ -23,19 +23,19 @@ use base qw(Koha::Object); > > =head1 NAME > >-Koha::Illbackend - Koha Illbackend Object class >+Koha::ILL::Backend - Koha Illbackend Object class > > =head2 Class methods > > =head3 new > >-New illbackend >+New ILL Backend > > =cut > > sub new { > my $class = shift; >- my $self = {}; >+ my $self = {}; > return bless $self, $class; > } > >@@ -119,7 +119,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; >@@ -129,7 +129,7 @@ sub embed { > > =head3 _type > >- my $type = Koha::Illbackend->_type; >+ my $type = Koha::ILL::Backend->_type; > > Return this object's type > >diff --git a/Koha/REST/V1/Illbackends.pm b/Koha/REST/V1/ILL/Backends.pm >similarity index 60% >rename from Koha/REST/V1/Illbackends.pm >rename to Koha/REST/V1/ILL/Backends.pm >index 45b9c29922d..58eec04a2cc 100644 >--- a/Koha/REST/V1/Illbackends.pm >+++ b/Koha/REST/V1/ILL/Backends.pm >@@ -1,19 +1,19 @@ >-package Koha::REST::V1::Illbackends; >+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; > >@@ -21,11 +21,11 @@ use Mojo::Base 'Mojolicious::Controller'; > > use Koha::Illrequest::Config; > use Koha::Illrequests; >-use Koha::Illbackend; >+use Koha::ILL::Backend; > > =head1 NAME > >-Koha::REST::V1::Illbackends >+Koha::REST::V1::ILL::Backends > > =head2 Operations > >@@ -38,9 +38,9 @@ Return a list of available ILL backends and its capabilities > sub list { > my $c = shift->openapi->valid_input; > >- my $config = Koha::Illrequest::Config->new; >- my $backends = $config->available_backends; >- my $backend_module = Koha::Illbackend->new; >+ my $config = Koha::ILL::Request::Config->new; >+ my $backends = $config->available_backends; >+ my $backend_module = Koha::ILL::Backend->new; > > my @data; > foreach my $b (@$backends) { >@@ -73,18 +73,19 @@ sub get { > > return try { > >- #FIXME: Should we move load_backend into Koha::Illbackend... >+ #FIXME: Should we move load_backend into Koha::ILL::Backend... > # or maybe make Koha::Ill::Backend a base class for all > # backends? > my $backend = Koha::Illrequest->new->load_backend($backend_id); > >- my $backend_module = Koha::Illbackend->new; >+ 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::Illbackend >+ #TODO: We need a to_api method in Koha::ILL::Backend > my $return = { > ill_backend_id => $backend_id, > capabilities => $backend->capabilities, >@@ -94,8 +95,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/api/v1/swagger/paths/ill_backends.yaml b/api/v1/swagger/paths/ill_backends.yaml >index f076137527b..52ff93dcb62 100644 >--- a/api/v1/swagger/paths/ill_backends.yaml >+++ b/api/v1/swagger/paths/ill_backends.yaml >@@ -1,8 +1,8 @@ > --- > /ill/backends: > get: >- x-mojo-to: Illbackends#list >- operationId: listIllbackends >+ x-mojo-to: ILL::Backends#list >+ operationId: listIllBackends > tags: > - ill_backends > summary: List ILL backends >@@ -52,8 +52,8 @@ > ill: "1" > "/ill/backends/{ill_backend_id}": > get: >- x-mojo-to: Illbackends#get >- operationId: getIllbackends >+ x-mojo-to: ILL::Backends#get >+ operationId: getIllBackends > tags: > - ill_backends > summary: Get ILL backend >diff --git a/t/db_dependent/Koha/Illbackend.t b/t/db_dependent/Koha/ILL/Backend.t >similarity index 97% >rename from t/db_dependent/Koha/Illbackend.t >rename to t/db_dependent/Koha/ILL/Backend.t >index 43b0bc5fe68..8a59e16e059 100755 >--- a/t/db_dependent/Koha/Illbackend.t >+++ b/t/db_dependent/Koha/ILL/Backend.t >@@ -21,7 +21,7 @@ use Modern::Perl; > > use Test::More tests => 1; > >-use Koha::Illbackend; >+use Koha::ILL::Backend; > > use t::lib::TestBuilder; > use t::lib::Mocks; >@@ -36,7 +36,7 @@ subtest 'existing_statuses() tests' => sub { > $schema->storage->txn_begin; > Koha::Illrequests->search->delete; > >- # Mock ILLBackend (as object) >+ # Mock external ILLBackend (as object) > my $backend = Test::MockObject->new; > $backend->set_isa('Koha::Illbackends::Mock'); > $backend->set_always( 'name', 'Mock' ); >@@ -133,7 +133,7 @@ subtest 'existing_statuses() tests' => sub { > } > ); > >- my $backend_module = Koha::Illbackend->new; >+ my $backend_module = Koha::ILL::Backend->new; > > my $existing_statuses = $backend_module->existing_statuses('Mock'); > >-- >2.44.0
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