From c089cc3deda8883c3562df3cb7873579be6f64a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot=20=28=40U-Exp=29?= Date: Fri, 12 Sep 2014 16:50:45 +0200 Subject: [PATCH] Testing boolean modif for draft field --- controller/smscontroller.php | 5 ++++- db/smsmapper.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/controller/smscontroller.php b/controller/smscontroller.php index 439837b..54fbc76 100644 --- a/controller/smscontroller.php +++ b/controller/smscontroller.php @@ -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"; diff --git a/db/smsmapper.php b/db/smsmapper.php index 83e5a84..8590488 100644 --- a/db/smsmapper.php +++ b/db/smsmapper.php @@ -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"] )); }