Bugzilla – Attachment 164072 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::Illcomment* -> Koha::ILL::Comment*
Bug-35581-KohaIllcomment---KohaILLComment.patch (text/plain), 8.30 KB, created by
Pedro Amorim
on 2024-03-28 16:00:14 UTC
(
hide
)
Description:
Bug 35581: Koha::Illcomment* -> Koha::ILL::Comment*
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2024-03-28 16:00:14 UTC
Size:
8.30 KB
patch
obsolete
>From 78c354adcd6f99ed88361f94a642bc9c6fc2d14c Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Thu, 14 Dec 2023 14:41:07 -0100 >Subject: [PATCH] Bug 35581: Koha::Illcomment* -> Koha::ILL::Comment* > >Koha/Illcomment.pm -> Koha/ILL/Comment.pm >Koha/Illcomments.pm -> Koha/ILL/Comments.pm > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> >--- > Koha/{Illcomment.pm => ILL/Comment.pm} | 8 ++-- > Koha/{Illcomments.pm => ILL/Comments.pm} | 12 ++--- > Koha/Illrequest.pm | 8 ++-- > ill/ill-requests.pl | 2 +- > .../{Illcomments.t => Koha/ILL/Comments.t} | 46 ++++++++++--------- > t/db_dependent/api/v1/ill_requests.t | 2 +- > 6 files changed, 41 insertions(+), 37 deletions(-) > rename Koha/{Illcomment.pm => ILL/Comment.pm} (87%) > rename Koha/{Illcomments.pm => ILL/Comments.pm} (81%) > rename t/db_dependent/{Illcomments.t => Koha/ILL/Comments.t} (67%) > >diff --git a/Koha/Illcomment.pm b/Koha/ILL/Comment.pm >similarity index 87% >rename from Koha/Illcomment.pm >rename to Koha/ILL/Comment.pm >index 594af5379ce..7bd1f13f870 100644 >--- a/Koha/Illcomment.pm >+++ b/Koha/ILL/Comment.pm >@@ -1,4 +1,4 @@ >-package Koha::Illcomment; >+package Koha::ILL::Comment; > > # Copyright Magnus Enger Libriotech 2017 > # >@@ -23,13 +23,13 @@ use base qw(Koha::Object); > > =head1 NAME > >-Koha::Illcomment - Koha Illcomment Object class >+Koha::ILL::Comment - Koha Illcomment Object class > > =head2 Class methods > > =head3 patron > >- my $patron = Koha::Illcomment->patron; >+ my $patron = Koha::ILL::Comment->patron; > > Return the patron object associated with this comment > >@@ -46,7 +46,7 @@ sub patron { > > =head3 _type > >- my $type = Koha::IllComment->_type; >+ my $type = Koha::ILL::Comment->_type; > > Return this object's type > >diff --git a/Koha/Illcomments.pm b/Koha/ILL/Comments.pm >similarity index 81% >rename from Koha/Illcomments.pm >rename to Koha/ILL/Comments.pm >index 01d15884e78..3f9c29c89e1 100644 >--- a/Koha/Illcomments.pm >+++ b/Koha/ILL/Comments.pm >@@ -1,4 +1,4 @@ >-package Koha::Illcomments; >+package Koha::ILL::Comments; > > # Copyright Magnus Enger Libriotech 2017 > # >@@ -19,18 +19,18 @@ package Koha::Illcomments; > > use Modern::Perl; > use Koha::Database; >-use Koha::Illcomment; >+use Koha::ILL::Comment; > use base qw(Koha::Objects); > > =head1 NAME > >-Koha::Illcomments - Koha Illcomments Object class >+Koha::ILL::Comments - Koha Illcomments Object class > > =head2 Internal methods > > =head3 _type > >- my $type = Koha::IllComments->_type; >+ my $type = Koha::ILL::Comments->_type; > > Return this object's type > >@@ -42,14 +42,14 @@ sub _type { > > =head3 object_class > >- my $class = Koha::IllComments->object_class; >+ my $class = Koha::ILL::Comments->object_class; > > Return this object's class name > > =cut > > sub object_class { >- return 'Koha::Illcomment'; >+ return 'Koha::ILL::Comment'; > } > > =head1 AUTHOR >diff --git a/Koha/Illrequest.pm b/Koha/Illrequest.pm >index 55f9051c7f7..d937e1a862c 100644 >--- a/Koha/Illrequest.pm >+++ b/Koha/Illrequest.pm >@@ -30,7 +30,7 @@ use Koha::Cache::Memory::Lite; > use Koha::Database; > use Koha::DateUtils qw( dt_from_string ); > use Koha::Exceptions::Ill; >-use Koha::Illcomments; >+use Koha::ILL::Comments; > use Koha::Illrequestattributes; > use Koha::AuthorisedValue; > use Koha::Illrequest::Logger; >@@ -208,7 +208,7 @@ sub illrequestattributes { > > sub illcomments { > my ( $self ) = @_; >- return Koha::Illcomments->_new_from_dbic( >+ return Koha::ILL::Comments->_new_from_dbic( > scalar $self->_result->illcomments > ); > } >@@ -217,13 +217,13 @@ sub illcomments { > > my $ill_comments = $req->comments; > >-Returns a I<Koha::Illcomments> resultset for the linked comments. >+Returns a I<Koha::ILL::Comments> resultset for the linked comments. > > =cut > > sub comments { > my ( $self ) = @_; >- return Koha::Illcomments->_new_from_dbic( >+ return Koha::ILL::Comments->_new_from_dbic( > scalar $self->_result->comments > ); > } >diff --git a/ill/ill-requests.pl b/ill/ill-requests.pl >index 4586ee5ea3f..2b709eabb14 100755 >--- a/ill/ill-requests.pl >+++ b/ill/ill-requests.pl >@@ -25,7 +25,7 @@ use C4::Auth qw( get_template_and_user ); > use C4::Output qw( output_and_exit output_html_with_http_headers ); > use Koha::Notice::Templates; > use Koha::AuthorisedValues; >-use Koha::Illcomment; >+use Koha::ILL::Comment; > use Koha::Illrequests; > use Koha::Illrequest; > use Koha::ILL::Batches; >diff --git a/t/db_dependent/Illcomments.t b/t/db_dependent/Koha/ILL/Comments.t >similarity index 67% >rename from t/db_dependent/Illcomments.t >rename to t/db_dependent/Koha/ILL/Comments.t >index 85cc63021c5..9cf6ebb1bd5 100755 >--- a/t/db_dependent/Illcomments.t >+++ b/t/db_dependent/Koha/ILL/Comments.t >@@ -30,54 +30,58 @@ 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::Illcomment'); >-use_ok('Koha::Illcomments'); >+use_ok('Koha::ILL::Comment'); >+use_ok('Koha::ILL::Comments'); > > $schema->storage->txn_begin; > > Koha::Illrequests->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::Illrequests->find($illrq->{illrequest_id}); >+my $illrq = $builder->build( >+ { >+ source => 'Illrequest', >+ value => { borrowernumber => $patron->{borrowernumber} } >+ } >+); >+my $illrq_obj = Koha::Illrequests->find( $illrq->{illrequest_id} ); > isa_ok( $illrq_obj, 'Koha::Illrequest' ); > > # 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; >-isa_ok( $comments, 'Koha::Illcomments', "Illcomments" ); >+isa_ok( $comments, 'Koha::ILL::Comments', "Illcomments" ); > my @comments_list = $comments->as_list(); > is( scalar @comments_list, 1, "We have 1 comment" ); > > # Get the first (and only) comment > my $comment = $comments->next(); >-isa_ok( $comment, 'Koha::Illcomment', "Illcomment" ); >+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; > >diff --git a/t/db_dependent/api/v1/ill_requests.t b/t/db_dependent/api/v1/ill_requests.t >index 3e7bb9d681f..7822acc4863 100755 >--- a/t/db_dependent/api/v1/ill_requests.t >+++ b/t/db_dependent/api/v1/ill_requests.t >@@ -209,7 +209,7 @@ subtest 'list() tests' => sub { > # x-koha-embed: comments > # Create comment > my $comment_text = "This is the comment"; >- my $comment = $builder->build_object({ class => 'Koha::Illcomments', value => { illrequest_id => $req_1->illrequest_id, comment => $comment_text , borrowernumber => $patron->borrowernumber } } ); >+ my $comment = $builder->build_object({ class => 'Koha::ILL::Comments', value => { illrequest_id => $req_1->illrequest_id, comment => $comment_text , borrowernumber => $patron->borrowernumber } } ); > > # Make sure comments come back > $t->get_ok("//$userid:$password@/api/v1/ill/requests" => {"x-koha-embed" => "comments"} ) >-- >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