Bug 18112: Add street type to self reg/self mod form
authorLucas Gass <lucas@bywatersolutions.com>
Tue, 4 May 2021 20:48:18 +0000 (20:48 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 11 May 2021 13:13:28 +0000 (15:13 +0200)
1. Add some values to the ROADTYPE authorized value
2. Go to PatronSelfRegistrationBorrowerUnwantedField and make sure
   streettype is NOT checked
3. Go the self reg form, no street type field
4. Apply patch
5. Check the self reg form, streettype should be there with all the
   options defined in ROADTYPE a.v.
6. Check the self modification form, street type should be there.
7. Make sure PatronSelfRegistrationBorrowerUnwantedField and
   PatronSelfModificationBorrowerUnwantedField hide the field correctly.
8. Make sure PatronSelfRegistrationBorrowerMandatoryField properly makes
   the field required.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt
opac/opac-memberentry.pl

index af7280a..206fe21 100644 (file)
 
                 <form method="post" action="/cgi-bin/koha/opac-memberentry.pl" id="memberentry-form" autocomplete="off">
 
-                [% FOREACH field = ['streetnumber' 'cardnumber' 'branchcode' 'categorycode' 'title' 'surname' 'firstname' 'dateofbirth' 'initials' 'othernames' 'address' 'address2' 'city' 'state' 'zipcode' 'country' 'phone' 'phonepro' 'mobile' 'email' 'emailpro' 'fax' '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' 'dateofbirth' 'initials' 'othernames' 'address' 'address2' 'city' 'state' 'zipcode' 'country' 'phone' 'phonepro' 'mobile' 'email' 'emailpro' 'fax' '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 %]
                                     <ol>
                                         [% IF Koha.Preference('AddressFormat') != 'de' %][% INCLUDE streetnumber %][% END %]
 
+                                        [% IF roadtypes %]
+                                            [% UNLESS hidden.defined('streettype') %]
+                                                <li>
+                                                    <label for="borrower_streettype" class="[% required.streettype | html %]">Street type:</label>
+
+                                                    <select name="borrower_streettype" name="borrower_streettype">
+                                                        <option value=""></option>
+                                                        [% FOR roadtype IN roadtypes %]
+                                                            [% IF roadtype.authorised_value == patron.streettype %]
+                                                                <option value="[% roadtype.authorised_value | html %]" selected="selected">[% roadtype.lib | html %]</option>
+                                                            [% ELSE %]
+                                                                <option value="[% roadtype.authorised_value | html %]">[% roadtype.lib | html %]</option>
+                                                            [% END %]
+                                                        [% END %]
+                                                    </select>
+                                                    <div class="required_label [% required.streettype | html %]">Required</div>
+                                                </li>
+                                            [% END %]
+                                        [% END %]
+
                                         [% UNLESS hidden.defined('address') %]
                                             <li>
                                                 <label for="borrower_address" class="[% required.address | html %]">Address:</label>
index 17f2b48..0cd16d9 100755 (executable)
@@ -44,7 +44,7 @@ use Koha::Patron::Modification;
 use Koha::Patron::Modifications;
 use Koha::Patron::Categories;
 use Koha::Token;
-
+use Koha::AuthorisedValues;
 my $cgi = CGI->new;
 my $dbh = C4::Context->dbh;
 
@@ -118,6 +118,11 @@ foreach my $attr (@$attributes) {
     }
 }
 
+my $roadtypes = C4::Koha::GetAuthorisedValues( 'ROADTYPE' );
+$template->param(
+    roadtypes => $roadtypes,
+);
+
 if ( $action eq 'create' ) {
 
     my %borrower = ParseCgiForBorrower($cgi);