pour_une_election_et_un_poste"; // GET - POST if (isset ($_GET['validation'])){ $validation=$_GET['validation']; }else{ $validation=0; } if (isset ($_POST['scrutin'])){ $scrutin=$_POST['scrutin']; }else{ $scrutin=0; } if (isset ($_POST['scrutinsolde'])){ $scrutinsolde=$_POST['scrutinsolde']; }else{ $scrutinsolde=0; } if (isset ($_POST['poste'])){ $poste=$_POST['poste']; }else{ $poste=0; } if (isset ($_POST['candidat'])){ $candidat=$_POST['candidat']; }else{ $candidat=0; } $f = new utils (); $f -> headerhtml (); $f -> collectivite (); $f -> droit ($obj); $f -> header (1, $ent); $f->isAuthorized($obj); echo "\n
\n"; if($validation==0){ $validation=1; echo ""; echo ""; echo ""; // choix scrutin $sql="select scrutin,libelle from scrutin where solde ='Oui'"; $res = $f -> db -> query($sql); if (DB :: isError($res)) die($res->getMessage()."erreur SELECT ".$sql); echo ""; // choix scrutin $sql="select scrutin,libelle from scrutin where solde !='Oui'"; $res = $f -> db -> query($sql); if (DB :: isError($res)) die($res->getMessage()."erreur SELECT ".$sql); echo ""; // choix poste $sql="select poste,poste from poste where nature ='affectation'"; $res = $f -> db -> query($sql); if (DB :: isError($res)) die($res->getMessage()."erreur SELECT ".$sql); echo ""; // choix candidat $sql="select candidat,nom,candidat.scrutin as scrutin from candidat inner join scrutin on candidat.scrutin=scrutin.scrutin where solde ='Oui' order by nom"; $res = $f -> db -> query($sql); if (DB :: isError($res)) die($res->getMessage()."erreur SELECT ".$sql); echo ""; If ($_SESSION['profil'] >= $f -> droit){ echo ""; echo "
".$f -> lang("transfert")." ".$f -> lang("des")." ".$f -> lang("affectation").$f -> lang("pluriel")."
".$f -> lang("selectionnez")." ".$f -> lang("un")." ".$f -> lang("scrutin")." ".$f -> lang("solde")."
".$f -> lang("selectionnez")." ".$f -> lang("un")." ".$f -> lang("scrutin")." ".$f -> lang("encours")."
".$f -> lang("selectionnez")." ".$f -> lang("un")." ".$f -> lang("poste")."
".$f -> lang("selectionnez")." ".$f -> lang("un")." ".$f -> lang("candidat")."

"; echo ""; echo "

"; echo $f -> lang("attention")." ".$f -> lang("traitement")." ".$f -> lang("non")." ".$f -> lang("controle")." , ".$f -> lang("decision")." = ".$f -> lang("non")."  !"; }else echo "
Droits insuffisants ou reconnectez-vous."; echo ""; echo "
"; }else{ // validation = 1 echo "
"; // verification existence echo "
".$f -> lang("traitement").""; $sql = "select count(affectation) from affectation where scrutin ='". $scrutin."' and poste ='".$poste."' and decision = 'Oui'"; if($candidat!='T') $sql.=" and where candidat='".$candidat."'"; $nb = $f -> db -> getOne($sql); if(!is_numeric($nb)) $nb=0; echo "
  ".$f -> lang("il_existe")." ".$nb." ".$poste.$f -> lang("pluriel")." ".$f -> lang("pour")." ".$scrutin." ".$f -> lang("candidat")." ".$candidat." ".$f -> lang("avec")." ".$f -> lang("decision")." = ".$f -> lang("oui")."
"; // selection $sql = "select affectation.elu,bureau,periode,candidat,nom,prenom from affectation inner join elu on elu.elu=affectation.elu where scrutin ='". $scrutinsolde."' and affectation.poste ='".$poste."' and decision = 'Oui'"; if($candidat!='T') $sql.=" and candidat='".$candidat."'"; $res = $f -> db -> query($sql); if (DB :: isError($res)) die($res->getMessage()."erreur SELECT ".$sql); while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ $affectation = $f -> db -> nextId('affectation'); $sql="insert into affectation (affectation,scrutin,decision,periode,poste,bureau,candidat,note,elu) values('".$affectation."','".$scrutin."','Non','".$row['periode']."','".$poste."','". $row['bureau']."','".$row['candidat']."','transfert ".$scrutinsolde. "','".$row['elu']."')"; $res1 = $f -> db -> query($sql); if (DB :: isError($res1)) die($res1->getMessage()."erreur maj ".$sql); echo "
  ".$row['elu']." ".$row['nom']." ".$row['prenom']."  ".$row['bureau'].' '. $row['periode']."
"; } echo ""; echo "
"; echo "
"; } echo "
"; // $f -> footer (); $f -> deconnexion (); $f -> footerhtml (); ?>