#
# This file is part of Koha.
#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
=head1 NAME
&GetOAISets &GetOAISet &GetOAISetBySpec &ModOAISet &DelOAISet &AddOAISet
&GetOAISetsMappings &GetOAISetMappings &ModOAISetMappings
&GetOAISetsBiblio &ModOAISetsBiblios &AddOAISetsBiblios
- &CalcOAISetsBiblio &UpdateOAISetsBiblio
+ &CalcOAISetsBiblio &UpdateOAISetsBiblio &DelOAISetsBiblio
);
}
GetOAISetsMappings returns mappings for all OAI Sets.
Mappings define how biblios are categorized in sets.
-A mapping is defined by three properties:
+A mapping is defined by four properties:
{
marcfield => 'XXX', # the MARC field to check
marcsubfield => 'Y', # the MARC subfield to check
+ operator => 'A', # the operator 'equal' or 'notequal'; 'equal' if ''
marcvalue => 'zzzz', # the value to check
}
{
marcfield => 'XXX',
marcsubfield => 'Y',
+ operator => 'A',
marcvalue => 'zzzz'
},
{
push @{ $mappings->{$result->{'set_id'}} }, {
marcfield => $result->{'marcfield'},
marcsubfield => $result->{'marcsubfield'},
+ operator => $result->{'operator'},
marcvalue => $result->{'marcvalue'}
};
}
push @mappings, {
marcfield => $result->{'marcfield'},
marcsubfield => $result->{'marcsubfield'},
+ operator => $result->{'operator'},
marcvalue => $result->{'marcvalue'}
};
}
{
marcfield => 'XXX',
marcsubfield => 'Y',
+ operator => 'A',
marcvalue => 'zzzz'
},
...
if(scalar @$mappings > 0) {
$query = qq{
- INSERT INTO oai_sets_mappings (set_id, marcfield, marcsubfield, marcvalue)
- VALUES (?,?,?,?)
+ INSERT INTO oai_sets_mappings (set_id, marcfield, marcsubfield, operator, marcvalue)
+ VALUES (?,?,?,?,?)
};
$sth = $dbh->prepare($query);
foreach (@$mappings) {
- $sth->execute($set_id, $_->{'marcfield'}, $_->{'marcsubfield'}, $_->{'marcvalue'});
+ $sth->execute($set_id, $_->{'marcfield'}, $_->{'marcsubfield'}, $_->{'operator'}, $_->{'marcvalue'});
}
}
}
next if not $mapping;
my $field = $mapping->{'marcfield'};
my $subfield = $mapping->{'marcsubfield'};
+ my $operator = $mapping->{'operator'};
my $value = $mapping->{'marcvalue'};
-
my @subfield_values = $record->subfield($field, $subfield);
- if(0 < grep /^$value$/, @subfield_values) {
- push @biblio_sets, $set_id;
- last;
+ if ($operator eq 'notequal') {
+ if(0 == grep /^$value$/, @subfield_values) {
+ push @biblio_sets, $set_id;
+ last;
+ }
+ }
+ else {
+ if(0 < grep /^$value$/, @subfield_values) {
+ push @biblio_sets, $set_id;
+ last;
+ }
}
}
}