@@ -, +, @@ in borrower self-registration --- opac/opac-memberentry.pl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) --- a/opac/opac-memberentry.pl +++ a/opac/opac-memberentry.pl @@ -58,7 +58,7 @@ if ( $action eq q{} ) { $template->param( action => $action, - hidden => GetHiddenFields(), + hidden => GetHiddenFields($action), mandatory => GetMandatoryFields($action), member_titles => GetTitles() || undef, branches => GetBranchesLoop(), @@ -229,15 +229,21 @@ $template->param( output_html_with_http_headers $cgi, $cookie, $template->output; sub GetHiddenFields { + my ($action) = @_; my %hidden_fields; my $BorrowerUnwantedField = C4::Context->preference("PatronSelfRegistrationBorrowerUnwantedField"); + #Fetch the mandatory fields to compare against hidden fields + my @mandatory_fields = keys %{GetMandatoryFields($action)}; + my @fields = split( /\|/, $BorrowerUnwantedField ); - foreach (@fields) { - next unless m/\w/o; - $hidden_fields{$_} = 1; + foreach my $field (@fields) { + next unless $field =~ m/\w/o; + #Don't hide mandatory fields + next if grep { $_ eq $field } @mandatory_fields; + $hidden_fields{$field} = 1; } return \%hidden_fields; --