Skip to content

Commit 5701bb6

Browse files
authored
feat: use real dates as priority over planned dates (#68)
* feat: use real dates as priority over planned dates * fix: update CHANGELOG.md
1 parent 61aea30 commit 5701bb6

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Change Log
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
6+
and this project adheres to [Semantic Versioning](http://semver.org/).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
12+
- Use real dates as priority over planned dates for tasks and projects

src/DataFactory.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ public function populateGanttItem($record, $type)
186186
$item->type = ($type == "root-project") ? "project" : $type;
187187
$item->parent = ($type == "root-project") ? 0 : (($type == "project") ? $record['projects_id'] : ($record["projecttasks_id"] > 0 ? $parentTaskUid : $record['projects_id']));
188188
$item->linktask_id = ($item->type != "project") ? $record["id"] : 0;
189-
$item->start_date = $record['plan_start_date'] ?? $_SESSION['glpi_currenttime'];
190-
$item->end_date = $record['plan_end_date'] ?? date('Y-m-d H:i:s', strtotime($item->start_date . ' + 1 day'));
189+
$item->start_date = $record['real_start_date'] ?? $record['plan_start_date'] ?? $_SESSION['glpi_currenttime'];
190+
$item->end_date = $record['real_end_date'] ?? $record['plan_end_date'] ?? date('Y-m-d H:i:s', strtotime($item->start_date . ' + 1 day'));
191191
$item->text = $record['name'];
192192
$item->content = isset($record['content']) ? RichText::getSafeHtml($record['content']) : "";
193193
$item->comment = $record['comment'] ?? "";

0 commit comments

Comments
 (0)