Lines 1-37
Link Here
|
1 |
// this function checks id date is like DD/MM/YYYY |
1 |
// this function checks id date is like DD/MM/YYYY |
2 |
function CheckDate(field) { |
2 |
function CheckDate(field) { |
3 |
var d = field.value; |
3 |
var d = field.value; |
4 |
if (d!="") { |
4 |
if (d!=="") { |
5 |
var amin = 1900; |
5 |
var amin = 1900; |
6 |
var amax = 2100; |
6 |
var amax = 2100; |
7 |
var date = d.split("/"); |
7 |
var date = d.split("/"); |
8 |
var ok=1; |
8 |
var ok=1; |
9 |
var msg; |
9 |
var msg; |
10 |
if ( (date.length < 2) && (ok==1) ) { |
10 |
if ( (date.length < 2) && (ok==1) ) { |
11 |
msg = MSG_SEPARATOR+field.name; |
11 |
msg = MSG_SEPARATOR+field.name; |
12 |
alert(msg); ok=0; field.focus(); |
12 |
alert(msg); ok=0; field.focus(); |
13 |
return; |
13 |
return; |
14 |
} |
14 |
} |
15 |
var dd = date[0]; |
15 |
var dd = date[0]; |
16 |
var mm = date[1]; |
16 |
var mm = date[1]; |
17 |
var yyyy = date[2]; |
17 |
var yyyy = date[2]; |
18 |
// checking days |
18 |
// checking days |
19 |
if ( ((isNaN(dd))||(dd<1)||(dd>31)) && (ok==1) ) { |
19 |
if ( ((isNaN(dd))||(dd<1)||(dd>31)) && (ok==1) ) { |
20 |
msg = MSG_INCORRECT_DAY+field.name; |
20 |
msg = MSG_INCORRECT_DAY+field.name; |
21 |
alert(msg); ok=0; field.focus(); |
21 |
alert(msg); ok=0; field.focus(); |
22 |
return false; |
22 |
return false; |
23 |
} |
23 |
} |
24 |
// checking months |
24 |
// checking months |
25 |
if ( ((isNaN(mm))||(mm<1)||(mm>12)) && (ok==1) ) { |
25 |
if ( ((isNaN(mm))||(mm<1)||(mm>12)) && (ok==1) ) { |
26 |
msg = MSG_INCORRECT_MONTH+field.name; |
26 |
msg = MSG_INCORRECT_MONTH+field.name; |
27 |
alert(msg); ok=0; field.focus(); |
27 |
alert(msg); ok=0; field.focus(); |
28 |
return false; |
28 |
return false; |
29 |
} |
29 |
} |
30 |
// checking years |
30 |
// checking years |
31 |
if ( ((isNaN(yyyy))||(yyyy<amin)||(yyyy>amax)) && (ok==1) ) { |
31 |
if ( ((isNaN(yyyy))||(yyyy<amin)||(yyyy>amax)) && (ok==1) ) { |
32 |
msg = MSG_INCORRECT_YEAR+field.name; |
32 |
msg = MSG_INCORRECT_YEAR+field.name; |
33 |
alert(msg); ok=0; field.focus(); |
33 |
alert(msg); ok=0; field.focus(); |
34 |
return false; |
34 |
return false; |
35 |
} |
35 |
} |
36 |
} |
36 |
} |
37 |
} |
37 |
} |
Lines 41-62
function unique() {
Link Here
|
41 |
var msg1; |
41 |
var msg1; |
42 |
var msg2; |
42 |
var msg2; |
43 |
if ( document.form.check_member.value==1){ |
43 |
if ( document.form.check_member.value==1){ |
44 |
if (document.form.categorycode.value != "I"){ |
44 |
if (document.form.categorycode.value != "I"){ |
45 |
|
45 |
|
46 |
msg1 += MSG_DUPLICATE_PATRON; |
46 |
msg1 += MSG_DUPLICATE_PATRON; |
47 |
alert(msg1); |
47 |
alert(msg1); |
48 |
check_form_borrowers(0); |
48 |
check_form_borrowers(0); |
49 |
document.form.submit(); |
49 |
document.form.submit(); |
50 |
|
50 |
|
51 |
}else{ |
51 |
}else{ |
52 |
msg2 += MSG_DUPLICATE_ORGANIZATION; |
52 |
msg2 += MSG_DUPLICATE_ORGANIZATION; |
53 |
alert(msg2); |
53 |
alert(msg2); |
54 |
check_form_borrowers(0); |
54 |
check_form_borrowers(0); |
55 |
} |
55 |
} |
56 |
} |
56 |
} |
57 |
else |
57 |
else |
58 |
{ |
58 |
{ |
59 |
document.form.submit(); |
59 |
document.form.submit(); |
60 |
} |
60 |
} |
61 |
|
61 |
|
62 |
} |
62 |
} |
Lines 66-171
else
Link Here
|
66 |
function check_manip_date(status) { |
66 |
function check_manip_date(status) { |
67 |
if (status=='verify'){ |
67 |
if (status=='verify'){ |
68 |
// this part of function('verify') is used to check if dateenrolled<date expiry |
68 |
// this part of function('verify') is used to check if dateenrolled<date expiry |
69 |
if (document.form.dateenrolled != '' && document.form.dateexpiry.value !='') { |
69 |
if (document.form.dateenrolled !== '' && document.form.dateexpiry.value !=='') { |
70 |
var myDate1=document.form.dateenrolled.value.split ('/'); |
70 |
var myDate1=document.form.dateenrolled.value.split ('/'); |
71 |
var myDate2=document.form.dateexpiry.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])) |
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])) |
73 |
|
73 |
|
74 |
{ |
74 |
{ |
75 |
document.form.dateenrolled.focus(); |
75 |
document.form.dateenrolled.focus(); |
76 |
var msg = MSG_LATE_EXPIRY; |
76 |
var msg = MSG_LATE_EXPIRY; |
77 |
alert(msg); |
77 |
alert(msg); |
78 |
} |
78 |
} |
79 |
} |
79 |
} |
80 |
} |
80 |
} |
81 |
} |
81 |
} |
82 |
//end function |
82 |
//end function |
83 |
|
83 |
|
84 |
|
84 |
|
85 |
// function to test all fields in forms and nav in different forms(1 ,2 or 3) |
85 |
// function to test all fields in forms and nav in different forms(1 ,2 or 3) |
86 |
function check_form_borrowers(nav){ |
86 |
function check_form_borrowers(nav){ |
87 |
var statut=0; |
87 |
var statut=0; |
88 |
var message = ""; |
88 |
var message = ""; |
89 |
var message_champ=""; |
89 |
var message_champ=""; |
90 |
if (document.form.check_member.value == 1 ) |
90 |
if (document.form.check_member.value == 1 ) |
91 |
{ |
91 |
{ |
92 |
if (document.form_double.answernodouble) { |
92 |
if (document.form_double.answernodouble) { |
93 |
if( (!(document.form_double.answernodouble.checked))){ |
93 |
if( (!(document.form_double.answernodouble.checked))){ |
94 |
document.form.nodouble.value=0; |
94 |
document.form.nodouble.value=0; |
95 |
} else { |
95 |
} else { |
96 |
document.form.nodouble.value=1; |
96 |
document.form.nodouble.value=1; |
97 |
} |
97 |
} |
98 |
} |
98 |
} |
99 |
} |
99 |
} |
100 |
|
|
|
101 |
if (document.form.BorrowerMandatoryField.value=='') |
102 |
{} |
103 |
else |
104 |
{ |
105 |
var champ_verif = document.form.BorrowerMandatoryField.value.split ('|'); |
106 |
message += MSG_MISSING_MANDATORY |
107 |
message += "\n"; |
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 |
120 |
statut=1; |
121 |
} |
122 |
} else { |
123 |
if ( val_champ == '' ) { |
124 |
// action if the field is not empty |
125 |
message_champ+=champ_verif[i]+"\n"; |
126 |
statut=1; |
127 |
} |
128 |
} |
129 |
} |
130 |
} |
131 |
} |
132 |
|
100 |
|
133 |
if ( document.form.password.value != document.form.password2.value ){ |
101 |
if (document.form.BorrowerMandatoryField.value==='') |
134 |
if ( message_champ != '' ){ |
102 |
{} |
135 |
message_champ += "\n"; |
103 |
else |
136 |
} |
104 |
{ |
137 |
message_champ+= MSG_PASSWORD_MISMATCH; |
105 |
var champ_verif = document.form.BorrowerMandatoryField.value.split ('|'); |
138 |
statut=1; |
106 |
message += MSG_MISSING_MANDATORY; |
139 |
} |
107 |
message += "\n"; |
|
|
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 |
120 |
statut=1; |
121 |
} |
122 |
} else { |
123 |
if ( val_champ === '' ) { |
124 |
// action if the field is not empty |
125 |
message_champ+=champ_verif[i]+"\n"; |
126 |
statut=1; |
127 |
} |
128 |
} |
129 |
} |
130 |
} |
131 |
} |
132 |
|
133 |
if ( document.form.password.value != document.form.password2.value ){ |
134 |
if ( message_champ !== '' ){ |
135 |
message_champ += "\n"; |
136 |
} |
137 |
message_champ+= MSG_PASSWORD_MISMATCH; |
138 |
statut=1; |
139 |
} |
140 |
|
140 |
|
141 |
//patrons form to test if you checked no to the question of double |
141 |
//patrons form to test if you checked no to the question of double |
142 |
if (statut!=1 && document.form.check_member.value > 0 ) { |
142 |
if (statut!=1 && document.form.check_member.value > 0 ) { |
143 |
if (!(document.form_double.answernodouble.checked)){ |
143 |
if (!(document.form_double.answernodouble.checked)){ |
144 |
message_champ+= MSG_DUPLICATE_SUSPICION; |
144 |
message_champ+= MSG_DUPLICATE_SUSPICION; |
145 |
statut=1; |
145 |
statut=1; |
146 |
document.form.nodouble.value=0; |
146 |
document.form.nodouble.value=0; |
147 |
} else { |
147 |
} else { |
148 |
document.form.nodouble.value=1; |
148 |
document.form.nodouble.value=1; |
149 |
} |
149 |
} |
150 |
} |
150 |
} |
151 |
|
151 |
|
152 |
if (statut==1){ |
152 |
if (statut==1){ |
153 |
//alert if at least 1 error |
153 |
//alert if at least 1 error |
154 |
alert(message+"\n"+message_champ); |
154 |
alert(message+"\n"+message_champ); |
155 |
return false; |
155 |
return false; |
156 |
} else { |
156 |
} else { |
157 |
document.form.submit(); |
157 |
document.form.submit(); |
158 |
} |
158 |
} |
159 |
} |
159 |
} |
160 |
|
160 |
|
161 |
function Dopop(link) { |
161 |
function Dopop(link) { |
162 |
// // var searchstring=document.form.value[i].value; |
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'); |
163 |
var newin=window.open(link,'popup','width=600,height=400,resizable=no,toolbar=false,scrollbars=no,top'); |
164 |
} |
164 |
} |
165 |
|
165 |
|
166 |
function Dopopguarantor(link) { |
166 |
function Dopopguarantor(link) { |
167 |
|
167 |
|
168 |
var newin=window.open(link,'popup','width=600,height=400,resizable=no,toolbar=false,scrollbars=yes,top'); |
168 |
var newin=window.open(link,'popup','width=600,height=400,resizable=no,toolbar=false,scrollbars=yes,top'); |
169 |
} |
169 |
} |
170 |
|
170 |
|
171 |
$(document).ready(function(){ |
171 |
$(document).ready(function(){ |
172 |
- |
|
|