From e583b5c3e3d8b6a2c3ce774962eeb55d5926c806 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Thu, 14 Dec 2023 15:20:48 -0100 Subject: [PATCH] Bug 35581: Koha/Illrequest/Workflow.pm -> Koha/ILL/Request/Workflow.pm Koha/Illrequest/Workflow/Availability.pm -> Koha/ILL/Request/Workflow/Availability.pm Koha/Illrequest/Workflow/TypeDisclaimer.pm -> Koha/ILL/Request/Workflow/TypeDisclaimer.pm Signed-off-by: David Nind --- Koha/{Illrequest => ILL/Request}/Workflow.pm | 10 +++++----- .../Request}/Workflow/Availability.pm | 12 ++++++------ .../Request}/Workflow/TypeDisclaimer.pm | 8 ++++---- ill/ill-requests.pl | 12 ++++++------ opac/opac-illrequests.pl | 8 ++++---- t/db_dependent/Illrequest/Availability.t | 10 +++++----- t/db_dependent/Illrequest/TypeDisclaimer.t | 10 +++++----- 7 files changed, 35 insertions(+), 35 deletions(-) rename Koha/{Illrequest => ILL/Request}/Workflow.pm (85%) rename Koha/{Illrequest => ILL/Request}/Workflow/Availability.pm (89%) rename Koha/{Illrequest => ILL/Request}/Workflow/TypeDisclaimer.pm (95%) diff --git a/Koha/Illrequest/Workflow.pm b/Koha/ILL/Request/Workflow.pm similarity index 85% rename from Koha/Illrequest/Workflow.pm rename to Koha/ILL/Request/Workflow.pm index d0bc2564f21..726ecdc3e60 100644 --- a/Koha/Illrequest/Workflow.pm +++ b/Koha/ILL/Request/Workflow.pm @@ -1,4 +1,4 @@ -package Koha::Illrequest::Workflow; +package Koha::ILL::Request::Workflow; # Copyright 2023 PTFS Europe Ltd # @@ -28,7 +28,7 @@ use Koha::Plugins; =head1 NAME -Koha::Illrequest::Workflow - Koha ILL Workflow parent class +Koha::ILL::Request::Workflow - Koha ILL Workflow parent class =head1 SYNOPSIS @@ -44,9 +44,9 @@ This class contains methods do be used by ILL workflow stages =head3 new - my $availability = Koha::Illrequest::Workflow::Availability->new( $params, 'opac' ) + my $availability = Koha::ILL::Request::Workflow::Availability->new( $params, 'opac' ) -Create a new Koha::Illrequest::Workflow child class object. +Create a new Koha::ILL::Request::Workflow child class object. We store the metadata and ui_context =cut @@ -65,7 +65,7 @@ sub new { =head3 prep_metadata - my $prepared = Koha::Illrequest::Workflow->prep_metadata($metadata); + my $prepared = Koha::ILL::Request::Workflow->prep_metadata($metadata); Given our metadata, return a string representing that metadata that can be passed in a URL (encoded in JSON then Base64 encoded) diff --git a/Koha/Illrequest/Workflow/Availability.pm b/Koha/ILL/Request/Workflow/Availability.pm similarity index 89% rename from Koha/Illrequest/Workflow/Availability.pm rename to Koha/ILL/Request/Workflow/Availability.pm index 7094dcc3c8c..87da28ebd8f 100644 --- a/Koha/Illrequest/Workflow/Availability.pm +++ b/Koha/ILL/Request/Workflow/Availability.pm @@ -1,4 +1,4 @@ -package Koha::Illrequest::Workflow::Availability; +package Koha::ILL::Request::Workflow::Availability; # Copyright 2019 PTFS Europe Ltd # @@ -21,13 +21,13 @@ use Modern::Perl; use JSON; -use base qw(Koha::Illrequest::Workflow); +use base qw(Koha::ILL::Request::Workflow); use Koha::Plugins; =head1 NAME -Koha::Illrequest::Workflow::Availability - Koha ILL Availability Searching +Koha::ILL::Request::Workflow::Availability - Koha ILL Availability Searching =head1 SYNOPSIS @@ -46,7 +46,7 @@ that can be used to search for item availability =head3 get_services my $services = - Koha::Illrequest::Workflow::Availability->get_services($params); + Koha::ILL::Request::Workflow::Availability->get_services($params); Given our metadata, iterate plugins with the right method and check if they can service our request and, if so, return an arrayref @@ -84,7 +84,7 @@ sub get_services { =head3 show_availability my $show_availability = - Koha::Illrequest::Workflow::Availability->show_availability($params); + Koha::ILL::Request::Workflow::Availability->show_availability($params); Given $params, return true if availability should be shown @@ -114,7 +114,7 @@ sub show_availability { =head3 availability_template_params my $availability_template_params = - Koha::Illrequest::Workflow::Availability->availability_template_params( + Koha::ILL::Request::Workflow::Availability->availability_template_params( $params); Given $params, return true if availability should be shown diff --git a/Koha/Illrequest/Workflow/TypeDisclaimer.pm b/Koha/ILL/Request/Workflow/TypeDisclaimer.pm similarity index 95% rename from Koha/Illrequest/Workflow/TypeDisclaimer.pm rename to Koha/ILL/Request/Workflow/TypeDisclaimer.pm index 51a20cce899..ee3764b8511 100644 --- a/Koha/Illrequest/Workflow/TypeDisclaimer.pm +++ b/Koha/ILL/Request/Workflow/TypeDisclaimer.pm @@ -1,4 +1,4 @@ -package Koha::Illrequest::Workflow::TypeDisclaimer; +package Koha::ILL::Request::Workflow::TypeDisclaimer; # Copyright 2023 PTFS Europe Ltd # @@ -21,7 +21,7 @@ use Modern::Perl; use POSIX qw( strftime ); -use base qw(Koha::Illrequest::Workflow); +use base qw(Koha::ILL::Request::Workflow); =head1 NAME @@ -129,7 +129,7 @@ sub after_request_created { value => strftime( "%Y-%m-%dT%H:%M:%S", localtime( time() ) ), readonly => 0 }; - Koha::Illrequestattribute->new($type_disclaimer_date)->store; + Koha::ILL::Request::Attribute->new($type_disclaimer_date)->store; my $type_disclaimer_value = { illrequest_id => $request->illrequest_id, @@ -137,7 +137,7 @@ sub after_request_created { value => $params->{type_disclaimer_value}, readonly => 0 }; - Koha::Illrequestattribute->new($type_disclaimer_value)->store; + Koha::ILL::Request::Attribute->new($type_disclaimer_value)->store; } =head3 _get_type_disclaimer_info diff --git a/ill/ill-requests.pl b/ill/ill-requests.pl index 22ec2d30210..cf66d54541c 100755 --- a/ill/ill-requests.pl +++ b/ill/ill-requests.pl @@ -29,8 +29,8 @@ use Koha::ILL::Comment; use Koha::Illrequests; use Koha::Illrequest; use Koha::ILL::Batches; -use Koha::Illrequest::Workflow::Availability; -use Koha::Illrequest::Workflow::TypeDisclaimer; +use Koha::ILL::Request::Workflow::Availability; +use Koha::ILL::Request::Workflow::TypeDisclaimer; use Koha::Libraries; use Koha::Plugins; @@ -128,9 +128,9 @@ if ( $backends_available ) { # Before request creation operations - Preparation my $availability = - Koha::Illrequest::Workflow::Availability->new( $params, 'staff' ); + Koha::ILL::Request::Workflow::Availability->new( $params, 'staff' ); my $type_disclaimer = - Koha::Illrequest::Workflow::TypeDisclaimer->new( $params, 'staff' ); + Koha::ILL::Request::Workflow::TypeDisclaimer->new( $params, 'staff' ); # ILLCheckAvailability operation if ($availability->show_availability($request)) { @@ -322,7 +322,7 @@ if ( $backends_available ) { # Prepare availability searching, if required # Get the definition for the z39.50 plugin if ( C4::Context->preference('ILLCheckAvailability') ) { - my $availability = Koha::Illrequest::Workflow::Availability->new( + my $availability = Koha::ILL::Request::Workflow::Availability->new( { name => 'ILL availability - z39.50', %{$request->metadata} @@ -551,6 +551,6 @@ sub get_ill_availability { } } - my $availability = Koha::Illrequest::Workflow::Availability->new($id_types, 'staff'); + my $availability = Koha::ILL::Request::Workflow::Availability->new( $id_types, 'staff' ); return $availability->get_services(); } diff --git a/opac/opac-illrequests.pl b/opac/opac-illrequests.pl index eea96ddf2e7..d9eaebe032d 100755 --- a/opac/opac-illrequests.pl +++ b/opac/opac-illrequests.pl @@ -32,8 +32,8 @@ use Koha::Illrequests; use Koha::Illrequest; use Koha::Libraries; use Koha::Patrons; -use Koha::Illrequest::Workflow::Availability; -use Koha::Illrequest::Workflow::TypeDisclaimer; +use Koha::ILL::Request::Workflow::Availability; +use Koha::ILL::Request::Workflow::TypeDisclaimer; my $query = CGI->new; @@ -121,9 +121,9 @@ if ( $op eq 'list' ) { # Before request creation operations - Preparation my $availability = - Koha::Illrequest::Workflow::Availability->new( $params, 'opac' ); + Koha::ILL::Request::Workflow::Availability->new( $params, 'opac' ); my $type_disclaimer = - Koha::Illrequest::Workflow::TypeDisclaimer->new( $params, 'opac' ); + Koha::ILL::Request::Workflow::TypeDisclaimer->new( $params, 'opac' ); # ILLCheckAvailability operation if ($availability->show_availability($request)) { diff --git a/t/db_dependent/Illrequest/Availability.t b/t/db_dependent/Illrequest/Availability.t index a8d98c9f721..8482c30a9d1 100755 --- a/t/db_dependent/Illrequest/Availability.t +++ b/t/db_dependent/Illrequest/Availability.t @@ -25,7 +25,7 @@ use Test::MockObject; use t::lib::TestBuilder; use t::lib::Mocks; -use Koha::Illrequest::Workflow::Availability; +use Koha::ILL::Request::Workflow::Availability; use Koha::Database; my $schema = Koha::Database->new->schema; @@ -33,7 +33,7 @@ $schema->storage->txn_begin; my $builder = t::lib::TestBuilder->new; -use_ok('Koha::Illrequest::Workflow::Availability'); +use_ok('Koha::ILL::Request::Workflow::Availability'); my $metadata = { title => 'This is a title', @@ -48,9 +48,9 @@ foreach my $key ( keys %{$metadata} ) { } my $availability = - Koha::Illrequest::Workflow::Availability->new( $sorted, 'staff' ); + Koha::ILL::Request::Workflow::Availability->new( $sorted, 'staff' ); -isa_ok( $availability, 'Koha::Illrequest::Workflow::Availability' ); +isa_ok( $availability, 'Koha::ILL::Request::Workflow::Availability' ); is( $availability->prep_metadata($sorted), @@ -85,7 +85,7 @@ t::lib::Mocks::mock_preference( 'ILLCheckAvailability', 1 ); # Mock not empty availability services my $availability_module = - Test::MockModule->new('Koha::Illrequest::Workflow::Availability'); + Test::MockModule->new('Koha::ILL::Request::Workflow::Availability'); $availability_module->mock( 'get_services', [ { name => 'service' } ] ); my $req_1 = $builder->build_object( diff --git a/t/db_dependent/Illrequest/TypeDisclaimer.t b/t/db_dependent/Illrequest/TypeDisclaimer.t index 402bb5002e4..123a8657723 100755 --- a/t/db_dependent/Illrequest/TypeDisclaimer.t +++ b/t/db_dependent/Illrequest/TypeDisclaimer.t @@ -25,7 +25,7 @@ use Test::MockObject; use t::lib::TestBuilder; use t::lib::Mocks; -use Koha::Illrequest::Workflow::TypeDisclaimer; +use Koha::ILL::Request::Workflow::TypeDisclaimer; use Koha::Database; my $schema = Koha::Database->new->schema; @@ -33,7 +33,7 @@ $schema->storage->txn_begin; my $builder = t::lib::TestBuilder->new; -use_ok('Koha::Illrequest::Workflow::TypeDisclaimer'); +use_ok('Koha::ILL::Request::Workflow::TypeDisclaimer'); my $metadata = { title => 'This is a title', @@ -48,9 +48,9 @@ foreach my $key ( keys %{$metadata} ) { } my $type_disclaimer = - Koha::Illrequest::Workflow::TypeDisclaimer->new( $sorted, 'staff' ); + Koha::ILL::Request::Workflow::TypeDisclaimer->new( $sorted, 'staff' ); -isa_ok( $type_disclaimer, 'Koha::Illrequest::Workflow::TypeDisclaimer' ); +isa_ok( $type_disclaimer, 'Koha::ILL::Request::Workflow::TypeDisclaimer' ); is( $type_disclaimer->prep_metadata($sorted), @@ -108,7 +108,7 @@ is( $type_disclaimer->show_type_disclaimer($request), # Mock ILLModuleDisclaimerByType with invalid YAML my $type_disclaimer_module = - Test::MockModule->new('Koha::Illrequest::Workflow::TypeDisclaimer'); + Test::MockModule->new('Koha::ILL::Request::Workflow::TypeDisclaimer'); $type_disclaimer_module->mock( '_get_type_disclaimer_sys_pref', {} ); is( $type_disclaimer->show_type_disclaimer($request), -- 2.30.2