1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Fixes for recurring invoices - restarting completed recurring invoices

This commit is contained in:
David Bomba 2024-03-08 08:16:39 +11:00
parent b6d429e336
commit bbcbfe9821
2 changed files with 6 additions and 4 deletions

View File

@ -884,7 +884,7 @@ class CheckData extends Command
public function checkClientSettings()
{
if ($this->option('fix') == 'true') {
Client::query()->whereNull('country_id')->cursor()->each(function ($client) {
Client::query()->whereNull('country_id')->orWhere('country_id', 0)->cursor()->each(function ($client) {
$client->country_id = $client->company->settings->country_id;
$client->saveQuietly();

View File

@ -355,11 +355,13 @@ class RecurringInvoice extends BaseModel
public function calculateStatus(bool $new_model = false) //15-02-2024 - $new_model needed
{
if($this->remaining_cycles == 0) {
if($this->remaining_cycles == 0)
return self::STATUS_COMPLETED;
} elseif ($new_model && $this->status_id == self::STATUS_ACTIVE && Carbon::parse($this->next_send_date)->isFuture())
elseif ($new_model && $this->status_id == self::STATUS_ACTIVE && Carbon::parse($this->next_send_date)->isFuture())
return self::STATUS_PENDING;
elseif($this->remaining_cycles != 0)
return self::STATUS_ACTIVE;
return $this->status_id;
}