Bug 35287: (Follow-up 37389): ExtendedAttributes
Apply ExtendedAttributes Mixin to AdditionalFields To test the ExtendedAttributes mixin search is working: 1) Create 2 or more searchable licenses additional fields 2) Create a new license and enter values in these searchable fields 3) Go to the licenses list, use the column filters to search on more than one column, verify that the search work as intended (AND operator) Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
e10a829568
commit
f1f33fce68
|
|
@ -22,7 +22,7 @@ use Koha::Database;
|
|||
|
||||
use Koha::ERM::License;
|
||||
|
||||
use base qw(Koha::Objects Koha::Objects::Mixin::AdditionalFields);
|
||||
use base qw(Koha::Objects::Mixin::AdditionalFields Koha::Objects);
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package Koha::Objects::Mixin::AdditionalFields;
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use base qw(Koha::Objects::Mixin::ExtendedAttributes);
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Koha::Objects::Mixin::AdditionalFields
|
||||
|
|
@ -56,6 +58,28 @@ sub filter_by_additional_fields {
|
|||
return $class->search(\%conditions, { join => [ ('additional_field_values') x $idx ] });
|
||||
}
|
||||
|
||||
=head3 extended_attributes_config
|
||||
|
||||
=cut
|
||||
|
||||
sub extended_attributes_config {
|
||||
my ($self) = @_;
|
||||
|
||||
my $tablename_query = $self->extended_attributes_tablename_query;
|
||||
|
||||
return {
|
||||
'id_field' => { 'foreign' => 'record_id', 'self' => $self->_resultset->result_source->primary_columns },
|
||||
'key_field' => 'field_id',
|
||||
'schema_class' => 'Koha::Schema::Result::AdditionalFieldValue',
|
||||
};
|
||||
}
|
||||
|
||||
sub extended_attributes_tablename_query {
|
||||
my ($self) = @_;
|
||||
|
||||
return { 'tablename' => $self->_resultset->result_source->name, 'operator' => '=' };
|
||||
}
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Koha Development Team <http://koha-community.org/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue