Merge pull request #14503 from AurelBichop/develop

FIX|fix #14502 fix to create a task for a project with api
This commit is contained in:
Laurent Destailleur 2020-08-19 14:15:19 +02:00 committed by GitHub
commit c7b6f4e0c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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');