Fix working out invoice start date, when start_at or invoice_next_at is null
This commit is contained in:
parent
36e379d876
commit
c8f1c97078
@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user