From 17e4e901bddcfa72cf81132857042089be38a6a7 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 15 Aug 2023 08:31:34 +1000 Subject: [PATCH] Improve return types for vendor settings --- app/Console/Commands/CheckData.php | 6 +++--- app/Models/Company.php | 1 + app/Models/Vendor.php | 4 ++-- config/beacon.php | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/Console/Commands/CheckData.php b/app/Console/Commands/CheckData.php index 4f522262d093..8f49531ea467 100644 --- a/app/Console/Commands/CheckData.php +++ b/app/Console/Commands/CheckData.php @@ -471,7 +471,7 @@ class CheckData extends Command $ii->saveQuietly(); }); - collect([Invoice::class, Quote::class, Credit::class, PurchaseOrder::class])->each(function ($entity) { + collect([Invoice::class, Quote::class, Credit::class, PurchaseOrder::class, RecurringInvoice::class])->each(function ($entity) { if ($entity::doesntHave('invitations')->count() > 0) { $entity::doesntHave('invitations')->cursor()->each(function ($entity) { $client_vendor_key = 'client_id'; @@ -694,7 +694,7 @@ class CheckData extends Command { $this->wrong_balances = 0; - Client::cursor()->where('is_deleted', 0)->where('clients.updated_at', '>', now()->subDays(2))->each(function ($client) { + Client::query()->cursor()->where('is_deleted', 0)->where('clients.updated_at', '>', now()->subDays(2))->each(function ($client) { $client->invoices->where('is_deleted', false)->whereIn('status_id', '!=', Invoice::STATUS_DRAFT)->each(function ($invoice) use ($client) { $total_paid = $invoice->payments() ->where('is_deleted', false)->whereIn('status_id', [Payment::STATUS_COMPLETED, Payment::STATUS_PENDING, Payment::STATUS_PARTIALLY_REFUNDED, Payment::STATUS_REFUNDED]) @@ -876,7 +876,7 @@ class CheckData extends Command $this->wrong_balances = 0; $this->wrong_paid_to_dates = 0; - foreach (Client::where('is_deleted', 0)->where('clients.updated_at', '>', now()->subDays(2))->cursor() as $client) { + foreach (Client::query()->where('is_deleted', 0)->where('clients.updated_at', '>', now()->subDays(2))->cursor() as $client) { $invoice_balance = $client->invoices()->where('is_deleted', false)->whereIn('status_id', [2,3])->sum('balance'); $ledger = CompanyLedger::where('client_id', $client->id)->orderBy('id', 'DESC')->first(); diff --git a/app/Models/Company.php b/app/Models/Company.php index 9b9f12c11858..644dcab807e1 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -707,6 +707,7 @@ class Company extends BaseModel public function getSetting($setting) { + //todo $this->setting ?? false if (property_exists($this->settings, $setting) != false) { return $this->settings->{$setting}; } diff --git a/app/Models/Vendor.php b/app/Models/Vendor.php index a055ed7992b4..84dcd3f286a1 100644 --- a/app/Models/Vendor.php +++ b/app/Models/Vendor.php @@ -230,9 +230,9 @@ class Vendor extends BaseModel * Returns a vendor settings proxying company setting * * @param string $setting - * @return string + * @return mixed */ - public function getSetting($setting): string + public function getSetting($setting): mixed { if ((property_exists($this->company->settings, $setting) != false) && (isset($this->company->settings->{$setting}) !== false)) { return $this->company->settings->{$setting}; diff --git a/config/beacon.php b/config/beacon.php index 801fb16091e7..06006106b268 100644 --- a/config/beacon.php +++ b/config/beacon.php @@ -22,8 +22,8 @@ return [ */ 'batch' => true, - 'cache_connection' => 'sentinel-cache', - + // 'cache_connection' => 'sentinel-cache', + 'cache_connection' => 'cache', /* * The default key used to store * metrics for batching