135 lines
3.6 KiB
PHP
Executable File
135 lines
3.6 KiB
PHP
Executable File
<?php
|
|
require_once 'Framework/Modele.php';
|
|
class Tabmotifecxlusionprestation extends Modele{
|
|
|
|
public function getlistermotifecxlusionprestation(){
|
|
$sql = "SELECT *
|
|
FROM p_motifecxlusionprestation
|
|
ORDER BY 1;";
|
|
|
|
$resultat = $this->executerRequete($sql);
|
|
return $resultat->fetchAll(PDO::FETCH_ASSOC);
|
|
}
|
|
|
|
public function getmotifecxlusionprestation($id){
|
|
$sql = "SELECT *
|
|
FROM p_motifecxlusionprestation
|
|
WHERE (id = ?);";
|
|
|
|
$resultat = $this->executerRequete($sql, array($id));
|
|
return $resultat->fetch(PDO::FETCH_ASSOC);
|
|
}
|
|
|
|
public function existeligne($codeMotifExclusion) {
|
|
$sql = 'select id FROM p_motifecxlusionprestation WHERE (codeMotifExclusion=?)';
|
|
$resultat = $this->executerRequete($sql, array($codeMotifExclusion));
|
|
return ($resultat->rowCount() > 0);
|
|
}
|
|
|
|
public function ajoutermotifexclusionprestation($codeMotifExclusion, $libelle, $libelleEng){
|
|
$codeSociete = $_SESSION['codeSociete'];
|
|
|
|
$sql = 'INSERT INTO p_motifecxlusionprestation(codeSociete,codeMotifExclusion,libelle,libelleEng)
|
|
VALUES (?,?,?,?);';
|
|
|
|
$this->executerRequete($sql, array($codeSociete,$codeMotifExclusion,$libelle,$libelleEng));
|
|
}
|
|
|
|
public function modifiermotifecxlusionprestation($codeMotifExclusion,$libelle,$libelleEng,$id){
|
|
|
|
if(empty($codeMotifExclusion) && empty($libelle)){
|
|
echo "Enregistrement impossible trop de données importantes sont absentes!";
|
|
die();
|
|
}
|
|
|
|
$sql = 'UPDATE p_motifecxlusionprestation
|
|
SET codeMotifExclusion=?,libelle=?,libelleEng=?
|
|
WHERE (id = ?);';
|
|
|
|
$this->executerRequete($sql, array($codeMotifExclusion,$libelle,$libelleEng,$id));
|
|
}
|
|
|
|
public function maxId(){
|
|
$sql = 'SELECT MAX(codeMotifExclusion)+1 AS `maxId`
|
|
FROM p_motifecxlusionprestation;';
|
|
|
|
$resultat = $this->executerRequete($sql)->fetch(PDO::FETCH_ASSOC);
|
|
return $resultat['maxId'];
|
|
}
|
|
|
|
|
|
public function supprimermotifecxlusionprestation($id){
|
|
$sql = 'DELETE
|
|
FROM p_motifecxlusionprestation
|
|
WHERE (id = ?);';
|
|
|
|
$this->executerRequete($sql, array($id));
|
|
}
|
|
|
|
///////////////////////////////////////////////////////
|
|
|
|
public function selectionnerune($id){
|
|
|
|
$sql = "UPDATE p_motifecxlusionprestation
|
|
SET choix='1'
|
|
WHERE (id = ?);";
|
|
|
|
$this->executerRequete($sql, array($id));
|
|
}
|
|
|
|
public function deselectionnerune($id){
|
|
|
|
$sql = "UPDATE p_motifecxlusionprestation
|
|
SET choix='0'
|
|
WHERE (id = ?);";
|
|
|
|
$this->executerRequete($sql, array($id));
|
|
}
|
|
|
|
public function selectionnertoutes(){
|
|
$sql = "UPDATE p_motifecxlusionprestation
|
|
SET choix='1';";
|
|
|
|
$this->executerRequete($sql);
|
|
}
|
|
|
|
public function deselectionnertoutes(){
|
|
|
|
$sql = "UPDATE p_motifecxlusionprestation
|
|
SET choix='0';";
|
|
|
|
$this->executerRequete($sql);
|
|
}
|
|
|
|
public function existeSelection() {
|
|
$sql = 'select id FROM p_motifecxlusionprestation WHERE (choix="1")';
|
|
$resultat = $this->executerRequete($sql);
|
|
return ($resultat->rowCount() > 0);
|
|
}
|
|
|
|
public function getid($id){
|
|
$sql = "SELECT *
|
|
FROM p_motifecxlusionprestation
|
|
WHERE (id = ?);";
|
|
|
|
$resultat = $this->executerRequete($sql, array($id));
|
|
return $resultat->fetch(PDO::FETCH_ASSOC);
|
|
}
|
|
|
|
public function supprimertoutes(){
|
|
|
|
$sql = 'DELETE
|
|
FROM p_motifecxlusionprestation;';
|
|
|
|
$this->executerRequete($sql);
|
|
}
|
|
|
|
public function supprimerchoix(){
|
|
|
|
$sql = "DELETE
|
|
FROM p_motifecxlusionprestation
|
|
WHERE (choix='1');";
|
|
|
|
$this->executerRequete($sql);
|
|
}
|
|
} |