From 555f4a6dc3bcd530b44a34483078df3bf5f30bde Mon Sep 17 00:00:00 2001 From: evarisk-micka Date: Fri, 9 Feb 2024 10:23:00 +0100 Subject: [PATCH 1/2] #564 [Hook] fix: elementtype without the ptt for projectdocument task --- class/actions_dolisirh.class.php | 2 +- .../projectdocument/doc_projectdocument_odt.modules.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/class/actions_dolisirh.class.php b/class/actions_dolisirh.class.php index d68ed7d..4edb5d6 100644 --- a/class/actions_dolisirh.class.php +++ b/class/actions_dolisirh.class.php @@ -474,7 +474,7 @@ function getDiffTimestampEvent() { } if ($parameters['currentcontext'] == 'projectcard') { - if (GETPOST('action') == 'view' || empty(GETPOST('action'))) { + if (GETPOST('action') != 'create') { global $user; print ''; diff --git a/core/modules/dolisirh/dolisirhdocuments/projectdocument/doc_projectdocument_odt.modules.php b/core/modules/dolisirh/dolisirhdocuments/projectdocument/doc_projectdocument_odt.modules.php index 120f968..4753f08 100644 --- a/core/modules/dolisirh/dolisirhdocuments/projectdocument/doc_projectdocument_odt.modules.php +++ b/core/modules/dolisirh/dolisirhdocuments/projectdocument/doc_projectdocument_odt.modules.php @@ -144,7 +144,7 @@ public function fillTagsLines(Odf $odfHandler, Translate $outputLangs, array $mo $allTimespentUser = 0; foreach ($allTasks as $task) { if ($versionEighteenOrMore) { - $filter = ' AND fk_element = ' . $task->id . ' AND ptt.elementtype = "task" AND fk_user = ' . $contact['id']; + $filter = ' AND fk_element = ' . $task->id . ' AND elementtype = "task" AND fk_user = ' . $contact['id']; } else { $filter = ' AND fk_element = ' . $task->id . ' AND fk_user = ' . $contact['id']; } @@ -218,7 +218,7 @@ public function fillTagsLines(Odf $odfHandler, Translate $outputLangs, array $mo if (is_array($allTasks) && !empty($allTasks)) { foreach ($allTasks as $task) { if ($versionEighteenOrMore) { - $filter = ' AND fk_element = ' . $task->id . ' AND ptt.elementtype = "task" AND fk_user = ' . $contact['id']; + $filter = ' AND fk_element = ' . $task->id . ' AND elementtype = "task" AND fk_user = ' . $contact['id']; } else { $filter = ' AND fk_element = ' . $task->id . ' AND fk_user = ' . $contact['id']; } @@ -346,7 +346,7 @@ public function write_file(SaturneDocuments $objectDocument, Translate $outputLa foreach ($tasksArray as $task) { $totalProgress += $task->progress; $totalPlannedWorkload += $task->planned_workload; - $totalConsumedTime += $task->duration; + $totalConsumedTime += $task->duration_effective; } $tmpArray['project_progress'] = (($totalProgress) ? price2num($totalProgress / $nbTasks, 2) . ' %' : '0 %'); $tmpArray['project_status'] = $object->getLibStatut(); From 37a7bbef555f1be008ec9ec52c827bbc2618daef Mon Sep 17 00:00:00 2001 From: evarisk-micka Date: Fri, 9 Feb 2024 14:31:27 +0100 Subject: [PATCH 2/2] #564 [ProjectDocument] fix: use timespent_total_duration --- .../projectdocument/doc_projectdocument_odt.modules.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/modules/dolisirh/dolisirhdocuments/projectdocument/doc_projectdocument_odt.modules.php b/core/modules/dolisirh/dolisirhdocuments/projectdocument/doc_projectdocument_odt.modules.php index 4753f08..5eb01b1 100644 --- a/core/modules/dolisirh/dolisirhdocuments/projectdocument/doc_projectdocument_odt.modules.php +++ b/core/modules/dolisirh/dolisirhdocuments/projectdocument/doc_projectdocument_odt.modules.php @@ -344,9 +344,10 @@ public function write_file(SaturneDocuments $objectDocument, Translate $outputLa if (is_array($tasksArray) && !empty($tasksArray)) { $nbTasks = count($tasksArray); foreach ($tasksArray as $task) { + $task->getSummaryOfTimeSpent(); $totalProgress += $task->progress; $totalPlannedWorkload += $task->planned_workload; - $totalConsumedTime += $task->duration_effective; + $totalConsumedTime += $task->timespent_total_duration; } $tmpArray['project_progress'] = (($totalProgress) ? price2num($totalProgress / $nbTasks, 2) . ' %' : '0 %'); $tmpArray['project_status'] = $object->getLibStatut();