Merge pull request #20822 from OPEN-DSI/14.0_fix_add_time_spent

FIX: Set datec when add time spent on a project task
This commit is contained in:
Laurent Destailleur 2022-05-12 01:57:20 +02:00 committed by GitHub
commit 34cdd17cb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1144,6 +1144,7 @@ class Task extends CommonObject
dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG); dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG);
$ret = 0; $ret = 0;
$now = dol_now();
// Check parameters // Check parameters
if (!is_object($user)) { if (!is_object($user)) {
@ -1169,6 +1170,7 @@ class Task extends CommonObject
$sql .= ", task_duration"; $sql .= ", task_duration";
$sql .= ", fk_user"; $sql .= ", fk_user";
$sql .= ", note"; $sql .= ", note";
$sql .= ", datec";
$sql .= ") VALUES ("; $sql .= ") VALUES (";
$sql .= $this->id; $sql .= $this->id;
$sql .= ", '".$this->db->idate($this->timespent_date)."'"; $sql .= ", '".$this->db->idate($this->timespent_date)."'";
@ -1177,6 +1179,7 @@ class Task extends CommonObject
$sql .= ", ".$this->timespent_duration; $sql .= ", ".$this->timespent_duration;
$sql .= ", ".$this->timespent_fk_user; $sql .= ", ".$this->timespent_fk_user;
$sql .= ", ".(isset($this->timespent_note) ? "'".$this->db->escape($this->timespent_note)."'" : "null"); $sql .= ", ".(isset($this->timespent_note) ? "'".$this->db->escape($this->timespent_note)."'" : "null");
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ")"; $sql .= ")";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);