From f5f4d98dcdad9efac7b4e7cb018cab631732e1e8 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Thu, 27 Jul 2023 20:32:14 +0000 Subject: [PATCH] Bug 34438: Add lang field to OPAC patron self registration form Signed-off-by: David Nind --- .../bootstrap/en/modules/opac-memberentry.tt | 32 ++++++++++++++++++- opac/opac-memberentry.pl | 9 ++++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt index fd9587ce3d8..fc7d10ff26a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt @@ -210,7 +210,7 @@
- [% FOREACH field = ['streetnumber' 'streettype' 'cardnumber' 'branchcode' 'categorycode' 'title' 'surname' 'firstname' 'middle_name' 'dateofbirth' 'initials' 'pronouns' 'othernames' 'address' 'address2' 'city' 'state' 'zipcode' 'country' 'phone' 'phonepro' 'mobile' 'email' 'emailpro' 'fax' 'B_streettype' 'B_streetnumber' 'B_address' 'B_address2' 'B_city' 'B_state' 'B_zipcode' 'B_country' 'B_phone' 'B_email' 'contactnote' 'altcontactsurname' 'altcontactfirstname' 'altcontactaddress1' 'altcontactaddress2' 'altcontactaddress3' 'altcontactstate' 'altcontactzipcode' 'altcontactcountry' 'altcontactphone' 'password' ] %] + [% FOREACH field = ['streetnumber' 'streettype' 'cardnumber' 'branchcode' 'categorycode' 'title' 'surname' 'firstname' 'middle_name' 'dateofbirth' 'initials' 'pronouns' 'othernames' 'address' 'address2' 'city' 'state' 'zipcode' 'country' 'phone' 'phonepro' 'mobile' 'email' 'emailpro' 'fax' 'B_streettype' 'B_streetnumber' 'B_address' 'B_address2' 'B_city' 'B_state' 'B_zipcode' 'B_country' 'B_phone' 'B_email' 'contactnote' 'altcontactsurname' 'altcontactfirstname' 'altcontactaddress1' 'altcontactaddress2' 'altcontactaddress3' 'altcontactstate' 'altcontactzipcode' 'altcontactcountry' 'altcontactphone' 'password' 'lang' ] %] [% IF mandatory.defined( field ) %] [% SET required.$field = 'required' %] [% END %] @@ -679,6 +679,36 @@ [% IF ( mandatory.defined('primary_contact_method') ) %]Required[% END %] + [% UNLESS hidden.defined('lang') %] +
  • + [% IF ( mandatory.defined('lang') ) %] + + [% ELSE %] + + [% END %] + + [% IF ( mandatory.defined('lang') ) %]
    Required
    [% END %] +
  • + [% END %] [% END %] diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index 56743e97d85..74e7cb9f31e 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -100,13 +100,18 @@ if ( defined $min ) { ); } +my $defaultCategory = Koha::Patron::Categories->find(C4::Context->preference('PatronSelfRegistrationDefaultCategory')); + +my $translated_languages = C4::Languages::getTranslatedLanguages( 'opac', C4::Context->preference('template') ); + $template->param( action => $action, hidden => GetHiddenFields( $mandatory, $action ), mandatory => $mandatory, libraries => $libraries, OPACPatronDetails => C4::Context->preference('OPACPatronDetails'), - defaultCategory => $defaultCategory, + defaultCategory => $defaultCategory, + languages => $translated_languages, ); my $attributes = ParsePatronAttributes($borrowernumber,$cgi); @@ -569,7 +574,7 @@ sub ParseCgiForBorrower { # Replace checkbox 'agreed' by datetime in gdpr_proc_consent $borrower{gdpr_proc_consent} = dt_from_string if $borrower{gdpr_proc_consent} && $borrower{gdpr_proc_consent} eq 'agreed'; - delete $borrower{$_} for qw/borrowernumber date_renewed debarred debarredcomment flags privacy privacy_guarantor_fines privacy_guarantor_checkouts checkprevcheckout updated_on lastseen lang login_attempts overdrive_auth_token anonymized/; # See also members/memberentry.pl + delete $borrower{$_} for qw/borrowernumber date_renewed debarred debarredcomment flags privacy privacy_guarantor_fines privacy_guarantor_checkouts checkprevcheckout updated_on lastseen login_attempts overdrive_auth_token anonymized/; # See also members/memberentry.pl delete $borrower{$_} for qw/dateenrolled dateexpiry borrowernotes opacnote sort1 sort2 sms_provider_id autorenew_checkouts gonenoaddress lost relationship/; # On OPAC only delete $borrower{$_} for split( /\s*\|\s*/, C4::Context->preference('PatronSelfRegistrationBorrowerUnwantedField') || q{} ); -- 2.30.2