Merge branch 'bug_8931' into 3.12-master
[koha.git] / cataloguing / merge_ajax.pl
1 #!/usr/bin/perl
2
3 use strict;
4 #use warnings; FIXME - Bug 2505
5
6 # standard or CPAN modules used
7 use IO::File;
8 use CGI;
9 use CGI::Session;
10 use C4::Context;
11 use C4::Biblio;
12 use C4::Auth qw/check_cookie_auth/;
13 use C4::UploadedFile;
14 use JSON;
15 use CGI::Cookie; # need to check cookies before
16                  # having CGI parse the POST request
17
18 my %cookies = fetch CGI::Cookie;
19 my ($auth_status, $sessionID) = check_cookie_auth($cookies{'CGISESSID'}->value, { editcatalogue => 'edit_catalogue' });
20 if ($auth_status ne "ok") {
21     my $reply = CGI->new("");
22     print $reply->header(-type => 'text/html');
23     exit 0;
24
25
26 my $reply = new CGI;
27 my $framework = $reply->param('frameworkcode');
28 my $tagslib = GetMarcStructure(1, $framework);
29 print $reply->header(-type => 'text/html');
30 print encode_json $tagslib;