mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 21:47:32 -05:00 
			
		
		
		
	Merge pull request #5156 from turbo124/v5-develop
Tuning company settings for missing properties
This commit is contained in:
		
						commit
						3a0624e649
					
				@ -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',
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
@ -134,6 +134,9 @@ trait GeneratesCounter
 | 
			
		||||
                return 'payment_number_counter';
 | 
			
		||||
                break;
 | 
			
		||||
            case Credit::class:
 | 
			
		||||
                if ($this->hasSharedCounter($client)) 
 | 
			
		||||
                    return 'invoice_number_counter';
 | 
			
		||||
            
 | 
			
		||||
                return 'credit_number_counter';
 | 
			
		||||
                break;
 | 
			
		||||
            case Project::class:
 | 
			
		||||
@ -313,7 +316,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');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user