diff --git a/app/Console/Commands/CheckData.php b/app/Console/Commands/CheckData.php index b843f33cb9e4..2941f2223d5a 100644 --- a/app/Console/Commands/CheckData.php +++ b/app/Console/Commands/CheckData.php @@ -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(); diff --git a/app/Models/RecurringInvoice.php b/app/Models/RecurringInvoice.php index a29e9f4023b6..0dd433c6be72 100644 --- a/app/Models/RecurringInvoice.php +++ b/app/Models/RecurringInvoice.php @@ -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; }