diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 523f93e97e4..aad0471027b 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -2119,6 +2119,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser break; } + // Line is invoiced if it has an invoice_id + $invoiced = $task_time->invoice_id ? true : false; + $date1 = $db->jdate($task_time->element_date); $date2 = $db->jdate($task_time->element_datehour); @@ -2156,7 +2159,18 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $selected = 1; } print ' '; - print ''; + + // Disable select if task not billable or already invoiced + $disabled = (intval($task_time->billable) != 1 || $invoiced); + $ctrl = ''; + if ($disabled) { + // If disabled, a dbl-click very close outside the control + // will re-enable it, so that user is not blocked if needed. + print ''.$ctrl.''; + print ''; + } else { + print $ctrl; + } } } } @@ -2426,7 +2440,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } // Invoiced - $invoiced = false; if (!empty($arrayfields['valuebilled']['checked'])) { print '