1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
|
<?php
require("./../../config/global.inc.php");
//In case the Session Variable was unset, assume it is not locked.
if(!isset($_SESSION['ProjectLocked'])){
$_SESSION['ProjectLocked'] = false;
}
if($_SESSION['ProjectLocked'] == false){
$modifReg = 0;
$traceTable = new T_TraceTable();
$traceTable->insertAll($DB, "Started Saving Operation, ".eMail_User());
//Insertion des reponses sur les regles
if (!isEmpty(getPOST('regle'))) {
$idProjetRevision = getPOST('idProjectRevision');
$tabCommentaires = getPOST('commentaire');
$tabStatuts = getPOST('statut');
$tabQaStatuts = getPOST('qaStatut');
$tabQaCommentaires = getPOST('qaCommentaire');
$tabSousRubriques = getPOST('sousRubrique');
$tabRegles = getPOST('regle');
$nbrRegles = sizeof($tabRegles );
$traceTable->insertAll($DB, "Saving for PR:".$idProjetRevision);
$traceTable->insertAll($DB, "No. Rules received: ".$nbrRegles);
if(isEmpty(getPost('idProjectRevision')))
{
echo "<H1>Warning: Project Revision is empty</H1>";
$traceTable->insertAll($DB, "Warning: Project Revision is empty!");
}
if(isEmpty(getPost('sousRubrique')))
{
echo "<H1>Warning: Sub Sections are empty</H1>";
$traceTable->insertAll($DB, "Warning: SousRubrique is empty!");
}
for ($i=0; $i < $nbrRegles; $i++)
{
try
{
$lienProjetRegle = T_lienProjetRegle::selectByIdRegleAndIdProjetRevisionAndSousRub2($DB, $tabRegles[$i], $idProjetRevision, $tabSousRubriques[$i]);
$lienProjetRegle->setIdStatut($tabStatuts[$i]);
$lienProjetRegle->setCommentaire($tabCommentaires[$i]);
$lienProjetRegle->setIdQaStatut($tabQaStatuts[$i]);
$lienProjetRegle->setQaCommentaire($tabQaCommentaires[$i]);
//echo $i." ".$tabCommentaires[$i]."<br/>"; //Used in debugging
//echo $tabQaStatus[$i]."<br>";
if (is_uploaded_file)
{
$nouveau_chemin = "./../../upload/";
if (move_uploaded_file($_FILES['userfile']['tmp_name'][$i], $nouveau_chemin.$_FILES['userfile']['name'][$i]))
{
$lienProjetRegle->setPieceJointeProjet($_FILES['userfile']['name'][$i]);
}
}
$lienProjetRegle->setDateModificationProjetRegle(date("Y-m-d H:i:s"));
if($lienProjetRegle->update($DB) == 0)
{
$traceTable->insertAll($DB, "ERROR in Rule ".$i." in LienProjetRegle (Rule id: ".$tabRegles[$i].")");
}
//Variable pour afficher un message de modification a l'utilisateur
$modifReg = 1;
//mettre a jour la date de modification d'un projet
$projetRevision = T_ProjetRevision::selectById($DB, $idProjetRevision);
$projetRevision->setDateModificationProjetRevision(date("Y-m-d H:i:s"));
if($projetRevision->update($DB) == 0)
{
$traceTable->insertAll($DB, "ERROR in Rule ".$i." in Project Revision ".$idProjetRevision);
}
//modifier la date de modification du projet phase une fois qu'on modifie dans t_lien_projet_regle(pour que ce projet s'affiche en premier dans page declaratioProjet.php)
$projetPhase = T_Projet_phase::selectById($DB, $projetRevision->getIdProjetPhase());
$projetPhase->setDateModificationProjetPhase(date("Y-m-d H:i:s"));
if($projetPhase->update($DB) == 0)
{
$traceTable->insertAll($DB, "ERROR in Rule ".$i." in Project Phase ".$projetRevision->getIdProjetPhase());
}
$traceTable->insertAll($DB, "Saving Rule no ".$i." ID ".$tabRegles[$i].". Status: ".$tabStatuts[$i].". Comment: ".$tabCommentaires[$i]);
}
catch(Exception $e)
{
$traceTable->insertAll($DB, "Saving Rule no ".$i." in PR ".$idProjetRevision.". ERROR: ".$e->getMessage());
}
}
}
else
{
echo "<H1>WARNING: The rules are sent EMPTY</H1>";
$traceTable->insertAll($DB, "Rules 'regle' sent were empty");
}
T_ProjetRevision::UnlockProjet($DB, $idProjetRevision);
$_SESSION['ProjectLocked'] = T_ProjetRevision::IsProjectLocked($DB, $idProjetRevision);
$traceTable->insertAll($DB, "End of Saving Operation");
$targetLink = getPOST('targetLink');
switch ($targetLink)
{
case "accueil":
$targetlink = "./../../views/identification/accueil.php";
break;
case "identification":
$targetlink = "./../../views/identification/identification.php";
break;
case "declaration":
$targetlink = "./../../views/projets/declarationProjet.php";
break;
case "declaration":
$targetlink = "./../../views/projets/declarationProjet.php";
break;
case "listchecklist":
$targetlink = "./../../views/projets/listChecklist.php?idPR=".$idProjetRevision;
break;
case "default":
$targetlink = "./genererChecklist.php?modifReg=".$modifReg."&idPR=".getPOST('idProjectRevision');
break;
case "disconnect":
$targetlink ="./../../controllers/identification/deconnecter.php";
break;
default: //In case of any phases re-direction
$targetlink = "./../../controllers/projets/genererChecklist.php?idPR=".substr($targetLink,3);
break;
}
echo
'
<script type="text/javascript">
function go_now()
{
//window.open("'.$targetlink.'", _self);
window.location.href = "'.$targetlink.'";
};
function redirect()
{
setTimeout("go_now()", 2000);
};
</script>
';
?>
<BODY onLoad="redirect();">
<?php
if($_SESSION['ProjectLocked'] == false)
{?>
<H1>Processing...</H1>
<?php
}?>
</BODY>
<?php
}
else
{
$targetLink = getPOST('targetLink');
$idProjetRevision = getPOST('idProjectRevision');
switch ($targetLink)
{
case "accueil":
$targetlink = "./../../views/identification/accueil.php";
break;
case "identification":
$targetlink = "./../../views/identification/identification.php";
break;
case "declaration":
$targetlink = "./../../views/projets/declarationProjet.php";
break;
case "declaration":
$targetlink = "./../../views/projets/declarationProjet.php";
break;
case "listchecklist":
$targetlink = "./../../views/projets/listChecklist.php?idPR=".$idProjetRevision;
break;
case "default":
$targetlink = "./genererChecklist.php?modifReg=".$modifReg."&idPR=".getPOST('idProjectRevision');
break;
case "disconnect":
$targetlink ="./../../controllers/identification/deconnecter.php";
break;
default: //In case of any phases re-direction
$targetlink = "./../../controllers/projets/genererChecklist.php?idPR=".substr($targetLink,3);
break;
}
redirige($targetlink);
}
?> |
Partager