浏览代码

Merge pull request #20948 from inovea-conseil/FIX#20886

FIX#20886 : manage durations in list_print_total.tpl.php
Laurent Destailleur 3 年之前
父节点
当前提交
d99e2ea4eb
共有 2 个文件被更改,包括 11 次插入4 次删除
  1. 7 1
      htdocs/core/tpl/list_print_total.tpl.php
  2. 4 3
      htdocs/fichinter/list.php

+ 7 - 1
htdocs/core/tpl/list_print_total.tpl.php

@@ -13,7 +13,13 @@ if (isset($totalarray['pos'])) {
 	while ($i < $totalarray['nbfield']) {
 		$i++;
 		if (!empty($totalarray['pos'][$i])) {
-			print '<td class="right">'.price(!empty($totalarray['val'][$totalarray['pos'][$i]])?$totalarray['val'][$totalarray['pos'][$i]]:0).'</td>';
+			if (!empty($totalarray['type'][$i])) {
+				if ($totalarray['type'][$i] == 'duration') {
+					print '<td class="right">'.(!empty($totalarray['val'][$totalarray['pos'][$i]])? convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]]): '00:00').'</td>';
+				}
+			} else {
+				print '<td class="right">' . price(!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : 0) . '</td>';
+			}
 		} else {
 			if ($i == 1) {
 				if (is_null($limit) || $num < $limit) {

+ 4 - 3
htdocs/fichinter/list.php

@@ -132,7 +132,7 @@ $arrayfields = array(
 	'f.fk_statut'=>array('label'=>'Status', 'checked'=>1, 'position'=>1000),
 	'fd.description'=>array('label'=>"DescriptionOfLine", 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS) ? 1 : 0),
 	'fd.date'=>array('label'=>'DateOfLine', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS) ? 1 : 0),
-	'fd.duree'=>array('label'=>'DurationOfLine', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS) ? 1 : 0),
+	'fd.duree'=>array('label'=>'DurationOfLine', 'type'=> 'duration', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS) ? 1 : 0), //type duration is here because in database, column 'duree' is double
 );
 // Extra fields
 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
@@ -737,9 +737,8 @@ if ($resql) {
 			print '<td class="right">'.convertSecondToTime($obj->duree, 'allhourmin').'</td>';
 			if (!$i) {
 				$totalarray['nbfield']++;
-			}
-			if (!$i) {
 				$totalarray['pos'][$totalarray['nbfield']] = 'fd.duree';
+				$totalarray['type'][$totalarray['nbfield']] = $arrayfields['fd.duree']['type']; //pass the type for the list_print_total.tpl.php to manage durations
 			}
 			$totalarray['val']['fd.duree'] += $obj->duree;
 		}
@@ -763,6 +762,8 @@ if ($resql) {
 		$i++;
 	}
 
+
+
 	// Show total line
 	include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';