use Mojo::Base 'Mojolicious::Controller';
+use C4::Context;
use Koha::Illrequests;
use Koha::Illrequestattributes;
use Koha::Libraries;
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} )
: ()
--- /dev/null
+$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";
+}
('HTML5MediaYouTube',0,'Embed|Don\'t embed','YouTube links as videos','YesNo'),
('IdRef','0','','Disable/enable the IdRef webservice from the OPAC detail page.','YesNo'),
('IllCheckAvailability', 0, '', 'If ON, during the ILL request process third party sources will be checked for current availability', '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'),
yes: Check
no: Don't check
- external sources for availability during the request process
- Fines policy:
+ -
+ - "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
type: choice
subtest 'list() tests' => sub {
- plan tests => 24;
+ plan tests => 30;
# Mock ILLBackend (as object)
my $backend = Test::MockObject->new;
value => {
backend => 'Mock',
branchcode => $library->branchcode,
- borrowernumber => $patron_1->borrowernumber
+ borrowernumber => $patron_1->borrowernumber,
+ status => 'STATUS1',
}
}
);
value => {
backend => 'Mock',
branchcode => $library->branchcode,
- borrowernumber => $patron_2->borrowernumber
+ borrowernumber => $patron_2->borrowernumber,
+ status => 'STATUS2',
}
}
);
$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;
};