Bug 35581: Koha::Illrequest::Logger -> Koha::ILL::Request::Logger
Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
bcc0f17317
commit
1e6717cf9c
|
|
@ -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(
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
Loading…
Reference in New Issue