From 4c80e0425b1c8e7a7979733bf9bd092a73483e4e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Sep 2021 02:10:42 +0200 Subject: [PATCH] Fix date for tasks created during project creation --- ..._modEventOrganization_EventOrganization.class.php | 7 +++++-- htdocs/projet/class/task.class.php | 12 ++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php b/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php index 04f9aaa17cc..dd1462ecf5f 100644 --- a/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php +++ b/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php @@ -101,8 +101,11 @@ class InterfaceEventOrganization extends DolibarrTriggers $defaultref = ''; } $task->ref = $defaultref; - $task->date_start = $object->date_start; - $task->date_end = $object->date_end; + + // TODO Can set offset for start date or endline from setup of task to create when creating event + $task->date_start = null; + $task->date_end = null; + $result = $task->create($user); if ($result < 0) { $this->errors=array_merge($this->errors, $task->errors); diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 8ea6d0c78a3..87ef51daefd 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -173,16 +173,16 @@ class Task extends CommonObject $sql .= ", planned_workload"; $sql .= ", progress"; $sql .= ") VALUES ("; - $sql .= $conf->entity; - $sql .= ", ".$this->fk_project; + $sql .= ((int) $conf->entity); + $sql .= ", ".((int) $this->fk_project); $sql .= ", ".(!empty($this->ref) ? "'".$this->db->escape($this->ref)."'" : 'null'); - $sql .= ", ".$this->fk_task_parent; + $sql .= ", ".((int) $this->fk_task_parent); $sql .= ", '".$this->db->escape($this->label)."'"; $sql .= ", '".$this->db->escape($this->description)."'"; $sql .= ", '".$this->db->idate($now)."'"; - $sql .= ", ".$user->id; - $sql .= ", ".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null'); - $sql .= ", ".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null'); + $sql .= ", ".((int) $user->id); + $sql .= ", ".($this->date_start ? "'".$this->db->idate($this->date_start)."'" : 'null'); + $sql .= ", ".($this->date_end ? "'".$this->db->idate($this->date_end)."'" : 'null'); $sql .= ", ".(($this->planned_workload != '' && $this->planned_workload >= 0) ? $this->planned_workload : 'null'); $sql .= ", ".(($this->progress != '' && $this->progress >= 0) ? $this->progress : 'null'); $sql .= ")";