Lines 254-260
elsif ( $action eq 'update' ) {
Link Here
|
254 |
} |
254 |
} |
255 |
else { |
255 |
else { |
256 |
my %borrower_changes = DelUnchangedFields( $borrowernumber, %borrower ); |
256 |
my %borrower_changes = DelUnchangedFields( $borrowernumber, %borrower ); |
257 |
my $extended_attributes_changes = FilterUnchagedAttributes( $borrowernumber, $attributes ); |
257 |
my $extended_attributes_changes = FilterUnchangedAttributes( $borrowernumber, $attributes ); |
258 |
|
258 |
|
259 |
if ( %borrower_changes || scalar @{$extended_attributes_changes} > 0 ) { |
259 |
if ( %borrower_changes || scalar @{$extended_attributes_changes} > 0 ) { |
260 |
( $template, $borrowernumber, $cookie ) = get_template_and_user( |
260 |
( $template, $borrowernumber, $cookie ) = get_template_and_user( |
Lines 317-322
elsif ( $action eq 'edit' ) { #Display logged in borrower's data
Link Here
|
317 |
|
317 |
|
318 |
$template->param( patron_attribute_classes => GeneratePatronAttributesForm( $borrowernumber ) ); |
318 |
$template->param( patron_attribute_classes => GeneratePatronAttributesForm( $borrowernumber ) ); |
319 |
} else { |
319 |
} else { |
|
|
320 |
# Render self-registration page |
320 |
$template->param( patron_attribute_classes => GeneratePatronAttributesForm() ); |
321 |
$template->param( patron_attribute_classes => GeneratePatronAttributesForm() ); |
321 |
} |
322 |
} |
322 |
|
323 |
|
Lines 474-480
sub DelEmptyFields {
Link Here
|
474 |
return %borrower; |
475 |
return %borrower; |
475 |
} |
476 |
} |
476 |
|
477 |
|
477 |
sub FilterUnchagedAttributes { |
478 |
sub FilterUnchangedAttributes { |
478 |
my ( $borrowernumber, $entered_attributes ) = @_; |
479 |
my ( $borrowernumber, $entered_attributes ) = @_; |
479 |
|
480 |
|
480 |
my @patron_attributes = grep {$_->opac_editable} Koha::Patron::Attributes->search({ borrowernumber => $borrowernumber })->as_list; |
481 |
my @patron_attributes = grep {$_->opac_editable} Koha::Patron::Attributes->search({ borrowernumber => $borrowernumber })->as_list; |
Lines 574-580
sub GeneratePatronAttributesForm {
Link Here
|
574 |
# If editable, make sure there's at least one empty entry, |
575 |
# If editable, make sure there's at least one empty entry, |
575 |
# to make the template's job easier |
576 |
# to make the template's job easier |
576 |
values => $attr_values{ $attr_type->code() } || [''] |
577 |
values => $attr_values{ $attr_type->code() } || [''] |
577 |
}; |
578 |
} |
|
|
579 |
unless !defined $attr_values{ $attr_type->code() } |
580 |
and !$attr_type->opac_editable; |
578 |
} |
581 |
} |
579 |
|
582 |
|
580 |
# Finally, build a list of containing classes |
583 |
# Finally, build a list of containing classes |
581 |
- |
|
|