headerhtml ();
$f -> collectivite ();
$f -> droit ($obj);
$f -> header (1, $ent);
$f->isAuthorized($obj);
echo "\n
\n";
if($validation==0){
$validation=1;
echo "
";
echo "".$f -> lang("affectation_automatique_des_heures")." - ".$f -> lang("table")." \"periode\" ";
echo "
";
}else{
// validation = 1
echo "
";
$sql="select candidature,periode,debut,fin,nom,prenom from candidature inner join agent on agent.agent=candidature.agent where scrutin='".
$scrutin."' and decision ='Oui' order by nom";
$res = $f -> db -> query($sql);
echo "
".$f -> lang("candidature").$f -> lang("pluriel")." ".$f -> lang("concernee").$f -> lang("pluriel")." ";
if (DB :: isError($res))
die($res->getMessage()."erreur SELECT ".$sql);
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){
$sql = "select debut from periode where periode ='".$row['periode']."'";
$debut = $f -> db -> getOne($sql);
//if(is_object($debut)) $debut='00:00';
$sql = "select fin from periode where periode ='".$row['periode']."'";
$fin = $f -> db -> getOne($sql);
echo " ".$row['candidature']." ".$row['nom']."  ".$row['prenom']." ".$row['periode']." ".$f -> lang("debut")." : ".$debut." ".$f -> lang("fin")." : ".$fin." ";
$sql="update candidature set debut='".$debut."', fin = '".$fin.
"' where candidature=".$row['candidature'];
$res1 = $f -> db -> query($sql);
if (DB :: isError($res1))
die($res1->getMessage()."erreur maj ".$sql);
}
echo " ";
echo "".$f -> lang("affectation")." ".$f -> lang("heure").$f -> lang("pluriel")." ";
echo "".$f -> lang("affectation")." ".$f -> lang("heure").$f -> lang("pluriel")." ".$f -> lang("effectuee")." ! ";
echo " ";
echo "";
}
echo "
";
$f -> footer ();
$f -> deconnexion ();
$f -> footerhtml ();
?>