Bug 25650: Add location and itype descriptions in ILS-DI GetRecords
[koha.git] / admin / oai_sets.pl
blob5f241856d1a5ac25132ed12a2a2018bad5fc1cf1
1 #!/usr/bin/perl
3 # Copyright 2011 BibLibre SARL
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 =head1 NAME
21 oai_sets.pl
23 =head1 DESCRIPTION
25 Admin page to describe OAI SETs
27 =cut
29 use Modern::Perl;
31 use CGI qw ( -utf8 );
32 use C4::Auth;
33 use C4::Output;
34 use C4::OAI::Sets;
36 use Data::Dumper;
38 my $input = CGI->new;
39 my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( {
40 template_name => 'admin/oai_sets.tt',
41 query => $input,
42 type => 'intranet',
43 flagsrequired => { 'parameters' => 'manage_oai_sets' },
44 debug => 1,
45 } );
47 my $op = $input->param('op');
49 if($op && $op eq "new") {
50 $template->param( op_new => 1 );
51 } elsif($op && $op eq "savenew") {
52 my $spec = $input->param('spec');
53 my $name = $input->param('name');
54 my @descriptions = $input->multi_param('description');
55 AddOAISet({
56 spec => $spec,
57 name => $name,
58 descriptions => \@descriptions
59 });
60 } elsif($op && $op eq "mod") {
61 my $id = $input->param('id');
62 my $set = GetOAISet($id);
63 $template->param(
64 op_mod => 1,
65 id => $set->{'id'},
66 spec => $set->{'spec'},
67 name => $set->{'name'},
68 descriptions => [ map { {description => $_} } @{ $set->{'descriptions'} } ],
70 } elsif($op && $op eq "savemod") {
71 my $id = $input->param('id');
72 my $spec = $input->param('spec');
73 my $name = $input->param('name');
74 my @descriptions = $input->multi_param('description');
75 ModOAISet({
76 id => $id,
77 spec => $spec,
78 name => $name,
79 descriptions => \@descriptions
80 });
81 } elsif($op && $op eq "del") {
82 my $id = $input->param('id');
83 DelOAISet($id);
86 my $OAISets = GetOAISets;
87 my @sets_loop;
88 foreach(@$OAISets) {
89 push @sets_loop, {
90 id => $_->{'id'},
91 spec => $_->{'spec'},
92 name => $_->{'name'},
93 descriptions => [ map { {description => $_} } @{ $_->{'descriptions'} } ]
97 $template->param(
98 sets_loop => \@sets_loop,
101 output_html_with_http_headers $input, $cookie, $template->output;