Bugzilla – Attachment 98391 Details for
Bug 23391
Hide finished ILL requests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23391 - Hide finished ILL requests
Bug-23391---Hide-finished-ILL-requests.patch (text/plain), 8.00 KB, created by
Andrew Isherwood
on 2020-02-04 14:12:10 UTC
(
hide
)
Description:
Bug 23391 - Hide finished ILL requests
Filename:
MIME Type:
Creator:
Andrew Isherwood
Created:
2020-02-04 14:12:10 UTC
Size:
8.00 KB
patch
obsolete
>From 316716318bc50891e93f3f5182b0a6f35ddbeaf7 Mon Sep 17 00:00:00 2001 >From: Magnus Enger <magnus@libriotech.no> >Date: Thu, 12 Dec 2019 15:07:03 +0100 >Subject: [PATCH] Bug 23391 - Hide finished ILL requests > >Currently, the main table of ILL requests will display all ILL >requests in the database, regardless of their status. For libraries >with active ILL this quickly leads to a lot of requests being displayed, >and the main page of the ILL module taking a long time to load. This >patch proposes to fix this by introducing the ILLHiddenRequestStatuses >syspref, which can take a pipe-separated list of ILL statuses that >will be hidden from view in the ILL module. This means that the >only way to find a hidden request will be through a report. > >To test: >- Apply the patch and make sure the atomic database update is run >- Make sure you have a few ILL requests, with at least two different > statuses >- Check that all requests are still displayed in the main table of > ILL requests >- Add one of the statuses* you have in your database to the > ILLHiddenRequestStatuses syspref, reload the ILL module frontpage > and verify that requests with the given status are not displayed >- Change the syspref to another status and verify requests with > that status are now hidden >- Change the syspref to hold both statuses, separated by the pipe > symbol (e.g.: A|B). Verify that no requests with the given > statuses are now displayed >- Run the ILL REST API tests, e.g.: > $ sudo koha-shell -c "prove t/db_dependent/api/v1/illrequests.t" kohadev > >* = The ILLHiddenRequestStatuses syspref should hold status codes, like >"REQ" and "NEW", not their human readable counterparts. > >Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >--- > Koha/REST/V1/Illrequests.pm | 9 +++++++++ > .../bug23391-hide-finished-ill-requests.perl | 10 ++++++++++ > installer/data/mysql/sysprefs.sql | 1 + > .../en/modules/admin/preferences/circulation.pref | 5 +++++ > t/db_dependent/api/v1/illrequests.t | 23 +++++++++++++++++++--- > 5 files changed, 45 insertions(+), 3 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug23391-hide-finished-ill-requests.perl > >diff --git a/Koha/REST/V1/Illrequests.pm b/Koha/REST/V1/Illrequests.pm >index 907dc5ce80..853495106a 100644 >--- a/Koha/REST/V1/Illrequests.pm >+++ b/Koha/REST/V1/Illrequests.pm >@@ -19,6 +19,7 @@ use Modern::Perl; > > use Mojo::Base 'Mojolicious::Controller'; > >+use C4::Context; > use Koha::Illrequests; > use Koha::Illrequestattributes; > use Koha::Libraries; >@@ -54,9 +55,17 @@ sub list { > delete $args->{embed}; > } > >+ # Get the pipe-separated string of hidden ILL statuses >+ my $hidden_statuses_string = C4::Context->preference('ILLHiddenRequestStatuses'); >+ # Turn into arrayref >+ my $hidden_statuses = [ split /\|/, $hidden_statuses_string ]; >+ > # Get all requests > # If necessary, only get those from a specified patron > my @requests = Koha::Illrequests->search({ >+ $hidden_statuses >+ ? ( status => { 'not in' => $hidden_statuses } ) >+ : (), > $args->{borrowernumber} > ? ( borrowernumber => $args->{borrowernumber} ) > : () >diff --git a/installer/data/mysql/atomicupdate/bug23391-hide-finished-ill-requests.perl b/installer/data/mysql/atomicupdate/bug23391-hide-finished-ill-requests.perl >new file mode 100644 >index 0000000000..2a7927d2d6 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug23391-hide-finished-ill-requests.perl >@@ -0,0 +1,10 @@ >+$DBversion = 'XXX'; >+if( CheckVersion( $DBversion ) ) { >+ $dbh->do( q{ >+ INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) >+ VALUES ('ILLHiddenRequestStatuses',NULL,NULL,'ILL statuses that are considered finished and should not be displayed in the ILL module','multiple') >+ }); >+ >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 23391 - Hide finished ILL requests)\n"; >+} >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index cfa295e197..6c959f7401 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -229,6 +229,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('IDreamBooksResults','0','','Display IDreamBooks.com rating in search results','YesNo'), > ('IDreamBooksReviews','0','','Display book review snippets from IDreamBooks.com','YesNo'), > ('IdRef','0','','Disable/enable the IdRef webservice from the OPAC detail page.','YesNo'), >+('ILLHiddenRequestStatuses', NULL, NULL, 'ILL statuses that are considered finished and should not be displayed in the ILL module', 'multiple'), > ('IllLog', 0, '', 'If ON, log information about ILL requests', 'YesNo'), > ('ILLModule','0','If ON, enables the interlibrary loans module.','','YesNo'), > ('ILLModuleCopyrightClearance','','70|10','Enter text to enable the copyright clearance stage of request creation. Text will be displayed','Textarea'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index 6eb5af0660..025f74bf69 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -834,6 +834,11 @@ Circulation: > yes: Enable > no: Disable > - unmediated Interlibrary loan requests. If enabled and the ILL backend supports it, the newly created requests are immediately requested by backend. >+ - >+ - "ILL statuses that are considered finished and should not be displayed in the ILL module: " >+ - pref: ILLHiddenRequestStatuses >+ class: multi >+ - (separated with |). If left empty, all ILL requests will be displayed. > Fines Policy: > - > - pref: finesCalendar >diff --git a/t/db_dependent/api/v1/illrequests.t b/t/db_dependent/api/v1/illrequests.t >index fefb96dea9..cdf3a0f2d2 100644 >--- a/t/db_dependent/api/v1/illrequests.t >+++ b/t/db_dependent/api/v1/illrequests.t >@@ -40,7 +40,7 @@ my $t = Test::Mojo->new('Koha::REST::V1'); > > subtest 'list() tests' => sub { > >- plan tests => 24; >+ plan tests => 30; > > # Mock ILLBackend (as object) > my $backend = Test::MockObject->new; >@@ -91,7 +91,8 @@ subtest 'list() tests' => sub { > value => { > backend => 'Mock', > branchcode => $library->branchcode, >- borrowernumber => $patron_1->borrowernumber >+ borrowernumber => $patron_1->borrowernumber, >+ status => 'STATUS1', > } > } > ); >@@ -129,7 +130,8 @@ subtest 'list() tests' => sub { > value => { > backend => 'Mock', > branchcode => $library->branchcode, >- borrowernumber => $patron_2->borrowernumber >+ borrowernumber => $patron_2->borrowernumber, >+ status => 'STATUS2', > } > } > ); >@@ -162,6 +164,21 @@ subtest 'list() tests' => sub { > $tx->req->env( { REMOTE_ADDR => $remote_address } ); > $t->request_ok($tx)->status_is(200)->json_is( [ $response2 ] ); > >+ # Test the ILLHiddenRequestStatuses syspref >+ t::lib::Mocks::mock_preference( 'ILLHiddenRequestStatuses', 'STATUS1' ); >+ $tx = $t->ua->build_tx( GET => '/api/v1/illrequests' ); >+ $tx->req->cookies( { name => 'CGISESSID', value => $session_id } ); >+ $tx->req->env( { REMOTE_ADDR => $remote_address } ); >+ $t->request_ok($tx)->status_is(200) >+ ->json_is( [ $req2_formatted ] ); >+ >+ t::lib::Mocks::mock_preference( 'ILLHiddenRequestStatuses', 'STATUS2' ); >+ $tx = $t->ua->build_tx( GET => '/api/v1/illrequests' ); >+ $tx->req->cookies( { name => 'CGISESSID', value => $session_id } ); >+ $tx->req->env( { REMOTE_ADDR => $remote_address } ); >+ $t->request_ok($tx)->status_is(200) >+ ->json_is( [ $req_formatted ] ); >+ > $schema->storage->txn_rollback; > }; > >-- >2.11.0
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 23391
:
96222
|
98390
|
98391
|
106411
|
106599
|
107121