improvements from SAN Ouest Provence :
authortipaul <tipaul>
Fri, 21 Apr 2006 13:31:34 +0000 (13:31 +0000)
committertipaul <tipaul>
Fri, 21 Apr 2006 13:31:34 +0000 (13:31 +0000)
* introducing a category_type into categories. It can be A (adult), C (children), P (Professionnal), I (institution/organisation).
* each category_type has it's own forms to create members.
* the borrowers table has been heavily modified (many fields changed), to get something more logic & readable
* reintroducing guarantor/guanrantee system that is now independant from hardcoded C/A for categories
* updating templates to fit template rules

(see mail feb, 17 on koha-devel "new features for borrowers" for more details)

koha-tmpl/intranet-tmpl/prog/en/includes/javascript/members.js [new file with mode: 0644]

diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/javascript/members.js b/koha-tmpl/intranet-tmpl/prog/en/includes/javascript/members.js
new file mode 100644 (file)
index 0000000..096c23c
--- /dev/null
@@ -0,0 +1,168 @@
+<script language="JavaScript" type="text/javascript">\r
+function CheckDate(d) {\r
+       if (d!="")\r
+{\r
+      // Cette fonction vérifie le format JJ/MM/AAAA saisi et la validité de la date.\r
+      // Le séparateur est défini dans la variable separateur\r
+      var amin=1900; // année mini\r
+      var amax=2100; // année maxi\r
+      var separateur="/"; // separateur entre jour/mois/annee\r
+      var j=(d.substring(0,2));\r
+      var m=(d.substring(3,5));\r
+      var a=(d.substring(6));\r
+      var ok=1;\r
+      if ( ((isNaN(j))||(j<1)||(j>31)) && (ok==1) ) {\r
+         alert("Le jour n'est pas correct."); ok=0;\r
+      }\r
+      if ( ((isNaN(m))||(m<1)||(m>12)) && (ok==1) ) {\r
+         alert("Le mois n'est pas correct."); ok=0;\r
+      }\r
+      if ( ((isNaN(a))||(a<amin)||(a>amax)) && (ok==1) ) {\r
+         alert("L'année n'est pas correcte."); ok=0;\r
+      }\r
+      if ( ((d.substring(2,3)!=separateur)||(d.substring(5,6)!=separateur)) && (ok==1) ) {\r
+         alert("Les séparateurs doivent être des "+separateur); ok=0;\r
+      }\r
+      return ok;\r
+   }\r
+}   \r
+   \r
+\r
+\r
+\r
+//function test if member is unique and if it's right the member is registred\r
+function unique() {\r
+if (  document.form.check_member.value==1){\r
+       if (document.form.categorycode.value!="I"){\r
+               \r
+               alert("ATTENTION !!!! Ce Lecteur  existe déja");\r
+       check_form_borrowers(0);\r
+       document.form.submit();\r
+       \r
+       }else{\r
+               alert("ATTENTION !!!! Cette Collectivité  existe déja");\r
+       check_form_borrowers(0);\r
+       }\r
+}\r
+else\r
+{\r
+       document.form.submit();\r
+}\r
+\r
+}\r
+//end function\r
+//function test if date enrooled < date expiry\r
+function check_manip_date(status) {\r
+if (status=='verify'){\r
+// this part of function('verify') is used to check if dateenrolled<date expiry\r
+var myDate1=document.form.dateenrolled.value.split ('/');\r
+var myDate2=document.form.dateexpiry.value.split ('/');\r
+       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]))\r
+       \r
+               { \r
+               alert("ATTENTION !!! Vérifiez la saisie de la date d'éxpiration qui ne doit pas être antérieure ou égale a la date d'inscription");\r
+               document.form.dateexpiry.value="";\r
+               document.form.dateexpiry.setfocus;\r
+               }\r
+       }\r
+}\r
+//end function\r
+\r
+\r
+// function to test all fields in forms and nav in different forms(1 ,2 or 3)\r
+ function check_form_borrowers(nav){\r
+\r
+var statut=0;\r
+if (nav< document.form.step.value) {\r
+       document.form.step.value=nav;\r
+       if ((document.form.step.value==0) && document.form.check_member.value == 1 )\r
+       {\r
+               \r
+               if (document.form_double.answernodouble)        {\r
+                       if( (!(document.form_double.answernodouble.checked))){\r
+                               document.form.nodouble.value=0;\r
+                       }\r
+                       else {\r
+                       document.form.nodouble.value=1;\r
+                       }\r
+               }\r
+       } \r
+       document.form.submit();\r
+       \r
+\r
+} else {\r
+       if (document.form.BorrowerMandatoryfield.value==''||document.form.FormFieldList.value=='' )\r
+       {}\r
+       else\r
+       {\r
+       var champ_verif = document.form.BorrowerMandatoryfield.value.split ('|');\r
+       var champ_form= document.form.FormFieldList.value.split('|');\r
+               var message ="The following fields are mandatory :\n";\r
+       var message_champ="";\r
+               for (var j=0; j<champ_form.length; j++){ \r
+                       for (var i=0; i<champ_verif.length; i++) {\r
+                               if (eval("document.form.elements['"+champ_verif[i]+"']") && eval("document.form.elements['"+champ_verif[j]+"']")) {\r
+                                       var val_champ=eval("document.form."+champ_verif[i]+".value");\r
+                                       var ref_champ=eval("document.form."+champ_verif[i]);\r
+                                       var val_form=eval("document.form."+champ_form[j]+".value");\r
+                                       if (champ_verif[i] == champ_form[j]){\r
+                                               //check if it's a select\r
+                                               if (ref_champ.type=='select-one'){\r
+                                                       if (ref_champ.options[0].selected ){\r
+                                                               // action if field is empty\r
+                                                               message_champ+=champ_verif[i]+"\n";\r
+                                                               //test to konw if u must show a message with error\r
+                                                               statut=1;\r
+                                                       }\r
+                                               }else {\r
+                                                       if ( val_champ == '' ) {\r
+                                                               // action if the field is not empty\r
+                                                               message_champ+=champ_verif[i]+"\n";\r
+                                                               statut=1;\r
+                                                       }       \r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+//borrowers form 2 test if u chcked no to the quetsion of double \r
+       if (document.form.step.value==2 && statut!=1 && document.form.check_member.value > 0 )\r
+       {\r
+               \r
+               \r
+                       if (!(document.form_double.answernodouble.checked)){\r
+                                       \r
+                               message ="";\r
+                                       message_champ="Vous devez confirmez que la suspicion de doublon est fausse !!! ";\r
+                                       statut=1;\r
+                                       document.form.nodouble.value=0;\r
+                       }\r
+                       else {\r
+                       document.form.nodouble.value=1;\r
+                       }\r
+       }\r
+               \r
+                       if (statut==1){\r
+                       //alert if at least 1 error\r
+                               alert(message+"\n"+message_champ);\r
+                       }\r
+                       else \r
+                       {\r
+                       document.form.step=nav;\r
+                       document.form.submit();\r
+                       }\r
+               }\r
+\r
+}\r
+function Dopop(link) {\r
+// //  var searchstring=document.form.value[i].value;\r
+       newin=window.open(link,"popup",'width=500,height=250,resizable=no,toolbar=false,scrollbars=no,top');\r
+}\r
+\r
+function Dopopguarantor(link) {\r
+\r
+       newin=window.open(link,"popup",'width=600,height=400,resizable=no,toolbar=false,scrollbars=no,top');\r
+}\r
+\r
+</script>\r