From 543e0e6c92de9fff4ec826012dca683bbdaae21f Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Thu, 13 Aug 2015 23:13:56 +0000
Subject: [PATCH] Use & Show Complete Date

---
 include/class.task.php                        |  3 +--
 include/staff/templates/task-preview.tmpl.php | 11 ++++++++++-
 include/staff/templates/task-view.tmpl.php    |  4 ++--
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/include/class.task.php b/include/class.task.php
index ed8b5a089..55671d1af 100644
--- a/include/class.task.php
+++ b/include/class.task.php
@@ -170,8 +170,7 @@ class TaskModel extends VerySimpleModel {
     }
 
     function getCloseDate() {
-        // TODO: have true close date
-        return $this->isClosed() ? $this->updated : '';
+        return $this->isClosed() ? $this->closed : '';
     }
 
     function isOpen() {
diff --git a/include/staff/templates/task-preview.tmpl.php b/include/staff/templates/task-preview.tmpl.php
index e44883210..e1f32892c 100644
--- a/include/staff/templates/task-preview.tmpl.php
+++ b/include/staff/templates/task-preview.tmpl.php
@@ -48,7 +48,16 @@ echo sprintf('
         </tr>',$status,
         Format::datetime($task->getCreateDate()));
 
-if ($task->isOpen() && $task->duedate) {
+if ($task->isClosed()) {
+
+    echo sprintf('
+            <tr>
+                <th>'.__('Completed').':</th>
+                <td>%s</td>
+            </tr>',
+            Format::datetime($task->getCloseDate()));
+
+} elseif ($task->isOpen() && $task->duedate) {
     echo sprintf('
             <tr>
                 <th>'.__('Due Date').':</th>
diff --git a/include/staff/templates/task-view.tmpl.php b/include/staff/templates/task-view.tmpl.php
index 2d7873c93..326576acf 100644
--- a/include/staff/templates/task-view.tmpl.php
+++ b/include/staff/templates/task-view.tmpl.php
@@ -178,7 +178,7 @@ if (!$ticket) { ?>
                     </tr>
 
                     <tr>
-                        <th><?php echo __('Create Date');?>:</th>
+                        <th><?php echo __('Created');?>:</th>
                         <td><?php echo Format::datetime($task->getCreateDate()); ?></td>
                     </tr>
                     <?php
@@ -192,7 +192,7 @@ if (!$ticket) { ?>
                     <?php
                     }else { ?>
                     <tr>
-                        <th><?php echo __('Close Date');?>:</th>
+                        <th><?php echo __('Completed');?>:</th>
                         <td><?php echo Format::datetime($task->getCloseDate()); ?></td>
                     </tr>
                     <?php
-- 
GitLab