FIX|fix #14502 fix to create a task for a project with api

This commit is contained in:
abichotte 2020-08-19 11:24:32 +02:00
parent 90545ac443
commit 1c6a062486
2 changed files with 7 additions and 3 deletions

View File

@ -35,7 +35,8 @@ class Tasks extends DolibarrApi
*/ */
static $FIELDS = array( static $FIELDS = array(
'ref', 'ref',
'label' 'label',
'fk_project'
); );
/** /**

View File

@ -62,7 +62,7 @@ class Task extends CommonObject
/** /**
* @var int ID parent task * @var int ID parent task
*/ */
public $fk_task_parent; public $fk_task_parent=0;
/** /**
* @var string Label of task * @var string Label of task
@ -145,6 +145,9 @@ class Task extends CommonObject
{ {
global $conf, $langs; global $conf, $langs;
//For the date
$now = dol_now();
$error = 0; $error = 0;
// Clean parameters // Clean parameters
@ -175,7 +178,7 @@ class Task extends CommonObject
$sql .= ", ".$this->fk_task_parent; $sql .= ", ".$this->fk_task_parent;
$sql .= ", '".$this->db->escape($this->label)."'"; $sql .= ", '".$this->db->escape($this->label)."'";
$sql .= ", '".$this->db->escape($this->description)."'"; $sql .= ", '".$this->db->escape($this->description)."'";
$sql .= ", '".$this->db->idate($this->date_c)."'"; $sql .= ", '".$this->db->idate($now)."'";
$sql .= ", ".$user->id; $sql .= ", ".$user->id;
$sql .= ", ".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null'); $sql .= ", ".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null');
$sql .= ", ".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null'); $sql .= ", ".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null');