mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-02 22:57:33 -05:00 
			
		
		
		
	Fixes for default country
This commit is contained in:
		
							parent
							
								
									dd2f9cf545
								
							
						
					
					
						commit
						ed75514646
					
				@ -238,6 +238,7 @@ class BillingPortalPurchase extends Component
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $company = $this->subscription->company;
 | 
					        $company = $this->subscription->company;
 | 
				
			||||||
        $user = $this->subscription->user;
 | 
					        $user = $this->subscription->user;
 | 
				
			||||||
 | 
					        $user->setCompany($company);
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        $client_repo = new ClientRepository(new ClientContactRepository());
 | 
					        $client_repo = new ClientRepository(new ClientContactRepository());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -13,6 +13,7 @@ namespace App\Repositories;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use App\Factory\ClientFactory;
 | 
					use App\Factory\ClientFactory;
 | 
				
			||||||
use App\Models\Client;
 | 
					use App\Models\Client;
 | 
				
			||||||
 | 
					use App\Models\Company;
 | 
				
			||||||
use App\Utils\Traits\GeneratesCounter;
 | 
					use App\Utils\Traits\GeneratesCounter;
 | 
				
			||||||
use App\Utils\Traits\SavesDocuments;
 | 
					use App\Utils\Traits\SavesDocuments;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -60,9 +61,9 @@ class ClientRepository extends BaseRepository
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $client->fill($data);
 | 
					        $client->fill($data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(!$client->country_id){
 | 
				
			||||||
        if(auth()->user() && !$client->country_id){
 | 
					            $company = Company::find($client->company_id);
 | 
				
			||||||
            $client->country_id = auth()->user()->company()->settings->country_id;
 | 
					            $client->country_id = $company->settings->country_id;
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user