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();
|
$last = $this->getInvoicedToAttribute();
|
||||||
|
|
||||||
if ($this->stop_at && $last->greaterThan($this->stop_at))
|
if ($last) {
|
||||||
return NULL;
|
return ($this->stop_at && $last->greaterThan($this->stop_at))
|
||||||
|
? NULL
|
||||||
|
: $last->addDay();
|
||||||
|
}
|
||||||
|
|
||||||
return $last
|
return ($this->invoice_next_at)
|
||||||
? $last->addDay()
|
? $this->invoice_next_at
|
||||||
: (min($this->start_at,$this->invoice_next_at) ?: Carbon::now());
|
: ($this->start_at ?: Carbon::now());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user