mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 20:21:10 -04:00
solve recurring invoice starts_at condition
This commit is contained in:
@ -20,6 +20,10 @@ class RecurringInvoice extends Model
|
|||||||
'id',
|
'id',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected $dates = [
|
||||||
|
'starts_at'
|
||||||
|
];
|
||||||
|
|
||||||
public const NONE = 'NONE';
|
public const NONE = 'NONE';
|
||||||
public const COUNT = 'COUNT';
|
public const COUNT = 'COUNT';
|
||||||
public const DATE = 'DATE';
|
public const DATE = 'DATE';
|
||||||
@ -259,7 +263,10 @@ class RecurringInvoice extends Model
|
|||||||
|
|
||||||
public function generateInvoice()
|
public function generateInvoice()
|
||||||
{
|
{
|
||||||
if (Carbon::now()->format('Y-m-d H:i:s') < $this->starts_at) {
|
if (Carbon::now()->lessThan($this->starts_at)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->limit_by == 'DATE') {
|
if ($this->limit_by == 'DATE') {
|
||||||
$startDate = Carbon::today()->format('Y-m-d');
|
$startDate = Carbon::today()->format('Y-m-d');
|
||||||
|
|
||||||
@ -288,7 +295,6 @@ class RecurringInvoice extends Model
|
|||||||
$this->updateNextInvoiceDate();
|
$this->updateNextInvoiceDate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public function createInvoice()
|
public function createInvoice()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user