From 7a2e08a6812bec0ecfde8355ea999558f8dbf92e Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 2 Aug 2019 11:41:40 +0200 Subject: [PATCH] Fix author in message / ticket API --- htdocs/ticket/class/api_tickets.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index 060ddc36ff344..c23ec3da1512f 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -160,15 +160,15 @@ private function getCommon($id = 0, $track_id = '', $ref = '') $num = count($this->ticket->cache_msgs_ticket); $i = 0; while ($i < $num) { - if ($this->ticket->cache_msgs_ticket[$i]['fk_user_action'] > 0) { + if ($this->ticket->cache_msgs_ticket[$i]['fk_user_author'] > 0) { $user_action = new User($this->db); - $user_action->fetch($this->ticket->cache_msgs_ticket[$i]['fk_user_action']); + $user_action->fetch($this->ticket->cache_msgs_ticket[$i]['fk_user_author']); } // Now define messages $messages[] = array( 'id' => $this->ticket->cache_msgs_ticket[$i]['id'], - 'fk_user_action' => $this->ticket->cache_msgs_ticket[$i]['fk_user_action'], + 'fk_user_action' => $this->ticket->cache_msgs_ticket[$i]['fk_user_author'], 'fk_user_action_socid' => $user_action->socid, 'fk_user_action_string' => dolGetFirstLastname($user_action->firstname, $user_action->lastname), 'message' => $this->ticket->cache_msgs_ticket[$i]['message'], @@ -195,6 +195,7 @@ private function getCommon($id = 0, $track_id = '', $ref = '') // Now define messages $history[] = array( 'id' => $this->ticket->cache_logs_ticket[$i]['id'], + 'fk_user_author' => $this->ticket->cache_msgs_ticket[$i]['fk_user_author'], 'fk_user_action' => $this->ticket->cache_logs_ticket[$i]['fk_user_create'], 'fk_user_action_string' => dolGetFirstLastname($user_action->firstname, $user_action->lastname), 'message' => $this->ticket->cache_logs_ticket[$i]['message'],