| 
      
            Lines 6-136
          
      
      
        Link Here
      
     | 
  
        
          | 6 | 
          [% INCLUDE 'calendar.inc' %]  | 
          6 | 
          [% INCLUDE 'calendar.inc' %]  | 
        
        
          | 7 | 
          <script type="text/javascript">  | 
          7 | 
          <script type="text/javascript">  | 
        
        
          | 8 | 
          //<![CDATA[  | 
          8 | 
          //<![CDATA[  | 
        
          
            
              | 9 | 
                  $(document).ready(function() { | 
              9 | 
              $(document).ready(function() { | 
            
        
          | 10 | 
           | 
          10 | 
           | 
        
          
            
              | 11 | 
                      [% IF categorycode %]  | 
              11 | 
              	[% IF categorycode %]  | 
            
            
              | 12 | 
                          update_category_code( "[% categorycode %]" );  | 
              12 | 
              		update_category_code( "[% categorycode %]" );  | 
            
            
              | 13 | 
                      [% ELSE %]  | 
              13 | 
              	[% ELSE %]  | 
            
            
              | 14 | 
                          if ( $("#categorycode_entry").length > 0 ){ | 
              14 | 
              		if ( $("#categorycode_entry").length > 0 ){ | 
            
            
              | 15 | 
                              var category_code = $("#categorycode_entry").find("option:selected").val(); | 
              15 | 
              			var category_code = $("#categorycode_entry").find("option:selected").val(); | 
            
            
              | 16 | 
                              update_category_code( category_code );  | 
              16 | 
              			update_category_code( category_code );  | 
            
            
              | 17 | 
                          }  | 
              17 | 
              		}  | 
            
            
              | 18 | 
                      [% END %]  | 
              18 | 
              	[% END %]  | 
            
            
              | 19 | 
                      $("#dateofbirth").datepicker({ maxDate: "-1D", yearRange: "c-120:" }); | 
              19 | 
              	$("#dateofbirth").datepicker({ maxDate: "-1D", yearRange: "c-120:" }); | 
            
            
              | 20 | 
                      dateformat = $("#dateofbirth").siblings(".hint").first().html(); | 
              20 | 
              	dateformat = $("#dateofbirth").siblings(".hint").first().html(); | 
            
            
              | 21 | 
                      CalculateAge();  | 
              21 | 
              	write_age();  | 
            
            
              | 22 | 
                      $("#entryform").validate({ | 
              22 | 
              	$("#entryform").validate({ | 
            
            
              | 23 | 
                          rules: { | 
              23 | 
              		rules: { | 
            
            
              | 24 | 
                              email: { | 
              24 | 
              			email: { | 
            
            
              | 25 | 
                                  email: true  | 
              25 | 
              				email: true  | 
            
            
              | 26 | 
                              },  | 
              26 | 
              			},  | 
            
            
              | 27 | 
                              emailpro: { | 
              27 | 
              			emailpro: { | 
            
            
              | 28 | 
                                  email: true  | 
              28 | 
              				email: true  | 
            
            
              | 29 | 
                              },  | 
              29 | 
              			},  | 
            
            
              | 30 | 
                              B_email: { | 
              30 | 
              			B_email: { | 
            
            
              | 31 | 
                                  email: true  | 
              31 | 
              				email: true  | 
            
            
              | 32 | 
                              }  | 
              32 | 
              			}  | 
            
            
              | 33 | 
                          },  | 
              33 | 
              		},  | 
            
            
              | 34 | 
                          submitHandler: function(form) { | 
              34 | 
              		submitHandler: function(form) { | 
            
            
              | 35 | 
                              $("body, form input[type='submit'], form button[type='submit'], form a").addClass('waiting'); | 
              35 | 
              			$("body, form input[type='submit'], form button[type='submit'], form a").addClass('waiting'); | 
            
            
              | 36 | 
                              if (form.beenSubmitted)  | 
              36 | 
              			if (form.beenSubmitted)  | 
            
            
              | 37 | 
                                  return false;  | 
              37 | 
              				return false;  | 
            
            
              | 38 | 
                              else  | 
              38 | 
              			else  | 
            
            
              | 39 | 
                                  form.beenSubmitted = true;  | 
              39 | 
              				form.beenSubmitted = true;  | 
            
            
              | 40 | 
                                  form.submit();  | 
              40 | 
              				form.submit();  | 
            
            
              | 41 | 
                              }  | 
              41 | 
              			}  | 
            
            
              | 42 | 
                      });  | 
              42 | 
              	});  | 
            
        
          | 43 | 
           | 
          43 | 
           | 
        
          
            
              | 44 | 
                      var mrform = $("#manual_restriction_form"); | 
              44 | 
              	var mrform = $("#manual_restriction_form"); | 
            
            
              | 45 | 
                      var mrlink = $("#add_manual_restriction"); | 
              45 | 
              	var mrlink = $("#add_manual_restriction"); | 
            
            
              | 46 | 
                      mrform.hide();  | 
              46 | 
              	mrform.hide();  | 
            
            
              | 47 | 
                      mrlink.on("click",function(e){ | 
              47 | 
              	mrlink.on("click",function(e){ | 
            
            
              | 48 | 
                          $(this).hide();  | 
              48 | 
              		$(this).hide();  | 
            
            
              | 49 | 
                          mrform.show();  | 
              49 | 
              		mrform.show();  | 
            
            
              | 50 | 
                          e.preventDefault();  | 
              50 | 
              		e.preventDefault();  | 
            
            
              | 51 | 
                      });  | 
              51 | 
              	});  | 
            
            
              | 52 | 
                      $("#cancel_manual_restriction").on("click",function(e){ | 
              52 | 
              	$("#cancel_manual_restriction").on("click",function(e){ | 
            
            
              | 53 | 
                          $('#debarred_expiration').val(''); | 
              53 | 
              		$('#debarred_expiration').val(''); | 
            
            
              | 54 | 
                          $('#add_debarment').val(0); | 
              54 | 
              		$('#add_debarment').val(0); | 
            
            
              | 55 | 
                          $('#debarred_comment').val(''); | 
              55 | 
              		$('#debarred_comment').val(''); | 
            
            
              | 56 | 
                          mrlink.show();  | 
              56 | 
              		mrlink.show();  | 
            
            
              | 57 | 
                          mrform.hide();  | 
              57 | 
              		mrform.hide();  | 
            
            
              | 58 | 
                          e.preventDefault();  | 
              58 | 
              		e.preventDefault();  | 
            
            
              | 59 | 
                      });  | 
              59 | 
              	});  | 
            
            
              | 60 | 
                  });  | 
              60 | 
              });  | 
            
        
          | 61 | 
           | 
          61 | 
           | 
        
          
            
              | 62 | 
                  function clear_entry(node) { | 
              62 | 
              function clear_entry(node) { | 
            
            
              | 63 | 
                      var original = $(node).parent();  | 
              63 | 
              	var original = $(node).parent();  | 
            
            
              | 64 | 
                      $("textarea", original).attr('value', ''); | 
              64 | 
              	$("textarea", original).attr('value', ''); | 
            
            
              | 65 | 
                      $("select", original).attr('value', ''); | 
              65 | 
              	$("select", original).attr('value', ''); | 
            
            
              | 66 | 
                  }  | 
              66 | 
              }  | 
            
        
          | 67 | 
           | 
          67 | 
           | 
        
          
            
              | 68 | 
                  function clone_entry(node) { | 
              68 | 
              function clone_entry(node) { | 
            
            
              | 69 | 
                      var original = $(node).parent();  | 
              69 | 
              	var original = $(node).parent();  | 
            
            
              | 70 | 
                      var clone = original.clone();  | 
              70 | 
              	var clone = original.clone();  | 
            
        
          | 71 | 
           | 
          71 | 
           | 
        
          
            
              | 72 | 
                      var newId = 50 + parseInt(Math.random() * 100000);  | 
              72 | 
              	var newId = 50 + parseInt(Math.random() * 100000);  | 
            
            
              | 73 | 
                      $("input,select,textarea", clone).attr('id', function() { | 
              73 | 
              	$("input,select,textarea", clone).attr('id', function() { | 
            
            
              | 74 | 
                          return this.id.replace(/patron_attr_\d+/, 'patron_attr_' + newId);  | 
              74 | 
              		return this.id.replace(/patron_attr_\d+/, 'patron_attr_' + newId);  | 
            
            
              | 75 | 
                      });  | 
              75 | 
              	});  | 
            
            
              | 76 | 
                      $("input,select,textarea", clone).attr('name', function() { | 
              76 | 
              	$("input,select,textarea", clone).attr('name', function() { | 
            
            
              | 77 | 
                          return this.name.replace(/patron_attr_\d+/, 'patron_attr_' + newId);  | 
              77 | 
              		return this.name.replace(/patron_attr_\d+/, 'patron_attr_' + newId);  | 
            
            
              | 78 | 
                      });  | 
              78 | 
              	});  | 
            
            
              | 79 | 
                      $("label", clone).attr('for', function() { | 
              79 | 
              	$("label", clone).attr('for', function() { | 
            
            
              | 80 | 
                          return $(this).attr("for").replace(/patron_attr_\d+/, 'patron_attr_' + newId); | 
              80 | 
              		return $(this).attr("for").replace(/patron_attr_\d+/, 'patron_attr_' + newId); | 
            
            
              | 81 | 
                      });  | 
              81 | 
              	});  | 
            
            
              | 82 | 
                      $("input#patron_attr_" + newId, clone).attr('value',''); | 
              82 | 
              	$("input#patron_attr_" + newId, clone).attr('value',''); | 
            
            
              | 83 | 
                      $("select#patron_attr_" + newId, clone).attr('value',''); | 
              83 | 
              	$("select#patron_attr_" + newId, clone).attr('value',''); | 
            
            
              | 84 | 
                      $(original).after(clone);  | 
              84 | 
              	$(original).after(clone);  | 
            
            
              | 85 | 
                      return false;  | 
              85 | 
              	return false;  | 
            
            
              | 86 | 
                  }  | 
              86 | 
              }  | 
            
        
          | 87 | 
           | 
          87 | 
           | 
        
          
            
              | 88 | 
                  function update_category_code(category_code) { | 
              88 | 
              function update_category_code(category_code) { | 
            
            
              | 89 | 
                      if ( $(category_code).is("select") ) { | 
              89 | 
              	if ( $(category_code).is("select") ) { | 
            
            
              | 90 | 
                          category_code = $("#categorycode_entry").find("option:selected").val(); | 
              90 | 
              		category_code = $("#categorycode_entry").find("option:selected").val(); | 
            
            
              | 91 | 
                      }  | 
              91 | 
              	}  | 
            
            
              | 92 | 
                      var mytables = $(".attributes_table"); | 
              92 | 
              	var mytables = $(".attributes_table"); | 
            
            
              | 93 | 
                      $(mytables).find("li").hide(); | 
              93 | 
              	$(mytables).find("li").hide(); | 
            
            
              | 94 | 
                      $(mytables).find(" li[data-category_code='"+category_code+"']").show(); | 
              94 | 
              	$(mytables).find(" li[data-category_code='"+category_code+"']").show(); | 
            
            
              | 95 | 
                      $(mytables).find(" li[data-category_code='']").show(); | 
              95 | 
              	$(mytables).find(" li[data-category_code='']").show(); | 
            
            
              | 96 | 
                  }  | 
              96 | 
              }  | 
            
        
          | 97 | 
           | 
          97 | 
           | 
        
          
            
              | 98 | 
                  function select_user(borrowernumber, borrower) { | 
              98 | 
              function select_user(borrowernumber, borrower) { | 
            
            
              | 99 | 
                      var form = $('#entryform').get(0); | 
              99 | 
              	var form = $('#entryform').get(0); | 
            
            
              | 100 | 
                      if (form.guarantorid.value) { | 
              100 | 
              	if (form.guarantorid.value) { | 
            
            
              | 101 | 
                          $("#contact-details").find('a').remove(); | 
              101 | 
              		$("#contact-details").find('a').remove(); | 
            
            
              | 102 | 
                          $("#contactname, #contactfirstname").parent().find('span').remove(); | 
              102 | 
              		$("#contactname, #contactfirstname").parent().find('span').remove(); | 
            
            
              | 103 | 
                      }  | 
              103 | 
              	}  | 
            
            
               | 
               | 
              104 | 
               | 
            
            
              | 105 | 
              	var id = borrower.borrowernumber;  | 
            
            
              | 106 | 
              	form.guarantorid.value = id;  | 
            
            
              | 107 | 
              	$('#contact-details') | 
            
            
              | 108 | 
              		.show()  | 
            
            
              | 109 | 
              		.find('span') | 
            
            
              | 110 | 
              		.after('<a target="blank" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=' + id + '">' + id + '</a>'); | 
            
            
              | 111 | 
               | 
            
            
              | 112 | 
              	$(form.contactname)  | 
            
            
              | 113 | 
              		.val(borrower.surname)  | 
            
            
              | 114 | 
              		.before('<span>' + borrower.surname + '</span>').get(0).type = 'hidden'; | 
            
            
              | 115 | 
              	$(form.contactfirstname)  | 
            
            
              | 116 | 
              		.val(borrower.firstname)  | 
            
            
              | 117 | 
              		.before('<span>' + borrower.firstname + '</span>').get(0).type = 'hidden'; | 
            
            
              | 118 | 
               | 
            
            
              | 119 | 
              	form.streetnumber.value = borrower.streetnumber;  | 
            
            
              | 120 | 
              	form.address.value = borrower.address;  | 
            
            
              | 121 | 
              	form.address2.value = borrower.address2;  | 
            
            
              | 122 | 
              	form.city.value = borrower.city;  | 
            
            
              | 123 | 
              	form.state.value = borrower.state;  | 
            
            
              | 124 | 
              	form.zipcode.value = borrower.zipcode;  | 
            
            
              | 125 | 
              	form.country.value = borrower.country;  | 
            
            
              | 126 | 
              	form.branchcode.value = borrower.branchcode;  | 
            
            
              | 127 | 
               | 
            
            
              | 128 | 
              	form.guarantorsearch.value = _("Change"); | 
            
        
          | 104 | 
           | 
          129 | 
           | 
        
          
            
              | 105 | 
                      var id = borrower.borrowernumber;  | 
              130 | 
              	return 0;  | 
            
            
              | 106 | 
                      form.guarantorid.value = id;  | 
              131 | 
              }  | 
            
            
              | 107 | 
                      $('#contact-details') | 
               | 
               | 
            
            
              | 108 | 
                          .show()  | 
            
            
              | 109 | 
                          .find('span') | 
            
            
              | 110 | 
                          .after('<a target="blank" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=' + id + '">' + id + '</a>'); | 
            
        
          | 111 | 
           | 
          132 | 
           | 
        
          
            
              | 112 | 
                      $(form.contactname)  | 
              133 | 
                  function write_age() { | 
            
            
              | 113 | 
                          .val(borrower.surname)  | 
              134 | 
                      var hint = $("#dateofbirth").siblings(".hint").first(); | 
            
            
              | 114 | 
                          .before('<span>' + borrower.surname + '</span>').get(0).type = 'hidden'; | 
              135 | 
                      hint.html(dateformat);  | 
            
            
              | 115 | 
                      $(form.contactfirstname)  | 
               | 
               | 
            
            
              | 116 | 
                          .val(borrower.firstname)  | 
            
            
              | 117 | 
                          .before('<span>' + borrower.firstname + '</span>').get(0).type = 'hidden'; | 
            
        
          | 118 | 
           | 
          136 | 
           | 
        
          
            
              | 119 | 
                      form.streetnumber.value = borrower.streetnumber;  | 
              137 | 
                      var age = CalculateAge(document.form.dateofbirth.value);  | 
            
            
              | 120 | 
                      form.address.value = borrower.address;  | 
               | 
               | 
            
            
              | 121 | 
                      form.address2.value = borrower.address2;  | 
            
            
              | 122 | 
                      form.city.value = borrower.city;  | 
            
            
              | 123 | 
                      form.state.value = borrower.state;  | 
            
            
              | 124 | 
                      form.zipcode.value = borrower.zipcode;  | 
            
            
              | 125 | 
                      form.country.value = borrower.country;  | 
            
            
              | 126 | 
                      form.branchcode.value = borrower.branchcode;  | 
            
        
          | 127 | 
           | 
          138 | 
           | 
        
          
            
              | 128 | 
                      form.guarantorsearch.value = _("Change"); | 
              139 | 
                      if (!age.year && !age.month) { | 
            
            
               | 
               | 
              140 | 
                          return;  | 
            
            
              | 141 | 
                      }  | 
            
            
              | 142 | 
               | 
            
            
              | 143 | 
                      var age_string;  | 
            
            
              | 144 | 
                      if (age.year || age.month) { | 
            
            
              | 145 | 
                          age_string = _('Age: '); | 
            
            
              | 146 | 
                      }  | 
            
            
              | 147 | 
               | 
            
            
              | 148 | 
                      if (age.year) { | 
            
            
              | 149 | 
                          age_string += _(age.year > 1 ? '%s years ' : '%s year ').format(age.year);  | 
            
            
              | 150 | 
                      }  | 
            
            
              | 151 | 
               | 
            
            
              | 152 | 
                      if (age.month) { | 
            
            
              | 153 | 
                          age_string += _(age.month > 1 ? '%s months ' : '%s month ').format(age.month);  | 
            
            
              | 154 | 
                      }  | 
            
        
          | 129 | 
           | 
          155 | 
           | 
        
          
            
              | 130 | 
                      return 0;  | 
              156 | 
                      hint.html(age_string);  | 
            
        
          | 131 | 
              }  | 
          157 | 
              }  | 
        
        
          | 132 | 
           | 
          158 | 
           | 
        
            
              | 133 | 
              >>>>>>> Bug 15206 - Show patron's age under date of birth in memberentry.pl  | 
               | 
               | 
            
        
          | 134 | 
                  var MSG_SEPARATOR = _("Separator must be / in field %s"); | 
          159 | 
                  var MSG_SEPARATOR = _("Separator must be / in field %s"); | 
        
        
          | 135 | 
                  var MSG_INCORRECT_DAY = _("Invalid day entered in field %s"); | 
          160 | 
                  var MSG_INCORRECT_DAY = _("Invalid day entered in field %s"); | 
        
        
          | 136 | 
                  var MSG_INCORRECT_MONTH = _("Invalid month entered in field %s"); | 
          161 | 
                  var MSG_INCORRECT_MONTH = _("Invalid month entered in field %s"); | 
        
  
    | 
      
            Lines 329-335
          
      
      
        Link Here
      
     | 
  
        
          | 329 | 
                          [% END %]  | 
          354 | 
                          [% END %]  | 
        
        
          | 330 | 
                          Date of birth: </label>  | 
          355 | 
                          Date of birth: </label>  | 
        
        
          | 331 | 
           | 
          356 | 
           | 
        
          
            
              | 332 | 
                              <input type="text" id="dateofbirth" name="dateofbirth" size="20" onchange="CalculateAge();" value="[% UNLESS opduplicate %][% dateofbirth %][% END %]" />  | 
              357 | 
                              <input type="text" id="dateofbirth" name="dateofbirth" size="20" onchange="write_age();" value="[% UNLESS opduplicate %][% dateofbirth %][% END %]" />  | 
            
        
          | 333 | 
           | 
          358 | 
           | 
        
        
          | 334 | 
                  [% IF ( mandatorydateofbirth ) %]<span class="required">Required</span>[% END %]  | 
          359 | 
                  [% IF ( mandatorydateofbirth ) %]<span class="required">Required</span>[% END %]  | 
        
        
          | 335 | 
                  [% IF ( ERROR_dateofbirth ) %]<span class="required">(Error)</span>[% END %]  | 
          360 | 
                  [% IF ( ERROR_dateofbirth ) %]<span class="required">(Error)</span>[% END %]  | 
        
            
              | 336 | 
              -   | 
               | 
               |