diff --git a/controleurs/c_pompiers.php b/controleurs/c_pompiers.php index e580575..74ea240 100644 --- a/controleurs/c_pompiers.php +++ b/controleurs/c_pompiers.php @@ -65,8 +65,14 @@ switch ($action) { break; case 'validerAjouter': case 'validerModifier': { - var_dump($_REQUEST); - $valeur = $_REQUEST['pId']; + var_dump($_REQUEST); + + if (!isset($pdo)) { + require_once ("../include/class.pdo.php"); + $pdo = PdoBD::getPdoBD(); + } + + $pId = $_REQUEST['pId']; $nom = addslashes($_REQUEST['ztNom']); $prenom = addslashes($_REQUEST['ztPrenom']); $type = $_REQUEST['lstType']; @@ -74,11 +80,12 @@ switch ($action) { $statut = $_REQUEST['lstStatut']; $cis = $_REQUEST['zCis']; $mail = $_REQUEST['ztMail']; - $login = $_REQUEST['ztLogin']; - $mdp = md5($_REQUEST['ztMdp']); - if ($_REQUEST['brMdp'] == 0 and $action === "validerModifier") { - $mdp = "*"; - } + $login = strtolower($_REQUEST['ztPrenom'][0]) . strtoupper($_REQUEST['ztNom']); + $mdp = md5($login); + //$mdp = md5($_REQUEST['ztMdp']); + // if ($_REQUEST['brMdp'] == 0 and $action === "validerModifier") { + // $mdp = "*"; + // } $adresse = addslashes($_REQUEST['ztAdresse']); if (strlen($_REQUEST['ztCodePostal']) > 1) { @@ -88,7 +95,7 @@ switch ($action) { } $ville = addslashes($_REQUEST['ztVille']); - if (strlen($_REQUEST['ztTel']) > 1) { + if (strlen($_REQUEST['ztTel']) > 0) { $tel = str_replace(" ", "", $_REQUEST['ztTel']); $tel = str_replace(".", "", $tel); $tel = str_replace("/", "", $tel); @@ -98,9 +105,9 @@ switch ($action) { $commentaire = addslashes($_REQUEST['ztObservation']); if ($action === "validerAjouter") { - $pdo->ajoutPompier($cis, $valeur, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire); + $pdo->ajoutPompier($cis, $pId, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire); } elseif ($action === "validerModifier") { - $pdo->majPompier($cis, $valeur, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire); + $pdo->majPompier($cis, $pId, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire); } //header('location: index.php?choixTraitement=pompiers&action=voir&lstPompiers=' . $valeur); break; diff --git a/include/class.pdo.php b/include/class.pdo.php index f2b0b30..cdb6778 100644 --- a/include/class.pdo.php +++ b/include/class.pdo.php @@ -79,10 +79,10 @@ class PdoBD public function getInfosPompier($login, $mdp) { /* - $req = "SELECT pCis, pId as id, pNom as nom, pPrenom as prenom, pStatut, pMail, pLogin, pMdp, pGrade, pAdresse, pCp, pVille, pBip, pCommentaire, - 'la caserne' as cNom, 'adresse' as cAdresse, 'telephone' as cTel, 'le groupement' as cGroupement, 'le grade' as wGrade, 'le statut' as wStatut, 'le type' as wType - FROM pompier"; - */ + $req = "SELECT pCis, pId as id, pNom as nom, pPrenom as prenom, pStatut, pMail, pLogin, pMdp, pGrade, pAdresse, pCp, pVille, pBip, pCommentaire, + 'la caserne' as cNom, 'adresse' as cAdresse, 'telephone' as cTel, 'le groupement' as cGroupement, 'le grade' as wGrade, 'le statut' as wStatut, 'le type' as wType + FROM pompier"; + */ $req = "SELECT pCis, pId as id, @@ -122,7 +122,7 @@ class PdoBD */ public function majActivite($cis, $idUser, $jour, $tranche, $newDispo) { - $existedTranche = 'SELECT aDisponibilite FROM `activite` + $existedTranche = 'SELECT aDisponibilite FROM activite WHERE aCis = ' . $cis . ' AND aDateGarde = "' . $jour . '" AND aTranche = ' . $tranche . ' AND aPompier = ' . $idUser . ';'; $rs = PdoBD::$monPdo->query($existedTranche); var_dump($rs); @@ -174,14 +174,29 @@ class PdoBD /** * Met à jour une ligne de la table pompier */ - public function majPompier($cis, $valeur, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire) + public function majPompier($cis, $pId, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire) { + $grade = 7; + $type = 2; + $statut = 2; + date_default_timezone_set('Europe/Paris'); + $dateUpdate = date('y-m-d h:i:s'); + + $req = " - - - - + UPDATE pompier + SET pCis ='$cis', pId ='$pId', + pNom ='$nom', pPrenom ='$prenom', + pStatut ='$statut', pType ='$type', + pMail ='$mail', pLogin ='$login', + pMdp ='$mdp', pAdresse ='$adresse', + pCp ='$cp', pVille ='$ville', + pBip ='$tel', pGrade ='$grade', + pCommentaire ='$commentaire', pDateModif ='$dateUpdate' + WHERE pCis='$cis' AND pId = '$pId' ;"; + var_dump($req); + die; $rs = PdoBD::$monPdo->exec($req); if ($rs === false) { afficherErreurSQL("Probleme lors de la mise à jour du pompier dans la base de données.", $req, PdoBD::$monPdo->errorInfo()); @@ -340,8 +355,8 @@ class PdoBD $lesDispos[$pompier][$laDate][$couleur] = $uneLigne['dCouleur']; } /* echo "
"; - print_r($lesDispos); - echo "";*/ + print_r($lesDispos); + echo "";*/ return $lesDispos; } diff --git a/include/proceduresJava.js b/include/proceduresJava.js index b7421dc..5303e8f 100644 --- a/include/proceduresJava.js +++ b/include/proceduresJava.js @@ -195,7 +195,7 @@ function format_euro(valeur) { // ========================= affiche l'onglet choisi function Affiche(ongletChoisi, nb) { - for(i=1;i
Nom | |
---|---|
Prénom | |
Adresse | |
Adresse | |
Code postal | |
Ville | |
Téléphone |