Fix working out invoice start date, when start_at or invoice_next_at is null

This commit is contained in:
Deon George 2025-05-22 09:23:21 +10:00
parent 36e379d876
commit c8f1c97078

View File

@ -608,12 +608,15 @@ class Service extends Model implements IDs
{
$last = $this->getInvoicedToAttribute();
if ($this->stop_at && $last->greaterThan($this->stop_at))
return NULL;
if ($last) {
return ($this->stop_at && $last->greaterThan($this->stop_at))
? NULL
: $last->addDay();
}
return $last
? $last->addDay()
: (min($this->start_at,$this->invoice_next_at) ?: Carbon::now());
return ($this->invoice_next_at)
? $this->invoice_next_at
: ($this->start_at ?: Carbon::now());
}
/**