1 // this function checks id date is like DD/MM/YYYY
2 function CheckDate(field) {
7 var date = d.split("/");
10 if ( (date.length < 2) && (ok==1) ) {
11 msg = MSG_SEPARATOR+field.name;
12 alert(msg); ok=0; field.focus();
19 if ( ((isNaN(dd))||(dd<1)||(dd>31)) && (ok==1) ) {
20 msg = MSG_INCORRECT_DAY+field.name;
21 alert(msg); ok=0; field.focus();
25 if ( ((isNaN(mm))||(mm<1)||(mm>12)) && (ok==1) ) {
26 msg = MSG_INCORRECT_MONTH+field.name;
27 alert(msg); ok=0; field.focus();
31 if ( ((isNaN(yyyy))||(yyyy<amin)||(yyyy>amax)) && (ok==1) ) {
32 msg = MSG_INCORRECT_YEAR+field.name;
33 alert(msg); ok=0; field.focus();
39 //function test if member is unique and if it's right the member is registred
43 if ( document.form.check_member.value==1){
44 if (document.form.categorycode.value != "I"){
46 msg1 += MSG_DUPLICATE_PATRON;
48 check_form_borrowers(0);
49 document.form.submit();
52 msg2 += MSG_DUPLICATE_ORGANIZATION;
54 check_form_borrowers(0);
59 document.form.submit();
64 //function test if date enrooled < date expiry
65 // WARNING: format-specific test.
66 function check_manip_date(status) {
67 if (status=='verify'){
68 // this part of function('verify') is used to check if dateenrolled<date expiry
69 if (document.form.dateenrolled != '' && document.form.dateexpiry.value !='') {
70 var myDate1=document.form.dateenrolled.value.split ('/');
71 var myDate2=document.form.dateexpiry.value.split ('/');
72 if ((myDate1[2]>myDate2[2])||(myDate1[2]==myDate2[2] && myDate1[1]>myDate2[1])||(myDate1[2]==myDate2[2] && myDate1[1]>=myDate2[1] && myDate1[0]>=myDate2[0]))
75 document.form.dateenrolled.focus();
76 var msg = MSG_LATE_EXPIRY;
85 // function to test all fields in forms and nav in different forms(1 ,2 or 3)
86 function check_form_borrowers(nav){
90 if (document.form.check_member.value == 1 )
92 if (document.form_double.answernodouble) {
93 if( (!(document.form_double.answernodouble.checked))){
94 document.form.nodouble.value=0;
96 document.form.nodouble.value=1;
101 if (document.form.BorrowerMandatoryField.value=='')
105 var champ_verif = document.form.BorrowerMandatoryField.value.split ('|');
106 message += MSG_MISSING_MANDATORY
108 for (var i=0; i<champ_verif.length; i++) {
109 if (document.getElementsByName(""+champ_verif[i]+"")[0]) {
110 var val_champ=eval("document.form."+champ_verif[i]+".value");
111 var ref_champ=eval("document.form."+champ_verif[i]);
112 //check if it's a select
113 if (ref_champ.type=='select-one'){
114 // check to see if first option is selected and is blank
115 if (ref_champ.options[0].selected &&
116 ref_champ.options[0].text == ''){
117 // action if field is empty
118 message_champ+=champ_verif[i]+"\n";
119 //test to know if you must show a message with error
123 if ( val_champ == '' ) {
124 // action if the field is not empty
125 message_champ+=champ_verif[i]+"\n";
133 if ( document.form.password.value != document.form.password2.value ){
134 if ( message_champ != '' ){
135 message_champ += "\n";
137 message_champ+= MSG_PASSWORD_MISMATCH;
141 //patrons form to test if you checked no to the question of double
142 if (statut!=1 && document.form.check_member.value > 0 ) {
143 if (!(document.form_double.answernodouble.checked)){
144 message_champ+= MSG_DUPLICATE_SUSPICION;
146 document.form.nodouble.value=0;
148 document.form.nodouble.value=1;
153 //alert if at least 1 error
154 alert(message+"\n"+message_champ);
157 document.form.submit();
161 function Dopop(link) {
162 // // var searchstring=document.form.value[i].value;
163 var newin=window.open(link,'popup','width=600,height=400,resizable=no,toolbar=false,scrollbars=no,top');
166 function Dopopguarantor(link) {
168 var newin=window.open(link,'popup','width=600,height=400,resizable=no,toolbar=false,scrollbars=yes,top');
171 $(document).ready(function(){
172 if($("#yesdebarred").is(":checked")){
173 $("#debarreduntil").show();
175 $("#debarreduntil").hide();
177 $("#yesdebarred,#nodebarred").change(function(){
178 if($("#yesdebarred").is(":checked")){
179 $("#debarreduntil").show();
180 $("#datedebarred").focus();
182 $("#debarreduntil").hide();