mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Add defaults for South African accounts setup
This commit is contained in:
parent
689d27cda3
commit
752054f86e
@ -124,8 +124,6 @@ class CreateAccount
|
||||
|
||||
NinjaMailerJob::dispatch($nmo, true);
|
||||
|
||||
// \Modules\Admin\Jobs\Account\NinjaUser::dispatch([], $sp035a66);
|
||||
|
||||
(new \Modules\Admin\Jobs\Account\NinjaUser([], $sp035a66))->handle();
|
||||
}
|
||||
|
||||
|
@ -84,6 +84,7 @@ class CreateCompany
|
||||
match($settings->country_id) {
|
||||
'724' => $company = $this->spanishSetup($company),
|
||||
'36' => $company = $this->australiaSetup($company),
|
||||
'710' => $company = $this->southAfticaSetup($company),
|
||||
default => $company->save(),
|
||||
};
|
||||
|
||||
@ -153,15 +154,6 @@ class CreateCompany
|
||||
|
||||
$company->save();
|
||||
|
||||
//user does not exist yet.
|
||||
// MultiDB::setDb($company->db);
|
||||
// $user = \App\Models\User::where('account_id', $company->account_id)->first();
|
||||
|
||||
// $tax_rate = TaxRateFactory::create($company->id, $user->id);
|
||||
// $tax_rate->name = $company->tax_data->regions->EU->subregions->ES->tax_name;
|
||||
// $tax_rate->rate = $company->tax_data->regions->EU->subregions->ES->tax_rate;
|
||||
// $tax_rate->save();
|
||||
|
||||
return $company;
|
||||
|
||||
} catch(\Exception $e) {
|
||||
@ -174,6 +166,40 @@ class CreateCompany
|
||||
|
||||
}
|
||||
|
||||
private function southAfticaSetup(Company $company): Company
|
||||
{
|
||||
|
||||
try {
|
||||
|
||||
$company->enabled_item_tax_rates = 1;
|
||||
$company->enabled_tax_rates = 1;
|
||||
|
||||
$translations = new \stdClass;
|
||||
$translations->invoice = "Tax Invoice";
|
||||
|
||||
$settings = $company->settings;
|
||||
$settings->currency_id = '4';
|
||||
$settings->timezone_id = '56';
|
||||
$settings->translations = $translations;
|
||||
|
||||
$company->settings = $settings;
|
||||
|
||||
$company->save();
|
||||
|
||||
return $company;
|
||||
|
||||
} catch(\Exception $e) {
|
||||
nlog($e->getMessage());
|
||||
nlog("SETUP: could not complete setup for South African Locale");
|
||||
}
|
||||
|
||||
$company->save();
|
||||
|
||||
return $company;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private function australiaSetup(Company $company): Company
|
||||
{
|
||||
try {
|
||||
@ -193,17 +219,6 @@ class CreateCompany
|
||||
|
||||
$company->save();
|
||||
|
||||
//$user = $company->account->users()->first();
|
||||
//user does not exist yet.
|
||||
// MultiDB::setDb($company->db);
|
||||
// $user = \App\Models\User::where('account_id', $company->account_id)->first();
|
||||
|
||||
|
||||
// $tax_rate = TaxRateFactory::create($company->id, $user->id);
|
||||
// $tax_rate->name = $company->tax_data->regions->AU->subregions->AU->tax_name;
|
||||
// $tax_rate->rate = $company->tax_data->regions->AU->subregions->AU->tax_rate;
|
||||
// $tax_rate->save();
|
||||
|
||||
return $company;
|
||||
|
||||
} catch(\Exception $e) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user