Bug 43069: Don't match every patron when no duplicate-match fields apply
check_for_existing_matches() called Koha::Patrons->search(undef) when PatronDuplicateMatchingAddFields left no usable field to match on, which matches every patron instead of none. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
2adc268464
commit
8697929514
|
|
@ -749,6 +749,10 @@ sub check_for_existing_matches {
|
|||
$match_conditions->{$field} = $new_patron_data->{$field} if $new_patron_data->{$field};
|
||||
}
|
||||
|
||||
# Without any usable conditions, Koha::Patrons->search would run
|
||||
# unfiltered and match every patron in the system.
|
||||
return { 'duplicate_found' => 0 } unless $match_conditions && %$match_conditions;
|
||||
|
||||
my $patrons = Koha::Patrons->search($match_conditions);
|
||||
if ( $patrons->count > 0 ) {
|
||||
return {
|
||||
|
|
|
|||
Loading…
Reference in New Issue