View | Details | Raw Unified | Return to bug 37389
Collapse All | Expand All

(-)a/Koha/ILL/Requests.pm (-2 / +1 lines)
Lines 22-28 use Modern::Perl; Link Here
22
use Koha::Database;
22
use Koha::Database;
23
use Koha::ILL::Request;
23
use Koha::ILL::Request;
24
use Koha::ILL::Request::Config;
24
use Koha::ILL::Request::Config;
25
use Koha::Objects::Mixin::ExtendedAttributes;
26
25
27
use base qw(Koha::Objects::Mixin::ExtendedAttributes Koha::Objects);
26
use base qw(Koha::Objects::Mixin::ExtendedAttributes Koha::Objects);
28
27
Lines 112-118 sub search_incomplete { Link Here
112
=cut
111
=cut
113
112
114
sub extended_attributes_config {
113
sub extended_attributes_config {
115
    my ( $self ) = @_;
114
    my ($self) = @_;
116
    return {
115
    return {
117
        'id_field'     => { 'foreign' => 'illrequest_id', 'self' => 'illrequest_id' },
116
        'id_field'     => { 'foreign' => 'illrequest_id', 'self' => 'illrequest_id' },
118
        'key_field'    => 'type',
117
        'key_field'    => 'type',
(-)a/Koha/Objects/Mixin/ExtendedAttributes.pm (-2 / +2 lines)
Lines 200-206 sub _rewrite_related_metadata_query { Link Here
200
sub _build_extended_attributes_relations {
200
sub _build_extended_attributes_relations {
201
    my ( $self, $types ) = @_;
201
    my ( $self, $types ) = @_;
202
202
203
    return if( !grep ( /extended_attributes/, keys %{$self->_resultset->result_source->_relationships} ) );
203
    return if ( !grep ( /extended_attributes/, keys %{ $self->_resultset->result_source->_relationships } ) );
204
204
205
    my $ea_config = $self->extended_attributes_config;
205
    my $ea_config = $self->extended_attributes_config;
206
206
Lines 231-234 sub _build_extended_attributes_relations { Link Here
231
    return map { 'extended_attributes_' . $_ } @{$types};
231
    return map { 'extended_attributes_' . $_ } @{$types};
232
}
232
}
233
233
234
1;
234
1;
(-)a/Koha/Patrons.pm (-1 / +1 lines)
Lines 571-577 sub filter_by_have_permission { Link Here
571
=cut
571
=cut
572
572
573
sub extended_attributes_config {
573
sub extended_attributes_config {
574
    my ( $self ) = @_;
574
    my ($self) = @_;
575
    return {
575
    return {
576
        'id_field'     => { 'foreign' => 'borrowernumber', 'self' => 'borrowernumber' },
576
        'id_field'     => { 'foreign' => 'borrowernumber', 'self' => 'borrowernumber' },
577
        'key_field'    => 'code',
577
        'key_field'    => 'code',
(-)a/t/db_dependent/Koha/Objects/Mixin/ExtendedAttributes.t (-5 / +3 lines)
Lines 44-56 subtest 'extended_attributes patrons join searches() tests' => sub { Link Here
44
    my $attribute_type_1 = $builder->build(
44
    my $attribute_type_1 = $builder->build(
45
        {
45
        {
46
            source => 'BorrowerAttributeType',
46
            source => 'BorrowerAttributeType',
47
            value => { repeatable => 1, is_date => 0, code => 'CODE_1' },
47
            value  => { repeatable => 1, is_date => 0, code => 'CODE_1' },
48
        }
48
        }
49
    );
49
    );
50
    my $attribute_type_2 = $builder->build(
50
    my $attribute_type_2 = $builder->build(
51
        {
51
        {
52
            source => 'BorrowerAttributeType',
52
            source => 'BorrowerAttributeType',
53
            value => { repeatable => 1, is_date => 0, code => 'CODE_2' }
53
            value  => { repeatable => 1, is_date => 0, code => 'CODE_2' }
54
        }
54
        }
55
    );
55
    );
56
56
Lines 71-77 subtest 'extended_attributes patrons join searches() tests' => sub { Link Here
71
71
72
    my $patrons_search = Koha::Patrons->search(
72
    my $patrons_search = Koha::Patrons->search(
73
        [
73
        [
74
            '-and'=>[
74
            '-and' => [
75
                {
75
                {
76
                    'extended_attributes.attribute' => { 'like' => '%Bar%' },
76
                    'extended_attributes.attribute' => { 'like' => '%Bar%' },
77
                    'extended_attributes.code'      => $attr1->code
77
                    'extended_attributes.code'      => $attr1->code
Lines 105-111 subtest 'extended_attributes patrons join searches() tests' => sub { Link Here
105
105
106
    is( $patrons_search2->count, 0, "Second patrons extended_attribute 'AND' query works." );
106
    is( $patrons_search2->count, 0, "Second patrons extended_attribute 'AND' query works." );
107
107
108
109
    my $patrons_search3 = Koha::Patrons->search(
108
    my $patrons_search3 = Koha::Patrons->search(
110
        [
109
        [
111
            [
110
            [
112
- 

Return to bug 37389