Lines 177-190
if ( $op eq 'modify' or $op eq 'save' or $op eq 'duplicate' ) {
Link Here
|
177 |
|
177 |
|
178 |
my $categorycode = $input->param('categorycode') || $borrower_data->{'categorycode'}; |
178 |
my $categorycode = $input->param('categorycode') || $borrower_data->{'categorycode'}; |
179 |
my $category_type = $input->param('category_type') || ''; |
179 |
my $category_type = $input->param('category_type') || ''; |
180 |
my $category; |
180 |
|
181 |
if ( !$category_type && $categorycode ) { |
181 |
my $category = Koha::Patron::Categories->find($categorycode); |
182 |
$category = Koha::Patron::Categories->find($categorycode); |
182 |
$category_type ||= $category && $category->category_type; |
183 |
$category_type = $category->category_type; |
183 |
|
184 |
$template->param( patron_category => $category ); |
|
|
185 |
} |
186 |
$category_type="A" unless $category_type; # FIXME we should display a error message instead of a 500 error ! |
184 |
$category_type="A" unless $category_type; # FIXME we should display a error message instead of a 500 error ! |
187 |
|
185 |
|
|
|
186 |
$template->param( patron_category => $category ); |
187 |
|
188 |
# if a add or modify is requested => check validity of data. |
188 |
# if a add or modify is requested => check validity of data. |
189 |
%data = %$borrower_data if ($borrower_data); |
189 |
%data = %$borrower_data if ($borrower_data); |
190 |
|
190 |
|
Lines 354-361
if ($op eq 'save' || $op eq 'insert'){
Link Here
|
354 |
if ( $dateofbirth ) { |
354 |
if ( $dateofbirth ) { |
355 |
my $patron = Koha::Patron->new({ dateofbirth => $dateofbirth }); |
355 |
my $patron = Koha::Patron->new({ dateofbirth => $dateofbirth }); |
356 |
my $age = $patron->get_age; |
356 |
my $age = $patron->get_age; |
357 |
my $borrowercategory = Koha::Patron::Categories->find($categorycode); |
357 |
my ($low,$high) = ($category->dateofbirthrequired, $category->upperagelimit); |
358 |
my ($low,$high) = ($borrowercategory->dateofbirthrequired, $borrowercategory->upperagelimit); |
|
|
359 |
if (($high && ($age > $high)) or ($age < $low)) { |
358 |
if (($high && ($age > $high)) or ($age < $low)) { |
360 |
push @errors, 'ERROR_age_limitations'; |
359 |
push @errors, 'ERROR_age_limitations'; |
361 |
$template->param( age_low => $low); |
360 |
$template->param( age_low => $low); |
Lines 385-391
if ($op eq 'save' || $op eq 'insert'){
Link Here
|
385 |
push @errors, "ERROR_password_mismatch" if ( $password ne $password2 ); |
384 |
push @errors, "ERROR_password_mismatch" if ( $password ne $password2 ); |
386 |
|
385 |
|
387 |
if ( $password and $password ne '****' ) { |
386 |
if ( $password and $password ne '****' ) { |
388 |
my ( $is_valid, $error ) = Koha::AuthUtils::is_password_valid( $password, Koha::Patron::Categories->find($categorycode) ); |
387 |
my ( $is_valid, $error ) = Koha::AuthUtils::is_password_valid( $password, $category ); |
389 |
unless ( $is_valid ) { |
388 |
unless ( $is_valid ) { |
390 |
push @errors, 'ERROR_password_too_short' if $error eq 'too_short'; |
389 |
push @errors, 'ERROR_password_too_short' if $error eq 'too_short'; |
391 |
push @errors, 'ERROR_password_too_weak' if $error eq 'too_weak'; |
390 |
push @errors, 'ERROR_password_too_weak' if $error eq 'too_weak'; |
Lines 823-829
if (C4::Context->preference('EnhancedMessagingPreferences')) {
Link Here
|
823 |
} |
822 |
} |
824 |
|
823 |
|
825 |
$template->param( borrower_data => \%data ); |
824 |
$template->param( borrower_data => \%data ); |
826 |
$template->param( "show_guarantor" => $categorycode ? Koha::Patron::Categories->find($categorycode)->can_be_guarantee : 1); # associate with step to know where you are |
825 |
$template->param( "show_guarantor" => $category ? $category->can_be_guarantee : 1); # associate with step to know where you are |
827 |
$template->param( "step_$step" => 1) if $step; # associate with step to know where u are |
826 |
$template->param( "step_$step" => 1) if $step; # associate with step to know where u are |
828 |
$template->param( step => $step ) if $step; # associate with step to know where u are |
827 |
$template->param( step => $step ) if $step; # associate with step to know where u are |
829 |
|
828 |
|
830 |
- |
|
|