Bug 10507: improve warning about duplicate patron attribute value
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / memberentrygen.tt
index f4734c0..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 = "" });
             }
         [% END %]
         $("#dateofbirth").datepicker({ maxDate: "-1D" });
+        $("#entryform").preventDoubleFormSubmit();
     });
 
     function clear_entry(node) {
-        var original = node.parentNode;
-        $("input[type=text]", original).attr('value', '');
+        var original = $(node).parent();
+        $("textarea", original).attr('value', '');
         $("select", original).attr('value', '');
     }
 
                        </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_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>
                 <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 %]
 
         [% IF ( mandatorydateofbirth ) %]<span class="required">Required</span>[% END %]
         [% IF ( ERROR_dateofbirth ) %]<span class="required">(Error)</span>[% END %]
       <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 %]
             <label for="from">
                        [% END %]
                        Registration date: </label>
-                       [% IF ( metric ) %]
+            [% 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 %]
+            [% ELSE %]
                 <input type="text" id="from" name="dateenrolled"  maxlength="10" size="10" value="[% dateenrolled %]" class="datepickerfrom" />
-                       [% END %]
+            [% 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="to" class="required">
                        [% ELSE %]
             <label for="to">
                        [% END %]
                        Expiry date (leave blank for auto calc) </label>
-                       [% IF ( metric ) %]
+            [% IF ( dateformat == "metric" ) %]
                                [% UNLESS ( opadd ) %]
                     <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 %]
                [% IF ( ERROR_dateexpiry ) %]<span class="required">(Error)</span>[% END %]
                <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
                </li>
-        [% END %]
         [% UNLESS noopacnote %]
                <li>
                        [% IF ( mandatoryopacnote ) %]
                             </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 ) %]
     <!-- 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');
                                 }
   </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>