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

Tuning company settings for missing properties

This commit is contained in:
David Bomba 2021-03-17 20:28:44 +11:00
parent e3d056ab0b
commit c95e0c3d7e
4 changed files with 9 additions and 2 deletions

View File

@ -108,6 +108,7 @@ class CompanySettings extends BaseSettings
public $project_number_counter = 1; //@implemented
public $shared_invoice_quote_counter = false; //@implemented
public $shared_invoice_credit_counter = false; //@implemented
public $recurring_number_prefix = 'R'; //@implemented
public $reset_counter_frequency_id = '0'; //@implemented
public $reset_counter_date = ''; //@implemented
@ -262,6 +263,7 @@ class CompanySettings extends BaseSettings
public $hide_empty_columns_on_pdf = false;
public static $casts = [
'shared_invoice_credit_counter' => 'bool',
'reply_to_name' => 'string',
'hide_empty_columns_on_pdf' => 'bool',
'enable_reminder_endless' => 'bool',

View File

@ -304,6 +304,10 @@ class Client extends BaseModel implements HasLocalePreference
return $this->company->settings->{$setting};
}
elseif( property_exists(CompanySettings::defaults(), $setting) ) {
return CompanySettings::defaults()->{$setting};
}
return '';
// throw new \Exception("Settings corrupted", 1);

View File

@ -13,6 +13,7 @@ namespace App\Services\BillingSubscription;
use App\DataMapper\InvoiceItem;
use App\Factory\InvoiceFactory;
use App\Models\BillingSubscription;
use App\Models\ClientSubscription;
use App\Models\Product;
use App\Repositories\InvoiceRepository;
@ -41,7 +42,7 @@ class BillingSubscriptionService
// 'line_items' => [],
// ];
$invoice = $invoice_repo->save($data, InvoiceFactory::create($billing_subscription->company_id, $billing_subscription->user_id));
$invoice = $invoice_repo->save($data, InvoiceFactory::create($this->billing_subscription->company_id, $this->billing_subscription->user_id));
/*
If trial_enabled -> return early

View File

@ -313,7 +313,7 @@ trait GeneratesCounter
*/
public function hasSharedCounter(Client $client) : bool
{
return (bool) $client->getSetting('shared_invoice_quote_counter');
return (bool) $client->getSetting('shared_invoice_quote_counter') || (bool) $client->getSetting('shared_invoice_credit_counter');
}
/**