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

(-)a/Koha/Auth/Client/OAuth.pm (-15 / +21 lines)
Lines 72-84 sub _get_data_and_patron { Link Here
72
                if defined $claim->{$pkey};
72
                if defined $claim->{$pkey};
73
        }
73
        }
74
74
75
        my $value = $mapped_data->{$matchpoint};
75
        $patron = $self->_find_patron_by_matchpoint( $matchpoint, $mapped_data->{$matchpoint} );
76
77
        my $matchpoint_rs = Koha::Patrons->search( { $matchpoint => $value } );
78
79
        if ( defined $value and $matchpoint_rs->count ) {
80
            $patron = $matchpoint_rs->next;
81
        }
82
    }
76
    }
83
77
84
    if ( defined $config->{userinfo_url} ) {
78
    if ( defined $config->{userinfo_url} ) {
Lines 101-113 sub _get_data_and_patron { Link Here
101
        }
95
        }
102
96
103
        unless ($patron) {
97
        unless ($patron) {
104
            my $value = $mapped_data->{$matchpoint};
98
            $patron = $self->_find_patron_by_matchpoint( $matchpoint, $mapped_data->{$matchpoint} );
105
106
            my $matchpoint_rs = Koha::Patrons->search( { $matchpoint => $value } );
107
108
            if ( defined $value and $matchpoint_rs->count ) {
109
                $patron = $matchpoint_rs->next;
110
            }
111
        }
99
        }
112
100
113
    }
101
    }
Lines 115-118 sub _get_data_and_patron { Link Here
115
    return ( $mapped_data, $patron );
103
    return ( $mapped_data, $patron );
116
}
104
}
117
105
106
=head3 _find_patron_by_matchpoint
107
108
    my $patron = $client->_find_patron_by_matchpoint( $matchpoint, $value );
109
110
Internal method to find a patron by the given matchpoint and value.
111
Returns the patron object if found, undef otherwise.
112
113
=cut
114
115
sub _find_patron_by_matchpoint {
116
    my ( $self, $matchpoint, $value ) = @_;
117
118
    return unless defined $value;
119
120
    my $matchpoint_rs = Koha::Patrons->search( { $matchpoint => $value } );
121
122
    return $matchpoint_rs->count ? $matchpoint_rs->next : undef;
123
}
124
118
1;
125
1;
119
- 

Return to bug 33782