Bugzilla – Attachment 159872 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/Illrequest.pm -> Koha/ILL/Request.pm
Bug-35581-KohaIllrequestpm---KohaILLRequestpm.patch (text/plain), 57.93 KB, created by
Pedro Amorim
on 2023-12-15 11:04:26 UTC
(
hide
)
Description:
Bug 35581: Koha/Illrequest.pm -> Koha/ILL/Request.pm
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2023-12-15 11:04:26 UTC
Size:
57.93 KB
patch
obsolete
>From 6b37edbe0bcbd969c80b9aafc7cf387c734c9367 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Fri, 15 Dec 2023 10:07:11 +0000 >Subject: [PATCH] Bug 35581: Koha/Illrequest.pm -> Koha/ILL/Request.pm > >Koha/Illrequests.pm -> Koha/ILL/Requests.pm > >Merged: >t/db_dependent/Koha/Illrequests.t >t/db_dependent/Illrequests.t > >Into: >t/db_dependent/Koha/ILL/Requests.t > >ILL classes file structure is, for the most part, around 7 years old and doesn't follow a strict logic. It's so confusing that some test files exist redundantly. > >This housekeeping should help future work in regards to ISO18626 to add Koha as a supplying agency instead of just requesting agency, as is now. >It should also help future housekeeping of moving backend related logic out of the Illrequest.pm into Illbackend.pm (now ILL/Request.pm and ILL/Backend.pm as of this patchset). >It should also help in structuring the addition of a master generic form (see bug 35570) > >This patchset will require existing backends to be updated to match the new class names and structure, if they invoke them. > >Test plan, k-t-d, run tests: >prove t/db_dependent/api/v1/ill_* >prove t/db_dependent/Koha/ILL/* > >Test plan, k-t-d, manual: >1) Install FreeForm, enable ILL module, run: >bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh) >2) You'll have to switch the FreeForm repo to the one compatible with this work, like: >cd /kohadevbox/koha/Koha/Illbackends/FreeForm >git checkout reorganize_ILL >3) Do some generic ILL testing: >3.1) Create a request >3.2) Add a comment to a request >3.3) Edit a request >3.4) Edit a request's item metadata >3.5) Confirm a request >3.6) List requests >3.7) Filter requests list using left side filters >4) Install a metadata enrichment plugin: >https://github.com/PTFS-Europe/koha-plugin-api-pubmed >4.1) Create an ILL batch and insert a pubmedid like 123 >4.2) Add the request and finish batch >5) Verify all of the above works as expected >--- > C4/Circulation.pm | 6 +- > C4/Letters.pm | 2 +- > Koha/Biblio.pm | 6 +- > Koha/ILL/Backend.pm | 4 +- > Koha/ILL/Batch.pm | 6 +- > Koha/{Illrequest.pm => ILL/Request.pm} | 10 +-- > Koha/ILL/Request/Attribute.pm | 4 +- > Koha/ILL/Request/SupplierUpdateProcessor.pm | 8 +- > Koha/ILL/Request/Workflow/TypeDisclaimer.pm | 6 +- > Koha/{Illrequests.pm => ILL/Requests.pm} | 12 +-- > Koha/REST/V1/ILL/Backends.pm | 6 +- > Koha/REST/V1/ILL/Batches.pm | 2 +- > Koha/REST/V1/Illrequests.pm | 12 +-- > Koha/Schema/Result/Illrequest.pm | 8 ++ > catalogue/detail.pl | 4 +- > ill/ill-requests.pl | 32 +++---- > misc/process_ill_updates.pl | 4 +- > opac/opac-illrequests.pl | 10 +-- > t/db_dependent/Biblio.t | 4 +- > t/db_dependent/Circulation.t | 4 +- > t/db_dependent/Illrequest/Availability.t | 6 +- > t/db_dependent/Illrequest/SupplierUpdate.t | 2 +- > .../Illrequest/SupplierUpdateProcessor.t | 8 +- > t/db_dependent/Illrequest/TypeDisclaimer.t | 6 +- > t/db_dependent/Koha/Biblio.t | 4 +- > t/db_dependent/Koha/ILL/Backend.t | 16 ++-- > t/db_dependent/Koha/ILL/Batch.t | 2 +- > t/db_dependent/Koha/ILL/Batches.t | 4 +- > t/db_dependent/Koha/ILL/Comments.t | 8 +- > .../Koha/{Illrequest.t => ILL/Request.t} | 6 +- > .../{Illrequests.t => Koha/ILL/Requests.t} | 83 +++++++++++++------ > t/db_dependent/Koha/Illrequests.t | 62 -------------- > t/db_dependent/api/v1/ill_backends.t | 14 ++-- > t/db_dependent/api/v1/ill_batches.t | 4 +- > t/db_dependent/api/v1/ill_requests.t | 24 +++--- > 35 files changed, 188 insertions(+), 211 deletions(-) > rename Koha/{Illrequest.pm => ILL/Request.pm} (99%) > rename Koha/{Illrequests.pm => ILL/Requests.pm} (90%) > rename t/db_dependent/Koha/{Illrequest.t => ILL/Request.t} (82%) > rename t/db_dependent/{Illrequests.t => Koha/ILL/Requests.t} (96%) > delete mode 100755 t/db_dependent/Koha/Illrequests.t > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index ac28b2e74b..69caa72e61 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -45,7 +45,7 @@ use Koha::Biblioitems; > use Koha::DateUtils qw( dt_from_string ); > use Koha::Calendar; > use Koha::Checkouts; >-use Koha::Illrequests; >+use Koha::ILL::Requests; > use Koha::Items; > use Koha::Patrons; > use Koha::Patron::Debarments qw( DelUniqueDebarment AddUniqueDebarment ); >@@ -1601,7 +1601,7 @@ sub AddIssue { > # Check if we need to use an exact due date set by the ILL module > if ( C4::Context->preference('ILLModule') ) { > # Check if there is an ILL connected with the biblio of the item we are issuing >- my $ill_request = Koha::Illrequests->search({ >+ my $ill_request = Koha::ILL::Requests->search({ > biblio_id => $item_object->biblionumber, > borrowernumber => $patron->borrowernumber, > completed => undef, >@@ -2489,7 +2489,7 @@ sub AddReturn { > # Check if this item belongs to a biblio record that is attached to an > # ILL request, if it is we need to update the ILL request's status > if ( $doreturn and C4::Context->preference('CirculateILL')) { >- my $request = Koha::Illrequests->find( >+ my $request = Koha::ILL::Requests->find( > { biblio_id => $item->biblio->biblionumber } > ); > $request->status('RET') if $request; >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 47e1252648..1aabfcfce6 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -1859,7 +1859,7 @@ sub _get_tt_params { > fk => 'verification_token', > }, > illrequests => { >- module => 'Koha::Illrequests', >+ module => 'Koha::ILL::Requests', > singular => 'illrequest', > plural => 'illrequests', > pk => 'illrequest_id' >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index 7d0b244085..90056173db 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -41,7 +41,7 @@ use Koha::Bookings; > use Koha::Checkouts; > use Koha::CirculationRules; > use Koha::Exceptions; >-use Koha::Illrequests; >+use Koha::ILL::Requests; > use Koha::Item::Transfer::Limits; > use Koha::Items; > use Koha::Libraries; >@@ -172,7 +172,7 @@ sub tickets { > > my $ill_requests = $biblio->ill_requests(); > >-Returns a Koha::Illrequests object >+Returns a Koha::ILL::Requests object > > =cut > >@@ -180,7 +180,7 @@ sub ill_requests { > my ( $self ) = @_; > > my $ill_requests = $self->_result->ill_requests; >- return Koha::Illrequests->_new_from_dbic($ill_requests); >+ return Koha::ILL::Requests->_new_from_dbic($ill_requests); > } > > =head3 item_groups >diff --git a/Koha/ILL/Backend.pm b/Koha/ILL/Backend.pm >index de6746af99..5fee395b76 100644 >--- a/Koha/ILL/Backend.pm >+++ b/Koha/ILL/Backend.pm >@@ -55,7 +55,7 @@ sub existing_statuses { > # throw 'Koha::Exceptions::Ill::InvalidBackendId' when we're converting to a Koha object. > # Finally, to get around 'ONLY_FULL_GROUP_BY', we have to be explicit about which > # 'request_id' we want to return, hense the 'MAX' call. >- my $ill_requests = Koha::Illrequests->search( >+ my $ill_requests = Koha::ILL::Requests->search( > { backend => $backend_id }, > { > select => [ 'status', \'MAX(illrequest_id)', 'backend' ], >@@ -78,7 +78,7 @@ sub existing_statuses { > } > > # Now do the same to get all status_aliases >- $ill_requests = Koha::Illrequests->search( >+ $ill_requests = Koha::ILL::Requests->search( > { backend => $backend_id }, > { > select => [ 'status_alias', \'MAX(illrequest_id)', 'backend' ], >diff --git a/Koha/ILL/Batch.pm b/Koha/ILL/Batch.pm >index 76330dd51c..659598b3d0 100644 >--- a/Koha/ILL/Batch.pm >+++ b/Koha/ILL/Batch.pm >@@ -21,7 +21,7 @@ use Modern::Perl; > > use Koha::Database; > >-use Koha::Illrequests; >+use Koha::ILL::Requests; > use Koha::ILL::Request::Logger; > use Koha::ILL::Batch::Statuses; > use Koha::Libraries; >@@ -81,14 +81,14 @@ sub library { > > =head3 requests > >-Return the I<Koha::Illrequests> for this batch >+Return the I<Koha::ILL::Requests> for this batch > > =cut > > sub requests { > my ($self) = @_; > my $requests = $self->_result->requests; >- return Koha::Illrequests->_new_from_dbic($requests); >+ return Koha::ILL::Requests->_new_from_dbic($requests); > } > > =head3 create_and_log >diff --git a/Koha/Illrequest.pm b/Koha/ILL/Request.pm >similarity index 99% >rename from Koha/Illrequest.pm >rename to Koha/ILL/Request.pm >index 28ec6d635a..e49e46693d 100644 >--- a/Koha/Illrequest.pm >+++ b/Koha/ILL/Request.pm >@@ -1,4 +1,4 @@ >-package Koha::Illrequest; >+package Koha::ILL::Request; > > # Copyright PTFS Europe 2016,2018 > # >@@ -48,11 +48,11 @@ use base qw(Koha::Object); > > =head1 NAME > >-Koha::Illrequest - Koha Illrequest Object class >+Koha::ILL::Request - Koha Illrequest Object class > > =head1 (Re)Design > >-An ILLRequest consists of two parts; the Illrequest Koha::Object, and a series >+An ILLRequest consists of two parts; the ILL::Request Koha::Object, and a series > of related Illrequestattributes. > > The former encapsulates the basic necessary information that any ILL requires >@@ -1233,7 +1233,7 @@ sub _limit_counter { > # Establish parameters of counts > my $resultset; > if ($method && $method eq 'annual') { >- $resultset = Koha::Illrequests->search({ >+ $resultset = Koha::ILL::Requests->search({ > -and => [ > %{$target}, > \"YEAR(placed) = YEAR(NOW())" >@@ -1243,7 +1243,7 @@ sub _limit_counter { > # XXX: This status list is ugly. There should be a method in config > # to return these. > my $where = { status => { -not_in => [ 'QUEUED', 'COMP' ] } }; >- $resultset = Koha::Illrequests->search({ %{$target}, %{$where} }); >+ $resultset = Koha::ILL::Requests->search( { %{$target}, %{$where} } ); > } > > # Fetch counts >diff --git a/Koha/ILL/Request/Attribute.pm b/Koha/ILL/Request/Attribute.pm >index ce1b47fd04..a761ab8c62 100644 >--- a/Koha/ILL/Request/Attribute.pm >+++ b/Koha/ILL/Request/Attribute.pm >@@ -49,13 +49,13 @@ sub store { > > =head3 request > >-Returns a Koha::Illrequest object representing the core request. >+Returns a Koha::ILL::Request object representing the core request . > > =cut > > sub request { > my ($self) = @_; >- return Koha::Illrequest->_new_from_dbic( $self->_result->illrequest ); >+ return Koha::ILL::Request->_new_from_dbic( $self->_result->illrequest ); > } > > =head2 Internal methods >diff --git a/Koha/ILL/Request/SupplierUpdateProcessor.pm b/Koha/ILL/Request/SupplierUpdateProcessor.pm >index 9ce0d9163b..e167ca6a7e 100644 >--- a/Koha/ILL/Request/SupplierUpdateProcessor.pm >+++ b/Koha/ILL/Request/SupplierUpdateProcessor.pm >@@ -21,7 +21,7 @@ use Modern::Perl; > > =head1 NAME > >-Koha::Illrequest::SupplierUpdateProcessor - Represents a SupplerUpdate processor >+Koha::ILL::Request::SupplierUpdateProcessor - Represents a SupplerUpdate processor > > =head1 SYNOPSIS > >@@ -40,12 +40,12 @@ a SupplierUpdate > > =head3 new > >- my $processor = Koha::Illrequest::SupplierUpdateProcessor->new( >+ my $processor = Koha::ILL::Request::SupplierUpdateProcessor->new( > $target_source_type, > $target_source_name > ); > >-Create a new Koha::Illrequest::SupplierUpdateProcessor object. >+Create a new Koha::ILL::Request::SupplierUpdateProcessor object . > > =cut > >@@ -64,7 +64,7 @@ sub new { > > =head3 run > >- Koha::Illrequest::SupplierUpdateProcessor->run(); >+ Koha::ILL::Request::SupplierUpdateProcessor->run(); > > Runs the processor > >diff --git a/Koha/ILL/Request/Workflow/TypeDisclaimer.pm b/Koha/ILL/Request/Workflow/TypeDisclaimer.pm >index 636318da48..d46c8843f0 100644 >--- a/Koha/ILL/Request/Workflow/TypeDisclaimer.pm >+++ b/Koha/ILL/Request/Workflow/TypeDisclaimer.pm >@@ -25,7 +25,7 @@ use base qw(Koha::ILL::Request::Workflow); > > =head1 NAME > >-Koha::Illrequest::TypeDisclaimer - Koha ILL TypeDisclaimer >+Koha::ILL::Request::TypeDisclaimer - Koha ILL TypeDisclaimer > > =head1 SYNOPSIS > >@@ -43,7 +43,7 @@ and handle the template params accordingly > =head3 show_type_disclaimer > > my $show_type_disclaimer = >- Koha::Illrequest::TypeDisclaimer->show_type_disclaimer($params); >+ Koha::ILL::Request::TypeDisclaimer->show_type_disclaimer($params); > > Given $params, return true if type disclaimer should be shown > >@@ -80,7 +80,7 @@ sub show_type_disclaimer { > =head3 type_disclaimer_template_params > > my $type_disclaimer_template_params = >- Koha::Illrequest::TypeDisclaimer->type_disclaimer_template_params( >+ Koha::ILL::Request::TypeDisclaimer->type_disclaimer_template_params( > $params); > > Given $params, return true if type disclaimer should be rendered >diff --git a/Koha/Illrequests.pm b/Koha/ILL/Requests.pm >similarity index 90% >rename from Koha/Illrequests.pm >rename to Koha/ILL/Requests.pm >index 2146c1e491..468bd34d82 100644 >--- a/Koha/Illrequests.pm >+++ b/Koha/ILL/Requests.pm >@@ -1,4 +1,4 @@ >-package Koha::Illrequests; >+package Koha::ILL::Requests; > > # Copyright PTFS Europe 2016 > # >@@ -20,14 +20,14 @@ package Koha::Illrequests; > use Modern::Perl; > > use Koha::Database; >-use Koha::Illrequest; >+use Koha::ILL::Request; > use Koha::ILL::Request::Config; > > use base qw(Koha::Objects); > > =head1 NAME > >-Koha::Illrequests - Koha Illrequests Object class >+Koha::ILL::Requests - Koha Illrequests Object class > > =head1 API > >@@ -37,7 +37,7 @@ Koha::Illrequests - Koha Illrequests Object class > > =head3 new > >- my $illRequests = Koha::Illrequests->new(); >+ my $illRequests = Koha::ILL::Requests->new(); > > Create an ILLREQUESTS object, a singleton through which we can interact with > ILLREQUEST objects stored in the database or search for ILL candidates at API >@@ -60,7 +60,7 @@ sub new { > > my $visible_requests = $requests->filter_by_visible; > >-Returns a I<Koha::Illrequests> resultset, filtered by statuses that are not listed >+Returns a I<Koha::ILL::Requests> resultset, filtered by statuses that are not listed > as hidden in the I<ILLHiddenRequestStatuses> system preference. > > =cut >@@ -121,7 +121,7 @@ sub _type { > =cut > > sub object_class { >- return 'Koha::Illrequest'; >+ return 'Koha::ILL::Request'; > } > > =head1 AUTHOR >diff --git a/Koha/REST/V1/ILL/Backends.pm b/Koha/REST/V1/ILL/Backends.pm >index 2f61bb658e..ccd69e60ec 100644 >--- a/Koha/REST/V1/ILL/Backends.pm >+++ b/Koha/REST/V1/ILL/Backends.pm >@@ -20,7 +20,7 @@ use Modern::Perl; > use Mojo::Base 'Mojolicious::Controller'; > > use Koha::ILL::Request::Config; >-use Koha::Illrequests; >+use Koha::ILL::Requests; > use Koha::ILL::Backend; > > =head1 NAME >@@ -43,7 +43,7 @@ sub list { > > my @data; > foreach my $b (@$backends) { >- my $backend = Koha::Illrequest->new->load_backend($b); >+ my $backend = Koha::ILL::Request->new->load_backend($b); > push @data, > { > ill_backend_id => $b, >@@ -69,7 +69,7 @@ sub get { > #FIXME: Should we move load_backend into Koha::ILL::Backend... > # or maybe make Koha::Ill::Backend a base class for all > # backends? >- my $backend = Koha::Illrequest->new->load_backend($backend_id); >+ my $backend = Koha::ILL::Request->new->load_backend($backend_id); > > my $backend_module = Koha::ILL::Backend->new; > >diff --git a/Koha/REST/V1/ILL/Batches.pm b/Koha/REST/V1/ILL/Batches.pm >index ab79e0d483..df1389f9ab 100644 >--- a/Koha/REST/V1/ILL/Batches.pm >+++ b/Koha/REST/V1/ILL/Batches.pm >@@ -21,7 +21,7 @@ use Mojo::Base 'Mojolicious::Controller'; > > use Koha::ILL::Batches; > use Koha::ILL::Batch::Statuses; >-use Koha::Illrequests; >+use Koha::ILL::Requests; > > use Try::Tiny qw( catch try ); > >diff --git a/Koha/REST/V1/Illrequests.pm b/Koha/REST/V1/Illrequests.pm >index 96e6f0a18e..4c1a526b4d 100644 >--- a/Koha/REST/V1/Illrequests.pm >+++ b/Koha/REST/V1/Illrequests.pm >@@ -20,7 +20,7 @@ use Modern::Perl; > use Mojo::Base 'Mojolicious::Controller'; > > use C4::Context; >-use Koha::Illrequests; >+use Koha::ILL::Requests; > use Koha::ILL::Request::Attributes; > use Koha::Libraries; > use Koha::Patrons; >@@ -38,7 +38,7 @@ Koha::REST::V1::Illrequests > > =head3 list > >-Controller function that handles listing Koha::Illrequest objects >+Controller function that handles listing Koha::ILL::Request objects > > =cut > >@@ -47,7 +47,7 @@ sub list { > > return try { > >- my $reqs = $c->objects->search(Koha::Illrequests->new->filter_by_visible); >+ my $reqs = $c->objects->search(Koha::ILL::Requests->new->filter_by_visible); > > return $c->render( > status => 200, >@@ -77,7 +77,7 @@ sub add { > $body->{borrowernumber} = delete $body->{patron_id}; > $body->{branchcode} = delete $body->{library_id}; > >- my $request = Koha::Illrequest->new->load_backend( $body->{backend} ); >+ my $request = Koha::ILL::Request->new->load_backend( $body->{backend} ); > > my $create_api = $request->_backend->capabilities('create_api'); > >@@ -93,7 +93,7 @@ sub add { > my $create_result = &{$create_api}($body, $request); > my $new_id = $create_result->illrequest_id; > >- my $new_req = Koha::Illrequests->find($new_id); >+ my $new_req = Koha::ILL::Requests->find($new_id); > > $c->res->headers->location($c->req->url->to_string . '/' . $new_req->illrequest_id); > return $c->render( >@@ -105,7 +105,7 @@ sub add { > } > catch { > >- my $to_api_mapping = Koha::Illrequest->new->to_api_mapping; >+ my $to_api_mapping = Koha::ILL::Request->new->to_api_mapping; > > if ( blessed $_ ) { > if ( $_->isa('Koha::Exceptions::Object::DuplicateID') ) { >diff --git a/Koha/Schema/Result/Illrequest.pm b/Koha/Schema/Result/Illrequest.pm >index ccfbe880ee..98d68f700b 100644 >--- a/Koha/Schema/Result/Illrequest.pm >+++ b/Koha/Schema/Result/Illrequest.pm >@@ -439,4 +439,12 @@ __PACKAGE__->belongs_to( > }, > ); > >+sub koha_object_class { >+ 'Koha::ILL::Request'; >+} >+ >+sub koha_objects_class { >+ 'Koha::ILL::Requests'; >+} >+ > 1; >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index 9edaf3f3bb..537cba427d 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -50,7 +50,7 @@ use Koha::Biblio::ItemGroup::Items; > use Koha::Biblio::ItemGroups; > use Koha::CoverImages; > use Koha::DateUtils; >-use Koha::Illrequests; >+use Koha::ILL::Requests; > use Koha::Items; > use Koha::ItemTypes; > use Koha::Patrons; >@@ -595,7 +595,7 @@ $template->param( holdcount => $holds->count ); > # Check if there are any ILL requests connected to the biblio > my $illrequests = > C4::Context->preference('ILLModule') >- ? Koha::Illrequests->search( { biblio_id => $biblionumber } ) >+ ? Koha::ILL::Requests->search( { biblio_id => $biblionumber } ) > : []; > $template->param( illrequests => $illrequests ); > >diff --git a/ill/ill-requests.pl b/ill/ill-requests.pl >index ea74673143..e32242e54a 100755 >--- a/ill/ill-requests.pl >+++ b/ill/ill-requests.pl >@@ -26,7 +26,7 @@ use C4::Output qw( output_and_exit output_html_with_http_headers ); > use Koha::Notice::Templates; > use Koha::AuthorisedValues; > use Koha::ILL::Comment; >-use Koha::Illrequests; >+use Koha::ILL::Requests; > use Koha::ILL::Batches; > use Koha::ILL::Request::Workflow::Availability; > use Koha::ILL::Request::Workflow::TypeDisclaimer; >@@ -39,7 +39,7 @@ use URI::Escape qw( uri_escape_utf8 ); > use JSON qw( encode_json ); > > our $cgi = CGI->new; >-my $illRequests = Koha::Illrequests->new; >+my $illRequests = Koha::ILL::Requests->new; > > # Grab all passed data > # 'our' since Plack changes the scoping >@@ -91,7 +91,7 @@ if ( $backends_available ) { > > if ( $op eq 'illview' ) { > # View the details of an ILL >- my $request = Koha::Illrequests->find($params->{illrequest_id}); >+ my $request = Koha::ILL::Requests->find($params->{illrequest_id}); > > # Get the details for notices that can be sent from here > my $notices = Koha::Notice::Templates->search( >@@ -127,7 +127,7 @@ if ( $backends_available ) { > > } elsif ( $op eq 'create' ) { > # Load the ILL backend >- my $request = Koha::Illrequest->new->load_backend( $params->{backend} ); >+ my $request = Koha::ILL::Request->new->load_backend( $params->{backend} ); > > # Before request creation operations - Preparation > my $availability = >@@ -164,7 +164,7 @@ if ( $backends_available ) { > } > } elsif ( $op eq 'migrate' ) { > # We're in the process of migrating a request >- my $request = Koha::Illrequests->find($params->{illrequest_id}); >+ my $request = Koha::ILL::Requests->find($params->{illrequest_id}); > my $backend_result; > if ( $params->{backend} ) { > $backend_result = $request->backend_migrate($params); >@@ -195,7 +195,7 @@ if ( $backends_available ) { > } elsif ( $op eq 'confirm' ) { > # Backend 'confirm' method > # confirm requires a specific request, so first, find it. >- my $request = Koha::Illrequests->find($params->{illrequest_id}); >+ my $request = Koha::ILL::Requests->find($params->{illrequest_id}); > my $backend_result = $request->backend_confirm($params); > $template->param( > whole => $backend_result, >@@ -208,7 +208,7 @@ if ( $backends_available ) { > } elsif ( $op eq 'cancel' ) { > # Backend 'cancel' method > # cancel requires a specific request, so first, find it. >- my $request = Koha::Illrequests->find($params->{illrequest_id}); >+ my $request = Koha::ILL::Requests->find($params->{illrequest_id}); > my $backend_result = $request->backend_cancel($params); > $template->param( > whole => $backend_result, >@@ -223,7 +223,7 @@ if ( $backends_available ) { > # (not the Illrequestattributes) > # We simulate the API for backend requests for uniformity. > # So, init: >- my $request = Koha::Illrequests->find($params->{illrequest_id}); >+ my $request = Koha::ILL::Requests->find($params->{illrequest_id}); > my $batches = Koha::ILL::Batches->search(undef, { > order_by => { -asc => 'name' } > }); >@@ -275,7 +275,7 @@ if ( $backends_available ) { > redirect_to_list(); > > } elsif ( $op eq 'delete_confirm') { >- my $request = Koha::Illrequests->find($params->{illrequest_id}); >+ my $request = Koha::ILL::Requests->find($params->{illrequest_id}); > > $template->param( > request => $request >@@ -287,7 +287,7 @@ if ( $backends_available ) { > # to the confirmation view > if ($params->{confirmed}) { > # We simply delete the request... >- Koha::Illrequests->find( $params->{illrequest_id} )->delete; >+ Koha::ILL::Requests->find( $params->{illrequest_id} )->delete; > # ... then return to list view. > redirect_to_list(); > } else { >@@ -299,7 +299,7 @@ if ( $backends_available ) { > } > > } elsif ( $op eq 'mark_completed' ) { >- my $request = Koha::Illrequests->find($params->{illrequest_id}); >+ my $request = Koha::ILL::Requests->find($params->{illrequest_id}); > my $backend_result = $request->mark_completed($params); > $template->param( > whole => $backend_result, >@@ -313,7 +313,7 @@ if ( $backends_available ) { > my $backend_result; > my $request; > try { >- $request = Koha::Illrequests->find($params->{illrequest_id}); >+ $request = Koha::ILL::Requests->find($params->{illrequest_id}); > $params->{current_branchcode} = C4::Context->mybranch; > $backend_result = $request->generic_confirm($params); > >@@ -370,7 +370,7 @@ if ( $backends_available ) { > # handle special commit rules & update type > handle_commit_maybe($backend_result, $request); > } elsif ( $op eq 'check_out') { >- my $request = Koha::Illrequests->find($params->{illrequest_id}); >+ my $request = Koha::ILL::Requests->find($params->{illrequest_id}); > my $backend_result = $request->check_out($params); > $template->param( > params => $params, >@@ -429,7 +429,7 @@ if ( $backends_available ) { > > } elsif ( $op eq "send_notice" ) { > my $illrequest_id = $params->{illrequest_id}; >- my $request = Koha::Illrequests->find($illrequest_id); >+ my $request = Koha::ILL::Requests->find($illrequest_id); > my $ret = $request->send_patron_notice($params->{notice_code}); > my $append = ''; > if ($ret->{result} && scalar @{$ret->{result}->{success}} > 0) { >@@ -449,7 +449,7 @@ if ( $backends_available ) { > } elsif ( $op eq "batch_create" ) { > # Do not remove, it prevents us falling through to the 'else' > } else { >- my $request = Koha::Illrequests->find($params->{illrequest_id}); >+ my $request = Koha::ILL::Requests->find($params->{illrequest_id}); > my $backend_result = $request->custom_capability($op, $params); > $template->param( > whole => $backend_result, >@@ -525,7 +525,7 @@ sub have_batch_backends { > # FIXME: This should be moved to Koha::Illbackend > sub can_batch { > my ( $backend ) = @_; >- my $request = Koha::Illrequest->new->load_backend( $backend ); >+ my $request = Koha::ILL::Request->new->load_backend( $backend ); > return $request->_backend_capability( 'provides_batch_requests' ); > } > >diff --git a/misc/process_ill_updates.pl b/misc/process_ill_updates.pl >index 3acba3d47f..a773eb8480 100755 >--- a/misc/process_ill_updates.pl >+++ b/misc/process_ill_updates.pl >@@ -22,7 +22,7 @@ use Getopt::Long qw( GetOptions ); > use POSIX; > > use Koha::Script; >-use Koha::Illrequests; >+use Koha::ILL::Requests; > > # Command line option values > my $get_help = 0; >@@ -96,7 +96,7 @@ if (scalar @status_alias_arr > 0) { > debug_msg("DBIC WHERE:"); > debug_msg($where); > >-my $requests = Koha::Illrequests->search($where); >+my $requests = Koha::ILL::Requests->search($where); > > debug_msg("Processing " . $requests->count . " requests"); > >diff --git a/opac/opac-illrequests.pl b/opac/opac-illrequests.pl >index 2826ed6c41..50660037a6 100755 >--- a/opac/opac-illrequests.pl >+++ b/opac/opac-illrequests.pl >@@ -28,7 +28,7 @@ use C4::Output qw( output_html_with_http_headers ); > use POSIX qw( strftime ); > > use Koha::ILL::Request::Config; >-use Koha::Illrequests; >+use Koha::ILL::Requests; > use Koha::Libraries; > use Koha::Patrons; > use Koha::ILL::Request::Workflow::Availability; >@@ -64,7 +64,7 @@ my $op = $params->{'method'} || 'list'; > > my ( $illrequest_id, $request ); > if ( $illrequest_id = $params->{illrequest_id} ) { >- $request = Koha::Illrequests->find($illrequest_id); >+ $request = Koha::ILL::Requests->find($illrequest_id); > # Make sure the request belongs to the logged in user > if( !$request || $request->borrowernumber != $loggedinuser ) { > print $query->redirect("/cgi-bin/koha/errors/404.pl"); >@@ -79,7 +79,7 @@ if ( ( $op eq 'create' || $op eq 'cancreq' || $op eq 'update' ) && !$patron->_re > > if ( $op eq 'list' ) { > >- my $requests = Koha::Illrequests->search( >+ my $requests = Koha::ILL::Requests->search( > { borrowernumber => $loggedinuser } > ); > $template->param( >@@ -110,12 +110,12 @@ if ( $op eq 'list' ) { > exit; > } elsif ( $op eq 'create' ) { > if (!$params->{backend}) { >- my $req = Koha::Illrequest->new; >+ my $req = Koha::ILL::Request->new; > $template->param( > backends => $req->available_backends > ); > } else { >- my $request = Koha::Illrequest->new >+ my $request = Koha::ILL::Request->new > ->load_backend($params->{backend}); > > # Before request creation operations - Preparation >diff --git a/t/db_dependent/Biblio.t b/t/db_dependent/Biblio.t >index 4f096f7fe1..b67ab536cd 100755 >--- a/t/db_dependent/Biblio.t >+++ b/t/db_dependent/Biblio.t >@@ -718,8 +718,8 @@ subtest 'DelBiblio' => sub { > { class => 'Koha::Acquisition::Orders', value => $orderinfo } ); > > # Add some ILL requests >- my $ill_req_1 = $builder->build_object({ class => 'Koha::Illrequests', value => { biblio_id => $biblio->id, deleted_biblio_id => undef } }); >- my $ill_req_2 = $builder->build_object({ class => 'Koha::Illrequests', value => { biblio_id => $biblio->id, deleted_biblio_id => undef } }); >+ my $ill_req_1 = $builder->build_object({ class => 'Koha::ILL::Requests', value => { biblio_id => $biblio->id, deleted_biblio_id => undef } }); >+ my $ill_req_2 = $builder->build_object({ class => 'Koha::ILL::Requests', value => { biblio_id => $biblio->id, deleted_biblio_id => undef } }); > > C4::Biblio::DelBiblio($biblio->biblionumber); # Or $biblio->delete > is( $subscription->get_from_storage, undef, 'subscription should be deleted on biblio deletion' ); >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 288c565013..6563acf1f5 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -2344,7 +2344,7 @@ subtest 'AddIssue & illrequests.due_date' => sub { > > my $custom_date_due = '9999-12-18 12:34:56'; > my $expected_date_due = '9999-12-18 23:59:00'; >- my $illrequest = Koha::Illrequest->new({ >+ my $illrequest = Koha::ILL::Request->new({ > borrowernumber => $patron->borrowernumber, > biblio_id => $item->biblionumber, > branchcode => $library->{'branchcode'}, >@@ -2358,7 +2358,7 @@ subtest 'AddIssue & illrequests.due_date' => sub { > $item = $builder->build_sample_item(); > $custom_date_due = '9999-12-19'; > $expected_date_due = '9999-12-19 23:59:00'; >- $illrequest = Koha::Illrequest->new({ >+ $illrequest = Koha::ILL::Request->new({ > borrowernumber => $patron->borrowernumber, > biblio_id => $item->biblionumber, > branchcode => $library->{'branchcode'}, >diff --git a/t/db_dependent/Illrequest/Availability.t b/t/db_dependent/Illrequest/Availability.t >index 8482c30a9d..d80dca387a 100755 >--- a/t/db_dependent/Illrequest/Availability.t >+++ b/t/db_dependent/Illrequest/Availability.t >@@ -75,8 +75,8 @@ $backend->mock( > ); > $backend->mock( 'status_graph', sub { }, ); > >-# Mock Koha::Illrequest::load_backend (to load Mocked Backend) >-my $illreqmodule = Test::MockModule->new('Koha::Illrequest'); >+# Mock Koha::ILL::Request::load_backend (to load Mocked Backend) >+my $illreqmodule = Test::MockModule->new('Koha::ILL::Request'); > $illreqmodule->mock( 'load_backend', > sub { my $self = shift; $self->{_my_backend} = $backend; return $self } ); > >@@ -90,7 +90,7 @@ $availability_module->mock( 'get_services', [ { name => 'service' } ] ); > > my $req_1 = $builder->build_object( > { >- class => 'Koha::Illrequests', >+ class => 'Koha::ILL::Requests', > value => {} > } > ); >diff --git a/t/db_dependent/Illrequest/SupplierUpdate.t b/t/db_dependent/Illrequest/SupplierUpdate.t >index 281c1df5f4..00dcfe3fc3 100755 >--- a/t/db_dependent/Illrequest/SupplierUpdate.t >+++ b/t/db_dependent/Illrequest/SupplierUpdate.t >@@ -19,7 +19,7 @@ use Modern::Perl; > > use Test::MockObject; > >-use Koha::Illrequest; >+use Koha::ILL::Request; > use Koha::ILL::Request::SupplierUpdate; > > use Test::More tests => 4; >diff --git a/t/db_dependent/Illrequest/SupplierUpdateProcessor.t b/t/db_dependent/Illrequest/SupplierUpdateProcessor.t >index 5577fb417c..d4110f30bd 100755 >--- a/t/db_dependent/Illrequest/SupplierUpdateProcessor.t >+++ b/t/db_dependent/Illrequest/SupplierUpdateProcessor.t >@@ -17,20 +17,20 @@ > > use Modern::Perl; > >-use Koha::Illrequest::SupplierUpdateProcessor; >+use Koha::ILL::Request::SupplierUpdateProcessor; > > use Test::More tests => 3; > use Test::Warn; > >-my $processor = Koha::Illrequest::SupplierUpdateProcessor->new( >+my $processor = Koha::ILL::Request::SupplierUpdateProcessor->new( > 'test_type', > 'test_name', > 'Test processor name' > ); > >-use_ok('Koha::Illrequest::SupplierUpdateProcessor'); >+use_ok('Koha::ILL::Request::SupplierUpdateProcessor'); > >-isa_ok( $processor, 'Koha::Illrequest::SupplierUpdateProcessor' ); >+isa_ok( $processor, 'Koha::ILL::Request::SupplierUpdateProcessor' ); > > warning_like { > $processor->run() >diff --git a/t/db_dependent/Illrequest/TypeDisclaimer.t b/t/db_dependent/Illrequest/TypeDisclaimer.t >index 123a865772..d24734e002 100755 >--- a/t/db_dependent/Illrequest/TypeDisclaimer.t >+++ b/t/db_dependent/Illrequest/TypeDisclaimer.t >@@ -75,8 +75,8 @@ $backend->mock( > ); > $backend->mock( 'status_graph', sub { }, ); > >-# Mock Koha::Illrequest::load_backend (to load Mocked Backend) >-my $illreqmodule = Test::MockModule->new('Koha::Illrequest'); >+# Mock Koha::ILL::Request::load_backend (to load Mocked Backend) >+my $illreqmodule = Test::MockModule->new('Koha::ILL::Request'); > $illreqmodule->mock( 'load_backend', > sub { my $self = shift; $self->{_my_backend} = $backend; return $self } ); > >@@ -96,7 +96,7 @@ article: > > my $req_1 = $builder->build_object( > { >- class => 'Koha::Illrequests', >+ class => 'Koha::ILL::Requests', > value => {} > } > ); >diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t >index 13be09f466..70d0d4f014 100755 >--- a/t/db_dependent/Koha/Biblio.t >+++ b/t/db_dependent/Koha/Biblio.t >@@ -1127,13 +1127,13 @@ subtest 'ill_requests() tests' => sub { > my $biblio = $builder->build_sample_biblio; > > my $rs = $biblio->ill_requests; >- is( ref($rs), 'Koha::Illrequests' ); >+ is( ref($rs), 'Koha::ILL::Requests' ); > is( $rs->count, 0, 'No linked requests' ); > > foreach ( 1..10 ) { > $builder->build_object( > { >- class => 'Koha::Illrequests', >+ class => 'Koha::ILL::Requests', > value => { biblio_id => $biblio->id } > } > ); >diff --git a/t/db_dependent/Koha/ILL/Backend.t b/t/db_dependent/Koha/ILL/Backend.t >index aef6b0c310..e199423ea6 100755 >--- a/t/db_dependent/Koha/ILL/Backend.t >+++ b/t/db_dependent/Koha/ILL/Backend.t >@@ -34,7 +34,7 @@ subtest 'existing_statuses() tests' => sub { > plan tests => 2; > > $schema->storage->txn_begin; >- Koha::Illrequests->search->delete; >+ Koha::ILL::Requests->search->delete; > > # Mock external ILLBackend (as object) > my $backend = Test::MockObject->new; >@@ -58,8 +58,8 @@ subtest 'existing_statuses() tests' => sub { > }, > ); > >- # Mock Koha::Illrequest::load_backend (to load Mocked Backend) >- my $illreqmodule = Test::MockModule->new('Koha::Illrequest'); >+ # Mock Koha::ILL::Request::load_backend (to load Mocked Backend) >+ my $illreqmodule = Test::MockModule->new('Koha::ILL::Request'); > $illreqmodule->mock( > 'load_backend', > sub { my $self = shift; $self->{_my_backend} = $backend; return $self } >@@ -78,7 +78,7 @@ subtest 'existing_statuses() tests' => sub { > > my $backend_req_status = $builder->build_object( > { >- class => 'Koha::Illrequests', >+ class => 'Koha::ILL::Requests', > value => { > status => 'READY', > status_alias => undef, >@@ -90,7 +90,7 @@ subtest 'existing_statuses() tests' => sub { > > my $req = $builder->build_object( > { >- class => 'Koha::Illrequests', >+ class => 'Koha::ILL::Requests', > value => { > status => 'REQ', > status_alias => undef, >@@ -101,7 +101,7 @@ subtest 'existing_statuses() tests' => sub { > ); > my $chk = $builder->build_object( > { >- class => 'Koha::Illrequests', >+ class => 'Koha::ILL::Requests', > value => { > status => 'CHK', > status_alias => undef, >@@ -112,7 +112,7 @@ subtest 'existing_statuses() tests' => sub { > ); > my $bob = $builder->build_object( > { >- class => 'Koha::Illrequests', >+ class => 'Koha::ILL::Requests', > value => { > status => 'REQ', > status_alias => 'BOB', >@@ -123,7 +123,7 @@ subtest 'existing_statuses() tests' => sub { > ); > my $req2 = $builder->build_object( > { >- class => 'Koha::Illrequests', >+ class => 'Koha::ILL::Requests', > value => { > status => 'REQ', > status_alias => undef, >diff --git a/t/db_dependent/Koha/ILL/Batch.t b/t/db_dependent/Koha/ILL/Batch.t >index 7d95e66df6..eaa6df4232 100755 >--- a/t/db_dependent/Koha/ILL/Batch.t >+++ b/t/db_dependent/Koha/ILL/Batch.t >@@ -35,7 +35,7 @@ subtest 'ill_batch() tests' => sub { > $schema->storage->txn_begin; > > my $batch = $builder->build_object( { class => 'Koha::ILL::Batches' } ); >- my $request = $builder->build_object( { class => 'Koha::Illrequests', value => { batch_id => undef } } ); >+ my $request = $builder->build_object( { class => 'Koha::ILL::Requests', value => { batch_id => undef } } ); > > is( $request->ill_batch, undef, 'Not having a linked batch makes the method return undef' ); > >diff --git a/t/db_dependent/Koha/ILL/Batches.t b/t/db_dependent/Koha/ILL/Batches.t >index 8607eb3e9a..e7348e85ea 100755 >--- a/t/db_dependent/Koha/ILL/Batches.t >+++ b/t/db_dependent/Koha/ILL/Batches.t >@@ -20,7 +20,7 @@ use Modern::Perl; > use Koha::Database; > use Koha::ILL::Batch; > use Koha::ILL::Batches; >-use Koha::Illrequests; >+use Koha::ILL::Requests; > use Koha::Patrons; > use t::lib::Mocks; > use t::lib::TestBuilder; >@@ -73,7 +73,7 @@ my $illrq = $builder->build( > } > } > ); >-my $illrq_obj = Koha::Illrequests->find( $illrq->{illrequest_id} ); >+my $illrq_obj = Koha::ILL::Requests->find( $illrq->{illrequest_id} ); > > # Check patron > my $batch_patron = $illbatch->patron; >diff --git a/t/db_dependent/Koha/ILL/Comments.t b/t/db_dependent/Koha/ILL/Comments.t >index c6adff8b67..45cd727567 100755 >--- a/t/db_dependent/Koha/ILL/Comments.t >+++ b/t/db_dependent/Koha/ILL/Comments.t >@@ -19,7 +19,7 @@ use Modern::Perl; > > use File::Basename qw/basename/; > use Koha::Database; >-use Koha::Illrequests; >+use Koha::ILL::Requests; > use Koha::ILL::Request::Attributes; > use Koha::ILL::Request::Config; > use Koha::Patrons; >@@ -37,7 +37,7 @@ use_ok('Koha::ILL::Comments'); > > $schema->storage->txn_begin; > >-Koha::Illrequests->search->delete; >+Koha::ILL::Requests->search->delete; > > # Create a patron > my $patron = $builder->build({ source => 'Borrower' }); >@@ -47,8 +47,8 @@ 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' ); >+my $illrq_obj = Koha::ILL::Requests->find($illrq->{illrequest_id}); >+isa_ok( $illrq_obj, 'Koha::ILL::Request' ); > > # Create a librarian > my $librarian = $builder->build({ source => 'Borrower' }); >diff --git a/t/db_dependent/Koha/Illrequest.t b/t/db_dependent/Koha/ILL/Request.t >similarity index 82% >rename from t/db_dependent/Koha/Illrequest.t >rename to t/db_dependent/Koha/ILL/Request.t >index 2c48fc8253..d63584d1b7 100755 >--- a/t/db_dependent/Koha/Illrequest.t >+++ b/t/db_dependent/Koha/ILL/Request.t >@@ -21,7 +21,7 @@ use Modern::Perl; > > use Test::More tests => 1; > >-use Koha::Illrequests; >+use Koha::ILL::Requests; > > use t::lib::TestBuilder; > >@@ -36,13 +36,13 @@ subtest 'patron() tests' => sub { > > my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); > my $request = >- $builder->build_object( { class => 'Koha::Illrequests', value => { borrowernumber => $patron->id } } ); >+ $builder->build_object( { class => 'Koha::ILL::Requests', value => { borrowernumber => $patron->id } } ); > > my $req_patron = $request->patron; > is( ref($req_patron), 'Koha::Patron' ); > is( $req_patron->id, $patron->id ); > >- $request = $builder->build_object( { class => 'Koha::Illrequests', value => { borrowernumber => undef } } ); >+ $request = $builder->build_object( { class => 'Koha::ILL::Requests', value => { borrowernumber => undef } } ); > > is( $request->patron, undef ); > >diff --git a/t/db_dependent/Illrequests.t b/t/db_dependent/Koha/ILL/Requests.t >similarity index 96% >rename from t/db_dependent/Illrequests.t >rename to t/db_dependent/Koha/ILL/Requests.t >index 48128f9960..464e5ce505 100755 >--- a/t/db_dependent/Illrequests.t >+++ b/t/db_dependent/Koha/ILL/Requests.t >@@ -41,12 +41,12 @@ use Test::Exception; > use Test::Deep qw/ cmp_deeply ignore /; > use Test::Warn; > >-use Test::More tests => 15; >+use Test::More tests => 16; > > my $schema = Koha::Database->new->schema; > my $builder = t::lib::TestBuilder->new; >-use_ok('Koha::Illrequest'); >-use_ok('Koha::Illrequests'); >+use_ok('Koha::ILL::Request'); >+use_ok('Koha::ILL::Requests'); > > subtest 'Basic object tests' => sub { > >@@ -54,11 +54,11 @@ subtest 'Basic object tests' => sub { > > $schema->storage->txn_begin; > >- Koha::Illrequests->search->delete; >+ Koha::ILL::Requests->search->delete; > my $illrq = $builder->build({ source => 'Illrequest' }); >- my $illrq_obj = Koha::Illrequests->find($illrq->{illrequest_id}); >+ my $illrq_obj = Koha::ILL::Requests->find($illrq->{illrequest_id}); > >- isa_ok($illrq_obj, 'Koha::Illrequest', >+ isa_ok($illrq_obj, 'Koha::ILL::Request', > "Correctly create and load an illrequest object."); > isa_ok($illrq_obj->_config, 'Koha::ILL::Request::Config', > "Created a config object as part of Illrequest creation."); >@@ -119,7 +119,7 @@ subtest 'Basic object tests' => sub { > > $illrq_obj->delete; > >- is(Koha::Illrequests->search->count, 0, >+ is(Koha::ILL::Requests->search->count, 0, > "No illrequest found after delete."); > > $schema->storage->txn_rollback; >@@ -130,14 +130,14 @@ subtest 'store borrowernumber change also updates holds' => sub { > > $schema->storage->txn_begin; > >- Koha::Illrequests->search->delete; >+ Koha::ILL::Requests->search->delete; > > my $patron = $builder->build_object({ class => 'Koha::Patrons' }); > my $other_patron = $builder->build_object({ class => 'Koha::Patrons' }); > my $biblio = $builder->build_object({ class => 'Koha::Biblios' }); > > my $request = $builder->build_object({ >- class => 'Koha::Illrequests', >+ class => 'Koha::ILL::Requests', > value => { > borrowernumber => $patron->borrowernumber, > biblio_id => $biblio->biblionumber, >@@ -170,13 +170,13 @@ subtest 'store borrowernumber change also updates holds' => sub { > is( $request->borrowernumber, $other_patron->borrowernumber, > 'after change, changed borrowernumber found in illrequests' ); > >- my $new_request = Koha::Illrequest->new({ >+ my $new_request = Koha::ILL::Request->new({ > biblio_id => $biblio->biblionumber, > branchcode => $patron->branchcode, > })->borrowernumber( $patron->borrowernumber )->store; > > is( $new_request->borrowernumber, $patron->borrowernumber, >- 'Koha::Illrequest->new()->store() works as expected'); >+ 'Koha::ILL::Request->new()->store() works as expected'); > > my $new_holds_found = Koha::Holds->search({ > biblionumber => $new_request->biblio_id, >@@ -197,7 +197,7 @@ subtest 'Working with related objects' => sub { > > my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); > my $illrq = $builder->build_object( >- { class => 'Koha::Illrequests', >+ { class => 'Koha::ILL::Requests', > value => { borrowernumber => $patron->id, biblio_id => undef } > } > ); >@@ -228,7 +228,7 @@ subtest 'Working with related objects' => sub { > is( $illrq->biblio, undef, "->biblio returns undef if no biblio" ); > my $biblio = $builder->build_object( { class => 'Koha::Biblios' } ); > my $req_bib = $builder->build_object( >- { class => 'Koha::Illrequests', >+ { class => 'Koha::ILL::Requests', > value => { biblio_id => $biblio->biblionumber } > } > ); >@@ -249,7 +249,7 @@ subtest 'Status Graph tests' => sub { > $schema->storage->txn_begin; > > my $illrq = $builder->build({source => 'Illrequest'}); >- my $illrq_obj = Koha::Illrequests->find($illrq->{illrequest_id}); >+ my $illrq_obj = Koha::ILL::Requests->find($ illrq->{illrequest_id}) ; > > # _core_status_graph tests: it's just a constant, so here we just make > # sure it returns a hashref. >@@ -314,7 +314,7 @@ subtest 'Status Graph tests' => sub { > my $new_graph = $illrq_obj->_status_graph_union( $new_node, $illrq_obj->_core_status_graph); > # Compare the updated graph to the expected graph > # The structure we compare against here is just a copy of the structure found >- # in Koha::Illrequest::_core_status_graph() + the new node we created above >+ # in Koha::ILL::Request::_core_status_graph() + the new node we created above > cmp_deeply( $new_graph, > { > TEST => { >@@ -438,7 +438,7 @@ subtest 'Status Graph tests' => sub { > my $dupe_graph = $illrq_obj->_status_graph_union( $illrq_obj->_core_status_graph, $dupe_node); > # Compare the updated graph to the expected graph > # The structure we compare against here is just a copy of the structure found >- # in Koha::Illrequest::_core_status_graph() + the new node we created above >+ # in Koha::ILL::Request::_core_status_graph() + the new node we created above > cmp_deeply( $dupe_graph, > { > NEW => { >@@ -561,7 +561,7 @@ subtest 'Backend testing (mocks)' => sub { > > my $patron = $builder->build({ source => 'Borrower' }); > my $illrq = $builder->build_object({ >- class => 'Koha::Illrequests', >+ class => 'Koha::ILL::Requests', > }); > > $illrq->_backend($backend); >@@ -706,7 +706,7 @@ subtest 'Backend core methods' => sub { > { default => { count => 0, method => 'active' } }); > > my $illrq = $builder->build_object({ >- class => 'Koha::Illrequests', >+ class => 'Koha::ILL::Requests', > value => { backend => undef } > }); > $illrq->_config($config); >@@ -944,7 +944,7 @@ subtest 'Helpers' => sub { > source => 'Illrequest', > value => { branchcode => "HDE", borrowernumber => $patron->{borrowernumber} } > }); >- my $illrq_obj = Koha::Illrequests->find($illrq->{illrequest_id}); >+ my $illrq_obj = Koha::ILL::Requests->find($illrq->{illrequest_id}); > $illrq_obj->_config($config); > $illrq_obj->_backend($backend); > >@@ -1168,7 +1168,7 @@ subtest 'Censorship' => sub { > $config->set_always('backend_dir', "/tmp"); > > my $illrq = $builder->build({source => 'Illrequest'}); >- my $illrq_obj = Koha::Illrequests->find($illrq->{illrequest_id}); >+ my $illrq_obj = Koha::ILL::Requests->find($illrq->{illrequest_id}); > $illrq_obj->_config($config); > $illrq_obj->_backend($backend); > >@@ -1203,7 +1203,7 @@ subtest 'Checking out' => sub { > my $biblio = $builder->build_sample_biblio(); > my $patron = $builder->build_object({ class => 'Koha::Patrons' }); > my $request = $builder->build_object({ >- class => 'Koha::Illrequests', >+ class => 'Koha::ILL::Requests', > value => { > borrowernumber => $patron->borrowernumber, > biblio_id => $biblio->biblionumber >@@ -1330,7 +1330,7 @@ subtest 'Checking out with custom due date' => sub { > } > }); > my $request = $builder->build_object({ >- class => 'Koha::Illrequests', >+ class => 'Koha::ILL::Requests', > value => { > borrowernumber => $patron->borrowernumber, > biblio_id => $biblio->biblionumber >@@ -1365,7 +1365,7 @@ subtest 'Checking Limits' => sub { > $config->set_always('backend_dir', "/tmp"); > > my $illrq = $builder->build({source => 'Illrequest'}); >- my $illrq_obj = Koha::Illrequests->find($illrq->{illrequest_id}); >+ my $illrq_obj = Koha::ILL::Requests->find($illrq->{illrequest_id}); > $illrq_obj->_config($config); > $illrq_obj->_backend($backend); > >@@ -1554,7 +1554,7 @@ subtest 'Custom statuses' => sub { > > my $ill_req = $builder->build_object( > { >- class => 'Koha::Illrequests', >+ class => 'Koha::ILL::Requests', > value => { > status_alias => $av->authorised_value > } >@@ -1565,7 +1565,7 @@ subtest 'Custom statuses' => sub { > > $ill_req->status("COMP"); > is($ill_req->statusalias, undef, >- "Koha::Illrequest->status overloading resetting status_alias"); >+ "Koha::ILL::Request->status overloading resetting status_alias"); > > $schema->storage->txn_rollback; > }; >@@ -1596,7 +1596,7 @@ subtest 'Checking in hook' => sub { > > my $illrq = $builder->build_object( > { >- class => 'Koha::Illrequests', >+ class => 'Koha::ILL::Requests', > value => { > biblio_id => $item->biblio->biblionumber, > status => 'NEW' >@@ -1628,3 +1628,34 @@ subtest 'Checking in hook' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'filter_by_visible() tests' => sub { >+ >+ plan tests => 4; >+ >+ $schema->storage->txn_begin; >+ >+ my $req = >+ $builder->build_object( { class => 'Koha::ILL::Requests', value => { status => 'REQ', biblio_id => undef } } ); >+ my $chk = >+ $builder->build_object( { class => 'Koha::ILL::Requests', value => { status => 'CHK', biblio_id => undef } } ); >+ my $ret = >+ $builder->build_object( { class => 'Koha::ILL::Requests', value => { status => 'RET', biblio_id => undef } } ); >+ >+ my $reqs_rs = Koha::ILL::Requests->search( { illrequest_id => [ $req->id, $chk->id, $ret->id ] } ); >+ >+ is( $reqs_rs->count, 3, 'Count is correct' ); >+ >+ t::lib::Mocks::mock_preference( 'ILLHiddenRequestStatuses', '' ); >+ >+ is( $reqs_rs->filter_by_visible->count, 3, 'No hidden statuses, same count' ); >+ >+ t::lib::Mocks::mock_preference( 'ILLHiddenRequestStatuses', 'CHK|RET' ); >+ >+ my $filtered_reqs = $reqs_rs->filter_by_visible; >+ >+ is( $filtered_reqs->count, 1, 'Count is correct' ); >+ is( $filtered_reqs->next->status, 'REQ' ); >+ >+ $schema->storage->txn_rollback; >+}; >diff --git a/t/db_dependent/Koha/Illrequests.t b/t/db_dependent/Koha/Illrequests.t >deleted file mode 100755 >index b75c248c58..0000000000 >--- a/t/db_dependent/Koha/Illrequests.t >+++ /dev/null >@@ -1,62 +0,0 @@ >-#!/usr/bin/perl >- >-# Copyright 2023 Koha Development team >-# >-# This file is part of Koha >-# >-# Koha is free software; you can redistribute it and/or modify it >-# under the terms of the GNU General Public License as published by >-# the Free Software Foundation; either version 3 of the License, or >-# (at your option) any later version. >-# >-# Koha is distributed in the hope that it will be useful, but >-# WITHOUT ANY WARRANTY; without even the implied warranty of >-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >-# GNU General Public License for more details. >-# >-# You should have received a copy of the GNU General Public License >-# along with Koha; if not, see <http://www.gnu.org/licenses>. >- >-use Modern::Perl; >- >-use Test::More tests => 1; >- >-use Koha::Illrequests; >- >-use t::lib::TestBuilder; >-use t::lib::Mocks; >- >-my $builder = t::lib::TestBuilder->new; >-my $schema = Koha::Database->new->schema; >- >-subtest 'filter_by_visible() tests' => sub { >- >- plan tests => 4; >- >- $schema->storage->txn_begin; >- >- my $req = $builder->build_object({ class => 'Koha::Illrequests', value => { status => 'REQ', biblio_id => undef } }); >- my $chk = $builder->build_object({ class => 'Koha::Illrequests', value => { status => 'CHK', biblio_id => undef } }); >- my $ret = $builder->build_object({ class => 'Koha::Illrequests', value => { status => 'RET', biblio_id => undef } }); >- >- my $reqs_rs = Koha::Illrequests->search( >- { >- illrequest_id => [ $req->id, $chk->id, $ret->id ] >- } >- ); >- >- is( $reqs_rs->count, 3, 'Count is correct' ); >- >- t::lib::Mocks::mock_preference('ILLHiddenRequestStatuses', ''); >- >- is( $reqs_rs->filter_by_visible->count, 3, 'No hidden statuses, same count' ); >- >- t::lib::Mocks::mock_preference('ILLHiddenRequestStatuses', 'CHK|RET'); >- >- my $filtered_reqs = $reqs_rs->filter_by_visible; >- >- is( $filtered_reqs->count, 1, 'Count is correct' ); >- is( $filtered_reqs->next->status, 'REQ' ); >- >- $schema->storage->txn_rollback; >-}; >diff --git a/t/db_dependent/api/v1/ill_backends.t b/t/db_dependent/api/v1/ill_backends.t >index ded2424fc1..58ac8e9d77 100755 >--- a/t/db_dependent/api/v1/ill_backends.t >+++ b/t/db_dependent/api/v1/ill_backends.t >@@ -27,7 +27,7 @@ use t::lib::TestBuilder; > use t::lib::Mocks; > > use Koha::AuthorisedValueCategories; >-use Koha::Illrequests; >+use Koha::ILL::Requests; > > my $schema = Koha::Database->new->schema; > my $builder = t::lib::TestBuilder->new; >@@ -80,15 +80,15 @@ subtest 'list() tests' => sub { > } > ); > >- # Mock Koha::Illrequest::load_backend (to load Mocked Backend) >- my $illreqmodule = Test::MockModule->new('Koha::Illrequest'); >+ # Mock Koha::ILL::Request::load_backend (to load Mocked Backend) >+ my $illreqmodule = Test::MockModule->new('Koha::ILL::Request'); > $illreqmodule->mock( 'load_backend', > sub { my $self = shift; $self->{_my_backend} = $backend; return $self } > ); > > $schema->storage->txn_begin; > >- Koha::Illrequests->search->delete; >+ Koha::ILL::Requests->search->delete; > > # create an authorized user > my $librarian = $builder->build_object( >@@ -169,21 +169,21 @@ subtest 'list() tests' => sub { > # Create some ILL requests > my $backend_status_req = $builder->build_object( > { >- class => 'Koha::Illrequests', >+ class => 'Koha::ILL::Requests', > value => > { status => $backend_status->{code}, backend => $backend->name } > } > ); > my $core_status_req = $builder->build_object( > { >- class => 'Koha::Illrequests', >+ class => 'Koha::ILL::Requests', > value => > { status => $core_status->{code}, backend => $backend->name } > } > ); > my $alias_status_req = $builder->build_object( > { >- class => 'Koha::Illrequests', >+ class => 'Koha::ILL::Requests', > value => { > status => $core_status->{code}, > backend => $backend->name, >diff --git a/t/db_dependent/api/v1/ill_batches.t b/t/db_dependent/api/v1/ill_batches.t >index 3dda9cc467..ed744a80ac 100755 >--- a/t/db_dependent/api/v1/ill_batches.t >+++ b/t/db_dependent/api/v1/ill_batches.t >@@ -27,7 +27,7 @@ use JSON qw(encode_json); > > use Koha::ILL::Batch; > use Koha::ILL::Batches; >-use Koha::Illrequests; >+use Koha::ILL::Requests; > use Koha::ILL::Batch::Statuses; > use Koha::Database; > >@@ -81,7 +81,7 @@ subtest 'list() tests' => sub { > > my $illrq = $builder->build_object( > { >- class => 'Koha::Illrequests', >+ class => 'Koha::ILL::Requests', > value => { > batch_id => $batch_1->id, > borrowernumber => $librarian->id, >diff --git a/t/db_dependent/api/v1/ill_requests.t b/t/db_dependent/api/v1/ill_requests.t >index 9745c5cf91..a2260a23d3 100755 >--- a/t/db_dependent/api/v1/ill_requests.t >+++ b/t/db_dependent/api/v1/ill_requests.t >@@ -29,7 +29,7 @@ use t::lib::TestBuilder; > use t::lib::Mocks; > > use Koha::AuthorisedValueCategories; >-use Koha::Illrequests; >+use Koha::ILL::Requests; > use Koha::DateUtils qw( format_sqldatetime ); > > my $schema = Koha::Database->new->schema; >@@ -62,15 +62,15 @@ subtest 'list() tests' => sub { > 'status_graph', sub {}, > ); > >- # Mock Koha::Illrequest::load_backend (to load Mocked Backend) >- my $illreqmodule = Test::MockModule->new('Koha::Illrequest'); >+ # Mock Koha::ILL::Request::load_backend (to load Mocked Backend) >+ my $illreqmodule = Test::MockModule->new('Koha::ILL::Request'); > $illreqmodule->mock( 'load_backend', > sub { my $self = shift; $self->{_my_backend} = $backend; return $self } > ); > > $schema->storage->txn_begin; > >- Koha::Illrequests->search->delete; >+ Koha::ILL::Requests->search->delete; > > # create an authorized user > my $librarian = $builder->build_object( >@@ -141,7 +141,7 @@ subtest 'list() tests' => sub { > # Create some ILL requests > my $req_1 = $builder->build_object( > { >- class => 'Koha::Illrequests', >+ class => 'Koha::ILL::Requests', > value => { > borrowernumber => $patron->borrowernumber, > batch_id => undef, >@@ -153,7 +153,7 @@ subtest 'list() tests' => sub { > ); > my $req_2 = $builder->build_object( > { >- class => 'Koha::Illrequests', >+ class => 'Koha::ILL::Requests', > value => { > batch_id => undef, > status => $request_status->{code}, >@@ -164,7 +164,7 @@ subtest 'list() tests' => sub { > > } > ); >- my $ret = $builder->build_object({ class => 'Koha::Illrequests', value => { status => 'RET' } }); >+ my $ret = $builder->build_object({ class => 'Koha::ILL::Requests', value => { status => 'RET' } }); > > # Three requests exist, expect all three to be returned > $t->get_ok("//$userid:$password@/api/v1/ill/requests") >@@ -282,7 +282,7 @@ subtest 'add() tests' => sub { > # Create an ILL request > my $illrequest = $builder->build_object( > { >- class => 'Koha::Illrequests', >+ class => 'Koha::ILL::Requests', > value => { > backend => 'Mock', > branchcode => $library->branchcode, >@@ -311,8 +311,8 @@ subtest 'add() tests' => sub { > 'status_graph', sub {}, > ); > >- # Mock Koha::Illrequest::load_backend (to load Mocked Backend) >- my $illreqmodule = Test::MockModule->new('Koha::Illrequest'); >+ # Mock Koha::ILL::Request::load_backend (to load Mocked Backend) >+ my $illreqmodule = Test::MockModule->new('Koha::ILL::Request'); > $illreqmodule->mock( > 'load_backend', > sub { my $self = shift; $self->{_my_backend} = $backend; return $self } >@@ -340,7 +340,7 @@ subtest 'add() tests' => sub { > > my $api_req = $builder->build_object( > { >- class => 'Koha::Illrequests', >+ class => 'Koha::ILL::Requests', > value => { > borrowernumber => $patron->borrowernumber, > batch_id => undef, >@@ -360,7 +360,7 @@ subtest 'add() tests' => sub { > > $schema->storage->txn_begin; > >- Koha::Illrequests->search->delete; >+ Koha::ILL::Requests->search->delete; > > my $body = { > ill_backend_id => 'Mock', >-- >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