Bug 35581: Koha::Illrequest::Workflow* -> Koha::ILL::Request::Workflow*

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 <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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:
Pedro Amorim 2023-12-14 15:20:48 -01:00 committed by Katrin Fischer
parent b3678d30f6
commit fb2d14901b
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
7 changed files with 59 additions and 56 deletions

View File

@ -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)

View File

@ -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

View File

@ -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
@ -54,27 +54,30 @@ sub show_type_disclaimer {
my $disc_sys_pref = $self->_get_type_disclaimer_sys_pref;
my $disc_info =
$self->_get_type_disclaimer_info( $self->_get_type_disclaimer_sys_pref,
$self->{metadata}->{type} );
my $disc_info = $self->_get_type_disclaimer_info(
$self->_get_type_disclaimer_sys_pref,
$self->{metadata}->{type}
);
return
# ILLModuleDisclaimerByType contains correct YAML
%{$disc_sys_pref}
# ILLModuleDisclaimerByType contains correct YAML
%{$disc_sys_pref}
# Check that we have info to display for this type
&& $disc_info
# Check that we have info to display for this type
&& $disc_info
# ILLModuleDisclaimerByType contains at least 'all'
&& $disc_sys_pref->{all}
# ILLModuleDisclaimerByType contains at least 'all'
&& $disc_sys_pref->{all}
# Type disclaimer has not yet been submitted
&& !$self->{metadata}->{type_disclaimer_submitted}
# Type disclaimer has not yet been submitted
&& !$self->{metadata}->{type_disclaimer_submitted}
# The form has been submitted and the backend is able to create the request
&& $request->_backend_capability( 'can_create_request',
$self->{metadata} );
# The form has been submitted and the backend is able to create the request
&& $request->_backend_capability(
'can_create_request',
$self->{metadata}
);
}
=head3 type_disclaimer_template_params
@ -90,12 +93,13 @@ Given $params, return true if type disclaimer should be rendered
sub type_disclaimer_template_params {
my ( $self, $params ) = @_;
my $disc_info =
$self->_get_type_disclaimer_info( $self->_get_type_disclaimer_sys_pref,
$params->{type} );
my $disc_info = $self->_get_type_disclaimer_info(
$self->_get_type_disclaimer_sys_pref,
$params->{type}
);
$params->{method} = 'typedisclaimer' if $self->{ui_context} eq 'staff';
delete $params->{stage} if $self->{ui_context} eq 'staff';
delete $params->{stage} if $self->{ui_context} eq 'staff';
return (
whole => $params,
@ -129,7 +133,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 +141,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
@ -154,7 +158,7 @@ sub _get_type_disclaimer_info {
my ( $self, $disc_sys_pref, $type ) = @_;
my @matching_request_type =
map ( $_ eq $type ? $_ : (), keys %$disc_sys_pref );
map ( $_ eq $type ? $_ : (), keys %$disc_sys_pref );
my $disc_info = undef;
if ( scalar @matching_request_type ) {
@ -162,8 +166,7 @@ sub _get_type_disclaimer_info {
$disc_info->{text} = $disc_sys_pref->{$type}->{text};
$disc_info->{av_cat} = $disc_sys_pref->{$type}->{av_category_code};
}
elsif ( $disc_sys_pref->{all} ) {
} elsif ( $disc_sys_pref->{all} ) {
$disc_info->{text} = $disc_sys_pref->{all}->{text};
$disc_info->{av_cat} = $disc_sys_pref->{all}->{av_category_code};
}

View File

@ -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)) {
@ -324,7 +324,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}
@ -554,6 +554,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();
}

View File

@ -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)) {

View File

@ -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(

View File

@ -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),