From 830d0bc1a9efb3d76a27699bfae1e5d5d1d3c523 Mon Sep 17 00:00:00 2001
From: Thibault Dockx <thibault.dockx@fusiondirectory.org>
Date: Mon, 17 Oct 2022 16:40:26 +0100
Subject: [PATCH] :sparkles: Feat(Tasks) - Proper human readable schedule

Adds proper human readable schedule while keeping the attribute
format untouched for further processing.
---
 plugins/addons/tasks/class_tasksColumn.inc     | 6 ++++++
 plugins/addons/tasks/class_tasksManagement.inc | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/plugins/addons/tasks/class_tasksColumn.inc b/plugins/addons/tasks/class_tasksColumn.inc
index abd034329..d3009a144 100644
--- a/plugins/addons/tasks/class_tasksColumn.inc
+++ b/plugins/addons/tasks/class_tasksColumn.inc
@@ -37,6 +37,12 @@ class TasksColumn extends Column
         case 'fdTasksMailObject':
           return "Mail Object";
 
+        case 'fdTasksScheduleDate':
+          // Z is added to value to match ldap generaliseztime
+          $datetime = (new LdapGeneralizedTime)->fromString($value.'Z');
+          $result = $datetime->format('Y-m-d H:i:s');
+          return $result;
+
         default:
           return parent::renderSingleValue($entry, $value);
       }
diff --git a/plugins/addons/tasks/class_tasksManagement.inc b/plugins/addons/tasks/class_tasksManagement.inc
index 779ae1cae..b59b90fcf 100644
--- a/plugins/addons/tasks/class_tasksManagement.inc
+++ b/plugins/addons/tasks/class_tasksManagement.inc
@@ -29,7 +29,7 @@ class tasksManagement extends management
     ['LinkColumn',  ['attributes' => 'cn', 'label' => 'Tasks']],
     //below fdTasksMailObject must be change to have a type defined within task creation (new ldap attributes ?hidden)
     ['TasksColumn', ['attributes' => 'fdTasksMailObject', 'label' => 'Types']],
-    ['Column', ['attributes' => 'fdTasksScheduleDate', 'label' => 'Schedule']],
+    ['TasksColumn', ['attributes' => 'fdTasksScheduleDate', 'label' => 'Schedule']],
     //below fdTasksStatus attribute needs to be calculated based on the type of the task.
     ['TasksColumn', ['attributes' => 'fdTasksStatus', 'label' => 'Status']],
     ['Column', ['attributes' => 'fdTasksCreationDate', 'label' => 'Creation Date']],
-- 
GitLab