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 = _("Separator must be /");
12 alert(msg); ok=0; field.focus();
19 if ( ((isNaN(dd))||(dd<1)||(dd>31)) && (ok==1) ) {
20 msg = _("day not correct.");
21 alert(msg); ok=0; field.focus();
25 if ( ((isNaN(mm))||(mm<1)||(mm>12)) && (ok==1) ) {
26 msg = _("month not correct.");
27 alert(msg); ok=0; field.focus();
31 if ( ((isNaN(yyyy))||(yyyy<amin)||(yyyy>amax)) && (ok==1) ) {
32 msg = _("years not correct.");
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 += ("Warning !!!! Duplicate patron!!!!");
48 check_form_borrowers(0);
49 document.form.submit();
52 msg2 += ("Warning !!!! Duplicate organisation!!!!");
54 check_form_borrowers(0);
59 document.form.submit();
64 //function test if date enrooled < date expiry
65 function check_manip_date(status) {
66 if (status=='verify'){
67 // this part of function('verify') is used to check if dateenrolled<date expiry
68 if (document.form.dateenrolled != '' && document.form.dateexpiry.value !='') {
69 var myDate1=document.form.dateenrolled.value.split ('/');
70 var myDate2=document.form.dateexpiry.value.split ('/');
71 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]))
74 document.form.dateenrolled.focus();
75 var msg = ("Warning !!! check date expiry >= date enrolment");
84 // function to test all fields in forms and nav in different forms(1 ,2 or 3)
85 function check_form_borrowers(nav){
87 if (document.form.check_member.value == 1 )
90 if (document.form_double.answernodouble) {
91 if( (!(document.form_double.answernodouble.checked))){
92 document.form.nodouble.value=0;
95 document.form.nodouble.value=1;
100 if (document.form.BorrowerMandatoryField.value=='')
104 var champ_verif = document.form.BorrowerMandatoryField.value.split ('|');
105 var message ="The following fields are mandatory :\n";
106 var message_champ="";
107 for (var i=0; i<champ_verif.length; i++) {
108 if (document.getElementsByName(""+champ_verif[i]+"")[0]) {
109 var val_champ=eval("document.form."+champ_verif[i]+".value");
110 var ref_champ=eval("document.form."+champ_verif[i]);
111 //check if it's a select
112 if (ref_champ.type=='select-one'){
113 if (ref_champ.options[0].selected ){
114 // action if field is empty
115 message_champ+=champ_verif[i]+"\n";
116 //test to konw if you must show a message with error
120 if ( val_champ == '' ) {
121 // action if the field is not empty
122 message_champ+=champ_verif[i]+"\n";
129 //patrons form to test if you chcked no to the quetsion of double
130 if (statut!=1 && document.form.check_member.value > 0 )
134 if (!(document.form_double.answernodouble.checked)){
137 message_champ+=("Please confirm suspicious duplicate patron !!! ");
139 document.form.nodouble.value=0;
142 document.form.nodouble.value=1;
147 //alert if at least 1 error
148 alert(message+"\n"+message_champ);
153 document.form.submit();
157 function Dopop(link) {
158 // // var searchstring=document.form.value[i].value;
159 var newin=window.open(link,'popup','width=600,height=400,resizable=no,toolbar=false,scrollbars=no,top');
162 function Dopopguarantor(link) {
164 var newin=window.open(link,'popup','width=600,height=400,resizable=no,toolbar=false,scrollbars=yes,top');