Bug 25590: Street number is missing from the alternate address in the OPAC
authorKatrin Fischer <katrin.fischer.83@web.de>
Sun, 26 Feb 2023 11:59:56 +0000 (11:59 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Fri, 31 Mar 2023 16:46:55 +0000 (18:46 +0200)
This patch adds the street number field to the alternate address
section in the OPAC, matching the layout of the address in the
staff interface.

To test:

1) Check that you are unable to add a street number to the Alternate
address when logged into the OPAC
2) Apply the patch
3) Check that you can now add and edit the streetnumber field.
4) Check that it also works correctly in patron self-registration.
5) Make the field mandatory and verify this works as expected
   (PatronSelfRegistrationBorrowerMandatoryField and PatronSelfModificationBorrowerMandatoryField)
6) Hide the field from the form
   (PatronSelfRegistrationBorrowerUnwantedField and PatronSelfModificationBorrowerUnwantedField)
7) Change the AddressFormat system preference to German
8) Verify that the street number field moved after the first address line matching
   the first address in the form.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt

index c49cc04..a21d631 100644 (file)
         </li>
     [% END %]
 [% END %]
+[% BLOCK B_streetnumber %]
+    [% UNLESS hidden.defined('B_streetnumber') %]
+        <li>
+            <label for="borrower_B_streetnumber" class="[% required.B_streetnumber | html %]">Street number:</label>
+
+            <input type="text" id="borrower_B_streetnumber" name="borrower_B_streetnumber" value="[% borrower.B_streetnumber | html %]" class="[% required.B_streetnumber | html %]" size="5" maxlength="10" />
+            <div class="required_label [% required.B_streetnumber | html %]">Required</div>
+        </li>
+    [% END %]
+[% END %]
 
 [% INCLUDE 'doc-head-open.inc' %]
     <title>[% IF action == 'edit' %]Update your personal details[% ELSE %]Register a new account[% END %] &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
 
                 <form method="post" action="/cgi-bin/koha/opac-memberentry.pl" id="memberentry-form" autocomplete="off">
 
-                [% 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_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' ] %]
                     [% IF mandatory.defined( field ) %]
                         [% SET required.$field = 'required' %]
                     [% END %]
                     [% END %]
 
                     [%# Following on one line for translatability %]
-                    [% UNLESS hidden.defined('B_address') && hidden.defined('B_address2') && hidden.defined('B_city') && hidden.defined('B_state') && hidden.defined('B_zipcode') && hidden.defined('B_country') && hidden.defined('B_phone') && hidden.defined('B_email') && hidden.defined('contactnote') %]
+                    [% UNLESS hidden.defined('B_streetnumber') && hidden.defined('B_address') && hidden.defined('B_address2') && hidden.defined('B_city') && hidden.defined('B_state') && hidden.defined('B_zipcode') && hidden.defined('B_country') && hidden.defined('B_phone') && hidden.defined('B_email') && hidden.defined('contactnote') %]
                         <div class="row">
                             <div class="col">
                                 <fieldset class="rows" id="memberentry_alternateaddress">
                                     <legend id="alternateaddress_legend">Alternate address</legend>
 
                                     <ol>
+                                        [% IF Koha.Preference('AddressFormat') != 'de' %][% INCLUDE B_streetnumber %][% END %]
+
                                         [% SET roadtypes = AuthorisedValues.GetAuthValueDropbox('ROADTYPE') %]
                                         [% IF roadtypes.count %]
                                             [% UNLESS hidden.defined('B_streettype') %]
                                             </li>
                                         [% END %]
 
+                                        [% IF Koha.Preference('AddressFormat') == 'de' %][% INCLUDE streetnumber %][% END %]
+
                                         [% UNLESS hidden.defined('B_address2') %]
                                             <li>
                                                 <label for="borrower_B_address2" class="[% required.B_address | html %]">Address 2:</label>