Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX#29901 blocking tasktimesel for nonbillabletime with dblclick enabling option #32023

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions htdocs/projet/tasks/time.php
Original file line number Diff line number Diff line change
Expand Up @@ -2119,6 +2119,9 @@ function setDetailVisibility() {
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);

Expand Down Expand Up @@ -2156,7 +2159,18 @@ function setDetailVisibility() {
$selected = 1;
}
print ' ';
print '<input id="cb' . $task_time->rowid . '" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="' . $task_time->rowid . '"' . ($selected ? ' checked="checked"' : '') . '>';

// Disable select if task not billable or already invoiced
$disabled = (intval($task_time->billable) != 1 || $invoiced);
$ctrl = '<input '.($disabled ? 'disabled' : '').' id="cb' . $task_time->rowid . '" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="' . $task_time->rowid . '"' . ($selected ? ' checked="checked"' : '') . '>';
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 '<span id="cbsp'. $task_time->rowid . '">'.$ctrl.'</span>';
print '<script>$("#cbsp' . $task_time->rowid . '").dblclick(()=>{ $("#cb' . $task_time->rowid . '").removeAttr("disabled") })</script>';
} else {
print $ctrl;
}
}
}
}
Expand Down Expand Up @@ -2426,7 +2440,6 @@ function setDetailVisibility() {
}

// Invoiced
$invoiced = false;
if (!empty($arrayfields['valuebilled']['checked'])) {
print '<td class="center">'; // invoice_id and invoice_line_id
if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) {
Expand Down Expand Up @@ -2506,6 +2519,7 @@ function setDetailVisibility() {
$selected = 1;
}
print '&nbsp;';

// Disable select if task not billable or already invoiced
$disabled = (intval($task_time->billable) != 1 || $invoiced);
$ctrl = '<input '.($disabled ? 'disabled' : '').' id="cb' . $task_time->rowid . '" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="' . $task_time->rowid . '"' . ($selected ? ' checked="checked"' : '') . '>';
Expand Down
Loading