1 package Koha::Objects::Mixin::AdditionalFields;
7 Koha::Objects::Mixin::AdditionalFields
13 use parent qw( Koha::Objects Koha::Objects::Mixin::AdditionalFields );
16 sub object_class { 'Koha::Foo' }
23 Koha::Foos->filter_by_additional_fields(...)
29 =head3 filter_by_additional_fields
31 my @objects = Koha::Foos->filter_by_additional_fields([
44 sub filter_by_additional_fields {
45 my ($class, $additional_fields) = @_;
49 foreach my $additional_field (@$additional_fields) {
51 my $alias = $idx > 1 ? "additional_field_values_$idx" : "additional_field_values";
52 $conditions{"$alias.field_id"} = $additional_field->{id};
53 $conditions{"$alias.value"} = { -like => '%' . $additional_field->{value} . '%'};
56 return $class->search(\%conditions, { join => [ ('additional_field_values') x $idx ] });
61 Koha Development Team <http://koha-community.org/>
63 =head1 COPYRIGHT AND LICENSE
65 Copyright 2018 BibLibre
67 This file is part of Koha.
69 Koha is free software; you can redistribute it and/or modify it under the
70 terms of the GNU General Public License as published by the Free Software
71 Foundation; either version 3 of the License, or (at your option) any later
74 Koha is distributed in the hope that it will be useful, but WITHOUT ANY
75 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
76 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
78 You should have received a copy of the GNU General Public License along
79 with Koha; if not, see <http://www.gnu.org/licenses>.