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 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
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
16 # with Koha; if not, write to the Free Software Foundation, Inc.,
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 Define mappings for a given set.
26 Mappings are conditions that define which biblio is included in which set.
27 A condition is in the form 200$a = 'abc'.
28 Multiple conditions can be defined for a given set. In this case,
29 the OR operator will be applied.
43 my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user
( {
44 template_name
=> 'admin/oai_set_mappings.tt',
48 flagsrequired
=> { 'parameters' => 'parameters_remaining_permissions' },
52 my $id = $input->param('id');
53 my $op = $input->param('op');
55 if($op && $op eq "save") {
56 my @marcfields = $input->param('marcfield');
57 my @marcsubfields = $input->param('marcsubfield');
58 my @operators = $input->param('operator');
59 my @marcvalues = $input->param('marcvalue');
63 while($i < @marcfields and $i < @marcsubfields and $i < @marcvalues) {
64 if($marcfields[$i] and $marcsubfields[$i]) {
66 marcfield
=> $marcfields[$i],
67 marcsubfield
=> $marcsubfields[$i],
68 operator
=> $operators[$i],
69 marcvalue
=> $marcvalues[$i]
74 ModOAISetMappings
($id, \
@mappings);
75 $template->param(mappings_saved
=> 1);
78 my $set = GetOAISet
($id);
79 my $mappings = GetOAISetMappings
($id);
83 setName
=> $set->{'name'},
84 setSpec
=> $set->{'spec'},
85 mappings
=> $mappings,
88 output_html_with_http_headers
$input, $cookie, $template->output;