From fabc9a69f06013083cbc64f9ef2a96dc6203f74b Mon Sep 17 00:00:00 2001 From: Olli-Antti Kivilahti Date: Tue, 4 Feb 2014 19:32:52 +0200 Subject: [PATCH] Bug 11676 - Loading shelving locations based on the item's homebranch instead of the user's logged-in branch. Svc AJAX-wrapper. This patch provides a HTTP-interface for the C4::Koha::GetAuthorisedValues() using the existing svc web interface. --- svc/getAuthorisedValues.pl | 70 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100755 svc/getAuthorisedValues.pl diff --git a/svc/getAuthorisedValues.pl b/svc/getAuthorisedValues.pl new file mode 100755 index 0000000..aca9a8c --- /dev/null +++ b/svc/getAuthorisedValues.pl @@ -0,0 +1,70 @@ +#!/usr/bin/perl + +# This file is part of Koha. +# +# Copyright 2013 Universidad Nacional de Cordoba +# Tomas Cohen Arazi +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +=head SYNOPSIS + +This file is a AJAX-callable wrapper for C4::Koha::GetAuthorisedValues() + +Valid parameters: + +category +selected +opac +branch_limit + +See C4::Koha::GetAuthorisedValues() for detailed documentation. + +=cut +use Modern::Perl; + +use CGI; +use C4::Auth qw/check_cookie_auth/; +use JSON qw/to_json/; +use C4::Koha qw/GetAuthorisedValues/; + +my $input = new CGI; + +my ( $auth_status, $sessionID ) = + check_cookie_auth( + $input->cookie('CGISESSID'), + { tools => 'upload_local_cover_images' } ); + +if ( $auth_status ne "ok" ) { + exit 0; +} + +## Getting the input parameters ## + +my $category = $input->param('category'); +my $selected = $input->param('selected'); +my $opac = $input->param('opac'); +my $branch_limit = $input->param('branch_limit'); + + +my $avs = C4::Koha::GetAuthorisedValues($category, $selected, $opac, $branch_limit); + + +binmode STDOUT, ":encoding(UTF-8)"; +print $input->header( + -type => 'application/json', + -charset => 'UTF-8' +); + +print to_json( $avs); \ No newline at end of file -- 1.8.1.2