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

(-)a/Koha/Patrons.pm (+23 lines)
Lines 647-652 sub extended_attributes_config { Link Here
647
    };
647
    };
648
}
648
}
649
649
650
=head3 check_for_existing_matches
651
652
=cut
653
654
sub check_for_existing_matches {
655
    my ( $self, $new_patron_data ) = @_;
656
657
    my @duplicate_match_fields = split '\|', C4::Context->preference('PatronDuplicateMatchingAddFields');
658
    my $match_conditions;
659
    for my $field (@duplicate_match_fields) {
660
        $match_conditions->{$field} = $new_patron_data->{$field} if $new_patron_data->{$field};
661
    }
662
663
    my $patrons = Koha::Patrons->search($match_conditions);
664
    if ( $patrons->count > 0 ) {
665
        return {
666
            'duplicate_found'  => 1,
667
            'matching_patrons' => $patrons
668
        };
669
    }
670
    return { 'duplicate_found' => 0 };
671
}
672
650
=head3 _type
673
=head3 _type
651
674
652
=cut
675
=cut
(-)a/members/memberentry.pl (-10 / +4 lines)
Lines 252-269 if ( $op eq 'cud-insert' || $op eq 'edit_form' || $op eq 'cud-save' || $op eq 'd Link Here
252
    }
252
    }
253
}
253
}
254
254
255
# Test uniqueness of surname, firstname and dateofbirth
255
#Test uniqueness of fields in PatronDuplicateMatchingAddFields
256
if ( ( $op eq 'cud-insert' ) and !$nodouble ) {
256
if ( ( $op eq 'cud-insert' ) and !$nodouble ) {
257
    my @dup_fields = split '\|', C4::Context->preference('PatronDuplicateMatchingAddFields');
258
    my $conditions;
259
    for my $f (@dup_fields) {
260
        $conditions->{$f} = $newdata{$f} if $newdata{$f};
261
    }
262
    $nodouble = 1;
257
    $nodouble = 1;
263
    my $patrons = Koha::Patrons->search($conditions);
258
    my $match_result = Koha::Patrons->check_for_existing_matches( \%newdata );
264
    if ( $patrons->count > 0 ) {
259
    if ( $match_result->{duplicate_found} ) {
265
        $nodouble     = 0;
260
        $nodouble     = 0;
266
        $check_patron = $patrons->next;
261
        $check_patron = $match_result->{matching_patrons}->next;
267
        $check_member = $check_patron->borrowernumber;
262
        $check_member = $check_patron->borrowernumber;
268
    }
263
    }
269
}
264
}
270
- 

Return to bug 40082