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

(-)a/svc/getAuthorisedValues.pl (-1 / +69 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Copyright Anonymous
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
=head SYNOPSIS
21
22
This file is a AJAX-callable wrapper for C4::Koha::GetAuthorisedValues()
23
24
Valid parameters:
25
26
category
27
selected
28
opac
29
branch_limit
30
31
See C4::Koha::GetAuthorisedValues() for detailed documentation.
32
33
=cut
34
use Modern::Perl;
35
36
use CGI;
37
use C4::Auth qw/check_cookie_auth/;
38
use JSON qw/to_json/;
39
use C4::Koha qw/GetAuthorisedValues/;
40
41
my $input = new CGI;
42
43
my ( $auth_status, $sessionID ) =
44
        check_cookie_auth(
45
            $input->cookie('CGISESSID'),
46
            { 'catalogue' => '*' } );
47
48
if ( $auth_status ne "ok" ) {
49
    exit 0;
50
}
51
52
## Getting the input parameters ##
53
54
my $category = $input->param('category');
55
my $selected = $input->param('selected');
56
my $opac = $input->param('opac');
57
my $branch_limit = $input->param('branch_limit');
58
59
60
my $avs = C4::Koha::GetAuthorisedValues($category, $selected, $opac, $branch_limit);
61
62
63
binmode STDOUT, ":encoding(UTF-8)";
64
print $input->header(
65
    -type => 'application/json',
66
    -charset => 'UTF-8'
67
);
68
69
print to_json( $avs);

Return to bug 11676