2 # Copyright 2007 LibLime
3 # Copyright 2012 software.coop and MJ Ray
5 # This file is part of Koha.
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.
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.
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>.
23 use C4::Auth qw/check_api_auth/;
28 binmode STDOUT, ':encoding(UTF-8)';
31 my ($status, $cookie, $sessionID) = check_api_auth($query, { editcatalogue => 'edit_catalogue'} );
32 unless ($status eq 'ok') {
33 print $query->header(-type => 'text/xml', -status => '403 Forbidden');
34 print XMLout({ auth_status => $status }, NoAttr => 1, RootName => 'response', XMLDecl => 1);
38 # do initial validation
39 my $path_info = $query->path_info();
40 my $biblionumber = undef;
41 if ($path_info =~ m!^/(\d+)$!) {
44 print $query->header(-type => 'text/xml', -status => '400 Bad Request');
46 if ($query->request_method eq 'GET') {
47 fetch_bib_framework($query, $biblionumber);
49 print $query->header(-type => 'text/xml', -status => '405 Method not allowed');
50 print XMLout({ error => 'Method not allowed' }, NoAttr => 1, RootName => 'response', XMLDecl => 1);
55 sub fetch_bib_framework {
57 my $biblionumber = shift;
58 my $frameworkcode = GetFrameworkCode( $biblionumber );
60 'frameworkcode' => $frameworkcode
62 print $query->header(-type => 'text/xml',-charset => 'utf-8',);
63 print XMLout($result, NoAttr => 1, RootName => 'response', XMLDecl => 1, NoEscape => 0);