Bug 21637: Fixed upercase letter in EasyAnalyticalRecords syspref
[koha.git] / Koha / SearchField.pm
blobefabb8db7d38d7f120a400c02cb9cd3af99a4999
1 package Koha::SearchField;
3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 3 of the License, or (at your option) any later
8 # version.
10 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along
15 # with Koha; if not, write to the Free Software Foundation, Inc.,
16 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 use Modern::Perl;
20 use Carp;
22 use Koha::Database;
23 use Koha::SearchMarcMaps;
25 use base qw(Koha::Object);
27 =head1 NAME
29 Koha::SearchField - Koha SearchField Object class
31 =head1 API
33 =head2 Class Methods
35 =cut
37 sub add_to_search_marc_maps {
38 my ( $self, $search_field, $params ) = @_;
39 return $self->_result()->add_to_search_marc_maps($search_field->_result, $params);
42 =head3 search_marc_maps
44 my $search_marc_maps = $search_field->search_marc_maps;
46 =cut
48 sub search_marc_maps {
49 my ( $self ) = @_;
51 my $marc_type = lc C4::Context->preference('marcflavour');
53 my $schema = Koha::Database->new->schema;
54 my $marc_map_fields = $schema->resultset('SearchMarcToField')->search(
56 'me.search_field_id' => $self->id,
57 'search_marc_map.marc_type' => $marc_type
60 select => [
61 'search_marc_map.index_name',
62 'search_marc_map.marc_type',
63 'search_marc_map.marc_field'
65 as => [ 'index_name', 'marc_type', 'marc_field' ],
66 join => 'search_marc_map'
70 return $marc_map_fields;
73 =head3 is_mapped_biblios
75 my $is_mapped_biblios = $search_field->is_mapped_biblios
77 =cut
79 sub is_mapped_biblios {
80 my ( $self ) = @_;
82 return $self->search_marc_maps->search(
84 index_name => 'biblios'
86 )->count ? 1 : 0;
89 =head3 type
91 =cut
93 sub _type {
94 return 'SearchField';