From e69b0f79f72d82a1607256b27828a7c34d6d286c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20David?= Date: Thu, 13 Jul 2023 18:12:31 +0200 Subject: [PATCH 1/2] #1387 [Control] fix: default text answer value --- core/tpl/digiquali_control_list.tpl.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/tpl/digiquali_control_list.tpl.php b/core/tpl/digiquali_control_list.tpl.php index ee0f0864..355f40cd 100644 --- a/core/tpl/digiquali_control_list.tpl.php +++ b/core/tpl/digiquali_control_list.tpl.php @@ -400,7 +400,11 @@ print dol_strlen($object->$key) > 0 ? $object->fields[$key]['arrayofkeyval'][$object->$key] : "N/A"; } elseif ($key == 'days_remaining_before_next_control') { - $nextControl = max(floor(($object->next_control_date - dol_now('tzuser'))/(3600 * 24)), 0); + if (dol_strlen($object->next_control_date) > 0) { + $nextControl = max(floor(($object->next_control_date - dol_now('tzuser'))/(3600 * 24)), 0); + } else { + $nextControl = 0; + } $nextControlColor = $nextControl < 0 ? 'red' : ($nextControl <= 30 ? 'orange' : ($nextControl <= 60 ? 'yellow' : 'green')); print '
' . $nextControl . '
' . $langs->trans('Days') . '
'; From c8fc6a09d47f358e294cafc381da39da66333940 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20David?= Date: Tue, 18 Jul 2023 11:42:37 +0200 Subject: [PATCH 2/2] #1387 [Control] fix: default text answer value with template --- core/tpl/digiquali_control_answers.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tpl/digiquali_control_answers.tpl.php b/core/tpl/digiquali_control_answers.tpl.php index e7ff1267..85ec079a 100644 --- a/core/tpl/digiquali_control_answers.tpl.php +++ b/core/tpl/digiquali_control_answers.tpl.php @@ -3,7 +3,7 @@ if (is_array($questionIds) && !empty($questionIds)) { foreach ($questionIds as $questionId) { $result = $controldet->fetchFromParentWithQuestion($object->id, $questionId); - $questionAnswer = 0; + $questionAnswer = ''; $comment = ''; if ($result > 0 && is_array($result)) { $itemControlDet = array_shift($result);