diff --git a/controllers/scheduleds.php b/controllers/scheduleds.php index daab3fc..e9caf53 100755 --- a/controllers/scheduleds.php +++ b/controllers/scheduleds.php @@ -165,7 +165,7 @@ return false; } - if (!$db->createScheduleds($date, $content)) + if (!$db->insertIntoTable('scheduleds', ['at' => $date, 'content' => $content, 'progress' => false])) { if (!$api) { @@ -259,7 +259,12 @@ //Si la date fournie est passée, on la change pour dans 2 minutes $objectDate = DateTime::createFromFormat('Y-m-d H:i', $date); - $db->updateTableWhere('scheduleds', ['content' => $scheduled['content'], 'date' => $date], ['id' => $id_scheduled]); //On met à jour le sms + if (!$db->updateTableWhere('scheduleds', ['content' => $scheduled['content'], 'at' => $date], ['id' => $id_scheduled])) + { + $_SESSION['errormessage'] = 'Impossible de mettre à jour le SMS numéro ' . $scheduled['id'] . '.'; + header('Location: ' . $this->generateUrl('scheduleds', 'showAll')); + return false; + } $db->deleteScheduleds_numbersForScheduled($id_scheduled); //On supprime tous les numéros pour ce SMS $db->deleteScheduleds_contactsForScheduled($id_scheduled); //On supprime tous les contacts pour ce SMS diff --git a/createDatabase.sql b/createDatabase.sql index d1ca2a3..1ae9f01 100755 --- a/createDatabase.sql +++ b/createDatabase.sql @@ -27,7 +27,7 @@ CREATE TABLE scheduleds id INT NOT NULL AUTO_INCREMENT, at DATETIME NOT NULL, content VARCHAR(1000) NOT NULL, - progress BOOLEAN NOT NULL, + progress BOOLEAN NOT NULL DEFAULT 0, PRIMARY KEY (id) ); diff --git a/receiveds/.keepdir b/receiveds/.keepdir new file mode 100644 index 0000000..e69de29