Lines 138-143
if ( $op eq 'cud-create' ) {
Link Here
|
138 |
my @empty_mandatory_fields = |
138 |
my @empty_mandatory_fields = |
139 |
( CheckMandatoryFields( \%borrower, $op ), CheckMandatoryAttributes( \%borrower, $attributes ) ); |
139 |
( CheckMandatoryFields( \%borrower, $op ), CheckMandatoryAttributes( \%borrower, $attributes ) ); |
140 |
my $invalidformfields = CheckForInvalidFields( { borrower => \%borrower, context => 'create' } ); |
140 |
my $invalidformfields = CheckForInvalidFields( { borrower => \%borrower, context => 'create' } ); |
|
|
141 |
my $match_result = Koha::Patrons->check_for_existing_matches( \%borrower ); |
142 |
|
141 |
delete $borrower{'password2'}; |
143 |
delete $borrower{'password2'}; |
142 |
my $is_cardnumber_valid; |
144 |
my $is_cardnumber_valid; |
143 |
if ( !grep { $_ eq 'cardnumber' } @empty_mandatory_fields ) { |
145 |
if ( !grep { $_ eq 'cardnumber' } @empty_mandatory_fields ) { |
Lines 158-169
if ( $op eq 'cud-create' ) {
Link Here
|
158 |
} |
160 |
} |
159 |
} |
161 |
} |
160 |
|
162 |
|
161 |
if ( @empty_mandatory_fields || @$invalidformfields || !$is_cardnumber_valid || $conflicting_attribute ) { |
163 |
if ( @empty_mandatory_fields |
|
|
164 |
|| @$invalidformfields |
165 |
|| !$is_cardnumber_valid |
166 |
|| $conflicting_attribute |
167 |
|| $match_result->{duplicate_found} ) |
168 |
{ |
162 |
|
169 |
|
163 |
$template->param( |
170 |
$template->param( |
164 |
empty_mandatory_fields => \@empty_mandatory_fields, |
171 |
empty_mandatory_fields => \@empty_mandatory_fields, |
165 |
invalid_form_fields => $invalidformfields, |
172 |
invalid_form_fields => $invalidformfields, |
166 |
borrower => \%borrower |
173 |
borrower => \%borrower, |
|
|
174 |
duplicate_found => $match_result->{duplicate_found} |
167 |
); |
175 |
); |
168 |
$template->param( patron_attribute_classes => GeneratePatronAttributesForm( undef, $attributes ) ); |
176 |
$template->param( patron_attribute_classes => GeneratePatronAttributesForm( undef, $attributes ) ); |
169 |
} elsif ( md5_base64( uc( $cgi->param('captcha') ) ) ne $cgi->param('captcha_digest') ) { |
177 |
} elsif ( md5_base64( uc( $cgi->param('captcha') ) ) ne $cgi->param('captcha_digest') ) { |
170 |
- |
|
|