diff --git a/model/dao/TaskDAO/PostgreSQLTaskDAO.php b/model/dao/TaskDAO/PostgreSQLTaskDAO.php index f0411b215..846c8fb7c 100644 --- a/model/dao/TaskDAO/PostgreSQLTaskDAO.php +++ b/model/dao/TaskDAO/PostgreSQLTaskDAO.php @@ -699,7 +699,7 @@ public function partialUpdate(DirtyTaskVO $taskVO) { if ($last == (strlen($sql) - 2)) $sql = substr($sql, 0, -2); - $sql = $sql . " WHERE id=".$taskVO->getId(); + $sql = $sql . ", updated_at=now() WHERE id=".$taskVO->getId(); $res = pg_query($this->connect, $sql); if ($res == NULL) throw new SQLQueryErrorException(pg_last_error()); @@ -899,7 +899,20 @@ public function update(TaskVO $taskVO) { public function create(TaskVO $taskVO) { $affectedRows = 0; - $sql = "INSERT INTO task (_date, init, _end, story, telework, onsite, text, ttype, phase, usrid, projectid) VALUES(" . + $sql = "INSERT INTO task (" . + "_date, " . + "init, " . + "_end, " . + "story, " . + "telework, " . + "onsite, " . + "text, " . + "ttype, " . + "phase, " . + "usrid, " . + "projectid, " . + "updated_at " . + ") VALUES(" . DBPostgres::formatDate($taskVO->getDate()) . ", " . DBPostgres::checkNull($taskVO->getInit()) . ", " . DBPostgres::checkNull($taskVO->getEnd()) . ", " . @@ -910,7 +923,9 @@ public function create(TaskVO $taskVO) { DBPostgres::checkStringNull($taskVO->getTtype()) . ", " . DBPostgres::checkStringNull($taskVO->getPhase()) . ", " . DBPostgres::checkNull($taskVO->getUserId()) . ", " . - DBPostgres::checkNull($taskVO->getProjectId()) . ")"; + DBPostgres::checkNull($taskVO->getProjectId()) . ", " . + "now()" . + ")" ; $res = pg_query($this->connect, $sql); diff --git a/model/vo/TaskVO.php b/model/vo/TaskVO.php index ceb2a1e98..c65bd318a 100644 --- a/model/vo/TaskVO.php +++ b/model/vo/TaskVO.php @@ -66,6 +66,7 @@ class TaskVO { protected $phase = NULL; protected $userId = NULL; protected $projectId = NULL; + protected $updated_at = NULL; public function setId($id) { if (is_null($id)) @@ -178,6 +179,17 @@ public function getProjectId() { return $this->projectId; } + public function setUpdatedAt($updated_at) { + if (is_null($updated_at)) + $this->updated_at = $updated_at; + else + $this->updated_at = (int) $updated_at; + } + + public function getUpdatedAt() { + return $this->updated_at; + } + /**#@-*/ /**