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