From 1c6a062486486b1336c0d06f713127be2cf624be Mon Sep 17 00:00:00 2001 From: abichotte Date: Wed, 19 Aug 2020 11:24:32 +0200 Subject: [PATCH 1/2] FIX|fix #14502 fix to create a task for a project with api --- htdocs/projet/class/api_tasks.class.php | 3 ++- htdocs/projet/class/task.class.php | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php index 084292d0727..8466fdc3bcb 100644 --- a/htdocs/projet/class/api_tasks.class.php +++ b/htdocs/projet/class/api_tasks.class.php @@ -35,7 +35,8 @@ class Tasks extends DolibarrApi */ static $FIELDS = array( 'ref', - 'label' + 'label', + 'fk_project' ); /** diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 10f5a36d67f..89189802a15 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -62,7 +62,7 @@ class Task extends CommonObject /** * @var int ID parent task */ - public $fk_task_parent; + public $fk_task_parent=0; /** * @var string Label of task @@ -145,6 +145,9 @@ class Task extends CommonObject { global $conf, $langs; + //For the date + $now = dol_now(); + $error = 0; // Clean parameters @@ -175,7 +178,7 @@ class Task extends CommonObject $sql .= ", ".$this->fk_task_parent; $sql .= ", '".$this->db->escape($this->label)."'"; $sql .= ", '".$this->db->escape($this->description)."'"; - $sql .= ", '".$this->db->idate($this->date_c)."'"; + $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'); From 8057ccb2236fdebbcdb856f892223cc0732b4505 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Aug 2020 14:13:30 +0200 Subject: [PATCH 2/2] Update task.class.php --- htdocs/projet/class/task.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 89189802a15..0d737dfea7f 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -62,7 +62,7 @@ class Task extends CommonObject /** * @var int ID parent task */ - public $fk_task_parent=0; + public $fk_task_parent = 0; /** * @var string Label of task