fixed data null bug

error-management
Nicolas FRANCO 2 years ago
parent 0b6a1ae665
commit 227cfa0942

@ -10,7 +10,7 @@
private string $idlist; // # id associating task to list
private bool $isDone; // # si la tache est complete
function __construct($titre,$description,$priorite,$idl,$dateDeb="",$dateFin="",$isDone=false,$id=0) {
function __construct($titre,$description,$priorite,$idl,$dateDeb=null,$dateFin=null,$isDone=false,$id=0) {
# if id = 0, on veut donc creer une nouvelle tache
# qui n'est pas encore dans la base de donnée et donc
# le id sera fait avec le auto increment

@ -120,10 +120,13 @@ class VisitorCtrl
function connection(){
$isCo = $this->userModel->connexion($_POST['username'],$_POST['password']);
if(!$isCo)
if(!$isCo){
$TMessage[] = 'This user does not exist'; require($this->TabVues["erreur"]);
$this->loadHome();
}
else
$this->loadHome();
}
function go_register(){
$user = $this->isUser;

@ -17,18 +17,23 @@ class TaskGateway
// code de retour pour les fonctions i,u,d?
public function insertT(Task $t){
$query='INSERT INTO Tache VALUES (:id,:titre,:descript,:dateDeb,:dateFin,:priorite,:idList,false)';
if($t->get_dateDeb() == null)
$dateDeb = NULL;
else
$dateDeb = $t->get_dateDeb();
if($t->get_dateFin() == null)
$dateFin = NULL;
else
$dateFin = $t->get_dateFin();
$this->con->executeQuery($query, array(
':id'=> array($t->get_id(),PDO::PARAM_STR),
':titre'=> array($t->get_titre(),PDO::PARAM_STR),
':descript'=> array($t->get_description(),PDO::PARAM_STR),
':dateDeb'=> array($t->get_dateDeb(),PDO::PARAM_STR),
':dateFin'=> array($t->get_dateFin(),PDO::PARAM_STR),
':dateDeb'=> array($dateDeb,PDO::PARAM_STR),
':dateFin'=> array($dateFin,PDO::PARAM_STR),
':priorite'=> array($t->get_priorite(),PDO::PARAM_STR),
':idList'=> array($t->get_idList(),PDO::PARAM_STR) ));
/*Comment gerer les erreurs?
* si valeur existe deja
*/
}
public function update($table,$id,$element, $valeur){

@ -13,7 +13,7 @@ class TaskModel
$this->gtw= new TaskGateway($con);
}
public function addTask($titre,$desc,$priorite,$idList,$dateDeb="",$dateFin="",$isDone=false,$id=0)
public function addTask($titre,$desc,$priorite,$idList,$dateDeb=null,$dateFin=null,$isDone=false,$id=0)
{
$t = new Task($titre,$desc,$priorite,$idList,$dateDeb,$dateFin,$isDone,$id);
$this->gtw->insertT($t);

@ -58,7 +58,7 @@
<form action="index.php" class="row row-cols-lg-auto g-3 justify-content-center align-items-center mb-4 pb-2" method="post">
<div class="col-12">
<div class="form-outline">
<input type="text" id="form1" class="form-control" name="listName"/>
<input type="text" id="form1" class="form-control" name="listName" required/>
</div>
</div>

Loading…
Cancel
Save