View | Details | Raw Unified | Return to bug 23391
Collapse All | Expand All

(-)a/Koha/REST/V1/Illrequests.pm (+9 lines)
Lines 19-24 use Modern::Perl; Link Here
19
19
20
use Mojo::Base 'Mojolicious::Controller';
20
use Mojo::Base 'Mojolicious::Controller';
21
21
22
use C4::Context;
22
use Koha::Illrequests;
23
use Koha::Illrequests;
23
use Koha::Illrequestattributes;
24
use Koha::Illrequestattributes;
24
use Koha::Libraries;
25
use Koha::Libraries;
Lines 54-62 sub list { Link Here
54
        delete $args->{embed};
55
        delete $args->{embed};
55
    }
56
    }
56
57
58
    # Get the pipe-separated string of hidden ILL statuses
59
    my $hidden_statuses_string = C4::Context->preference('ILLHiddenRequestStatuses');
60
    # Turn into arrayref
61
    my $hidden_statuses = [ split /\|/, $hidden_statuses_string ];
62
57
    # Get all requests
63
    # Get all requests
58
    # If necessary, only get those from a specified patron
64
    # If necessary, only get those from a specified patron
59
    my @requests = Koha::Illrequests->search({
65
    my @requests = Koha::Illrequests->search({
66
        $hidden_statuses
67
        ? ( status => { 'not in' => $hidden_statuses } )
68
        : (),
60
        $args->{borrowernumber}
69
        $args->{borrowernumber}
61
        ? ( borrowernumber => $args->{borrowernumber} )
70
        ? ( borrowernumber => $args->{borrowernumber} )
62
        : ()
71
        : ()
(-)a/installer/data/mysql/atomicupdate/bug23391-hide-finished-ill-requests.perl (+10 lines)
Line 0 Link Here
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do( q{
4
            INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type)
5
            VALUES ('ILLHiddenRequestStatuses',NULL,NULL,'ILL statuses that are considered finished and should not be displayed in the ILL module','multiple')
6
    });
7
8
    SetVersion( $DBversion );
9
    print "Upgrade to $DBversion done (Bug 23391 - Hide finished ILL requests)\n";
10
}
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 234-239 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
234
('HTML5MediaYouTube',0,'Embed|Don\'t embed','YouTube links as videos','YesNo'),
234
('HTML5MediaYouTube',0,'Embed|Don\'t embed','YouTube links as videos','YesNo'),
235
('IdRef','0','','Disable/enable the IdRef webservice from the OPAC detail page.','YesNo'),
235
('IdRef','0','','Disable/enable the IdRef webservice from the OPAC detail page.','YesNo'),
236
('IllCheckAvailability', 0, '', 'If ON, during the ILL request process third party sources will be checked for current availability', 'YesNo'),
236
('IllCheckAvailability', 0, '', 'If ON, during the ILL request process third party sources will be checked for current availability', 'YesNo'),
237
('ILLHiddenRequestStatuses', NULL, NULL, 'ILL statuses that are considered finished and should not be displayed in the ILL module', 'multiple'),
237
('IllLog', 0, '', 'If ON, log information about ILL requests', 'YesNo'),
238
('IllLog', 0, '', 'If ON, log information about ILL requests', 'YesNo'),
238
('ILLModule','0','If ON, enables the interlibrary loans module.','','YesNo'),
239
('ILLModule','0','If ON, enables the interlibrary loans module.','','YesNo'),
239
('ILLModuleCopyrightClearance','','70|10','Enter text to enable the copyright clearance stage of request creation. Text will be displayed','Textarea'),
240
('ILLModuleCopyrightClearance','','70|10','Enter text to enable the copyright clearance stage of request creation. Text will be displayed','Textarea'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-1 / +6 lines)
Lines 894-900 Circulation: Link Here
894
                  yes: Check
894
                  yes: Check
895
                  no: Don't check
895
                  no: Don't check
896
            - external sources for availability during the request process
896
            - external sources for availability during the request process
897
    Fines policy:
897
        -
898
            - "ILL statuses that are considered finished and should not be displayed in the ILL module: "
899
            - pref: ILLHiddenRequestStatuses
900
              class: multi
901
            - (separated with |). If left empty, all ILL requests will be displayed.
902
    Fines Policy:
898
        -
903
        -
899
            - pref: finesCalendar
904
            - pref: finesCalendar
900
              type: choice
905
              type: choice
(-)a/t/db_dependent/api/v1/illrequests.t (-4 / +20 lines)
Lines 40-46 my $t = Test::Mojo->new('Koha::REST::V1'); Link Here
40
40
41
subtest 'list() tests' => sub {
41
subtest 'list() tests' => sub {
42
42
43
    plan tests => 24;
43
    plan tests => 30;
44
44
45
    # Mock ILLBackend (as object)
45
    # Mock ILLBackend (as object)
46
    my $backend = Test::MockObject->new;
46
    my $backend = Test::MockObject->new;
Lines 91-97 subtest 'list() tests' => sub { Link Here
91
            value => {
91
            value => {
92
                backend        => 'Mock',
92
                backend        => 'Mock',
93
                branchcode     => $library->branchcode,
93
                branchcode     => $library->branchcode,
94
                borrowernumber => $patron_1->borrowernumber
94
                borrowernumber => $patron_1->borrowernumber,
95
                status         => 'STATUS1',
95
            }
96
            }
96
        }
97
        }
97
    );
98
    );
Lines 129-135 subtest 'list() tests' => sub { Link Here
129
            value => {
130
            value => {
130
                backend        => 'Mock',
131
                backend        => 'Mock',
131
                branchcode     => $library->branchcode,
132
                branchcode     => $library->branchcode,
132
                borrowernumber => $patron_2->borrowernumber
133
                borrowernumber => $patron_2->borrowernumber,
134
                status         => 'STATUS2',
133
            }
135
            }
134
        }
136
        }
135
    );
137
    );
Lines 162-167 subtest 'list() tests' => sub { Link Here
162
    $tx->req->env( { REMOTE_ADDR => $remote_address } );
164
    $tx->req->env( { REMOTE_ADDR => $remote_address } );
163
    $t->request_ok($tx)->status_is(200)->json_is( [ $response2 ] );
165
    $t->request_ok($tx)->status_is(200)->json_is( [ $response2 ] );
164
166
167
    # Test the ILLHiddenRequestStatuses syspref
168
    t::lib::Mocks::mock_preference( 'ILLHiddenRequestStatuses', 'STATUS1' );
169
    $tx = $t->ua->build_tx( GET => '/api/v1/illrequests' );
170
    $tx->req->cookies( { name => 'CGISESSID', value => $session_id } );
171
    $tx->req->env( { REMOTE_ADDR => $remote_address } );
172
    $t->request_ok($tx)->status_is(200)
173
      ->json_is( [ $req2_formatted ] );
174
175
    t::lib::Mocks::mock_preference( 'ILLHiddenRequestStatuses', 'STATUS2' );
176
    $tx = $t->ua->build_tx( GET => '/api/v1/illrequests' );
177
    $tx->req->cookies( { name => 'CGISESSID', value => $session_id } );
178
    $tx->req->env( { REMOTE_ADDR => $remote_address } );
179
    $t->request_ok($tx)->status_is(200)
180
      ->json_is( [ $req_formatted ] );
181
165
    $schema->storage->txn_rollback;
182
    $schema->storage->txn_rollback;
166
};
183
};
167
184
168
- 

Return to bug 23391