From 1edb6ef9ff3d8750757e48ef91d4c7c9dc872b8b Mon Sep 17 00:00:00 2001
From: Owen Leonard <oleonard@myacpl.org>
Date: Tue, 3 Sep 2019 18:31:03 +0000
Subject: [PATCH] Bug 23512: (follow-up) Add markup comments

This patch adds comments to the template to highlight the markup
structure.

This patch should have no effect on the interface or functionality.

https://bugs.koha-community.org/show_bug.cgi?id=23533
Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
---
 .../prog/en/modules/members/memberentrygen.tt      | 210 +++++++++++----------
 1 file changed, 106 insertions(+), 104 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
index 67823dd..770fada 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
@@ -65,8 +65,8 @@
                     [% IF ( S ) %] Staff [% END %]
                 [% END %])
             </strong>
-        [% END %]
-    </div>
+        [% END # /UNLESS blocking_error %]
+    </div> <!-- /#breadcrumbs -->
 
     <div class="main container-fluid">
         <div class="row">
@@ -101,8 +101,10 @@
                             [% ELSE %]
                                 Modify patron
                             [% END %]
+
                             [% IF (firstname) %] [% firstname | html %] [% END %]
                             [% IF (surname) %] [% surname | html %] [% END %]
+
                             ([% IF ( categoryname ) %]
                                 [% categoryname | html %]
                             [% ELSE %]
@@ -129,7 +131,7 @@
                                 <button type="submit" id="not-duplicate" class="new"><i class="fa fa-plus"></i> Not a duplicate.
                                 Save as new record</button>
                             </div>
-                        [% END %]
+                        [% END # /IF check_member %]
 
                         [% IF ( nok ) %]
                             <div class="dialog alert">
@@ -185,8 +187,8 @@
                                         <li id="ERROR_bad_email_alternative">The alternative email is invalid.</li>
                                     [% END %]
                                 </ul>
-                            </div>
-                        [% END %]
+                            </div> <!-- /.dialog.alert -->
+                        [% END # /IF nok %]
 
                         <div id="toolbar" class="btn-toolbar">
                             [% UNLESS ( check_member ) %]
@@ -201,8 +203,8 @@
                                 [% END %]
                                     <i class="fa fa-times"></i> Cancel
                                 </a>
-                            [% END %]
-                        </div>
+                            [% END # /UNLESS check_member %]
+                        </div> <!-- /#toolbar -->
 
                         <form name="form" id="entryform"  action="/cgi-bin/koha/members/memberentry.pl" method="post" autocomplete="off" class="toggler" >
                             [% UNLESS ( check_member ) %]
@@ -232,7 +234,7 @@
                                         <input type="hidden" name="cardnumber" value="[% cardnumber | html %]" />
                                     [% END %]
                                 [% END %]
-                            [% END %]
+                            [% END # /IF opadd %]
 
                             [% IF ( step_1 ) %]
                                 [% UNLESS notitle && nosurname && nofirstname && nodateofbirth && noinitials && noothernames && nosex %]
@@ -262,9 +264,9 @@
                                                             </select>
                                                         [% IF ( mandatorytitle ) %]<span class="required">Required</span>[% END %]
                                                         </li>
-                                                    [% END %]
-                                                [% END %]
-                                            [% END %]
+                                                    [% END # /IF BorrowersTitles %]
+                                                [% END # /UNLESS notitle %]
+                                            [% END # /UNLESS I %]
 
                                             [% UNLESS nosurname %]
                                                 <li>
@@ -289,7 +291,7 @@
                                                     [% END %]
                                                     [% IF ( mandatorysurname ) %]<span class="required">Required</span>[% END %]
                                                 </li>
-                                            [% END %]
+                                            [% END # /UNLESS nosurname %]
 
                                             [% UNLESS ( I ) %]
                                                 [% UNLESS nofirstname %]
@@ -304,7 +306,7 @@
                                                         <input type="text" id="firstname" name="firstname" size="20"  value="[% firstname | html UNLESS opduplicate %]" />
                                                         [% IF ( mandatoryfirstname ) %]<span class="required">Required</span>[% END %]
                                                     </li>
-                                                [% END %]
+                                                [% END # /UNLESS nofirstname %]
 
                                                 [% UNLESS nodateofbirth %]
                                                     <li>
@@ -320,7 +322,7 @@
                                                         [% IF ( ERROR_dateofbirth ) %]<span class="required">(Error)</span>[% END %]
                                                         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
                                                     </li>
-                                                [% END %]
+                                                [% END # /UNLESS nodateofbirth %]
 
                                                 [% UNLESS noinitials %]
                                                     <li>
@@ -334,8 +336,8 @@
                                                         <input type="text" id="initials" name="initials" size="20"  value="[% initials | html UNLESS opduplicate %]" />
                                                         [% IF ( mandatoryinitials ) %]<span class="required">Required</span>[% END %]
                                                     </li>
-                                                [% END %]
-                                            [% END %]
+                                                [% END # /UNLESS noinitials %]
+                                            [% END # /UNLESS I %]
 
                                             [% UNLESS noothernames %]
                                                 <li>
@@ -350,7 +352,7 @@
                                                     [% IF ( mandatoryothernames ) %]<span class="required">Required</span>[% END %]
                                                     [% IF ( I ) %]<input type="hidden" name="sex" value="N" />[% END %]
                                                 </li>
-                                            [% END %]
+                                            [% END # /UNLESS noothernames %]
 
                                             [% UNLESS ( I ) %]
                                                 [% UNLESS nosex %]
@@ -375,12 +377,12 @@
                                                             <label for="sex-female">Female </label><input type="radio" name="sex" id="sex-female" value="F" />
                                                             <label for="sex-male">Male </label><input type="radio" name="sex" id="sex-male" value="M" />
                                                             <label for="sex-none">None specified </label><input type="radio" name="sex" id="sex-none" value="" checked="checked" />
-                                                        [% END %]
+                                                        [% END # /UNLESS ( opduplicate ) %]
                                                     </li>
-                                                [% END %]
-                                            [% END %]
+                                                [% END # /UNLESS nosex %]
+                                            [% END # /UNLESS ( I ) %]
                                         </ol>
-                                    </fieldset>
+                                    </fieldset> <!-- /#memberentry_identity -->
                                 [% END # hide fieldset %]
 
                                 [% IF show_guarantor || guarantor %]
@@ -427,11 +429,11 @@
                                                                 <label for="delete_guarantor-[% r.id | uri %]">Remove: </label>
                                                                 <input type="checkbox" id="delete_guarantor-[% r.id | uri %]" name="delete_guarantor" value="[% r.id | html %]" />
                                                             </li>
-                                                        [% END %]
+                                                        [% END # /IF category_type == 'I' %]
                                                     </ol>
-                                                </fieldset>
+                                                </fieldset> <!-- /.rows -->
                                             [% END # END relationships foreach %]
-                                        </span>
+                                        </span> <!-- /#guarantor_relationships -->
 
                                         <fieldset class="rows guarantor" id="guarantor_template">
                                             <ol>
@@ -465,7 +467,7 @@
                                                     <span><a href="#" class="guarantor_cancel">Remove</a></span>
                                                 </li>
                                             </ol>
-                                        </fieldset>
+                                        </fieldset> <!-- /#guarantor_template -->
 
                                         <ol>
                                             <input type="hidden" id="guarantor_id" value="" />
@@ -492,8 +494,8 @@
                                                 </li>
                                             [% END %]
                                         </ol>
-                                    </fieldset>
-                                [% END %]
+                                    </fieldset> <!-- /.row -->
+                                [% END # /IF show_guarantor || guarantor %]
 
 
                                 [% UNLESS noaddress && noaddress2 && nocity && nostate && nozipcode && nocountry %]
@@ -519,7 +521,7 @@
                                                     [% IF ( mandatorycontactname ) %]<span class="required">Required</span>[% END %]
                                                     <div class="hint">Non-patron guarantor surname</div>
                                                 </li>
-                                            [% END %]
+                                            [% END # /UNLESS nocontactname %]
 
                                             [% UNLESS nocontactfirstname %]
                                                 <li>
@@ -533,7 +535,7 @@
                                                     [% IF ( mandatorycontactfirstname ) %]<span class="required">Required</span>[% END %]
                                                     <div class="hint">Non-patron guarantor first name</div>
                                                 </li>
-                                            [% END %]
+                                            [% END # /UNLESS nocontactfirstname %]
 
                                             [% UNLESS norelationship %]
                                                 [% IF possible_relationships %]
@@ -550,8 +552,8 @@
                                                             [% END %]
                                                         </select>
                                                     </li>
-                                                [% END %]
-                                            [% END %]
+                                                [% END # /IF possible_relationships %]
+                                            [% END # /UNLESS norelationship %]
 
                                             [% UNLESS nophone %]
                                                 <li>
@@ -565,7 +567,7 @@
                                                     [% IF ( mandatoryphone ) %]<span class="required">Required</span>[% END %]
                                                     <div class="hint">Shows on transit slips</div>
                                                 </li>
-                                            [% END %]
+                                            [% END # UNLESS nophone %]
 
                                             [% UNLESS nophonepro %]
                                                 <li>
@@ -578,7 +580,7 @@
                                                     <input type="text" id="phonepro" name="phonepro" value="[% phonepro | html %]" />
                                                     [% IF ( mandatoryphonepro ) %]<span class="required">Required</span>[% END %]
                                                 </li>
-                                            [% END %]
+                                            [% END # /UNLESS nophonepro %]
 
                                             [% UNLESS nomobile %]
                                                 <li>
@@ -591,7 +593,7 @@
                                                     <input type="text" id="mobile" name="mobile" value="[% mobile | html %]" />
                                                     [% IF ( mandatorymobile ) %]<span class="required">Required</span>[% END %]
                                                 </li>
-                                            [% END %]
+                                            [% END # /UNLESS nomobile %]
 
                                             [% UNLESS noemail %]
                                                 <li>
@@ -604,7 +606,7 @@
                                                     <input type="text" id="email" name="email" size="45" value="[% email | html %]" />
                                                     [% IF ( mandatoryemail ) %]<span class="required">Required</span>[% END %]<div class="hint">Shows on transit slips</div>
                                                 </li>
-                                            [% END %]
+                                            [% END # /UNLESS noemail %]
 
                                             [% UNLESS noemailpro %]
                                                 <li>
@@ -617,7 +619,7 @@
                                                     <input type="text" id="emailpro" name="emailpro" size="45" value="[% emailpro | html %]" />
                                                     [% IF ( mandatoryemailpro ) %]<span class="required">Required</span>[% END %]
                                                 </li>
-                                            [% END %]
+                                            [% END # /UNLESS noemailpro %]
 
                                             [% UNLESS nofax %]
                                                 <li>
@@ -630,13 +632,13 @@
                                                     <input type="text" id="fax" name="fax" value="[% fax | html %]" />
                                                     [% IF ( mandatoryfax ) %]<span class="required">Required</span>[% END %]
                                                 </li>
-                                            [% END %]
+                                            [% END # /UNLESS nofax %]
                                         </ol>
-                                    </fieldset>
-                                [% END # hide fieldset %]
+                                    </fieldset> <!-- /#memberentry_contact -->
+                                [% END # /UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %]
 
                             <!-- ************************ STEP_1 *********************** -->
-                            [% END %]
+                            [% END # /IF ( step_1 ) %]
 
                             [% IF ( step_6 ) %]
                                 [% UNLESS noB_address && noB_address2 && noB_city && noB_zipcode && noB_state && noB_country &&nocontactnote && noB_phone && noB_email %]
@@ -647,7 +649,7 @@
                                             [% INCLUDE 'member-alt-address-style-us.inc' %]
                                      [% END %]
                                 [% END # UNLESS noB_address && noB_city && noB_state && noB_phone && noB_email %]
-                            [% END %]
+                            [% END # / IF ( step_6 ) %]
 
                             [% IF ( step_2 ) %]
                                 [% UNLESS noaltcontactsurname && noaltcontactfirstname && noaltcontactaddress1 && noaltcontactaddress2 && noaltcontactaddress3 && noaltcontactstate && noaltcontactzipcode && noaltcontactcountry && noaltcontactphone %]
@@ -658,7 +660,7 @@
                                             [% INCLUDE 'member-alt-contact-style-us.inc' %]
                                     [% END %]
                                 [% END # UNLESS noaltcontactsurname && noaltcontactfirstname etc %]
-                            [% END %]
+                            [% END # /IF ( step_2 ) %]
 
                             [% IF ( step_3 ) %]
                                 [% SET autoMemberNum = Koha.Preference('autoMemberNum') %]
@@ -695,7 +697,7 @@
                                                       <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" />
                                                       [% IF mandatorycardnumber %]<span class="required">Required</span>[% END %]
                                                       <div class="hint">There is no minimum or maximum character length.
-                                                [% END %]
+                                                [% END # /IF minlength_cardnumber == maxlength_cardnumber %]
                                                 [% IF autoMemberNum %]
                                                       [% IF mandatorycardnumber %]
                                                           <br/><span class="error">AutoMemberNum is set to enabled, but cardnumber is marked as mandatory in BorrowerMandatoryField: auto calc has been disabled.</span>
@@ -703,9 +705,9 @@
                                                           <br/>Leave blank for auto calc during registration
                                                       [% END %]
                                                 [% END %]
-                                                </div><!--/hint div -->
+                                                </div><!-- /.hint -->
                                             </li>
-                                        [% END %]
+                                        [% END # /UNLESS nocardnumber %]
 
                                         [% UNLESS nobranchcode %]
                                             <li>
@@ -756,7 +758,7 @@
                                                 [% PROCESS 'av-build-dropbox.inc' name="sort1", category="Bsort1", default=sort1, size = 20 %]
                                                 [% IF ( mandatorysort1 ) %]<span class="required">Required</span>[% END %]
                                             </li>
-                                        [% END %]
+                                        [% END # /UNLESS nosort1 %]
 
                                         [% UNLESS nosort2 %]
                                             <li>
@@ -770,7 +772,7 @@
                                                 [% PROCESS 'av-build-dropbox.inc' name="sort2", category="Bsort2", default=sort2, size = 20 %]
                                                 [% IF ( mandatorysort2 ) %]<span class="required">Required</span>[% END %]
                                             </li>
-                                        [% END %]
+                                        [% END # /UNLESS nosort2 %]
 
                                         [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
                                             <li>
@@ -789,9 +791,9 @@
                                                         <option value="no">No if settings allow it</option>
                                                         <option value="inherit" selected="selected">Inherit from settings</option>
                                                     [% END %]
-                                                </select>
+                                                </select> <!-- /#checkprevcheckout -->
                                            </li>
-                                        [% END %]
+                                        [% END # /IF CheckPrevCheckout %]
 
                                         [% IF Koha.Preference('TranslateNotices') %]
                                             <li>
@@ -805,21 +807,21 @@
                                                                     <option value="[% sublanguage.rfc4646_subtag | html %]" selected="selected">[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
                                                                 [% ELSE %]
                                                                     <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] [% sublanguage.region_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
-                                                                [% END %]
+                                                                [% END # /IF sublanguage.rfc4646_subtag %]
                                                             [% ELSE %]
                                                                 [% IF sublanguage.rfc4646_subtag == lang %]
                                                                     <option value="[% sublanguage.rfc4646_subtag | html %]" selected="selected">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
                                                                 [% ELSE %]
                                                                     <option value="[% sublanguage.rfc4646_subtag | html %]">[% sublanguage.native_description | html %] ([% sublanguage.rfc4646_subtag | html %])</option>
-                                                                [% END %]
-                                                            [% END %]
-                                                        [% END %]
-                                                    [% END %]
-                                                </select>
+                                                                [% END # /IF sublanguage.rfc4646_subtag %]
+                                                            [% END # /language.plural %]
+                                                        [% END #/FOR sublanguage %]
+                                                    [% END # /FOR language %]
+                                                </select> <!-- /#lang -->
                                             </li>
-                                        [% END %]
+                                        [% END # /IF Koha.Preference('TranslateNotices') %]
                                     </ol>
-                                </fieldset>
+                                </fieldset> <!-- /#memberentry_library_management -->
 
                                 [% UNLESS nodateenrolled &&  noopacnote && noborrowernotes %]
                                     <fieldset class="rows" id="memberentry_subscription">
@@ -838,12 +840,12 @@
                                                         <input type="text" id="from" name="dateenrolled" maxlength="10" size="10" onchange="CheckDate(document.form.dateenrolled);check_manip_date('verify');" value="[% dateenrolled | html %]" class="datepickerfrom" />
                                                     [% ELSE %]
                                                         <input type="text" id="from" name="dateenrolled"  maxlength="10" size="10" value="[% dateenrolled | html %]" class="datepickerfrom" />
-                                                    [% END %]
+                                                    [% END # /IF dateformat metric %]
                                                     [% IF ( mandatorydateenrolled ) %]<span class="required">Required</span>[% END %]
                                                     [% IF ( ERROR_dateenrolled ) %]<span class="required">(Error)</span>[% END %]
                                                     <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
                                                 </li>
-                                            [% END %]
+                                            [% END # /UNLESS nodateenrolled %]
 
                                             [% UNLESS nodateexpiry %]
                                                 <li>
@@ -870,7 +872,7 @@
                                                     [% ELSE %]
                                                         <input type="text" id="to" name="dateexpiry" maxlength="10"  size="10" value="[% dateexpiry | html %]" class="datepickerto" />
                                                     [% END %]
-                                                [% END %]
+                                                [% END # /IF dateformat metric %]
                                                 [% IF ( mandatorydateexpiry ) %]<span class="required">Required</span>[% END %]
                                                 [% IF ( ERROR_dateexpiry ) %]<span class="required">(Error)</span>[% END %]
                                                 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
@@ -889,7 +891,7 @@
                                                     <div class="hint">This message appears on this patron's user page in the OPAC</div>
                                                     [% IF ( mandatoryopacnote ) %]<span class="required">Required</span>[% END %]
                                                 </li>
-                                            [% END %]
+                                            [% END # /UNLESS noopacnote %]
 
                                             [% UNLESS noborrowernotes %]
                                                 <li>
@@ -904,10 +906,10 @@
                                                     <div class="hint">This message displays when checking out to this patron</div>
                                                     [% IF ( mandatoryborrowernotes ) %]<span class="required">Required</span>[% END %]
                                                 </li>
-                                            [% END %]
+                                            [% END # /UNLESS noborrowernotes %]
                                         </ol>
-                                    </fieldset>
-                                [% END # hide fieldset %]
+                                    </fieldset> <!-- /#memberentry_subscription -->
+                                [% END # /UNLESS nodateenrolled &&  noopacnote && noborrowernotes %]
 
                                 [% UNLESS nouserid && nopassword %]
                                     <fieldset class="rows" id="memberentry_userid">
@@ -942,7 +944,7 @@
 
                                                     [% IF ( mandatoryuserid ) %]<span class="required">Required</span>[% END %]
                                                 </li>
-                                            [% END %]
+                                            [% END # /UNLESS nouserid %]
 
                                             [% UNLESS nopassword %]
                                                 <li>
@@ -966,7 +968,7 @@
                                                             [% ELSE %]
                                                                 <input type="password" id="password" name="password" size="20" value="[% password | html %]" />
                                                             [% END %]
-                                                        [% END %]
+                                                        [% END # /IF ( NoUpdateLogin ) %]
                                                     [% ELSE %]
                                                         [% IF ( password ) %]
                                                             [% IF ( NoUpdateLogin ) %]
@@ -984,8 +986,8 @@
                                                             [% ELSE %]
                                                                 <input type="password" id="password" name="password" size="20" value="" />
                                                             [% END %]
-                                                        [% END %]
-                                                    [% END %]
+                                                        [% END # /IF ( password ) %]
+                                                    [% END # /IF ( opadd ) %]
                                                     [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %]
                                                     [% IF ( ERROR_password_too_short ) %]<span class="required">Password is too short</span>[% END %]
                                                     [% IF ( ERROR_password_too_weak ) %]<span class="required">Password is too weak</span>[% END %]
@@ -1013,7 +1015,7 @@
                                                             [% ELSE %]
                                                                 <input type="password" id="password2" name="password2" size="20" value="[% password | html %]" />
                                                             [% END %]
-                                                        [% END %]
+                                                        [% END # /IF ( NoUpdateLogin ) %]
                                                     [% ELSE %]
                                                         [% IF ( password ) %]
                                                             [% IF ( NoUpdateLogin ) %]
@@ -1031,16 +1033,16 @@
                                                             [% ELSE %]
                                                                 <input type="password" id="password2" name="password2" size="20" value="" />
                                                             [% END %]
-                                                        [% END %]
-                                                    [% END %]
+                                                        [% END # IF ( password ) %]
+                                                    [% END # /IF ( opadd ) %]
 
                                                     [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %]
                                                     [% IF ( ERROR_password_mismatch ) %]<span class="required">Passwords do not match</span>[% END %]
                                                 </li>
-                                            [% END %]
+                                            [% END # /UNLESS nopassword %]
                                         </ol>
-                                    </fieldset>
-                                [% END # hide fieldset %]
+                                    </fieldset> <!-- /#memberentry_userid -->
+                                [% END # /UNLESS nouserid && nopassword %]
 
                                 <!--this zones are not necessary in modif mode -->
                                 [% UNLESS ( opadd || opduplicate ) %]
@@ -1072,11 +1074,11 @@
                                                         </label>
                                                     [% ELSE %]
                                                         [% IF flagloo.yes %]Yes[% ELSE %]No[% END %]
-                                                    [% END %]
+                                                    [% END # /IF CAN_user_circulate_manage_restrictions %]
                                                 </li>
                                             [% END %]
-                                        </ol>
-                                    </fieldset>
+                                        </ol> <!-- /.radio -->
+                                    </fieldset> <!-- /#memberentry_account_flags -->
 
                                     <fieldset class="rows" id="memberentry_restrictions">
                                         <legend id="restrictions_lgd">Patron restrictions</legend>
@@ -1113,12 +1115,12 @@
                                                                 </td>
                                                             [% END %]
                                                         </tr>
-                                                    [% END %]
+                                                    [% END # /FOREACH d%]
                                                 </tbody>
                                             </table>
                                         [% ELSE %]
                                             <p>Patron is currently unrestricted.</p>
-                                        [% END %]
+                                        [% END # /IF ( debarments )%]
 
                                         [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %]
                                             <p><a href="#" id="add_manual_restriction">Add manual restriction</a></p>
@@ -1139,11 +1141,11 @@
                                                 <p>
                                                     <a class="cancel" id="cancel_manual_restriction" href="#">Cancel</a>
                                                 </p>
-                                            </fieldset>
-                                        [% END %]
-                                    </fieldset>
-                                [% END %]
-                            [% END %]
+                                            </fieldset> <!-- /#manual_restriction_form -->
+                                        [% END # /IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions  %]
+                                    </fieldset> <!-- /#memberentry_restrictions -->
+                                [% END # /UNLESS ( opadd || opduplicate ) %]
+                            [% END # /IF ( step_3 ) %]
 
                             [% IF ( step_7 ) %]
                                 [% IF Koha.Preference('HouseboundModule') %]
@@ -1164,7 +1166,7 @@
                                                     <input type="radio" id="yes_housebound_chooser" name="housebound_chooser" value="1" />
                                                     <label for="no_housebound_chooser">No </label>
                                                     <input type="radio" id="no_housebound_chooser" name="housebound_chooser" value="0" checked="checked" />
-                                                [% END %]
+                                                [% END # /IF ( housebound_role.housebound_chooser == 1 ) %]
                                             </li>
                                             <li>
                                                 <label class="radio" for="housebound_deliverer">Deliverer:</label>
@@ -1178,10 +1180,10 @@
                                                     <input type="radio" id="yes_housebound_deliverer" name="housebound_deliverer" value="1" />
                                                     <label for="no_housebound_deliverer">No </label>
                                                     <input type="radio" id="no_housebound_deliverer" name="housebound_deliverer" value="0" checked="checked" />
-                                                [% END %]
+                                                [% END # /IF ( housebound_role.housebound_deliverer == 1 ) %]
                                             </li>
-                                        </ol>
-                                    </fieldset>
+                                        </ol> <!-- /.radio -->
+                                    </fieldset> <!-- /#memberentry_housebound_roles -->
                                 [% END # hide fieldset %]
                             [% END # IF step_7 %]
 
@@ -1213,25 +1215,25 @@
                                                                                 [% auth_val_loo.lib | html %]
                                                                             </option>
                                                                         [% END %]
-                                                                    [% END %]
+                                                                    [% END # /FOREACH auth_val_loo %]
                                                                 </select>
                                                             [% ELSE %]
                                                                 <textarea rows="2" cols="30" id="[% patron_attribute.form_id | html %]" name="[% patron_attribute.form_id | html %]">[% patron_attribute.value | html %]</textarea>
-                                                            [% END %]
+                                                            [% END # /IF ( patron_attribute.use_dropdown ) %]
                                                             <input type="hidden" id="[% patron_attribute.form_id | html %]_code" name="[% patron_attribute.form_id | html %]_code" value="[% patron_attribute.code | html %]" />
                                                             <a href="#" onclick="clear_entry(this); return false;"><i class="fa fa-fw fa-trash"></i> Clear</a>
                                                             [% IF ( patron_attribute.repeatable ) %]
                                                                 <a href="#" onclick="clone_entry(this); return false;"><i class="fa fa-fw fa-plus"></i> New</a>
                                                             [% END %]
                                                         </li>
-                                                    [% END %]
+                                                    [% END # /FOREACH patron_attribute %]
                                                     [% IF pa_loo.class %]</fieldset>[% END %]
                                                 </ol>
-                                            [% END %]
-                                        </fieldset>
-                                    [% END %]
-                                [% END %]
-                            [% END %]
+                                            [% END # /FOREACH pa_loo %]
+                                        </fieldset> <!-- /#memberentry_patron_attributes -->
+                                    [% END # /UNLESS ( no_patron_attribute_types ) %]
+                                [% END # /IF Koha.Preference('ExtendedPatronAttributes') %]
+                            [% END # /IF ( step_4 ) %]
 
                             [% IF ( step_5 ) %]
                                 [% IF ( EnhancedMessagingPreferences ) %]
@@ -1261,12 +1263,12 @@
                                                         [% END %]
                                                     </select>
                                                 </p>
-                                            [% END %]
-                                        [% END %]
-                                    </fieldset>
-                                [% END %]
-                            [% END %]
-                        </form>
+                                            [% END # /UNLESS nosms_provider_id %]
+                                        [% END # /IF ( SMSSendDriver ) %]
+                                    </fieldset> <!-- /#memberentry_messaging_prefs -->
+                                [% END # /IF ( EnhancedMessagingPreferences ) %]
+                            [% END # /IF ( step_5 ) %]
+                        </form> <!-- /#entryform -->
 
                         [% IF quickadd && opadd  && !check_member %]
                             <form id="quick_add_form" class="toggler">
@@ -1277,7 +1279,7 @@
                             </form>
                         [% END %]
 
-                    [% END %]
+                    [% END # /UNLESS no_add %]
                 </main>
             </div> <!-- /.col-sm-10.col-sm-push-2 -->
 
@@ -1444,7 +1446,7 @@
                 $("#qagd").click(function() { $("#guarantordelete").click(); });
                 $("#quick_add_form").show();
             });
-        [% END %]
+        [% END # /IF quickadd && opadd  && !check_member %]
 
     </script>
     [% Asset.js("js/members.js") | $raw %]
-- 
2.7.4