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 229-234 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
229
('IDreamBooksResults','0','','Display IDreamBooks.com rating in search results','YesNo'),
229
('IDreamBooksResults','0','','Display IDreamBooks.com rating in search results','YesNo'),
230
('IDreamBooksReviews','0','','Display book review snippets from IDreamBooks.com','YesNo'),
230
('IDreamBooksReviews','0','','Display book review snippets from IDreamBooks.com','YesNo'),
231
('IdRef','0','','Disable/enable the IdRef webservice from the OPAC detail page.','YesNo'),
231
('IdRef','0','','Disable/enable the IdRef webservice from the OPAC detail page.','YesNo'),
232
('ILLHiddenRequestStatuses', NULL, NULL, 'ILL statuses that are considered finished and should not be displayed in the ILL module', 'multiple'),
232
('IllLog', 0, '', 'If ON, log information about ILL requests', 'YesNo'),
233
('IllLog', 0, '', 'If ON, log information about ILL requests', 'YesNo'),
233
('ILLModule','0','If ON, enables the interlibrary loans module.','','YesNo'),
234
('ILLModule','0','If ON, enables the interlibrary loans module.','','YesNo'),
234
('ILLModuleCopyrightClearance','','70|10','Enter text to enable the copyright clearance stage of request creation. Text will be displayed','Textarea'),
235
('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 (+5 lines)
Lines 834-839 Circulation: Link Here
834
                  yes: Enable
834
                  yes: Enable
835
                  no: Disable
835
                  no: Disable
836
            - unmediated Interlibrary loan requests. If enabled and the ILL backend supports it, the newly created requests are immediately requested by backend.
836
            - unmediated Interlibrary loan requests. If enabled and the ILL backend supports it, the newly created requests are immediately requested by backend.
837
        -
838
            - "ILL statuses that are considered finished and should not be displayed in the ILL module: "
839
            - pref: ILLHiddenRequestStatuses
840
              class: multi
841
            - (separated with |). If left empty, all ILL requests will be displayed.
837
    Fines Policy:
842
    Fines Policy:
838
        -
843
        -
839
            - pref: finesCalendar
844
            - pref: finesCalendar
(-)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