From 701beafdc1f82a772eb606737dfcb149f0c2f6c0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Jun 2023 18:54:38 +0200 Subject: [PATCH] Debug v18 - Fix #24917 --- htdocs/core/lib/project.lib.php | 48 ++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index c289f523bd3..8e956e006cb 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -619,6 +619,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t // We declare counter as global because we want to edit them into recursive call global $total_projectlinesa_spent, $total_projectlinesa_planned, $total_projectlinesa_spent_if_planned, $total_projectlinesa_declared_if_planned, $total_projectlinesa_tobill, $total_projectlinesa_billed, $total_budget_amount; + global $totalarray; if ($level == 0) { $total_projectlinesa_spent = 0; @@ -628,6 +629,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t $total_projectlinesa_tobill = 0; $total_projectlinesa_billed = 0; $total_budget_amount = 0; + $totalarray = array(); } for ($i = 0; $i < $numlines; $i++) { @@ -700,6 +702,16 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t $taskstatic->duration_effective = $lines[$i]->duration; $taskstatic->budget_amount = $lines[$i]->budget_amount; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + $selected = 0; + if (in_array($lines[$i]->id, $arrayofselected)) { + $selected = 1; + } + print ''; + print ''; + } if ($showproject) { // Project ref @@ -936,14 +948,16 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print ''; // Action column - print ''; - $selected = 0; - if (in_array($lines[$i]->id, $arrayofselected)) { - $selected = 1; - } - print ''; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + $selected = 0; + if (in_array($lines[$i]->id, $arrayofselected)) { + $selected = 1; + } + print ''; - print ''; + print ''; + } print "\n"; @@ -976,6 +990,11 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0 || $total_projectlinesa_tobill > 0 || $total_projectlinesa_billed > 0 || $total_budget_amount > 0) && $level <= 0) { print ''; + + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + print ''.$langs->trans("Total").''; if ($showproject) { print ''; @@ -1092,18 +1111,21 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print ''; } - //Check if Extrafields is totalizable - foreach ($extrafields->attributes['projet_task']['totalizable'] as $key=>$value) { - if ($arrayfields['ef.'.$key]['checked'] == 1) { - print ''; + // Check if Extrafields is totalizable + foreach ($extrafields->attributes['projet_task']['totalizable'] as $key => $value) { + if (!empty($arrayfields['ef.'.$key]['checked']) && $arrayfields['ef.'.$key]['checked'] == 1) { + print ''; if ($value == 1) { - print $totalarray['totalizable'][$key]['total']; + print empty($totalarray['totalizable'][$key]['total']) ? '' : $totalarray['totalizable'][$key]['total']; } print ''; } } - print ''; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + print ''; }