1 function _(s) { return s } // dummy function for gettext
3 // this function checks id date is like DD/MM/YYYY
4 function CheckDate(field) {
9 var date = d.split("/");
12 if ( (date.length < 2) && (ok==1) ) {
13 msg = _("Separator must be /");
14 alert(msg); ok=0; field.focus();
21 if ( ((isNaN(dd))||(dd<1)||(dd>31)) && (ok==1) ) {
22 msg = _("day not correct.");
23 alert(msg); ok=0; field.focus();
27 if ( ((isNaN(mm))||(mm<1)||(mm>12)) && (ok==1) ) {
28 msg = _("month not correct.");
29 alert(msg); ok=0; field.focus();
33 if ( ((isNaN(yyyy))||(yyyy<amin)||(yyyy>amax)) && (ok==1) ) {
34 msg = _("years not correct.");
35 alert(msg); ok=0; field.focus();
41 //function test if member is unique and if it's right the member is registred
45 if ( document.form.check_member.value==1){
46 if (document.form.categorycode.value != "I"){
48 msg1 += ("Warning !!!! Duplicate patron!!!!");
50 check_form_borrowers(0);
51 document.form.submit();
54 msg2 += ("Warning !!!! Duplicate organisation!!!!");
56 check_form_borrowers(0);
61 document.form.submit();
66 //function test if date enrooled < date expiry
67 function check_manip_date(status) {
68 if (status=='verify'){
69 // this part of function('verify') is used to check if dateenrolled<date expiry
70 if (document.form.dateenrolled != '' && document.form.dateexpiry.value !='') {
71 var myDate1=document.form.dateenrolled.value.split ('/');
72 var myDate2=document.form.dateexpiry.value.split ('/');
73 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]))
76 document.form.dateenrolled.focus();
77 var msg = ("Warning !!! check date expiry >= date enrolment");
86 // function to test all fields in forms and nav in different forms(1 ,2 or 3)
87 function check_form_borrowers(nav){
89 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;
97 document.form.nodouble.value=1;
102 if (document.form.BorrowerMandatoryField.value=='')
106 var champ_verif = document.form.BorrowerMandatoryField.value.split ('|');
107 var message ="The following fields are mandatory :\n";
108 var message_champ="";
109 for (var i=0; i<champ_verif.length; i++) {
110 if (document.getElementsByName(""+champ_verif[i]+"")[0]) {
111 var val_champ=eval("document.form."+champ_verif[i]+".value");
112 var ref_champ=eval("document.form."+champ_verif[i]);
113 //check if it's a select
114 if (ref_champ.type=='select-one'){
115 if (ref_champ.options[0].selected ){
116 // action if field is empty
117 message_champ+=champ_verif[i]+"\n";
118 //test to konw if you must show a message with error
122 if ( val_champ == '' ) {
123 // action if the field is not empty
124 message_champ+=champ_verif[i]+"\n";
131 //patrons form to test if you chcked no to the quetsion of double
132 if (statut!=1 && document.form.check_member.value > 0 )
136 if (!(document.form_double.answernodouble.checked)){
139 message_champ+=("Please confirm suspicious duplicate patron !!! ");
141 document.form.nodouble.value=0;
144 document.form.nodouble.value=1;
149 //alert if at least 1 error
150 alert(message+"\n"+message_champ);
155 document.form.submit();
159 function Dopop(link) {
160 // // var searchstring=document.form.value[i].value;
161 var newin=window.open(link,'popup','width=600,height=400,resizable=no,toolbar=false,scrollbars=no,top');
164 function Dopopguarantor(link) {
166 var newin=window.open(link,'popup','width=600,height=400,resizable=no,toolbar=false,scrollbars=yes,top');