Improve return types for vendor settings

This commit is contained in:
David Bomba 2023-08-15 08:31:34 +10:00
parent 8630acb412
commit 17e4e901bd
4 changed files with 8 additions and 7 deletions

View File

@ -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();

View File

@ -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};
}

View File

@ -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};

View File

@ -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