Fix for Bug 5037 - If patron category is empty it shouldn't show
[koha_gimpoz] / koha-tmpl / intranet-tmpl / prog / en / modules / members / memberentrygen.tmpl
index d75a738..806b43c 100644 (file)
@@ -2,11 +2,11 @@
 <title>Koha &rsaquo; Patrons &rsaquo; 
 <!-- TMPL_IF NAME="opadd" -->  Add<!-- TMPL_ELSE --> Modify<!--/TMPL_IF--> <!--TMPL_IF Name="categoryname"--> <!--TMPL_VAR Name="categoryname"--> patron<!-- TMPL_ELSE --><!--TMPL_IF Name="I"--> Organization patron<!--/TMPL_IF --><!--TMPL_IF Name="A"--> Adult patron<!--/TMPL_IF --><!--TMPL_IF Name="C"--> Child patron<!--/TMPL_IF --><!--TMPL_IF Name="P"--> Professional patron<!--/TMPL_IF --><!--TMPL_IF Name="S"--> Staff patron<!--/TMPL_IF --><!--/TMPL_IF --><!--TMPL_UNLESS Name="opadd"--> <!-- TMPL_VAR NAME="surname" -->, <!-- TMPL_VAR name="firstname" --><!--/TMPL_UNLESS--></title>
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-<script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/js/members.js"></script>
 <!-- TMPL_INCLUDE NAME="calendar.inc" -->
 <script type="text/JavaScript" language="JavaScript">
 //<![CDATA[
     $(document).ready(function() {
+               $("fieldset.rows input").keydown(function(e){ return checkEnter(e); });
         $("#guarantordelete").click(function() {
             $("#contact-details").hide().find('a').remove();
             $("#guarantorid, #contactname, #contactfirstname").each(function () { this.value = "" });
@@ -25,7 +25,7 @@
 
     function clear_entry(node) {
         var original = node.parentNode.parentNode;
-        $("input", original).attr('value', '');
+        $("input[type=text]", original).attr('value', '');
         $("select", original).attr('value', '');
     }
 
         $("select", clone).attr('name', function() {
             return this.name.replace(/patron_attr_\d+/, 'patron_attr_' + newId);
         });
+        $("input#patron_attr_" + newId, clone).attr('value','');
+        $("select#patron_attr_" + newId, clone).attr('value','');
         original.parentNode.insertBefore(clone, original.nextSibling);
     }
-
+               var MSG_SEPARATOR = _("Separator must be / in field ");
+        var MSG_INCORRECT_DAY = _("Invalid day entered in field ");
+        var MSG_INCORRECT_MONTH = _("Invalid month entered in field ");
+        var MSG_INCORRECT_YEAR = _("Invalid year entered in field ");
+        var MSG_DUPLICATE_PATRON = _("Warning: Duplicate patron");
+        var MSG_DUPLICATE_ORGANIZATION = _("Warning: Duplicate organization");
+        var MSG_LATE_EXPIRY = _("Warning: Expiration date falls before enrollment date");
+        var MSG_MISSING_MANDATORY = _("The following fields are mandatory:");
+        var MSG_DUPLICATE_SUSPICION = _("Please confirm whether this is a duplicate patron");
 //]]>
 </script>
+<script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/js/members.js"></script>
 </head>
 <body>
 <!-- TMPL_INCLUDE NAME="header.inc" -->
@@ -88,7 +99,7 @@
                                <h3>Duplicate suspected</h3>
                                <a href="javascript:Dopop('borrowers_details.pl?borrowernumber=<!--TMPL_VAR NAME="check_member"-->');" >Detail</a>
                                Duplicate ?
-                               <a href="/cgi-bin/koha/members/memberentry.pl?borrowernumber=<!--TMPL_VAR NAME="check_member"-->&amp;category_type=<!--TMPL_VAR NAME="check_categorytype"-->">Yes</a> 
+                               <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;borrowernumber=<!--TMPL_VAR NAME="check_member"-->&amp;category_type=<!--TMPL_VAR NAME="check_categorytype"-->">Yes</a>
                                &nbsp;&nbsp;&nbsp; No, it is not
                                <!-- TMPL_IF NAME="checked"-->
                                        <input type="checkbox" checked="checked" name="answernodouble" >
                </form>
                </p>
        <!--/TMPL_IF-->
-               
+
        <!-- TMPL_IF Name="debug" -->
                <div id="debug">
                                <div>Debug is on (level <!-- TMPL_VAR NAME="debug" -->)</div>
                        <!-- TMPL_IF NAME="ERROR_dateexpiry" -->
                                <li id="ERROR_dateexpiry">Date of expiration is invalid.</li>
                        <!-- /TMPL_IF -->
+                       <!-- TMPL_IF NAME="ERROR_short_password" -->
+                               <li id="ERROR_short_password">Password must be at least <!-- TMPL_VAR NAME="minPasswordLength" --> characters long.</li>
+                       <!-- /TMPL_IF -->
             <!-- TMPL_IF NAME="ERROR_extended_unique_id_failed" -->
                 <li id="ERROR_extended_unique_id_failed">The attribute value 
                     <!-- TMPL_VAR NAME="ERROR_extended_unique_id_failed" --> is already is use by another patron record.</li>
         </script>
         <!-- TMPL_IF NAME="mandatorydateofbirth" --><span class="required">Required</span><!-- /TMPL_IF -->
         <!-- TMPL_IF NAME="ERROR_dateofbirth" --><span class="required">(Error)</span><!-- /TMPL_IF -->
+               <div class="hint"><!-- TMPL_INCLUDE NAME="date-format.inc" --></div>
             </li>
             <li>
                 <!-- TMPL_IF NAME="mandatoryinitials" -->
     <fieldset class="rows">
         <legend>Guarantor Information</legend>
         <ol>
-        <!-- TMPL_IF NAME="guarantorid" -->
-        <li id="contact-details">
-        <!-- TMPL_ELSE -->
-        <li id="contact-details" style="display: none">
-        <!-- /TMPL_IF -->
-            <span class="label">Patron #:</span> <!-- TMPL_IF NAME="guarantorid" --> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="guarantorid" -->" target="blank"><!-- TMPL_VAR NAME="guarantorid" --></a><!-- /TMPL_IF -->
-        </li>
-        <li>
-            <label for="contactname">Surname: </label>
-            <!-- TMPL_IF NAME="guarantorid" -->
-            <span><!-- TMPL_VAR NAME="contactname" --></span>
-            <input name="contactname" id="contactname" type="hidden" size="20" value="<!-- TMPL_VAR NAME="contactname" -->" />
-            <!-- TMPL_ELSE -->
-            <input name="contactname" id="contactname" type="text" size="20" value="<!-- TMPL_VAR NAME="contactname" -->" />
-            <!-- /TMPL_IF -->
-        </li>
-        <li>
-            <label for="contactfirstname">First name: </label>
-            <!-- TMPL_IF NAME="guarantorid" -->
-            <span><!-- TMPL_VAR NAME="contactfirstname" --></span>
-            <input name="contactfirstname" id="contactfirstname" type="hidden" size="20" value="<!-- TMPL_VAR NAME="contactfirstname" -->" />
-            <!-- TMPL_ELSE -->
-            <input name="contactfirstname" id="contactfirstname" type="text" size="20" value="<!-- TMPL_VAR NAME="contactfirstname" -->" />
-            <!-- /TMPL_IF -->
-        </li>
-        <!-- TMPL_IF name="relshiploop" -->
-        <li>
-            <label for="relationship">Relationship: </label>
-            <select name="relationship" id="relationship" >
-                <!-- TMPL_LOOP name="relshiploop" -->
-                <!-- TMPL_IF name="selected" -->
-                <option value="<!-- TMPL_VAR name="relationship" -->" selected="selected" ><!-- TMPL_VAR name="relationship" --></option>
-                <!-- TMPL_ELSE -->
-                <option value="<!-- TMPL_VAR name="relationship" -->"><!-- TMPL_VAR name="relationship" --></option>
-                <!-- /TMPL_IF -->
-                <!-- /TMPL_LOOP -->
-            </select>
-        </li>
-        <!-- /TMPL_IF -->
+<!--TMPL_IF Name="P"-->
+               <!-- TMPL_IF NAME="guarantorid" -->
+               <li id="contact-details">
+               <!-- TMPL_ELSE -->
+               <li id="contact-details" style="display: none">
+               <!-- /TMPL_IF -->
+                   <span class="label">Organization #:</span> <!-- TMPL_IF NAME="guarantorid" --> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="guarantorid" -->" target="blank"><!-- TMPL_VAR NAME="guarantorid" --></a><!-- /TMPL_IF -->
+               </li>
+               <li>
+                   <label for="contactname">Organization name: </label>
+                   <!-- TMPL_IF NAME="guarantorid" -->
+                   <span><!-- TMPL_VAR NAME="contactname" --></span>
+                   <input name="contactname" id="contactname" type="hidden" size="20" value="<!-- TMPL_VAR NAME="contactname" -->" />
+                   <!-- TMPL_ELSE -->
+                   <input name="contactname" id="contactname" type="text" size="20" value="<!-- TMPL_VAR NAME="contactname" -->" />
+                   <!-- /TMPL_IF -->
+               </li>
+<!-- TMPL_ELSE -->
+ <!-- TMPL_IF NAME="C" -->
+ <!-- TMPL_IF NAME="guarantorid" -->
+ <li id="contact-details">
+ <!-- TMPL_ELSE -->
+ <li id="contact-details" style="display: none">
+ <!-- /TMPL_IF -->
+     <span class="label">Patron #:</span> <!-- TMPL_IF NAME="guarantorid" --> <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="guarantorid" -->" target="blank"><!-- TMPL_VAR NAME="guarantorid" --></a><!-- /TMPL_IF -->
+ </li>
+ <li>
+     <label for="contactname">Surname: </label>
+     <!-- TMPL_IF NAME="guarantorid" -->
+     <span><!-- TMPL_VAR NAME="contactname" --></span>
+     <input name="contactname" id="contactname" type="hidden" size="20" value="<!-- TMPL_VAR NAME="contactname" -->" />
+     <!-- TMPL_ELSE -->
+     <input name="contactname" id="contactname" type="text" size="20" value="<!-- TMPL_VAR NAME="contactname" -->" />
+     <!-- /TMPL_IF -->
+ </li>
+ <li>
+     <label for="contactfirstname">First name: </label>
+     <!-- TMPL_IF NAME="guarantorid" -->
+     <span><!-- TMPL_VAR NAME="contactfirstname" --></span>
+     <input name="contactfirstname" id="contactfirstname" type="hidden" size="20" value="<!-- TMPL_VAR NAME="contactfirstname" -->" />
+     <!-- TMPL_ELSE -->
+     <input name="contactfirstname" id="contactfirstname" type="text" size="20" value="<!-- TMPL_VAR NAME="contactfirstname" -->" />
+     <!-- /TMPL_IF -->
+ </li>
+ <!-- TMPL_IF name="relshiploop" -->
+ <li>
+     <label for="relationship">Relationship: </label>
+     <select name="relationship" id="relationship" >
+         <!-- TMPL_LOOP name="relshiploop" -->
+         <!-- TMPL_IF name="selected" -->
+         <option value="<!-- TMPL_VAR name="relationship" -->" selected="selected" ><!-- TMPL_VAR name="relationship" --></option>
+         <!-- TMPL_ELSE -->
+         <option value="<!-- TMPL_VAR name="relationship" -->"><!-- TMPL_VAR name="relationship" --></option>
+         <!-- /TMPL_IF -->
+         <!-- /TMPL_LOOP -->
+     </select>
+ </li>
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_IF -->
+<!--/TMPL_IF -->
         <li>
             <span class="label">&nbsp;</span>
             <!-- TMPL_IF NAME="guarantorid" -->
-            <input id="guarantorsearch" type="button" value="Change" onclick="Dopopguarantor('guarantor_search.pl');" />
+            <input id="guarantorsearch" type="button" value="Change" onclick="Dopopguarantor('guarantor_search.pl?category_type=<!-- TMPL_VAR NAME="category_type" -->');" />
             <!-- TMPL_ELSE -->
-            <input id="guarantorsearch" type="button" value="Set to Patron" onclick="Dopopguarantor('guarantor_search.pl');" />
+            <input id="guarantorsearch" type="button" value="Set to Patron" onclick="Dopopguarantor('guarantor_search.pl?category_type=<!-- TMPL_VAR NAME="category_type" -->');" />
             <!-- /TMPL_IF -->
             <input id="guarantordelete" type="button" value="Delete" />
         </li>
       City, State: </label>
         
         <input type="text" id="city" name="city" size="20" value="<!-- TMPL_VAR NAME="city" -->" />
-        <!-- TMPL_IF NAME="city_cgipopup" -->or <strong>choose</strong> <!-- TMPL_VAR NAME="citypopup" --><!-- /TMPL_IF -->
+        <!-- TMPL_IF NAME="city_cgipopup" -->or <strong>choose</strong>
+        <select id="select_city" name="select_city">
+        <!-- TMPL_LOOP NAME="city_loop" -->
+            <!-- TMPL_IF NAME="selected" -->
+            <option value="<!-- TMPL_VAR NAME="city_zipcode"-->|<!-- TMPL_VAR NAME="city_name" -->" selected="selected">
+            <!-- TMPL_ELSE -->
+            <option value="<!-- TMPL_VAR NAME="city_zipcode"-->|<!-- TMPL_VAR NAME="city_name" -->">
+            <!-- /TMPL_IF -->
+                <!-- TMPL_VAR NAME="city_name" --> <!-- TMPL_VAR NAME="city_zipcode" -->
+            </option>
+        <!-- /TMPL_LOOP -->
+        </select>
+        <!-- /TMPL_IF -->
          <!-- TMPL_IF NAME="mandatorycity" --><span class="required">Required</span><!-- /TMPL_IF -->
     </li>
     <li> 
       <!--TMPL_ELSE-->
         <label for="zipcode">
       <!-- /TMPL_IF-->
-      Zipcode: </label>
+      Zip/Postal code: </label>
       <input type="text" name="zipcode" id="zipcode" size="10" value="<!-- TMPL_VAR NAME="zipcode" -->" />
          <!-- TMPL_IF NAME="mandatoryzipcode" --><span class="required">Required</span><!-- /TMPL_IF -->
     </li>
+    
+    <li> 
+      <!-- TMPL_IF NAME="mandatorycountry" -->
+        <label for="country" class="required">
+      <!--TMPL_ELSE-->
+        <label for="country">
+      <!-- /TMPL_IF-->
+      Country: </label>
+      <input type="text" name="country" id="country" size="20" value="<!-- TMPL_VAR NAME="country" -->" />
+         <!-- TMPL_IF NAME="mandatorycountry" --><span class="required">Required</span><!-- /TMPL_IF -->
+    </li>    
   
        </ol>
     </fieldset>
   <fieldset class="rows" id="memberentry_contact">
-    <legend>Contact</legend><ol>       
-<!--TMPL_IF Name="C"-->
-      <h2>Patron</h2>
-      <li> 
-        <!-- TMPL_IF NAME="mandatoryB_email" -->
-          <label for="B_email" class="required">
-        <!--TMPL_ELSE-->
-          <label for="B_email">
-        <!-- /TMPL_IF-->
-        E-mail (home): </label>
-        <input type="text" id="B_email" name="B_email" size="45" value="<!-- TMPL_VAR NAME="B_email" -->" />
-               <!-- TMPL_IF NAME="mandatoryB_email" --><span class="required">Required</span><!-- /TMPL_IF --> </li>
-<!--/TMPL_IF-->
+    <legend>Contact</legend><ol>
       <li>
       <!-- TMPL_IF NAME="mandatoryphone" --> 
       <label for="phone" class="required">
       <!-- /TMPL_IF-->
       Phone (home): </label>
       <input type="text" id="phone" name="phone" value="<!-- TMPL_VAR NAME="phone" -->" />
-         <!-- TMPL_IF NAME="mandatoryphone" --><span class="required">Required</span><!-- /TMPL_IF -->
+         <!-- TMPL_IF NAME="mandatoryphone" --><span class="required">Required</span><!-- /TMPL_IF --><div class="hint">Shows on transit slips</div>
+
     </li>
     <li>
       <!-- TMPL_IF NAME="mandatoryphonepro" -->
       <!--TMPL_ELSE-->
       <label for="email">
       <!-- /TMPL_IF-->
-      E-mail (home): </label>
+      Email (home): </label>
       <input type="text" id="email" name="email" size="45" value="<!-- TMPL_VAR NAME="email" -->" />  
-         <!-- TMPL_IF NAME="mandatoryemail" --><span class="required">Required</span><!-- /TMPL_IF -->
+         <!-- TMPL_IF NAME="mandatoryemail" --><span class="required">Required</span><!-- /TMPL_IF --><div class="hint">Shows on transit slips</div>
+
     </li>
     <li>
       <!-- TMPL_IF NAME="mandatoryemailpro" --> 
       <!--TMPL_ELSE-->
       <label for="emailpro">
       <!-- /TMPL_IF-->
-      E-mail (work): </label>
+      Email (work): </label>
       <input type="text" id="emailpro" name="emailpro" size="45" value="<!-- TMPL_VAR NAME="emailpro" -->" />
          <!-- TMPL_IF NAME="mandatoryemailpro" --><span class="required">Required</span><!-- /TMPL_IF -->
     </li>
 
 <!-- ************************ STEP_1 *********************** -->
 <!--/TMPL_IF -->
-<!--TMPL_IF Name="step_2"-->
+<!--TMPL_IF Name="step_6"-->
 
                <fieldset class="rows" id="memberentry_address">
                <legend>Alternate address</legend><ol>
          <!-- TMPL_IF NAME="mandatoryB_address" --><span class="required">Required</span><!-- /TMPL_IF -->
                        </li>
                        <li>
+                               <!-- TMPL_IF NAME="mandatoryB_address2" -->
+                                       <label for="B_address2" class="required">
+                               <!--TMPL_ELSE-->
+                                       <label for="B_address2">
+                               <!-- /TMPL_IF-->
+                               Address 2: </label>
+                               <input type="text" id="B_address2" name="B_address2" size="40" value="<!-- TMPL_VAR NAME="B_address2" -->" />
+         <!-- TMPL_IF NAME="mandatoryB_address2" --><span class="required">Required</span><!-- /TMPL_IF -->
+                       </li>                   
+                       <li>
                                <!-- TMPL_IF NAME="mandatoryB_city" -->
                                        <label for="B_city" class="required" >
                                <!--TMPL_ELSE-->
                                        <label for="B_city">
                                <!-- /TMPL_IF-->
-                               City: </label>
+                               City, State: </label>
                                <input type="text" id="B_city" name="B_city" size="20" value="<!-- TMPL_VAR NAME="B_city" -->" />
          <!-- TMPL_IF NAME="mandatoryB_city" --><span class="required">Required</span><!-- /TMPL_IF -->
                        </li>
                                <!--TMPL_ELSE-->
                                        <label for="B_zipcode">
                                <!-- /TMPL_IF-->
-                               Zipcode: </label>
-                               <input type="text" id="B_zipcode" name="B_zipcode" maxlength="5" size="5" value="<!-- TMPL_VAR NAME="B_zipcode" -->" />
+                               Zip/Postal code: </label>
+                               <input type="text" id="B_zipcode" name="B_zipcode" maxlength="10" size="10" value="<!-- TMPL_VAR NAME="B_zipcode" -->" />
          <!-- TMPL_IF NAME="mandatoryB_zipcode" --><span class="required">Required</span><!-- /TMPL_IF -->
                        </li>
+                       <li>
+                               <!-- TMPL_IF NAME="mandatoryB_country" -->
+                                       <label for="B_country" class="required">
+                               <!--TMPL_ELSE-->
+                                       <label for="B_country">
+                               <!-- /TMPL_IF-->
+                               Country: </label>
+                               <input type="text" id="B_country" name="B_country" size="20" value="<!-- TMPL_VAR NAME="B_country" -->" />
+         <!-- TMPL_IF NAME="mandatoryB_country" --><span class="required">Required</span><!-- /TMPL_IF -->
+                       </li>
             <li>
                 <!-- TMPL_IF NAME="mandatoryB_phone" -->
                 <label for="B_phone" class="required">
         <!--TMPL_ELSE-->
           <label for="B_email">
         <!-- /TMPL_IF-->
-        E-mail: </label>
+        Email: </label>
         <input type="text" id="B_email" name="B_email" size="45" value="<!-- TMPL_VAR NAME="B_email" -->" />
                <!-- TMPL_IF NAME="mandatoryB_email" --><span class="required">Required</span><!-- /TMPL_IF --> </li>
             <li>
             </li>
                        </ol>
                </fieldset>
+<!-- /TMPL_IF -->              
+<!--TMPL_IF Name="step_2"-->
                <fieldset class="rows" id="memberentry_altaddress">       
                    <legend>Alternate Contact</legend><ol>
                        <li>
-                           <!-- TMPL_IF NAME="mandatoryaltcontactfirstname" -->
-                               <label for="altcontactfirstname" class="required">
-                               <!-- TMPL_ELSE -->
-                               <label for="altcontactfirstname">
-                               <!-- /TMPL_IF -->
-                               First name:</label>
-                               <input type="text" name="altcontactfirstname" id="altcontactfirstname" value="<!-- TMPL_VAR NAME="altcontactfirstname" -->" />
-                               <!-- TMPL_IF NAME="mandatoryaltcontactfirstname" --><span class="required">Required</span><!-- /TMPL_IF -->
-                       </li>
-                       <li>
                            <!-- TMPL_IF NAME="mandatoryaltcontactsurname" -->
                                <label for="altcontactsurname" class="required">
                                <!-- TMPL_ELSE -->
                                <!-- TMPL_IF NAME="mandatoryaltcontactsurname" --><span class="required">Required</span><!-- /TMPL_IF -->
                        </li>
                        <li>
+                           <!-- TMPL_IF NAME="mandatoryaltcontactfirstname" -->
+                               <label for="altcontactfirstname" class="required">
+                               <!-- TMPL_ELSE -->
+                               <label for="altcontactfirstname">
+                               <!-- /TMPL_IF -->
+                               First name:</label>
+                               <input type="text" name="altcontactfirstname" id="altcontactfirstname" value="<!-- TMPL_VAR NAME="altcontactfirstname" -->" />
+                               <!-- TMPL_IF NAME="mandatoryaltcontactfirstname" --><span class="required">Required</span><!-- /TMPL_IF -->
+                       </li>
+                       <li>
                            <!-- TMPL_IF NAME="mandatoryaltcontactaddress1" -->
                                <label for="altcontactaddress1" class="required">
                                <!-- TMPL_ELSE -->
                                <label for="altcontactaddress1">
                                <!-- /TMPL_IF -->
-                               Address line 1:</label>
+                               Address:</label>
                                <input type="text" name="altcontactaddress1" id="altcontactaddress1" value="<!-- TMPL_VAR NAME="altcontactaddress1" -->" size="40" />
                                <!-- TMPL_IF NAME="mandatoryaltcontactaddress1" --><span class="required">Required</span><!-- /TMPL_IF -->
                        </li>
                                <!-- TMPL_ELSE -->
                                <label for="altcontactaddress2">
                                <!-- /TMPL_IF -->
-                               Address line 2:</label>
+                               Address 2:</label>
                                <input type="text" name="altcontactaddress2" id="altcontactaddress2" value="<!-- TMPL_VAR NAME="altcontactaddress2" -->" size="40" />
                                <!-- TMPL_IF NAME="mandatoryaltcontactaddress2" --><span class="required">Required</span><!-- /TMPL_IF -->
                        </li>
                                <!-- TMPL_ELSE -->
                                <label for="altcontactzipcode">
                                <!-- /TMPL_IF -->
-                               ZIP/Post code:</label>
+                               Zip/Postal code:</label>
                                <input type="text" name="altcontactzipcode" id="altcontactzipcode" value="<!-- TMPL_VAR NAME="altcontactzipcode" -->" size="5" />
                                <!-- TMPL_IF NAME="mandatoryaltcontactzipcode" --><span class="required">Required</span><!-- /TMPL_IF -->
                        </li>
                        <li>
+                           <!-- TMPL_IF NAME="mandatoryaltcontactcountry" -->
+                               <label for="altcontactcountry" class="required">
+                               <!-- TMPL_ELSE -->
+                               <label for="altcontactcountry">
+                               <!-- /TMPL_IF -->
+                               Country:</label>
+                               <input type="text" name="altcontactcountry" id="altcontactcountry" value="<!-- TMPL_VAR NAME="altcontactcountry" -->" size="20" />
+                               <!-- TMPL_IF NAME="mandatoryaltcontactcountry" --><span class="required">Required</span><!-- /TMPL_IF -->
+                       </li>                   
+                       <li>
                            <!-- TMPL_IF NAME="mandatoryaltcontactphone" -->
                                <label for="altcontactphone" class="required">
                                <!-- TMPL_ELSE -->
         <label for="categorycode">Category: </label>
         <select id="categorycode" name="categorycode">
         <!-- TMPL_LOOP NAME="typeloop" -->
-               <!-- TMPL_IF EXPR="typename eq 'C'" --><optgroup label="Child"><!-- /TMPL_IF -->
-               <!-- TMPL_IF EXPR="typename eq 'A'" --><optgroup label="Adult"><!-- /TMPL_IF -->
-               <!-- TMPL_IF EXPR="typename eq 'S'" --><optgroup label="Staff"><!-- /TMPL_IF -->
-               <!-- TMPL_IF EXPR="typename eq 'I'" --><optgroup label="Organization"><!-- /TMPL_IF -->
-               <!-- TMPL_IF EXPR="typename eq 'P'" --><optgroup label="Professional"><!-- /TMPL_IF -->
-               <!-- TMPL_IF EXPR="typename eq 'X'" --><optgroup label="Statistical"><!-- /TMPL_IF -->
-                <!-- TMPL_LOOP NAME="categoryloop" -->
+                       <!-- TMPL_LOOP NAME="categoryloop" -->
+                               <!-- TMPL_IF NAME="__first__" -->
+                                       <!-- TMPL_IF NAME="typename_C" --><optgroup label="Child"><!-- /TMPL_IF -->
+                                       <!-- TMPL_IF NAME="typename_A" --><optgroup label="Adult"><!-- /TMPL_IF -->
+                                       <!-- TMPL_IF NAME="typename_S" --><optgroup label="Staff"><!-- /TMPL_IF -->
+                                       <!-- TMPL_IF NAME="typename_I" --><optgroup label="Organization"><!-- /TMPL_IF -->
+                                       <!-- TMPL_IF NAME="typename_P" --><optgroup label="Professional"><!-- /TMPL_IF -->
+                                       <!-- TMPL_IF NAME="typename_X" --><optgroup label="Statistical"><!-- /TMPL_IF -->
+                           <!-- /TMPL_IF -->
                                <!-- TMPL_IF NAME="categorycodeselected" -->
                <option value="<!-- TMPL_VAR NAME="categorycode" -->" selected="selected"><!-- TMPL_VAR NAME="categoryname" --></option>
                                <!-- TMPL_ELSE -->
 <option value="<!-- TMPL_VAR NAME="categorycode" -->"><!-- TMPL_VAR NAME="categoryname" --></option>
                                <!-- /TMPL_IF -->
-                <!-- /TMPL_LOOP -->
-        </optgroup>
-        <!-- /TMPL_LOOP -->
-               </select>
+                               <!-- TMPL_IF NAME="__last__" -->
+                               </optgroup>
+                               <!-- /TMPL_IF -->
+            <!-- /TMPL_LOOP -->
+       <!-- /TMPL_LOOP -->
+       </select>
     <!-- TMPL_ELSE -->
-        <span class="problem">There is no category type to add <!--TMPL_IF Name="A"-->an Adult<!--/TMPL_IF--><!--TMPL_IF Name="C"-->a Child<!--/TMPL_IF--><!--TMPL_IF Name="I"-->an Institution<!--/TMPL_IF--><!--TMPL_IF Name="P"-->a professionnal<!--/TMPL_IF--><!--TMPL_IF Name="S"-->a Staff Member<!--/TMPL_IF-->.</span>
+        <span class="problem">There is no category type to add <!--TMPL_IF Name="A"-->an Adult<!--/TMPL_IF--><!--TMPL_IF Name="C"-->a Child<!--/TMPL_IF--><!--TMPL_IF Name="I"-->an Institution<!--/TMPL_IF--><!--TMPL_IF Name="P"-->a Professional<!--/TMPL_IF--><!--TMPL_IF Name="S"-->a Staff Member<!--/TMPL_IF-->.</span>
               <a href="/cgi-bin/koha/admin/categorie.pl">Please create one</a>
     <!-- /TMPL_IF -->
     </li>
       </script>
                <!-- TMPL_IF NAME="mandatorydateenrolled" --><span class="required">Required</span><!-- /TMPL_IF -->
                <!-- TMPL_IF NAME="ERROR_dateenrolled" --><span class="required">(Error)</span><!-- /TMPL_IF -->
+               <div class="hint"><!-- TMPL_INCLUDE NAME="date-format.inc" --></div>
                </li>
                <li>
                        <!-- TMPL_IF NAME="mandatorydateexpiry" -->
       </script>
                <!-- TMPL_IF NAME="mandatorydateexpiry" --><span class="required">Required</span><!-- /TMPL_IF -->
                <!-- TMPL_IF NAME="ERROR_dateexpiry" --><span class="required">(Error)</span><!-- /TMPL_IF -->
+               <div class="hint"><!-- TMPL_INCLUDE NAME="date-format.inc" --></div>
                </li>
                <li>
                        <!-- TMPL_IF NAME="mandatoryopacnote" -->
                        <!-- /TMPL_IF-->        
                        OPAC note: </label>
                        <textarea id="opacnote" name="opacnote" cols="55" rows="5"><!-- TMPL_VAR NAME="opacnote" --></textarea>
+                       <div class="hint">This message appears on this patron's user page in the OPAC</div>
          <!-- TMPL_IF NAME="mandatoryopacnote" --><span class="required">Required</span><!-- /TMPL_IF -->
                </li>
                <li>
                        <!--TMPL_ELSE-->
                                <label for="borrowernotes">
                        <!-- /TMPL_IF-->
-                       Library note: </label>
+                       Circulation note: </label>
                        <textarea id="borrowernotes" name="borrowernotes" cols="55" rows="5"><!-- TMPL_VAR NAME="borrowernotes" --></textarea>
+                       <div class="hint">This message displays when checking out to this patron</div>
          <!-- TMPL_IF NAME="mandatoryborrowernotes" --><span class="required">Required</span><!-- /TMPL_IF -->
                </li>
                </ol>
                                <!-- /TMPL_IF -->
                        <!--/TMPL_IF-->
                        <!--/TMPL_IF-->
-         <!-- TMPL_IF NAME="mandatorypassword" --><span class="required">Required</span><!-- /TMPL_IF -->
+         <!-- TMPL_IF NAME="mandatorypassword" --><span class="required">Required</span><!-- /TMPL_IF --><!-- TMPL_IF NAME="ERROR_short_password" --><span class="required">Password is too short</span><!-- /TMPL_IF -->
+<!-- TMPL_IF NAME="minPasswordLength" --><div class="hint">Minimum password length: <!-- TMPL_VAR NAME="minPasswordLength" --></div><!-- /TMPL_IF -->
                </li></ol>
                </fieldset>
                <!--this zones are not necessary in modif mode -->
                        </ol>
                        </fieldset>
                <!-- /TMPL_UNLESS -->   
+
 <!-- /TMPL_IF -->
 
-<!-- TMPL_IF NAME="step_4" --><!-- TMPL_IF NAME="ExtendedPatronAttributes" -->
+<!-- TMPL_IF NAME="step_4" --><!-- TMPL_IF NAME="ExtendedPatronAttributes" --><!-- TMPL_UNLESS NAME="no_patron_attribute_types" -->
   <fieldset class="rows" id="memberentry_patron_attributes">
-    <input type="hidden" name="setting_extended_patron_attributes" value="1">
+    <input type="hidden" name="setting_extended_patron_attributes" value="1" />
     <legend>Additional attributes and identifiers</legend>
-    <!-- TMPL_IF NAME="no_patron_attribute_types" -->
-    No patron attribute types defined.
-    <!-- TMPL_ELSE -->
     <table>
         <tr>
             <th>Type</th>
             <td><!-- TMPL_VAR NAME="code" --> (<!-- TMPL_VAR NAME="description" -->)
             </td>
             <td>
-                <input type="hidden" id="<!-- TMPL_VAR NAME="form_id" -->_code" name="<!-- TMPL_VAR NAME="form_id" -->_code"
-                       value="<!-- TMPL_VAR NAME="code" -->" />
+                <input type="hidden" id="<!-- TMPL_VAR NAME="form_id" -->_code" name="<!-- TMPL_VAR NAME="form_id" -->_code" value="<!-- TMPL_VAR NAME="code" ESCAPE="HTML" -->" />
                 <!-- TMPL_IF NAME="use_dropdown" -->
                     <select id="<!-- TMPL_VAR NAME="form_id" -->" name="<!-- TMPL_VAR NAME="form_id" -->">
                         <option value="" />
                         <!-- /TMPL_LOOP -->
                     </select>
                 <!-- TMPL_ELSE -->
-                    <input type="text" maxlength="30" value="<!-- TMPL_VAR NAME="value" -->"
+                    <input type="text" maxlength="64" value="<!-- TMPL_VAR NAME="value" -->"
                            id="<!-- TMPL_VAR NAME="form_id" -->" name="<!-- TMPL_VAR NAME="form_id" -->" />
                 <!-- /TMPL_IF -->
                 <!-- TMPL_IF NAME="password_allowed" -->
-                    (Password: <input type="password" maxlength="30" value="<!-- TMPL_VAR NAME="password" -->"
+                    (Password: <input type="password" maxlength="64" value="<!-- TMPL_VAR NAME="password" -->"
                            id="<!-- TMPL_VAR NAME="form_id" -->_password" name="<!-- TMPL_VAR NAME="form_id" -->_password" />)
                 <!-- /TMPL_IF -->
             </td>
         </tr>
         <!-- /TMPL_LOOP -->
     </table>
+  </fieldset>
+<!-- /TMPL_IF--><!-- /TMPL_IF --><!-- /TMPL_UNLESS -->
+
+<!-- TMPL_IF NAME="step_5" --><!-- TMPL_IF NAME="EnhancedMessagingPreferences" -->
+  <fieldset class="rows" id="memberentry_messaging_prefs">
+    <!-- TMPL_IF NAME="opadd" -->
+    <!-- handle changing prefs if creating new patron and changing
+         the patron category
+    -->
+    <script language="javascript" type="text/javascript">//<![CDATA[
+       $(document).ready(function(){
+            var message_prefs_dirty = false;
+            $('#memberentry_messaging_prefs > *').change(function() {
+                message_prefs_dirty = true;
+            });
+            $('#categorycode').change(function() {
+                var categorycode = $(this).val();
+                if (message_prefs_dirty) {
+                    if (!confirm('Change messaging preferences to default for this category?')) {
+                        return;
+                    }
+                }
+                $.getJSON('/cgi-bin/koha/members/default_messageprefs.pl?categorycode=' + categorycode,
+                    function(data) {
+                        $.each(data.messaging_preferences, function(i, item) {
+                            var attrid = item.message_attribute_id;
+                            var transports = ['email', 'rss', 'sms'];
+                            $.each(transports, function(j, transport) {
+                                if (item['transport-' + transport] != ' ') {
+                                    $('#' + transport + attrid).attr('checked', item['transport-' + transport]);
+                                } else {
+                                    $('#' + transport + attrid).removeAttr('checked');
+                                }
+                            });
+                            if (item.digest && item.digest != ' ') {
+                                $('#digest' + attrid).attr('checked', item.digest);
+                            } else {
+                                $('#digest' + attrid).removeAttr('checked');
+                            }
+                            if (item.takes_days == '1') {
+                                $('[name=' + attrid + '-DAYS]').val('' + item.days_in_advance);
+                            }
+                        });
+                        message_prefs_dirty = false;
+                    }
+                );
+            });
+        });
+    //]]>
+    </script>
+    <!-- /TMPL_IF -->
+    <input type="hidden" name="setting_messaging_prefs" value="1" />
+    <legend>Patron messaging preferences</legend>
+    <!-- TMPL_INCLUDE NAME="messaging-preference-form.inc" -->
+    <!-- TMPL_IF NAME="SMSSendDriver" -->
+        <p><label for="SMSnumber">SMS number:</label> 
+          <input type="text" id="SMSnumber" name="SMSnumber" value="<!-- TMPL_VAR NAME="SMSnumber"  -->" />
+        </p>
     <!-- /TMPL_IF -->
   </fieldset>
-<!-- /TMPL_IF--><!-- /TMPL_IF -->
+<!-- /TMPL_IF --> <!-- /TMPL_IF -->
 
     <fieldset class="action">
         <input type="submit" name="save" onclick="return check_form_borrowers();" value="Save" />
 </div><!-- /TMPL_UNLESS -->
 </div>
 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
+