From 1e6717cf9c95626405fab20c8e5147f4e2afa363 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Thu, 14 Dec 2023 17:07:23 +0000 Subject: [PATCH] Bug 35581: Koha::Illrequest::Logger -> Koha::ILL::Request::Logger Signed-off-by: David Nind Signed-off-by: Pedro Amorim Signed-off-by: Katrin Fischer --- Koha/ILL/Batch.pm | 8 ++++---- Koha/ILL/Batch/Status.pm | 8 ++++---- Koha/{Illrequest => ILL/Request}/Logger.pm | 18 +++++++++--------- Koha/Illrequest.pm | 16 ++++++++-------- t/db_dependent/Koha/ILL/Batch/Statuses.t | 2 +- .../{Illrequest => Koha/ILL/Request}/Logger.t | 6 +++--- 6 files changed, 29 insertions(+), 29 deletions(-) rename Koha/{Illrequest => ILL/Request}/Logger.pm (93%) rename t/db_dependent/{Illrequest => Koha/ILL/Request}/Logger.t (95%) diff --git a/Koha/ILL/Batch.pm b/Koha/ILL/Batch.pm index d5aa7955fe..76330dd51c 100644 --- a/Koha/ILL/Batch.pm +++ b/Koha/ILL/Batch.pm @@ -22,7 +22,7 @@ use Modern::Perl; use Koha::Database; use Koha::Illrequests; -use Koha::Illrequest::Logger; +use Koha::ILL::Request::Logger; use Koha::ILL::Batch::Statuses; use Koha::Libraries; use Koha::Patrons; @@ -104,7 +104,7 @@ sub create_and_log { $self->store; - my $logger = Koha::Illrequest::Logger->new; + my $logger = Koha::ILL::Request::Logger->new; $logger->log_something( { @@ -140,7 +140,7 @@ sub update_and_log { library_id => $self->library_id, }; - my $logger = Koha::Illrequest::Logger->new; + my $logger = Koha::ILL::Request::Logger->new; $logger->log_something( { @@ -168,7 +168,7 @@ Log batch delete sub delete_and_log { my ($self) = @_; - my $logger = Koha::Illrequest::Logger->new; + my $logger = Koha::ILL::Request::Logger->new; $logger->log_something( { diff --git a/Koha/ILL/Batch/Status.pm b/Koha/ILL/Batch/Status.pm index 6f49f618c4..b13efd4a1c 100644 --- a/Koha/ILL/Batch/Status.pm +++ b/Koha/ILL/Batch/Status.pm @@ -19,7 +19,7 @@ package Koha::ILL::Batch::Status; use Modern::Perl; use Koha::Database; -use Koha::Illrequest::Logger; +use Koha::ILL::Request::Logger; use Koha::ILL::Batch; use JSON qw( to_json ); use base qw(Koha::Object); @@ -59,7 +59,7 @@ sub create_and_log { } )->store; - my $logger = Koha::Illrequest::Logger->new; + my $logger = Koha::ILL::Request::Logger->new; $logger->log_something( { @@ -90,7 +90,7 @@ sub update_and_log { my $after = { name => $self->name }; - my $logger = Koha::Illrequest::Logger->new; + my $logger = Koha::ILL::Request::Logger->new; $logger->log_something( { @@ -127,7 +127,7 @@ sub delete_and_log { my $affected = Koha::ILL::Batches->search( { status_code => $self->code } ); $affected->update( { status_code => 'UNKNOWN' } ); - my $logger = Koha::Illrequest::Logger->new; + my $logger = Koha::ILL::Request::Logger->new; $logger->log_something( { diff --git a/Koha/Illrequest/Logger.pm b/Koha/ILL/Request/Logger.pm similarity index 93% rename from Koha/Illrequest/Logger.pm rename to Koha/ILL/Request/Logger.pm index 6aff15765d..dbd2703c44 100644 --- a/Koha/Illrequest/Logger.pm +++ b/Koha/ILL/Request/Logger.pm @@ -1,4 +1,4 @@ -package Koha::Illrequest::Logger; +package Koha::ILL::Request::Logger; # Copyright 2018 PTFS Europe Ltd # @@ -29,7 +29,7 @@ use Koha::Notice::Template; =head1 NAME -Koha::Illrequest::Logger - Koha ILL Action / Event logger +Koha::ILL::ILL::Request::Logger - Koha ILL Action / Event logger =head1 SYNOPSIS @@ -47,9 +47,9 @@ relating to Illrequest to the action log. =head3 new - my $config = Koha::Illrequest::Logger->new(); + my $config = Koha::ILL::Request::Logger->new(); -Create a new Koha::Illrequest::Logger object. +Create a new Koha::ILL::Request::Logger object . We also set up what can be logged, how to do it and how to display log entries we get back out @@ -84,7 +84,7 @@ sub new { =head3 log_maybe - Koha::IllRequest::Logger->log_maybe($params); + Koha::ILL::Request::Logger->log_maybe($params); Receive params hashref, containing a request object and an attrs hashref (which may or may not be defined) If the attrs hashref contains @@ -109,7 +109,7 @@ sub log_maybe { =head3 log_patron_notice - Koha::IllRequest::Logger->log_patron_notice($params); + Koha::ILL::Request::Logger->log_patron_notice($params); Receive a hashref containing a request object and params to log, and log it @@ -134,7 +134,7 @@ sub log_patron_notice { =head3 log_status_change - Koha::IllRequest::Logger->log_status_change($params); + Koha::ILL::Request::Logger->log_status_change($params); Receive a hashref containing a request object and a status to log, and log it @@ -160,7 +160,7 @@ sub log_status_change { =head3 log_something - Koha::IllRequest::Logger->log_something({ + Koha::ILL::Request::Logger->log_something({ modulename => 'ILL', actionname => 'STATUS_CHANGE', objectnumber => $req->id, @@ -226,7 +226,7 @@ sub get_log_template { =head3 get_request_logs - $requestlogs = Koha::IllRequest::Logger->get_request_logs($request_id); + $requestlogs = Koha::ILL::Request::Logger->get_request_logs($request_id); Get all logged actions for a given request diff --git a/Koha/Illrequest.pm b/Koha/Illrequest.pm index 8f4b396c9c..9c2a70a642 100644 --- a/Koha/Illrequest.pm +++ b/Koha/Illrequest.pm @@ -33,7 +33,7 @@ use Koha::Exceptions::Ill; use Koha::ILL::Comments; use Koha::ILL::Request::Attributes; use Koha::AuthorisedValue; -use Koha::Illrequest::Logger; +use Koha::ILL::Request::Logger; use Koha::Patron; use Koha::ILL::Batches; use Koha::AuthorisedValues; @@ -235,7 +235,7 @@ sub comments { sub logs { my ( $self ) = @_; - my $logger = Koha::Illrequest::Logger->new; + my $logger = Koha::ILL::Request::Logger->new; return $logger->get_request_logs($self); } @@ -318,7 +318,7 @@ sub status_alias { my $ret = $self->SUPER::status_alias($val); my $val_to_log = $val ? $new_status_alias : scalar $self->status; if ($ret) { - my $logger = Koha::Illrequest::Logger->new; + my $logger = Koha::ILL::Request::Logger->new; $logger->log_status_change({ request => $self, value => $val_to_log @@ -380,7 +380,7 @@ sub status { # so we pass -1, which is special cased in the overloaded setter $self->status_alias("-1"); } else { - my $logger = Koha::Illrequest::Logger->new; + my $logger = Koha::ILL::Request::Logger->new; $logger->log_status_change({ request => $self, value => $new_status @@ -442,7 +442,7 @@ sub load_backend { $self->{_my_backend} = $backend_plugin->new_ill_backend( { config => $self->_config, - logger => Koha::Illrequest::Logger->new + logger => Koha::ILL::Request::Logger->new } ); } elsif ($backend_name) { @@ -455,7 +455,7 @@ sub load_backend { $self->{_my_backend} = $backend_class->new( { config => $self->_config, - logger => Koha::Illrequest::Logger->new + logger => Koha::ILL::Request::Logger->new } ); } @@ -1714,7 +1714,7 @@ sub send_patron_notice { } } if (scalar @success > 0) { - my $logger = Koha::Illrequest::Logger->new; + my $logger = Koha::ILL::Request::Logger->new; $logger->log_patron_notice({ request => $self, notice_code => $notice_code @@ -1960,7 +1960,7 @@ sub store { $attrs->{log_origin} = 'core'; if ($ret && defined $attrs) { - my $logger = Koha::Illrequest::Logger->new; + my $logger = Koha::ILL::Request::Logger->new; $logger->log_maybe({ request => $self, attrs => $attrs diff --git a/t/db_dependent/Koha/ILL/Batch/Statuses.t b/t/db_dependent/Koha/ILL/Batch/Statuses.t index 987c1c9e24..80052ee40a 100755 --- a/t/db_dependent/Koha/ILL/Batch/Statuses.t +++ b/t/db_dependent/Koha/ILL/Batch/Statuses.t @@ -47,7 +47,7 @@ my $effects = { }; # Mock a logger so we can check it is called -my $logger = Test::MockModule->new('Koha::Illrequest::Logger'); +my $logger = Test::MockModule->new('Koha::ILL::Request::Logger'); $logger->mock( 'log_something', sub { diff --git a/t/db_dependent/Illrequest/Logger.t b/t/db_dependent/Koha/ILL/Request/Logger.t similarity index 95% rename from t/db_dependent/Illrequest/Logger.t rename to t/db_dependent/Koha/ILL/Request/Logger.t index 07d4097573..8fc5e7fb8f 100755 --- a/t/db_dependent/Illrequest/Logger.t +++ b/t/db_dependent/Koha/ILL/Request/Logger.t @@ -34,7 +34,7 @@ my $c4_tpl = Test::MockModule->new('C4::Templates'); $c4_tpl->mock('_get_template_file', sub { return ('htdocs', 'theme', 'lang', 'base/'); }); -use_ok('Koha::Illrequest::Logger'); +use_ok('Koha::ILL::Request::Logger'); subtest 'Basics' => sub { @@ -42,12 +42,12 @@ subtest 'Basics' => sub { $schema->storage->txn_begin; - my $logger = Koha::Illrequest::Logger->new; + my $logger = Koha::ILL::Request::Logger->new; # new() # ok( defined($logger), 'new() returned something' ); - ok( $logger->isa('Koha::Illrequest::Logger'), + ok( $logger->isa('Koha::ILL::Request::Logger'), 'new() returns the correct object' ); # This is an incomplete data hashref, we use it to -- 2.39.5