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:
Pedro Amorim 2024-07-26 14:24:44 +00:00 committed by Katrin Fischer
parent e10a829568
commit f1f33fce68
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
2 changed files with 25 additions and 1 deletions

View File

@ -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

View File

@ -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/>