282 lines
10 KiB
JavaScript
282 lines
10 KiB
JavaScript
|
//<script language="Javascript">
|
|||
|
|
|||
|
var arSigneErreurLayers = new Array();
|
|||
|
arSigneErreurLayers[0]='erreur';
|
|||
|
|
|||
|
|
|||
|
function validRequestSAA(objLink,nbBalAccreditees){
|
|||
|
var sDiv,sBal,sUrl,i, vFlag,size;
|
|||
|
|
|||
|
size = nbBalAccreditees;
|
|||
|
|
|||
|
sDiv='<div class="clErreur">';
|
|||
|
|
|||
|
// on enl<6E>ve les coches des zones suppl<70>mentaires vides
|
|||
|
if (window.document.frmForm1.txt_bs1.value=='') window.document.frmForm1.chk_bs1.checked=false;
|
|||
|
if (window.document.frmForm1.txt_bs2.value=='') window.document.frmForm1.chk_bs2.checked=false;
|
|||
|
|
|||
|
// on teste que les BAL suppl<70>mentaires ne correspondent pas <20> l'une des BAL accr<63>dit<69>es
|
|||
|
if (window.document.frmForm1.chk_bs1.checked) {
|
|||
|
if (size != 1) {
|
|||
|
for (i=0;i<size;i++) {
|
|||
|
if (window.document.frmForm1.txt_bs1.value.toUpperCase()==window.document.frmForm1.chk_b[i].value) {
|
|||
|
MM_setTextOfLayer('erreur','',sDiv + aErreur['ACCRED2'] + window.document.frmForm1.txt_bs1.value + "</div>")
|
|||
|
MM_showHideLayers('',arSigneErreurLayers,'erreur');
|
|||
|
return(false) ;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else {
|
|||
|
if (window.document.frmForm1.txt_bs1.value.toUpperCase()==window.document.frmForm1.chk_b.value) {
|
|||
|
MM_setTextOfLayer('erreur','',sDiv + aErreur['ACCRED2'] + window.document.frmForm1.txt_bs1.value + "</div>")
|
|||
|
MM_showHideLayers('',arSigneErreurLayers,'erreur');
|
|||
|
return(false) ;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (window.document.frmForm1.chk_bs2.checked) {
|
|||
|
if (size != 1) {
|
|||
|
for (i=0;i<size;i++) {
|
|||
|
if (window.document.frmForm1.txt_bs2.value.toUpperCase()==window.document.frmForm1.chk_b[i].value) {
|
|||
|
MM_setTextOfLayer('erreur','',sDiv + aErreur['ACCRED2'] + window.document.frmForm1.txt_bs2.value + "</div>")
|
|||
|
MM_showHideLayers('',arSigneErreurLayers,'erreur');
|
|||
|
return(false) ;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else {
|
|||
|
if (window.document.frmForm1.txt_bs2.value.toUpperCase()==window.document.frmForm1.chk_b.value) {
|
|||
|
MM_setTextOfLayer('erreur','',sDiv + aErreur['ACCRED2'] + window.document.frmForm1.txt_bs2.value + "</div>")
|
|||
|
MM_showHideLayers('',arSigneErreurLayers,'erreur');
|
|||
|
return(false) ;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// on teste que les deux BAL suppl<70>mentaires soient diff<66>rentes l'une de l'autre
|
|||
|
if (window.document.frmForm1.chk_bs1.checked & window.document.frmForm1.chk_bs2.checked & (window.document.frmForm1.txt_bs1.value.toUpperCase()==window.document.frmForm1.txt_bs2.value.toUpperCase())) {
|
|||
|
MM_setTextOfLayer('erreur','',sDiv + aErreur['ACCRED2'] + window.document.frmForm1.txt_bs1.value + "</div>")
|
|||
|
MM_showHideLayers('',arSigneErreurLayers,'erreur');
|
|||
|
return(false) ;
|
|||
|
}
|
|||
|
|
|||
|
// on teste qu'il y ait au moins une case de coch<63>e dans les BAL accr<63>dit<69>es
|
|||
|
i=0;
|
|||
|
vFlag = false;
|
|||
|
if (size != 1) {
|
|||
|
{while (i<size & !vFlag) {if (window.document.frmForm1.chk_b[i++].checked) vFlag=true;}}
|
|||
|
if (!vFlag) {
|
|||
|
MM_setTextOfLayer('erreur','',sDiv + aErreur['ACCRED1'] + "</div>")
|
|||
|
MM_showHideLayers('',arSigneErreurLayers,'erreur');
|
|||
|
return(false) ;
|
|||
|
}
|
|||
|
}
|
|||
|
else {
|
|||
|
if (window.document.frmForm1.chk_b.checked) vFlag=true;
|
|||
|
if (!vFlag) {
|
|||
|
MM_setTextOfLayer('erreur','',sDiv + aErreur['ACCRED7'] + "</div>")
|
|||
|
MM_showHideLayers('',arSigneErreurLayers,'erreur');
|
|||
|
return(false) ;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// on teste qu'il n'y ait pas plus de trois BAL s<>lectionn<6E>es
|
|||
|
vFlag=0;
|
|||
|
if (size != 1) {
|
|||
|
for (i=0;i<size;i++) if (window.document.frmForm1.chk_b[i].checked) vFlag++;
|
|||
|
if (window.document.frmForm1.chk_bs1.checked) vFlag++;
|
|||
|
if (window.document.frmForm1.chk_bs2.checked) vFlag++;
|
|||
|
if (vFlag>3) {
|
|||
|
MM_setTextOfLayer('erreur','',sDiv + aErreur['ACCRED6'] + "</div>")
|
|||
|
MM_showHideLayers('',arSigneErreurLayers,'erreur');
|
|||
|
return(false) ;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// on construit la requ<71>te SAA pour la seconde partie
|
|||
|
sBal='';
|
|||
|
if (size != 1) {
|
|||
|
for (i=0;i<size;i++) {
|
|||
|
if (window.document.frmForm1.chk_b[i].defaultChecked) {
|
|||
|
if (!window.document.frmForm1.chk_b[i].checked) sBal+= 'S;'+window.document.frmForm1.chk_b[i].value + ';' ;
|
|||
|
}
|
|||
|
else {
|
|||
|
if (window.document.frmForm1.chk_b[i].checked) sBal+= 'C;'+window.document.frmForm1.chk_b[i].value + ';' ;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else {
|
|||
|
if (window.document.frmForm1.chk_b.defaultChecked) {
|
|||
|
if (!window.document.frmForm1.chk_b.checked) sBal+= 'S;'+window.document.frmForm1.chk_b.value + ';' ;
|
|||
|
}
|
|||
|
else {
|
|||
|
if (window.document.frmForm1.chk_b.checked) sBal+= 'C;'+window.document.frmForm1.chk_b.value + ';' ;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (window.document.frmForm1.chk_bs1.defaultChecked) {
|
|||
|
if (window.document.frmForm1.chk_bs1.checked) {
|
|||
|
if (window.document.frmForm1.chk_bs1.value.toUpperCase()!=window.document.frmForm1.txt_bs1.value) {
|
|||
|
sBal += 'S;'+window.document.frmForm1.chk_bs1.value + ';C;' + window.document.frmForm1.txt_bs1.value + ';' ;
|
|||
|
}
|
|||
|
}
|
|||
|
else {
|
|||
|
sBal += 'S;'+window.document.frmForm1.chk_bs1.value + ';';
|
|||
|
}
|
|||
|
}
|
|||
|
else {
|
|||
|
if (window.document.frmForm1.chk_bs1.checked) {
|
|||
|
sBal += 'C;'+window.document.frmForm1.txt_bs1.value + ';';
|
|||
|
}
|
|||
|
}
|
|||
|
if (window.document.frmForm1.chk_bs2.defaultChecked) {
|
|||
|
if (window.document.frmForm1.chk_bs2.checked) {
|
|||
|
if (window.document.frmForm1.chk_bs2.value.toUpperCase()!=window.document.frmForm1.txt_bs2.value) {
|
|||
|
sBal += 'S;'+window.document.frmForm1.chk_bs2.value + ';C;' + window.document.frmForm1.txt_bs2.value + ';' ;
|
|||
|
}
|
|||
|
}
|
|||
|
else {
|
|||
|
sBal += 'S;'+window.document.frmForm1.chk_bs2.value + ';';
|
|||
|
}
|
|||
|
}
|
|||
|
else {
|
|||
|
if (window.document.frmForm1.chk_bs2.checked) {
|
|||
|
sBal += 'C;'+window.document.frmForm1.txt_bs2.value + ';';
|
|||
|
}
|
|||
|
}
|
|||
|
// On alerte s'il n'y a aucune modification dans le suivi
|
|||
|
if (sBal=='') {
|
|||
|
MM_setTextOfLayer('erreur','',sDiv + aErreur['ACCRED10'] + "</div>")
|
|||
|
MM_showHideLayers('',arSigneErreurLayers,'erreur');
|
|||
|
return(false) ;
|
|||
|
}
|
|||
|
|
|||
|
sUrl = 'module.asp?mod='+sModule+'&id=' + sBDFId + '&ClientRef=' + sClientRef + '&bal=' + sBal;
|
|||
|
objLink.href = sUrl;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
function disabledCheckBoxs(nbBalAccreditees) {
|
|||
|
var size, i, nbCheckedAccred, nbCheckedNotAccred;
|
|||
|
//Nombre de Bals selectionn<6E>es parmis les Bals accr<63>dit<69>s
|
|||
|
//size = window.document.frmForm1.chk_b.length;
|
|||
|
size = nbBalAccreditees;
|
|||
|
nbCheckedAccred = 0;
|
|||
|
if (size != 1) {
|
|||
|
for (i=0;i<size;i++) {
|
|||
|
if (window.document.frmForm1.chk_b[i].checked) nbCheckedAccred++;
|
|||
|
}
|
|||
|
}
|
|||
|
else {
|
|||
|
if (window.document.frmForm1.chk_b.checked) nbCheckedAccred++;
|
|||
|
}
|
|||
|
|
|||
|
// Nombre de Bals selectionn<6E>es parmis les Bals suppl<70>mentaires
|
|||
|
nbCheckedNotAccred = 0;
|
|||
|
if (window.document.frmForm1.chk_bs1.checked) nbCheckedNotAccred++;
|
|||
|
if (window.document.frmForm1.chk_bs2.checked) nbCheckedNotAccred++;
|
|||
|
nbChecked = nbCheckedAccred + nbCheckedNotAccred
|
|||
|
|
|||
|
// Le nombre max de Bals est selectionn<6E> ==> griser les Bals restantes
|
|||
|
if (nbChecked==3) {
|
|||
|
if (size != 1) {
|
|||
|
for (i=0;i<size;i++) {
|
|||
|
if (!window.document.frmForm1.chk_b[i].checked) {
|
|||
|
window.document.frmForm1.chk_b[i].setAttribute('disabled','disabled');
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else {
|
|||
|
if (!window.document.frmForm1.chk_b.checked) {
|
|||
|
window.document.frmForm1.chk_b.setAttribute('disabled','disabled');
|
|||
|
}
|
|||
|
}
|
|||
|
if (!window.document.frmForm1.chk_bs1.checked) {
|
|||
|
window.document.frmForm1.txt_bs1.setAttribute('disabled','disabled');
|
|||
|
window.document.frmForm1.chk_bs1.setAttribute('disabled','disabled');
|
|||
|
}
|
|||
|
if (!window.document.frmForm1.chk_bs2.checked) {
|
|||
|
window.document.frmForm1.txt_bs2.setAttribute('disabled','disabled');
|
|||
|
window.document.frmForm1.chk_bs2.setAttribute('disabled','disabled');
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// Le nombre de Bal selectionn<6E> est inf<6E>rieur <20> 3
|
|||
|
if (nbChecked<3) {
|
|||
|
if (size != 1) {
|
|||
|
for (i=0;i<size;i++) {
|
|||
|
if (!window.document.frmForm1.chk_b[i].checked) {
|
|||
|
window.document.frmForm1.chk_b[i].removeAttribute('disabled');
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else {
|
|||
|
if (!window.document.frmForm1.chk_b.checked) {
|
|||
|
window.document.frmForm1.chk_b.removeAttribute('disabled');
|
|||
|
}
|
|||
|
}
|
|||
|
switch (nbCheckedAccred) {
|
|||
|
case 0 :
|
|||
|
window.document.frmForm1.txt_bs1.setAttribute('disabled','disabled');
|
|||
|
window.document.frmForm1.chk_bs1.setAttribute('disabled','disabled');
|
|||
|
window.document.frmForm1.chk_bs1.checked = false;
|
|||
|
window.document.frmForm1.txt_bs2.setAttribute('disabled','disabled');
|
|||
|
window.document.frmForm1.chk_bs2.setAttribute('disabled','disabled');
|
|||
|
window.document.frmForm1.chk_bs2.checked = false;
|
|||
|
break;
|
|||
|
case 1 :
|
|||
|
window.document.frmForm1.txt_bs1.removeAttribute('disabled');
|
|||
|
window.document.frmForm1.chk_bs1.removeAttribute('disabled');
|
|||
|
window.document.frmForm1.txt_bs2.removeAttribute('disabled');
|
|||
|
window.document.frmForm1.chk_bs2.removeAttribute('disabled');
|
|||
|
break;
|
|||
|
case 2 :
|
|||
|
window.document.frmForm1.txt_bs1.removeAttribute('disabled');
|
|||
|
window.document.frmForm1.chk_bs1.removeAttribute('disabled');
|
|||
|
window.document.frmForm1.txt_bs2.setAttribute('disabled','disabled');
|
|||
|
window.document.frmForm1.chk_bs2.setAttribute('disabled','disabled');
|
|||
|
window.document.frmForm1.chk_bs2.checked = false;
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
function checkBoxsFree(indice,nbBalAccreditees) {
|
|||
|
switch (indice) {
|
|||
|
case 1 :
|
|||
|
if (window.document.frmForm1.txt_bs1.value.length == 0) {
|
|||
|
window.document.frmForm1.chk_bs1.checked = false;
|
|||
|
disabledCheckBoxs(nbBalAccreditees);
|
|||
|
}
|
|||
|
else {
|
|||
|
if (window.document.frmForm1.txt_bs1.value.length == 1) {
|
|||
|
window.document.frmForm1.chk_bs1.checked = true;
|
|||
|
disabledCheckBoxs(nbBalAccreditees);
|
|||
|
}
|
|||
|
else
|
|||
|
if (window.document.frmForm1.chk_bs1.checked == false) {
|
|||
|
window.document.frmForm1.chk_bs1.checked = true;
|
|||
|
disabledCheckBoxs(nbBalAccreditees);
|
|||
|
}
|
|||
|
}
|
|||
|
break;
|
|||
|
case 2 :
|
|||
|
if (window.document.frmForm1.txt_bs2.value.length == 0) {
|
|||
|
window.document.frmForm1.chk_bs2.checked = false;
|
|||
|
disabledCheckBoxs(nbBalAccreditees);
|
|||
|
}
|
|||
|
else {
|
|||
|
if (window.document.frmForm1.txt_bs2.value.length == 1) {
|
|||
|
window.document.frmForm1.chk_bs2.checked = true;
|
|||
|
disabledCheckBoxs(nbBalAccreditees);
|
|||
|
}
|
|||
|
else
|
|||
|
if (window.document.frmForm1.chk_bs2.checked == false) {
|
|||
|
window.document.frmForm1.chk_bs2.checked = true;
|
|||
|
disabledCheckBoxs(nbBalAccreditees);
|
|||
|
}
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|