Jonathan Druart
093cffe7c1
Same as bug 29394, we want the flatpickr instanciations be done at the same place, from calendar.inc. That way they will all behave identically. Test plan: Edit a patron category and confirm that the "until date" calendar has the "yesterday" and "today" dates disabled Place a hold on an item, go to the patron detail page, click the "holds" tab, suspend. That should trigger a modal that will display a calendar with "yesterday" and "today" dates disabled Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
99 lines
2.8 KiB
JavaScript
99 lines
2.8 KiB
JavaScript
/* global __ */
|
|
|
|
jQuery.validator.addMethod( "letters_numbers", function(value,element){
|
|
var patt = /^[a-zA-Z0-9\-_]+$/g;
|
|
if (patt.test(element.value)) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}, __("Category code can only contain the following characters: letters, numbers, - and _.")
|
|
);
|
|
|
|
jQuery.validator.addMethod( "enrollment_period", function(){
|
|
enrolmentperiod = $("#enrolmentperiod").val();
|
|
enrolmentperioddate = $("#enrolmentperioddate").val();
|
|
if ( $("#enrolmentperiod").val() !== "" && $("#enrolmentperioddate").val() !== "" ) {
|
|
return false;
|
|
} else {
|
|
return true;
|
|
}
|
|
}, __("Please choose an enrollment period in months OR by date.")
|
|
);
|
|
|
|
$(document).ready(function() {
|
|
KohaTable("patron_categories", {
|
|
"aoColumnDefs": [{
|
|
"aTargets": [-1],
|
|
"bSortable": false,
|
|
"bSearchable": false
|
|
}, {
|
|
"aTargets": [3, 4, 5],
|
|
"sType": "natural"
|
|
}, ],
|
|
"aaSorting": [
|
|
[1, "asc"]
|
|
],
|
|
"sPaginationType": "full",
|
|
"exportColumns": [0,1,2,3,4,5,6,7,8,9,10,11,12],
|
|
}, columns_settings);
|
|
|
|
if ($("#branches option:selected").length < 1) {
|
|
$("#branches option:first").attr("selected", "selected");
|
|
}
|
|
|
|
$("#categorycode").on("blur",function(){
|
|
toUC(this);
|
|
});
|
|
|
|
$("#category_form").validate({
|
|
rules: {
|
|
categorycode: {
|
|
required: true,
|
|
letters_numbers: true
|
|
},
|
|
description: "required",
|
|
enrolmentperiod: {
|
|
required: function(element){
|
|
return $("#enrolmentperioddate").val() === "";
|
|
},
|
|
digits: true,
|
|
enrollment_period: true,
|
|
min: 1
|
|
},
|
|
enrolmentperioddate: {
|
|
required: function(element){
|
|
return $("#enrolmentperiod").val() === "";
|
|
},
|
|
enrollment_period: true
|
|
},
|
|
dateofbirthrequired: {
|
|
digits: true
|
|
},
|
|
upperagelimit: {
|
|
digits: true
|
|
},
|
|
enrolmentfee: {
|
|
number: true
|
|
},
|
|
reservefee: {
|
|
number: true
|
|
},
|
|
category_type: {
|
|
required: true
|
|
},
|
|
min_password_length: {
|
|
digits: true
|
|
}
|
|
},
|
|
messages: {
|
|
enrolmentperiod: {
|
|
required: __("Please choose an enrollment period in months OR by date.")
|
|
},
|
|
enrolmentperioddate: {
|
|
required: __("Please choose an enrollment period in months OR by date.")
|
|
}
|
|
}
|
|
|
|
});
|
|
});
|