From dbbb860fb43fda90194e81c4cad9d2ed0db4cf43 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 3 Mar 2023 12:07:46 +0100 Subject: [PATCH] feat: update invoice and invoice line on time spend #24102 --- htdocs/projet/class/task.class.php | 4 ++++ htdocs/projet/tasks/time.php | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 596d828ff97..741d884202e 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -128,6 +128,8 @@ class Task extends CommonObjectLine public $timespent_thm; public $timespent_note; public $timespent_fk_product; + public $timespent_invoiceid; + public $timespent_invoicelineid; public $comments = array(); @@ -1736,6 +1738,8 @@ class Task extends CommonObjectLine $sql .= " task_duration = ".((int) $this->timespent_duration).","; $sql .= " fk_user = ".((int) $this->timespent_fk_user).","; $sql .= " fk_product = ".((int) $this->timespent_fk_product).","; + $sql .= " invoice_id = ".((int) $this->timespent_invoiceid).","; + $sql .= " invoice_line_id = ".((int) $this->timespent_invoicelineid).","; $sql .= " note = ".(isset($this->timespent_note) ? "'".$this->db->escape($this->timespent_note)."'" : "null"); $sql .= " WHERE rowid = ".((int) $this->timespent_id); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 23a898c8760..6ae6d78ace5 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -309,6 +309,7 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us } $object->timespent_fk_user = GETPOST("userid_line", 'int'); $object->timespent_fk_product = GETPOST("fk_product", 'int'); + $object->timespent_fk_product = GETPOST("fk_product", 'int'); $result = 0; if (in_array($object->timespent_fk_user, $childids) || $user->rights->projet->all->creer) { @@ -336,8 +337,10 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us } $object->timespent_fk_user = GETPOST("userid_line", 'int'); $object->timespent_fk_product = GETPOST("fk_product", 'int'); - + $object->timespent_invoiceid = GETPOST("invoiceid", 'int'); + $object->timespent_invoicelineid = GETPOST("invoicelineid", 'int'); $result = 0; + if (in_array($object->timespent_fk_user, $childids) || $user->rights->projet->all->creer) { $result = $object->updateTimeSpent($user);