From 7f5950c9582fd74c62ff4503c473c17a5cef0ae9 Mon Sep 17 00:00:00 2001 From: arnaud Date: Fri, 8 Sep 2017 09:14:34 +0200 Subject: [PATCH] FIX multiple comments not reset on fetch --- htdocs/projet/class/task.class.php | 1 + htdocs/projet/tasks/comment.php | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index cf94307a32a..3789759c2e9 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1801,6 +1801,7 @@ class Task extends CommonObject */ public function fetchComments() { + $this->comments = array(); $sql = "SELECT"; $sql.= " c.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_comment as c"; diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php index 0446cc71ea6..3f0cbe0bf47 100644 --- a/htdocs/projet/tasks/comment.php +++ b/htdocs/projet/tasks/comment.php @@ -141,7 +141,6 @@ if ($id > 0 || ! empty($ref)) if ($task->fetch($id,$ref) > 0) { $res=$task->fetch_optionals($task->id,$extralabels); - $res = $task->fetchComments(); $result=$projectstatic->fetch($task->fk_project); if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); @@ -369,7 +368,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print $langs->trans('User').' : '.$userstatic->getNomUrl().'
'; print $langs->trans('Date').' : '.dol_print_date($comment->datec,'dayhoursec'); - if($first && $fk_user == $user->id) { + if(($first && $fk_user == $user->id) || $user->admin == 1) { print '
'.$langs->trans('Delete').''; } print '
';