Bug 10507: improve warning about duplicate patron attribute value
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / memberentrygen.tt
index 8a31738..7a2d29e 100644 (file)
@@ -3,10 +3,10 @@
 [% IF ( opadd ) %]Add[% ELSIF ( opduplicate ) %]Duplicate[% ELSE %] Modify[% END %] [% IF ( categoryname ) %] [% categoryname %] patron[% ELSE %][% IF ( I ) %] Organization patron[% END %][% IF ( A ) %] Adult patron[% END %][% IF ( C ) %] Child patron[% END %][% IF ( P ) %] Professional patron[% END %][% IF ( S ) %] Staff patron[% END %][% END %][% UNLESS ( opadd ) %] [% surname %], [% firstname %][% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
 [% INCLUDE 'calendar.inc' %]
-<script type="text/JavaScript">
+<script type="text/javascript">
 //<![CDATA[
     $(document).ready(function() {
-               $("fieldset.rows input").keydown(function(e){ return checkEnter(e); });
+         $("fieldset.rows input").addClass("noEnterSubmit");
         $("#guarantordelete").click(function() {
             $("#contact-details").hide().find('a').remove();
             $("#guarantorid, #contactname, #contactfirstname").each(function () { this.value = "" });
                 update_category_code( category_code );
             }
         [% END %]
-
+        $("#dateofbirth").datepicker({ maxDate: "-1D" });
+        $("#entryform").preventDoubleFormSubmit();
     });
 
     function clear_entry(node) {
-        var original = node.parentNode.parentNode;
-        $("input[type=text]", original).attr('value', '');
+        var original = $(node).parent();
+        $("textarea", original).attr('value', '');
         $("select", original).attr('value', '');
     }
 
     function clone_entry(node) {
-        var original = node.parentNode.parentNode;
-        var clone = original.cloneNode(true);
+        var original = $(node).parent();
+        var clone = original.clone();
+
         var newId = 50 + parseInt(Math.random() * 100000);
-        $("input", clone).attr('id', function() {
+        $("input,select,textarea", clone).attr('id', function() {
             return this.id.replace(/patron_attr_\d+/, 'patron_attr_' + newId);
         });
-        $("input", clone).attr('name', function() {
+        $("input,select,textarea", clone).attr('name', function() {
             return this.name.replace(/patron_attr_\d+/, 'patron_attr_' + newId);
         });
-        $("select", clone).attr('id', function() {
-            return this.id.replace(/patron_attr_\d+/, 'patron_attr_' + newId);
-        });
-        $("select", clone).attr('name', function() {
-            return this.name.replace(/patron_attr_\d+/, 'patron_attr_' + newId);
+        $("label", clone).attr('for', function() {
+            return $(this).attr("for").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);
+        $(original).after(clone);
+        return false;
     }
 
     function update_category_code(category_code) {
         if ( $(category_code).is("select") ) {
             category_code = $("#categorycode").find("option:selected").val();
         }
-        var mytables = $(".attributes_table>tbody");
-
-        mytables.find("tr").each(function(){
-            $(this).hide()
-        });
-
-        mytables.find("tr[data-category_code="+category_code+"]").each(function(){
-            $(this).show();
-        });
-        mytables.find("tr[data-category_code='']").each(function(){
-            $(this).show();
-        });
-
+        var mytables = $(".attributes_table");
+        $(mytables).find("li").hide();
+        $(mytables).find(" li[data-category_code="+category_code+"]").show();
+        $(mytables).find(" li[data-category_code='']").show();
     }
 
                var MSG_SEPARATOR = _("Separator must be / in field ");
                                <p><a class="popup" href="javascript:Dopop('moremember.pl?print=brief&amp;borrowernumber=[% check_member %]');" >View existing record</a></p>
                                <form action="/cgi-bin/koha/members/memberentry.pl" method="get"><input type="hidden" name="op" value="modify" /><input type="hidden" name="borrowernumber" value="[% check_member %]" /><input type="hidden" name="category_type" value="[% check_categorytype %]" /><input class="edit" type="submit" value="It is a duplicate. Edit existing record" /></form>
 
-                               <form name="form_double" action="/cgi-bin/koha/members/memberentry.pl" method="post">
+                <form name="form_double" action="/cgi-bin/koha/members/memberentry.pl" method="post" autocomplete="off">
                                <input type="hidden" name="nodouble" value="1" />
                                <input class="new" type="submit" value="Not a duplicate. Save as new record" />
                        </div>
        [% END %]
 
-       [% IF ( debug ) %]
-               <div id="debug">
-                               <div>Debug is on (level [% debug %])</div>
-               </div>
-       [% END %]
        [% IF ( nok ) %]
                <div class="dialog alert">
                        <p>The following fields are wrong. Please fix them.</p>
                        [% END %]
                        [% IF ( ERROR_age_limitations ) %]
                                <li id="ERROR_age_limitations">Patron's age is incorrect for their category.  
-                                       Ages allowed are [% ERROR_age_limitations %].</li>
+                    Ages allowed are [% age_low %]-[% age_high %].</li>
                        [% END %]
                        [% IF ( ERROR_branch ) %]
                                <li id="ERROR_branch">Library is invalid.</li>
                        [% END %]
             [% IF ( ERROR_extended_unique_id_failed ) %]
                 <li id="ERROR_extended_unique_id_failed">The attribute value 
-                    [% ERROR_extended_unique_id_failed %] is already is use by another patron record.</li>
+                    [% ERROR_extended_unique_id_failed_value %] is already in use by another patron record.</li>
                        [% END %]
                        </ul>
                </div>
        [% END %]
 
 
-[% UNLESS ( check_member ) %]<form name="form" id="entryform"  action="/cgi-bin/koha/members/memberentry.pl" method="post">
+[% UNLESS ( check_member ) %]<form name="form" id="entryform"  action="/cgi-bin/koha/members/memberentry.pl" method="post" autocomplete="off">
 <input type="hidden" name="nodouble"  value="[% nodouble %]" /> [% END %]
 <!--    field always hidden in different form (1,2,3) -->
 <input type="hidden" name="BorrowerMandatoryField" value="[% BorrowerMandatoryField %]" />
                 <label for="dateofbirth">
                 [% END %]
                 Date of birth: </label>
-                               
-       [% IF ( metric ) %]                     
+
+        [% IF ( dateformat == "metric" ) %]
                 <input type="text" id="dateofbirth" name="dateofbirth" size="20" onchange="CheckDate(document.form.dateofbirth);" value="[% IF ( opduplicate ) %][% ELSE %][% dateofbirth %][% END %]" />
-[% ELSE %]
+        [% ELSE %]
                 <input type="text" id="dateofbirth" name="dateofbirth" size="20" value="[% IF ( opduplicate ) %][% ELSE %][% dateofbirth %][% END %]" />
-[% END %]
+        [% END %]
 
-                <img src="[% themelang %]/lib/calendar/cal.gif" id="dateofbirth_button" alt="Show Calendar" />
-        <script language="JavaScript" type="text/javascript">
-            Calendar.setup(
-            {
-                inputField : "dateofbirth",
-                ifFormat : "[% DHTMLcalendar_dateformat %]",
-                button : "dateofbirth_button"
-            }
-            );
-        </script>
         [% IF ( mandatorydateofbirth ) %]<span class="required">Required</span>[% END %]
         [% IF ( ERROR_dateofbirth ) %]<span class="required">(Error)</span>[% END %]
                <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
 
 [% IF ( showguarantor ) %]<input type="hidden" id="guarantorid" name="guarantorid"   value="[% guarantorid %]" />
     <fieldset class="rows">
-        <legend>Guarantor Information</legend>
+        <legend>Guarantor information</legend>
         <ol>
 [% IF ( P ) %]
                [% IF ( guarantorid ) %]
             [% IF ( guarantorid ) %]
             <input id="guarantorsearch" type="button" value="Change" onclick="Dopopguarantor('guarantor_search.pl?category_type=[% category_type %]');" />
             [% ELSE %]
-            <input id="guarantorsearch" type="button" value="Set to Patron" onclick="Dopopguarantor('guarantor_search.pl?category_type=[% category_type %]');" />
+            <input id="guarantorsearch" type="button" value="Set to patron" onclick="Dopopguarantor('guarantor_search.pl?category_type=[% category_type %]');" />
             [% END %]
             <input id="guarantordelete" type="button" value="Delete" />
         </li>
       [% ELSE %]
       <label for="phone">
       [% END %]
-      Primary Phone: </label>
+      Primary phone: </label>
       [% IF ( opduplicate ) %]
                        <input type="text" id="phone" name="phone" value="[% phone %]" onclick="this.value=''" />
       [% ELSE %]
       [% ELSE %]
       <label for="phonepro">
       [% END %]
-      Secondary Phone: </label>
+      Secondary phone: </label>
       [% IF ( opduplicate ) %]
                        <input type="text" id="phonepro" name="phonepro" value="[% phonepro %]" onclick="this.value=''" />
       [% ELSE %]
       [% ELSE %]
       <label for="mobile">
       [% END %]
-      Other Phone: </label>
+      Other phone: </label>
       [% IF ( opduplicate ) %]
                <input type="text" id="mobile" name="mobile" value="[% mobile %]" onclick="this.value=''" />
       [% ELSE %]
       [% ELSE %]
       <label for="email">
       [% END %]
-      Primary Email: </label>
+      Primary email: </label>
       [% IF ( opduplicate ) %]
                <input type="text" id="email" name="email" size="45" value="[% email %]" onclick="this.value=''" />
       [% ELSE %]
       [% ELSE %]
       <label for="emailpro">
       [% END %]
-      Secondary Email: </label>
+      Secondary email: </label>
       [% IF ( opduplicate ) %]
                <input type="text" id="emailpro" name="emailpro" size="45" value="[% emailpro %]" onclick="this.value=''" />
       [% ELSE %]
 [% IF ( step_2 ) %]
     [% UNLESS noaltcontactsurname && noaltcontactfirstname && noaltcontactaddress1 && noaltcontactaddress2 && noaltcontactaddress3 && noaltcontactstate && noaltcontactzipcode && noaltcontactcountry && noaltcontactphone %]
                <fieldset class="rows" id="memberentry_altaddress">       
-                   <legend id="alt_contact_lgd">Alternate Contact</legend><ol>
+            <legend id="alt_contact_lgd">Alternate contact</legend><ol>
         [% UNLESS noaltcontactsurname %]
                        <li>
                            [% IF ( mandatoryaltcontactsurname ) %]
 [% IF ( step_3 ) %]
 
   <fieldset class="rows" id="memberentry_library_management">
-    <legend id="library_management_lgd">Library Management</legend><ol>
+    <legend id="library_management_lgd">Library management</legend><ol>
         [% UNLESS nocardnumber %]
    <li> [% IF ( mandatorycardnumber ) %]
       <label for="cardnumber" class="required">
       <label for="cardnumber">
     [% END %] 
     Card number: </label>
-    [% IF ( opduplicate ) %]
-               <input type="text" id="cardnumber" name="cardnumber" size="20" />
-    [% ELSE %]
-               <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber %]" />
-    [% END %]
+       <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber %]" />
          [% IF ( mandatorycardnumber ) %]<span class="required">Required</span>[% END %]</li>
         [% END %]
         [% UNLESS nobranchcode %]
     <li>
-      [% IF ( mandatorybranchcode ) %]
-        <label for="branchcode" class="required">
-      [% ELSE %]
-        <label for="branchcode">
-      [% END %]
-      Library: </label>
-      [% CGIbranch %]
-         [% IF ( mandatorybranchcode ) %]<span class="required">Required</span>[% END %]
+        <label for="branchcode" class="required">Library:</label>
+        <select name="branchcode" size="1" id="branchcode">
+        [%- FOREACH branchloo IN branchloop %]
+          [% IF ( branchloo.selected ) -%]
+            <option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
+          [%- ELSE -%]
+            <option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
+          [%- END -%]
+        [%- END %]
+      </select>
+      <span class="required">Required</span>
     </li>
         [% END %]
     <li>
-        <label for="categorycode">Category: </label>
+        <label for="categorycode" class="required">Category: </label>
         <select id="categorycode" name="categorycode" onchange="update_category_code(this);">
         [% FOREACH typeloo IN typeloop %]
             [% FOREACH categoryloo IN typeloo.categoryloop %]
             [% END %]
        [% END %]
        </select>
+       <span class="required">Required</span>
     </li>
         [% UNLESS nosort1 %]
     <li>
       [% IF ( CGIsort1 ) %] 
         [% CGIsort1 %]
       [% ELSE %]
-        <input  type="text" id="sort1" name="sort1" size="20"  value="[% sort1 %]" />
+          [% IF ( opduplicate ) %]
+            <input  type="text" id="sort1" name="sort1" size="20"  value="[% sort1 %]" onclick="this.value=''" />
+          [% ELSE %]
+            <input  type="text" id="sort1" name="sort1" size="20"  value="[% sort1 %]" />
+          [% END %]
          [% IF ( mandatorysort1 ) %]<span class="required">Required</span>[% END %]
       [% END %]   
     </li>
         [% END %]
        </ol>
   </fieldset>
-    [% UNLESS nodateenrolled && nodateexpiry &&  noopacnote && noborrowernotes %]
+    [% UNLESS nodateenrolled &&  noopacnote && noborrowernotes %]
        <fieldset class="rows" id="memberentry_subscription">
        <legend id="library_setup_lgd">Library set-up</legend><ol>
         [% UNLESS nodateenrolled %]
                <li>
                        [% IF ( mandatorydateenrolled ) %]
-                       <label for="dateenrolled" class="required">
+            <label for="from" class="required">
                        [% ELSE %]
-                       <label for="dateenrolled">
+            <label for="from">
                        [% END %]
                        Registration date: </label>
-                       [% IF ( metric ) %]
-                               <input type="text" id="dateenrolled" name="dateenrolled"  maxlength="10" size="10" onchange="CheckDate(document.form.dateenrolled);check_manip_date('verify');" value="[% dateenrolled %]" />
-                       [% ELSE %]
-                               <input type="text" id="dateenrolled" name="dateenrolled"  maxlength="10" size="10" value="[% dateenrolled %]" />
-                       [% END %]
-            <img src="[% themelang %]/lib/calendar/cal.gif" id="dateenrolled_button" alt="Show Calendar" />
-      <script language="JavaScript" type="text/javascript">
-        Calendar.setup(
-          {
-            inputField : "dateenrolled",
-            ifFormat : "[% DHTMLcalendar_dateformat %]",
-            button : "dateenrolled_button"
-          }
-        );
-      </script>
+            [% IF ( dateformat == "metric" ) %]
+                <input type="text" id="from" name="dateenrolled"  maxlength="10" size="10" onchange="CheckDate(document.form.dateenrolled);check_manip_date('verify');" value="[% dateenrolled %]" class="datepickerfrom" />
+            [% ELSE %]
+                <input type="text" id="from" name="dateenrolled"  maxlength="10" size="10" value="[% dateenrolled %]" class="datepickerfrom" />
+            [% END %]
                [% 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>
         [% END %]
         [% UNLESS nodateexpiry %]
                <li>
+        [% ELSE %]
+                <li style="display:none">
+        [% END %]
                        [% IF ( mandatorydateexpiry ) %]
-                       <label for="dateexpiry" class="required">
+            <label for="to" class="required">
                        [% ELSE %]
-                       <label for="dateexpiry">
+            <label for="to">
                        [% END %]
                        Expiry date (leave blank for auto calc) </label>
-                       [% IF ( metric ) %]
+            [% IF ( dateformat == "metric" ) %]
                                [% UNLESS ( opadd ) %]
-                                       <input type="text" id="dateexpiry" name="dateexpiry" maxlength="10"  size="10" onchange="CheckDate(document.form.dateexpiry);check_manip_date('verify');" value="[% dateexpiry %]" />
+                    <input type="text" id="to" name="dateexpiry" maxlength="10"  size="10" onchange="CheckDate(document.form.dateexpiry);check_manip_date('verify');" value="[% dateexpiry %]" class="datepickerto" />
                                [% ELSE %]
-                                       <input type="text" id="dateexpiry" name="dateexpiry" maxlength="10"  size="10" onchange="CheckDate(document.form.dateexpiry);check_manip_date('verify');" />
+                    <input type="text" id="to" name="dateexpiry" maxlength="10"  size="10" onchange="CheckDate(document.form.dateexpiry);check_manip_date('verify');" class="datepickerto" />
                                [% END %]
                        [% ELSE %]
                                [% UNLESS ( opadd ) %]
-                               <input type="text" id="dateexpiry" name="dateexpiry" maxlength="10"  size="10" value="[% dateexpiry %]" />
+                <input type="text" id="to" name="dateexpiry" maxlength="10"  size="10" value="[% dateexpiry %]" class="datepickerto" />
                                [% ELSE %]
-                               <input type="text" id="dateexpiry" name="dateexpiry" maxlength="10"  size="10" />
+                <input type="text" id="to" name="dateexpiry" maxlength="10"  size="10" class="datepickerto" />
                                [% END %]
                        [% END %]
-            <img src="[% themelang %]/lib/calendar/cal.gif" id="dateexpiry_button" alt="Show Calendar" />
-      <script language="JavaScript" type="text/javascript">
-        Calendar.setup(
-          {
-            inputField : "dateexpiry",
-            ifFormat : "[% DHTMLcalendar_dateformat %]",
-            button : "dateexpiry_button"
-          }
-        );
-      </script>
                [% 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>
                </li>
-        [% END %]
         [% UNLESS noopacnote %]
                <li>
                        [% IF ( mandatoryopacnote ) %]
 
     [% UNLESS nouserid && nopassword %]
        <fieldset class="rows" id="memberentry_userid">
-               <legend id="opac_staff_login_lgd">OPAC/Staff Login</legend><ol>
+        <legend id="opac_staff_login_lgd">OPAC/Staff login</legend><ol>
         [% UNLESS nouserid %]
                <li>
                        [% IF ( mandatoryuserid ) %]
                <!--this zones are not necessary in modif mode -->
                [% UNLESS ( opadd ) %]
                <fieldset class="rows">
-                       <legend>Patron Account Flags</legend>
+            <legend>Patron account flags</legend>
                        <ol class="radio">
                        [% FOREACH flagloo IN flagloop %]
                                <li><label class="radio" for="yes[% flagloo.name %]">
-                               [% IF ( flagloo.key == 'gonenoaddress' ) %]Gone no Address:[% END %]
+                [% IF ( flagloo.key == 'gonenoaddress' ) %]Gone no address:[% END %]
                                [% IF ( flagloo.key == 'debarred' ) %]Restricted:[% END %]
-                               [% IF ( flagloo.key == 'lost' ) %]Lost Card:[% END %]
+                [% IF ( flagloo.key == 'lost' ) %]Lost card:[% END %]
                 </label>
                                <label for="yes[% flagloo.name %]">Yes </label>
                                [% IF ( flagloo.yes ) %]
                 <label for="nodebarred">No </label>
                 <input type="radio" id="nodebarred" name="debarred" value="0" checked="checked"/>
                                [% END %]
-                               
-                               <br />
-                               <label for="datedebarred" class="radio">until:</label> 
-                               [% IF opduplicate %]
-                                   <input type="text" name="datedebarred" id="datedebarred" class="debarred" value="[% datedebarred %]" onclick="this.value=''" />
-                               [% ELSE %]
-                                   <input type="text" name="datedebarred" id="datedebarred" class="debarred" value="[% datedebarred %]" />
-                               [% END %]
-                               <img src="[% themelang %]/lib/calendar/cal.gif" id="debarred_button" alt="Show Calendar" />
-                        <script language="JavaScript" type="text/javascript">
-                           Calendar.setup(
-                           {
-                               inputField : "datedebarred",
-                               ifFormat : "[% DHTMLcalendar_dateformat %]",
-                               button : "debarred_button"
-                           }
-                           );
-                       </script>
-                       <br />
+
+                <span id="debarreduntil"><label for="datedebarred" class="inline">Until:</label>
+                                [% IF opduplicate %]
+                                    <input type="text" name="datedebarred" id="datedebarred" class="debarred datepicker" value="[% datedebarred %]" onclick="this.value=''" />
+                                [% ELSE %]
+                                    <input type="text" name="datedebarred" id="datedebarred" class="debarred datepicker" value="[% datedebarred %]" />
+                                [% END %]
+                <span class="hint">(optional)</span> </span>
+                </li>
+                <li>
                        <label for="debarredcomment" class="radio">Comment:</label>
                               [% IF ( opduplicate ) %] 
                                   <textarea id="debarredcomment" name="debarredcomment" cols="55" rows="3" onclick="this.value=''">[% debarredcomment %]</textarea>
     <legend>Additional attributes and identifiers</legend>
     [% FOREACH pa_loo IN patron_attributes %]
         [% IF pa_loo.class %]
-            <h4>[% pa_loo.lib %]</h4>
-            <table id=aai_[% pa_loo.class %] class="attributes_table">
-        [% ELSE %]
-            <table id="aai" class="attributes_table">
+            <fieldset id="aai_[% pa_loo.class %]">
+            <legend>[% pa_loo.lib %]</legend>
         [% END %]
-        <thead>
-            <tr>
-                <th>Type</th>
-                <th colspan="2">Value</th>
-            </tr>
-        </thead>
-        <tbody>
+        <ol class="attributes_table">
             [% FOREACH patron_attribute IN pa_loo.items %]
-                <tr data-category_code="[% patron_attribute.category_code %]">
-                    <td>
-                        [% patron_attribute.code %] ([% patron_attribute.description %])
-                    </td>
-                    <td>
+                <li data-category_code="[% patron_attribute.category_code %]">
+                    <label for="[% patron_attribute.form_id %]">[% patron_attribute.description %]: </label>
                         <input type="hidden" id="[% patron_attribute.form_id %]_code" name="[% patron_attribute.form_id %]_code" value="[% patron_attribute.code |html %]" />
                         [% IF ( patron_attribute.use_dropdown ) %]
                             <select id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]">
                             </select>
                         [% ELSE %]
                             [% IF ( opduplicate ) %]
-                            <input type="text" maxlength="64" value="[% patron_attribute.value %]"
-                                   id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]" onclick="this.value=''" />
+                            <textarea rows="2" cols="30" id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]" onclick="this.value=''" >[% patron_attribute.value %]</textarea>
                             [% ELSE %]
-                            <input type="text" maxlength="64" value="[% patron_attribute.value %]"
-                                   id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]" />
+                            <textarea rows="2" cols="30" id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]">[% patron_attribute.value %]</textarea>
                             [% END %]
                         [% END %]
                         [% IF ( patron_attribute.password_allowed ) %]
-                            (Password: <input type="password" maxlength="64" value="[% patron_attribute.password %]"
+                            (<label class="yesno" for="[% patron_attribute.form_id %]_password">Password:</label> <input type="password" maxlength="64" value="[% patron_attribute.password %]"
                                    id="[% patron_attribute.form_id %]_password" name="[% patron_attribute.form_id %]_password" />)
                         [% END %]
-                    </td>
-                    <td>
-                        <a href="#" onclick="clear_entry(this); return false;">Clear</a>
+                        <a href="#" class="clear-field" onclick="clear_entry(this); return false;">Clear</a>
                         [% IF ( patron_attribute.repeatable ) %]
-                        <a href="#" onclick="clone_entry(this); return false;">New</a>
+                        <a href="#" class="clone-field" onclick="clone_entry(this); return false;">New</a>
                         [% END %]
-                    </td>
-                </tr>
+                </li>
             [% END %]
-        </tbody>
-        </table>
+        </ol>
+        [% IF pa_loo.class %]</fieldset>[% END %]
     [% END %]
   </fieldset>
 [% END %][% END %][% END %]
     <!-- handle changing prefs if creating new patron and changing
          the patron category
     -->
-    <script language="javascript" type="text/javascript">//<![CDATA[
+    <script type="text/javascript">//<![CDATA[
        $(document).ready(function(){
             var message_prefs_dirty = false;
             $('#memberentry_messaging_prefs > *').change(function() {
                             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]);
+                                if (item['transports_' + transport] == 1) {
+                                    $('#' + transport + attrid).attr('checked', 'checked');
                                 } else {
                                     $('#' + transport + attrid).removeAttr('checked');
                                 }
     <input type="hidden" name="setting_messaging_prefs" value="1" />
     <legend id="patron_messaging_prefs_lgd">Patron messaging preferences</legend>
     [% IF type_only %]
-        <i>If no preferences are selected, the default preferences for the category chosen will be applied on save, otherwise your selection here is saved</i>
+        <p>If no preferences are selected, the default preferences for the category chosen will be applied on save, otherwise your selection here is saved</p>
     [% END %]
     [% INCLUDE 'messaging-preference-form.inc' %]
     [% IF ( SMSSendDriver ) %]
   </fieldset>
 [% END %] [% END %]
 
+[% UNLESS ( check_member ) %]
     <fieldset class="action">
         <input type="submit" name="save" onclick="return check_form_borrowers();" value="Save" />
       [% IF ( opadd ) %]
          <a class="cancel" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">Cancel</a>
           [% END %]
     </fieldset>
+[% END %]
 </form>
   
 </div>