Lines 236-254
if ( (defined $newdata{'userid'}) && ($newdata{'userid'} eq '')){
Link Here
|
236 |
$debug and warn join "\t", map {"$_: $newdata{$_}"} qw(dateofbirth dateenrolled dateexpiry); |
236 |
$debug and warn join "\t", map {"$_: $newdata{$_}"} qw(dateofbirth dateenrolled dateexpiry); |
237 |
my $extended_patron_attributes = (); |
237 |
my $extended_patron_attributes = (); |
238 |
if ($op eq 'save' || $op eq 'insert'){ |
238 |
if ($op eq 'save' || $op eq 'insert'){ |
239 |
if (checkcardnumber($newdata{cardnumber},$newdata{borrowernumber})){ |
239 |
# If the cardnumber is blank, treat it as null. |
240 |
push @errors, 'ERROR_cardnumber'; |
240 |
$newdata{'cardnumber'} = undef if $newdata{'cardnumber'} =~ /^\s*$/; |
241 |
} |
241 |
|
242 |
my $dateofbirthmandatory = (scalar grep {$_ eq "dateofbirth"} @field_check) ? 1 : 0; |
242 |
if (checkcardnumber($newdata{cardnumber},$newdata{borrowernumber})){ |
243 |
if ($newdata{dateofbirth} && $dateofbirthmandatory) { |
243 |
push @errors, 'ERROR_cardnumber'; |
244 |
my $age = GetAge($newdata{dateofbirth}); |
244 |
} |
245 |
my $borrowercategory=GetBorrowercategory($newdata{'categorycode'}); |
245 |
my $dateofbirthmandatory = (scalar grep {$_ eq "dateofbirth"} @field_check) ? 1 : 0; |
246 |
my ($low,$high) = ($borrowercategory->{'dateofbirthrequired'}, $borrowercategory->{'upperagelimit'}); |
246 |
if ($newdata{dateofbirth} && $dateofbirthmandatory) { |
247 |
if (($high && ($age > $high)) or ($age < $low)) { |
247 |
my $age = GetAge($newdata{dateofbirth}); |
248 |
push @errors, 'ERROR_age_limitations'; |
248 |
my $borrowercategory=GetBorrowercategory($newdata{'categorycode'}); |
249 |
$template->param('ERROR_age_limitations' => "$low to $high"); |
249 |
my ($low,$high) = ($borrowercategory->{'dateofbirthrequired'}, $borrowercategory->{'upperagelimit'}); |
|
|
250 |
if (($high && ($age > $high)) or ($age < $low)) { |
251 |
push @errors, 'ERROR_age_limitations'; |
252 |
$template->param('ERROR_age_limitations' => "$low to $high"); |
253 |
} |
250 |
} |
254 |
} |
251 |
} |
|
|
252 |
|
255 |
|
253 |
if($newdata{surname} && C4::Context->preference('uppercasesurnames')) { |
256 |
if($newdata{surname} && C4::Context->preference('uppercasesurnames')) { |
254 |
$newdata{'surname'} = uc($newdata{'surname'}); |
257 |
$newdata{'surname'} = uc($newdata{'surname'}); |
Lines 396-402
if ( $op eq "duplicate" ) {
Link Here
|
396 |
$template->param( step_1 => 1, step_2 => 1, step_3 => 1, step_4 => 1, step_5 => 1, step_6 => 1 ) unless $step; |
399 |
$template->param( step_1 => 1, step_2 => 1, step_3 => 1, step_4 => 1, step_5 => 1, step_6 => 1 ) unless $step; |
397 |
} |
400 |
} |
398 |
|
401 |
|
399 |
# my $cardnumber=$data{'cardnumber'}; |
|
|
400 |
$data{'cardnumber'}=fixup_cardnumber($data{'cardnumber'}) if $op eq 'add'; |
402 |
$data{'cardnumber'}=fixup_cardnumber($data{'cardnumber'}) if $op eq 'add'; |
401 |
if(!defined($data{'sex'})){ |
403 |
if(!defined($data{'sex'})){ |
402 |
$template->param( none => 1); |
404 |
$template->param( none => 1); |
403 |
- |
|
|