1
0
mirror of https://github.com/nerzhul/ocsms.git synced 2025-06-07 07:56:23 +00:00

Testing boolean modif for draft field

This commit is contained in:
Loïc Blot (@U-Exp) 2014-09-12 16:50:45 +02:00
parent 3096f44293
commit c089cc3ded
2 changed files with 5 additions and 2 deletions

View File

@ -57,7 +57,7 @@ class SmsController extends Controller {
return false;
}
foreach ($smsDatas as $sms) {
foreach ($smsDatas as &$sms) {
if (!array_key_exists("id", $sms) || !array_key_exists("read", $sms) ||
!array_key_exists("draft", $sms) ||
!array_key_exists("date", $sms) || !array_key_exists("seen", $sms) ||
@ -85,6 +85,9 @@ class SmsController extends Controller {
$this->errorMsg = "Error: Invalid SMS Draft state";
return false;
}
else {
$sms["draft"] == $sms["draft"] === true;
}
if (!is_numeric($sms["date"]) && $sms["date"] != 0 && $sms["date"] != 1) {
$this->errorMsg = "Error: Invalid SMS date";

View File

@ -30,7 +30,7 @@ class SmsMapper extends Mapper {
$result = $query->execute(array(
$userId, "NOW()", "NOW()",
$sms["read"] === "true", $sms["seen"] === "true",
(int) $sms["date"], $sms["draft"] === "true", $sms["id"],
(int) $sms["date"], $sms["draft"], (int) $sms["id"],
$sms["address"], $sms["body"]
));
}