From b3678d30f6620b24f069a8ac3c91fa8f845d8f13 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Thu, 14 Dec 2023 15:02:05 -0100 Subject: [PATCH] Bug 35581: Koha::Illrequestattribute* -> Koha::ILL::Request::Attribute* Koha/Illrequestattribute.pm -> Koha/ILL/Request/Attribute.pm Koha/Illrequestattributes.pm -> Koha/ILL/Request/Attributes.pm Signed-off-by: David Nind Signed-off-by: Pedro Amorim Signed-off-by: Katrin Fischer --- .../Request/Attribute.pm} | 6 +++--- .../Request/Attributes.pm} | 10 +++++----- Koha/Illrequest.pm | 10 +++++----- Koha/REST/V1/Illrequests.pm | 2 +- Koha/Schema/Result/Illrequestattribute.pm | 8 ++++++++ t/db_dependent/Illrequests.t | 4 ++-- t/db_dependent/Koha/ILL/Comments.t | 2 +- .../ILL/Request/Attributes.t} | 12 ++++++------ 8 files changed, 31 insertions(+), 23 deletions(-) rename Koha/{Illrequestattribute.pm => ILL/Request/Attribute.pm} (88%) rename Koha/{Illrequestattributes.pm => ILL/Request/Attributes.pm} (82%) rename t/db_dependent/{Illrequestattributes.t => Koha/ILL/Request/Attributes.t} (85%) diff --git a/Koha/Illrequestattribute.pm b/Koha/ILL/Request/Attribute.pm similarity index 88% rename from Koha/Illrequestattribute.pm rename to Koha/ILL/Request/Attribute.pm index b5b75dee3d..ce1b47fd04 100644 --- a/Koha/Illrequestattribute.pm +++ b/Koha/ILL/Request/Attribute.pm @@ -1,4 +1,4 @@ -package Koha::Illrequestattribute; +package Koha::ILL::Request::Attribute; # Copyright PTFS Europe 2016 # @@ -25,7 +25,7 @@ use base qw(Koha::Object); =head1 NAME -Koha::Illrequestattribute - Koha Illrequestattribute Object class +Koha::ILL::Request::Attribute - Koha Illrequestattribute Object class =head1 API @@ -70,7 +70,7 @@ sub _type { =head3 to_api_mapping -This method returns the mapping for representing a Koha::Illrequestattribute object +This method returns the mapping for representing a Koha::ILL::Request::Attribute object on the API. =cut diff --git a/Koha/Illrequestattributes.pm b/Koha/ILL/Request/Attributes.pm similarity index 82% rename from Koha/Illrequestattributes.pm rename to Koha/ILL/Request/Attributes.pm index fbf3409366..ba2c4fd7da 100644 --- a/Koha/Illrequestattributes.pm +++ b/Koha/ILL/Request/Attributes.pm @@ -1,4 +1,4 @@ -package Koha::Illrequestattributes; +package Koha::ILL::Request::Attributes; # Copyright PTFS Europe 2016 # @@ -20,13 +20,13 @@ package Koha::Illrequestattributes; use Modern::Perl; use Koha::Database; -use Koha::Illrequestattribute; +use Koha::ILL::Request::Attribute; use base qw(Koha::Objects); =head1 NAME -Koha::Illrequestattributes - Koha Illrequestattributes Object class +Koha::ILL::Request::Attributes - Koha Illrequestattributes Object class =head1 API @@ -36,7 +36,7 @@ Koha::Illrequestattributes - Koha Illrequestattributes Object class =head3 search -my $attributes = Koha::Illrequestattributes->search( $params ); +my $attributes = Koha::ILL::Request::Attributes->search( $params ); =cut @@ -61,7 +61,7 @@ sub _type { =cut sub object_class { - return 'Koha::Illrequestattribute'; + return 'Koha::ILL::Request::Attribute'; } =head1 AUTHOR diff --git a/Koha/Illrequest.pm b/Koha/Illrequest.pm index fbdddfc6bc..774f3de146 100644 --- a/Koha/Illrequest.pm +++ b/Koha/Illrequest.pm @@ -31,7 +31,7 @@ use Koha::Database; use Koha::DateUtils qw( dt_from_string ); use Koha::Exceptions::Ill; use Koha::ILL::Comments; -use Koha::Illrequestattributes; +use Koha::ILL::Request::Attributes; use Koha::AuthorisedValue; use Koha::Illrequest::Logger; use Koha::Patron; @@ -198,7 +198,7 @@ sub statusalias { sub illrequestattributes { deprecated 'illrequestattributes is DEPRECATED in favor of extended_attributes'; my ( $self ) = @_; - return Koha::Illrequestattributes->_new_from_dbic( + return Koha::ILL::Request::Attributes->_new_from_dbic( scalar $self->_result->illrequestattributes ); } @@ -274,7 +274,7 @@ sub library { my $extended_attributes = $request->extended_attributes; -Returns the linked I resultset object. +Returns the linked I resultset object. =cut @@ -282,8 +282,8 @@ sub extended_attributes { my ( $self ) = @_; my $rs = $self->_result->extended_attributes; - # We call search to use the filters in Koha::Illrequestattributes->search - return Koha::Illrequestattributes->_new_from_dbic($rs)->search; + # We call search to use the filters in Koha::ILL::Request::Attributes->search + return Koha::ILL::Request::Attributes->_new_from_dbic($rs)->search; } =head3 status_alias diff --git a/Koha/REST/V1/Illrequests.pm b/Koha/REST/V1/Illrequests.pm index 08020b8961..229c8d5fa1 100644 --- a/Koha/REST/V1/Illrequests.pm +++ b/Koha/REST/V1/Illrequests.pm @@ -21,7 +21,7 @@ use Mojo::Base 'Mojolicious::Controller'; use C4::Context; use Koha::Illrequests; -use Koha::Illrequestattributes; +use Koha::ILL::Request::Attributes; use Koha::Libraries; use Koha::Patrons; use Koha::Libraries; diff --git a/Koha/Schema/Result/Illrequestattribute.pm b/Koha/Schema/Result/Illrequestattribute.pm index 48bd3aff5c..a52e87ec67 100644 --- a/Koha/Schema/Result/Illrequestattribute.pm +++ b/Koha/Schema/Result/Illrequestattribute.pm @@ -124,4 +124,12 @@ __PACKAGE__->add_columns( '+readonly' => { is_boolean => 1 } ); +sub koha_object_class { + 'Koha::ILL::Request::Attribute'; +} + +sub koha_objects_class { + 'Koha::ILL::Request::Attributes'; +} + 1; diff --git a/t/db_dependent/Illrequests.t b/t/db_dependent/Illrequests.t index a5516b2850..3d55467ac8 100755 --- a/t/db_dependent/Illrequests.t +++ b/t/db_dependent/Illrequests.t @@ -22,7 +22,7 @@ use File::Basename qw/basename/; use C4::Circulation qw( AddIssue AddReturn ); use Koha::Database; -use Koha::Illrequestattributes; +use Koha::ILL::Request::Attributes; use Koha::Illrequest::Config; use Koha::Biblios; use Koha::Patrons; @@ -220,7 +220,7 @@ subtest 'Working with related objects' => sub { } ); - my $rs = Koha::Illrequestattributes->search( { illrequest_id => $illrq->id } ); + my $rs = Koha::ILL::Request::Attributes->search( { illrequest_id => $illrq->id } ); is( $illrq->extended_attributes->count, $rs->count, "Fetching expected number of Illrequestattributes for our request." ); diff --git a/t/db_dependent/Koha/ILL/Comments.t b/t/db_dependent/Koha/ILL/Comments.t index 9cf6ebb1bd..0994288333 100755 --- a/t/db_dependent/Koha/ILL/Comments.t +++ b/t/db_dependent/Koha/ILL/Comments.t @@ -20,7 +20,7 @@ use Modern::Perl; use File::Basename qw/basename/; use Koha::Database; use Koha::Illrequests; -use Koha::Illrequestattributes; +use Koha::ILL::Request::Attributes; use Koha::Illrequest::Config; use Koha::Patrons; use t::lib::Mocks; diff --git a/t/db_dependent/Illrequestattributes.t b/t/db_dependent/Koha/ILL/Request/Attributes.t similarity index 85% rename from t/db_dependent/Illrequestattributes.t rename to t/db_dependent/Koha/ILL/Request/Attributes.t index 780c59a3e8..afcab4d426 100755 --- a/t/db_dependent/Illrequestattributes.t +++ b/t/db_dependent/Koha/ILL/Request/Attributes.t @@ -25,8 +25,8 @@ use t::lib::TestBuilder; use Test::More tests => 3; my $schema = Koha::Database->new->schema; -use_ok('Koha::Illrequestattribute'); -use_ok('Koha::Illrequestattributes'); +use_ok('Koha::ILL::Request::Attribute'); +use_ok('Koha::ILL::Request::Attributes'); subtest 'Basic object tests' => sub { @@ -34,19 +34,19 @@ subtest 'Basic object tests' => sub { $schema->storage->txn_begin; - Koha::Illrequestattributes->search->delete; + Koha::ILL::Request::Attributes->search->delete; my $builder = t::lib::TestBuilder->new; my $illrqattr = $builder->build( { source => 'Illrequestattribute' } ); - my $illrqattr_obj = Koha::Illrequestattributes->find( + my $illrqattr_obj = Koha::ILL::Request::Attributes->find( $illrqattr->{illrequest_id}, $illrqattr->{backend}, $illrqattr->{type} ); isa_ok( - $illrqattr_obj, 'Koha::Illrequestattribute', + $illrqattr_obj, 'Koha::ILL::Request::Attribute', "Correctly create and load an illrequestattribute object." ); is( @@ -69,7 +69,7 @@ subtest 'Basic object tests' => sub { $illrqattr_obj->delete; is( - Koha::Illrequestattributes->search->count, 0, + Koha::ILL::Request::Attributes->search->count, 0, "No attributes found after delete." ); -- 2.39.5