Bug 3813: SIP2, Bad Patron Information Response to Message 64
[koha.git] / admin / fieldmapping.pl
blobbd3ca1bf3c2f6af35c82e7b89a446d0e942bba75
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 under the
7 # terms of the GNU General Public License as published by the Free Software
8 # Foundation; either version 2 of the License, or (at your option) any later
9 # version.
11 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
12 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License along with
16 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
17 # Suite 330, Boston, MA 02111-1307 USA
19 use strict;
20 use warnings;
21 use CGI;
22 use C4::Auth;
23 use C4::Biblio;
24 use C4::Koha;
25 use C4::Output;
27 my $query = new CGI;
29 my $framework = $query->param('framework') || "";
31 my $field = $query->param('fieldname');
32 my $fieldcode = $query->param('marcfield');
33 my $subfieldcode = $query->param('marcsubfield');
34 my $op = $query->param('op');
35 my $id = $query->param('id');
37 my ($template, $loggedinuser, $cookie)
38 = get_template_and_user({template_name => "admin/fieldmapping.tmpl",
39 query => $query,
40 type => "intranet",
41 authnotrequired => 0,
42 flagsrequired => {parameters => 1},
43 debug => 1,
44 });
46 # get framework list
47 my $frameworks = getframeworks();
48 my @frameworkloop;
49 foreach my $thisframeworkcode (keys %$frameworks) {
50 my $selected = 1 if $thisframeworkcode eq $framework;
51 my %row =(value => $thisframeworkcode,
52 selected => $selected,
53 frameworktext => $frameworks->{$thisframeworkcode}->{'frameworktext'},
55 push @frameworkloop, \%row;
58 if($op eq "delete" and $id){
59 DeleteFieldMapping($id);
60 print $query->redirect("/cgi-bin/koha/admin/fieldmapping.pl?framework=".$framework);
61 exit;
64 # insert operation
65 if($field and $fieldcode){
66 SetFieldMapping($framework, $field, $fieldcode, $subfieldcode);
69 my $fieldloop = GetFieldMapping($framework);
70 warn Data::Dumper::Dumper($fieldloop->[1]);
72 $template->param( frameworkloop => \@frameworkloop,
73 framework => $framework,
74 fields => $fieldloop,
77 output_html_with_http_headers $query, $cookie, $template->output;