]> Softwares of Agnibho - simpleipd.git/blobdiff - lib/db.php
Fixed departure
[simpleipd.git] / lib / db.php
index 9cdffbcb3f5b315f82bc0a7d35a647d82e75e8df..86e37608ebe006bd7ca5e54046f9f7782914295a 100644 (file)
@@ -267,9 +267,10 @@ class DB extends SQLite3 {
   function setDischarged($pid){
     global $log;
     if(!checkAccess("discharge", "dbSet")) return false;
-    $stmt=$this->prepare("UPDATE patients SET status=:discharged WHERE pid=:pid;");
+    $stmt=$this->prepare("UPDATE patients SET status=:discharged,departure=:time WHERE pid=:pid;");
     $stmt->bindValue(":pid", $pid);
     $stmt->bindValue(":discharged", "discharged");
+    $stmt->bindValue(":time", time());
     $stmt->execute();
     $log->log($pid, "discharged", null);
   }
@@ -281,8 +282,10 @@ class DB extends SQLite3 {
     $stmt->bindValue(":time", strtotime($post["date"].$post["time"]));
     $stmt->bindValue(":data", json_encode($post));
     $stmt->execute();
-    $stmt=$this->prepare("UPDATE patients SET status='expired' WHERE pid=:pid;");
+    $stmt=$this->prepare("UPDATE patients SET status=:expired,departure=:time WHERE pid=:pid;");
     $stmt->bindValue(":pid", $pid);
+    $stmt->bindValue(":expired", "expired");
+    $stmt->bindValue(":time", time());
     $stmt->execute();
     $log->log($pid, "death_declare", json_encode($post));
   }