3 jQuery.validator.addMethod( "letters_numbers", function(value,element){
4 var patt = /^[a-zA-Z0-9\-_]+$/g;
5 if (patt.test(element.value)) {
10 }, __("Category code can only contain the following characters: letters, numbers, - and _.")
13 jQuery.validator.addMethod( "enrollment_period", function(){
14 enrolmentperiod = $("#enrolmentperiod").val();
15 enrolmentperioddate = $("#enrolmentperioddate").val();
16 if ( $("#enrolmentperiod").val() !== "" && $("#enrolmentperioddate").val() !== "" ) {
21 }, __("Please choose an enrollment period in months OR by date.")
24 flatpickr.l10ns.default.firstDayOfWeek = calendarFirstDayOfWeek;
26 $(document).ready(function() {
27 KohaTable("patron_categories", {
33 "aTargets": [3, 4, 5],
39 "sPaginationType": "full",
40 "exportColumns": [0,1,2,3,4,5,6,7,8,9,10,11,12],
43 $("#enrolmentperioddate").flatpickr({
44 minDate: new Date().fp_incr(1)
47 if ($("#branches option:selected").length < 1) {
48 $("#branches option:first").attr("selected", "selected");
51 $("#categorycode").on("blur",function(){
55 $("#category_form").validate({
61 description: "required",
63 required: function(element){
64 return $("#enrolmentperioddate").val() === "";
67 enrollment_period: true,
70 enrolmentperioddate: {
71 required: function(element){
72 return $("#enrolmentperiod").val() === "";
74 enrollment_period: true
76 dateofbirthrequired: {
91 min_password_length: {
97 required: __("Please choose an enrollment period in months OR by date.")
99 enrolmentperioddate: {
100 required: __("Please choose an enrollment period in months OR by date.")