From 8d74b510098a91d586be4a0377a9987fe94593c9 Mon Sep 17 00:00:00 2001
From: BENKE Charlene <1179011+defrance@users.noreply.github.com>
Date: Fri, 4 Feb 2022 15:52:37 +0100
Subject: [PATCH 1/4] fix : duration in hour and min (not in second)
use convertSecondToTime for totalise duration
---
htdocs/fichinter/list.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php
index d710d7cd6cc..871d6511669 100644
--- a/htdocs/fichinter/list.php
+++ b/htdocs/fichinter/list.php
@@ -741,7 +741,7 @@ if ($resql) {
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'fd.duree';
}
- $totalarray['val']['fd.duree'] += $obj->duree;
+ $totalarray['val']['fd.duree'] += convertSecondToTime($obj->duree, 'allhourmin');
}
// Action column
print '
';
From 1c87c6fd5d533a8bfe3c3db63e5be9c9104455f2 Mon Sep 17 00:00:00 2001
From: BENKE Charlene <1179011+defrance@users.noreply.github.com>
Date: Sat, 5 Feb 2022 12:10:57 +0100
Subject: [PATCH 2/4] Update list.php
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
first introduce à type of totalisation
---
htdocs/fichinter/list.php | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php
index 871d6511669..c61fa4b1393 100644
--- a/htdocs/fichinter/list.php
+++ b/htdocs/fichinter/list.php
@@ -7,6 +7,7 @@
* Copyright (C) 2015 Jean-François Ferry
* Copyright (C) 2018 Ferran Marcet
* Copyright (C) 2021 Frédéric France
+ * Copyright (C) 2022 Charlène Benke
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -739,9 +740,10 @@ if ($resql) {
$totalarray['nbfield']++;
}
if (!$i) {
+ $totalarray['type'][$totalarray['nbfield']] = 'duration';
$totalarray['pos'][$totalarray['nbfield']] = 'fd.duree';
}
- $totalarray['val']['fd.duree'] += convertSecondToTime($obj->duree, 'allhourmin');
+ $totalarray['val']['fd.duree'] += $obj->duree;
}
// Action column
print '| ';
From 9977761846189c444b90896307f097df1bbc47e3 Mon Sep 17 00:00:00 2001
From: BENKE Charlene <1179011+defrance@users.noreply.github.com>
Date: Sat, 5 Feb 2022 12:12:37 +0100
Subject: [PATCH 3/4] print the good format of totalisation
---
htdocs/core/tpl/list_print_total.tpl.php | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/htdocs/core/tpl/list_print_total.tpl.php b/htdocs/core/tpl/list_print_total.tpl.php
index 929ea2df50f..481387af380 100644
--- a/htdocs/core/tpl/list_print_total.tpl.php
+++ b/htdocs/core/tpl/list_print_total.tpl.php
@@ -13,7 +13,12 @@ if (isset($totalarray['pos'])) {
while ($i < $totalarray['nbfield']) {
$i++;
if (!empty($totalarray['pos'][$i])) {
- print ' | '.price(!empty($totalarray['val'][$totalarray['pos'][$i]])?$totalarray['val'][$totalarray['pos'][$i]]:0).' | ';
+ print '';
+ if ($totalarray['type'][$i] == 'duration')
+ print (!empty($totalarray['val'][$totalarray['pos'][$i]])?convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]], 'allhourmin'):0);
+ else
+ print price(!empty($totalarray['val'][$totalarray['pos'][$i]])?$totalarray['val'][$totalarray['pos'][$i]]:0);
+ print ' | ';
} else {
if ($i == 1) {
if (is_null($limit) || $num < $limit) {
From d1f3411bacb523080efc09100c3630d5a52f4878 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Sun, 6 Feb 2022 12:35:33 +0100
Subject: [PATCH 4/4] Update list_print_total.tpl.php
---
htdocs/core/tpl/list_print_total.tpl.php | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/htdocs/core/tpl/list_print_total.tpl.php b/htdocs/core/tpl/list_print_total.tpl.php
index 481387af380..b015dc51fdc 100644
--- a/htdocs/core/tpl/list_print_total.tpl.php
+++ b/htdocs/core/tpl/list_print_total.tpl.php
@@ -14,10 +14,11 @@ if (isset($totalarray['pos'])) {
$i++;
if (!empty($totalarray['pos'][$i])) {
print '';
- if ($totalarray['type'][$i] == 'duration')
+ if ($totalarray['type'][$i] == 'duration') {
print (!empty($totalarray['val'][$totalarray['pos'][$i]])?convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]], 'allhourmin'):0);
- else
+ } else {
print price(!empty($totalarray['val'][$totalarray['pos'][$i]])?$totalarray['val'][$totalarray['pos'][$i]]:0);
+ }
print ' | ';
} else {
if ($i == 1) {
|