Bug 12973: Additional unit tests for XSLT_Handler.t
[koha.git] / authorities / merge_ajax.pl
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use CGI qw ( -utf8 );
7 use CGI::Session;
8 use C4::Context;
9 use C4::Auth qw/check_cookie_auth/;
10 use C4::AuthoritiesMarc;
11 use JSON;
12 use CGI::Cookie; # need to check cookies before
13                  # having CGI parse the POST request
14
15 my %cookies = fetch CGI::Cookie;
16 my ($auth_status, $sessionID) = check_cookie_auth($cookies{'CGISESSID'}->value, { editcatalogue => 'edit_catalogue' });
17 if ($auth_status ne "ok") {
18     my $reply = CGI->new("");
19     print $reply->header(-type => 'text/html');
20     exit 0;
21 }
22
23 my $reply = new CGI;
24 my $framework = $reply->param('frameworkcode');
25 my $tagslib = GetTagsLabels(1, $framework);
26 print $reply->header(-type => 'text/html');
27 print encode_json $tagslib;