Bug 26265: (QA follow-up) Remove g option from regex, add few dirs
[koha-equinox.git] / authorities / merge_ajax.pl
1 #!/usr/bin/perl
2
3 use Modern::Perl;
4
5 use CGI qw ( -utf8 );
6 use CGI::Cookie; # need to check cookies before CGI parses the POST request
7 use JSON;
8
9 use C4::Context;
10 use C4::Auth qw/check_cookie_auth/;
11 use C4::AuthoritiesMarc;
12
13 my %cookies = CGI::Cookie->fetch;
14 my ($auth_status, $sessionID) = check_cookie_auth($cookies{'CGISESSID'}->value, { editcatalogue => 'edit_catalogue' });
15 my $reply = CGI->new;
16 if ($auth_status ne "ok") {
17     print $reply->header(-type => 'text/html');
18     exit 0;
19 }
20
21 my $framework = $reply->param('frameworkcode');
22 my $tagslib = GetTagsLabels(1, $framework);
23 print $reply->header(-type => 'text/html');
24 print encode_json $tagslib;