Bug 16733: Adjust koha-indexer
[koha.git] / admin / fieldmapping.pl
blob75fd892960a4f68cc1d603fcaf66dc4ec052770a
1 #!/usr/bin/perl
2 # Copyright 2009 SARL BibLibre
4 # This file is part of Koha.
6 # Koha is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # Koha is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with Koha; if not, see <http://www.gnu.org/licenses>.
19 use strict;
20 use warnings;
21 use CGI qw ( -utf8 );
22 use C4::Auth;
23 use C4::Biblio;
24 use C4::Koha;
25 use C4::Output;
27 use Koha::BiblioFrameworks;
29 my $query = new CGI;
31 my $frameworkcode = $query->param('framework') || "";
32 my $field = $query->param('fieldname');
33 my $fieldcode = $query->param('marcfield');
34 my $subfieldcode = $query->param('marcsubfield');
35 my $op = $query->param('op') || q{};
36 my $id = $query->param('id');
38 my ($template, $loggedinuser, $cookie)
39 = get_template_and_user({template_name => "admin/fieldmapping.tt",
40 query => $query,
41 type => "intranet",
42 authnotrequired => 0,
43 flagsrequired => {parameters => 'parameters_remaining_permissions'},
44 debug => 1,
45 });
47 if($op eq "delete" and $id){
48 DeleteFieldMapping($id);
49 print $query->redirect("/cgi-bin/koha/admin/fieldmapping.pl?framework=".$frameworkcode);
50 exit;
53 # insert operation
54 if($field and $fieldcode){
55 SetFieldMapping($frameworkcode, $field, $fieldcode, $subfieldcode);
58 my $fieldloop = GetFieldMapping($frameworkcode);
60 my $frameworks = Koha::BiblioFrameworks->search({}, { order_by => ['frameworktext'] });
61 my $framework = $frameworks->search( { frameworkcode => $frameworkcode } )->next;
62 $template->param(
63 frameworks => $frameworks,
64 framework => $framework,
65 fields => $fieldloop,
68 output_html_with_http_headers $query, $cookie, $template->output;