extranet/www/fiben/ressources/javascript/multi_identifiants.js
2010-01-28 09:32:35 +00:00

113 lines
3.4 KiB
JavaScript

//<script language="Javascript">
var arSigneErreurLayers = new Array();
arSigneErreurLayers[0]='cMod';
arSigneErreurLayers[1]='c1';
arSigneErreurLayers[2]='c2';
arSigneErreurLayers[3]='c3';
arSigneErreurLayers[4]='c4';
arSigneErreurLayers[5]='c5';
arSigneErreurLayers[6]='c6';
arSigneErreurLayers[7]='c7';
arSigneErreurLayers[8]='c8';
arSigneErreurLayers[9]='c9';
arSigneErreurLayers[10]='c10';
arSigneErreurLayers[11]='signeNom';
arSigneErreurLayers[12]='erreur';
function resetFields()
{
var objRef;
for (i=1;i<=10;i++) {
objRef = MM_findObj('ident'+i);
objRef.value='';
}
objRef=MM_findObj('txt_mod');
objRef.value='';
objRef=MM_findObj('txt_refint');
objRef.value='';
MM_showHideLayers('',arSigneErreurLayers);
//return(false);
}
function validRequest(objLink,sMod,sFam,sSource) {
var i,sUrl, sId, bFlag;
sUrl = cstRoot + '/Demandes/MultiIdentRequest.asp?Mod='
if (sMod==null) sMod=document.frmForm1.txt_mod.value; else document.frmForm1.txt_mod.value=sMod;
sUrl+= sMod;
if (bCheck(sMod)) {
if (sFam!=null) sUrl+= '&Famille=' + sFam;
if (document.frmForm1.txt_refint.value!='') sUrl+= '&RefClient=' + document.frmForm1.txt_refint.value;
for (i=1;i<=cstMaxId;i++) {
sId = MM_findObj('ident'+i);
if (sId.value!='' && sId.value!=null) {
sUrl+= '&Id=' + sId.value;
}
}
objLink.href=sUrl;
}
}
function bCheck(sMod)
{
var bFlag,bIndex, objIdent;
var sDiv='<div class="clErreur">' ;
if(sMod=="")
{
MM_setTextOfLayer('erreur','',sDiv + aErreur['U054'] + "</div>");
MM_showHideLayers('',arSigneErreurLayers,'erreur','cMod');
return(false);
}
if (objModule.value=='81' || objModule.value=='82' || objModule.value=='83' || objModule.value=='84' || objModule.value=='85' || objModule.value=='88' || objModule.value=='91' || objModule.value=='92' || objModule.value=='93' || objModule.value=='94' || objModule.value=='95' || objModule.value=='98' || objModule.value.toUpperCase()=='LS')
{
MM_setTextOfLayer('erreur','',sDiv + aErreur['U00A'] + "</div>");
MM_showHideLayers('',arSigneErreurLayers,'erreur','cMod');
return(false);
}
if (sMod=="07")
{
MM_setTextOfLayer('erreur','',sDiv + aErreur['U00B'] + "</div>");
MM_showHideLayers('',arSigneErreurLayers,'erreur','cMod');
return(false);
}
iIndex=sUserProfile.indexOf("|" + sMod.toUpperCase() + "|") ;
if (iIndex==-1)
{
MM_setTextOfLayer('erreur','',sDiv + aErreur['U02'] + "</div>");
MM_showHideLayers('',arSigneErreurLayers,'erreur','cMod');
return(false);
}
bFlag=false ;
bIndex = (cstValidModuleList4BDFKeys.indexOf("|" + sMod + "|")==-1);
for(i=1;i<=cstMaxId;i++)
{
objIdent=MM_findObj('ident' + i);
if ((objIdent.value!='')&&(objIdent.value!='null'))
{
bFlag=true ;
if (iCheckIdentifiant(objIdent.value)==cstNothing)
{
MM_setTextOfLayer('erreur','',sDiv + aErreur['U01'] + "</div>");
MM_showHideLayers('',arSigneErreurLayers,'erreur','c' + i);
return (false);
}
if (iCheckIdentifiant(objIdent.value)==cstBDFKey && bIndex)
{
MM_setTextOfLayer('erreur','',sDiv + aErreur['IST06'] + "</div>");
MM_showHideLayers('',arSigneErreurLayers,'erreur','c' + i);
return (false);
}
}
}
if (bFlag==false)
{
MM_setTextOfLayer('erreur','',sDiv + aErreur['U053'] + "</div>");
MM_showHideLayers('',arSigneErreurLayers,'erreur','c1');
return(false);
}
return(true);
}