Only check billable rate restriction if time entry becomes billable

This commit is contained in:
Constantin Graf
2026-10-14 13:29:32 +02:00
parent 0fa6f8c005
commit bcae6382db
2 changed files with 69 additions and 2 deletions

View File

@@ -648,7 +648,7 @@ class TimeEntryController extends Controller
$timeEntry = new TimeEntry;
$timeEntry->fill($request->validated());
// Organizations that can not use billable rates can not create billable time entries
if (! $this->canUseBillableRates($organization)) {
if ($timeEntry->billable && ! $this->canUseBillableRates($organization)) {
$timeEntry->billable = false;
}
$timeEntry->client()->associate($client);
@@ -721,7 +721,7 @@ class TimeEntryController extends Controller
$wasBillable = $timeEntry->billable;
$timeEntry->fill($request->validated());
// Organizations that can not use billable rates can keep or remove the billable flag, but not set it
if (! $wasBillable && ! $this->canUseBillableRates($organization)) {
if ($timeEntry->billable && ! $wasBillable && ! $this->canUseBillableRates($organization)) {
$timeEntry->billable = false;
}
if ($newMember !== null) {