diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 6a6089d7e1e..05ac4f25490 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -278,10 +278,16 @@ if (! empty($project_ref) && ! empty($withproject)) // To show all time lines for project $projectidforalltimes=0; -if (GETPOST('projectid','none')) +if (GETPOST('projectid','int')) { $projectidforalltimes=GETPOST('projectid','int'); } +elseif (GETPOST('project_ref','alpha')) +{ + $projectstatic->fetch(0, GETPOST('project_ref','alpha')); + $projectidforalltimes=$projectstatic->id; + $withproject=1; +} /* @@ -544,7 +550,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) else print '0 %'; } else print ''.$langs->trans("WorkloadNotDefined").''; - print ''; + print ''; + + print ''; print ''; @@ -665,7 +673,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $arrayfields['t.note']=array('label'=>$langs->trans("Note"), 'checked'=>1); $arrayfields['t.task_duration']=array('label'=>$langs->trans("Duration"), 'checked'=>1); $arrayfields['value'] =array('label'=>$langs->trans("Value"), 'checked'=>1, 'enabled'=>(empty($conf->salaries->enabled)?0:1)); - $arrayfields['valuebilled'] =array('label'=>$langs->trans("AmountInvoiced"), 'checked'=>1, 'enabled'=>((! empty($conf->global->PROJECT_HIDE_TASKS) || empty($conf->global->PROJECT_BILL_TIME_SPENT))?0:1)); + $arrayfields['valuebilled'] =array('label'=>$langs->trans("Billed"), 'checked'=>1, 'enabled'=>((! empty($conf->global->PROJECT_HIDE_TASKS) || empty($conf->global->PROJECT_BILL_TIME_SPENT))?0:1)); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -763,6 +771,10 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print ''.$langs->trans("Note").''; print ''.$langs->trans("NewTimeSpent").''; print ''.$langs->trans("ProgressDeclared").''; + if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print ''; + } print ''; print "\n"; @@ -812,6 +824,12 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print $formother->select_percent(GETPOST('progress')?GETPOST('progress'):$object->progress, 'progress', 0, 5, 0, 100, 1); print ''; + // Invoiced + if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print ''; + } + print ''; print ''; print '   '; @@ -1102,10 +1120,27 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Value billed if (! empty($arrayfields['valuebilled']['checked'])) { - print ''; - $valuebilled = price2num($task_time->total_ht); - if (isset($task_time->total_ht)) print price($valuebilled, 1, $langs, 1, -1, -1, $conf->currency); - print ''; + print ''; // invoice_id and invoice_line_id + if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + if ($projectstatic->bill_time) + { + if ($task_time->invoice_id) + { + $tmpinvoice->fetch($task_time->invoice_id); + print $tmpinvoice->getNomUrl(1); + } + else + { + print $langs->trans("No"); + } + } + else + { + print ''.$langs->trans("NA").''; + } + } + print ''; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalvaluebilledfield']=$totalarray['nbfield']; $totalarray['totalvaluebilled'] += $valuebilled;