mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Support updating plan price
This commit is contained in:
parent
65b7556070
commit
5d1f6fd837
@ -392,7 +392,6 @@ class AccountRepository
|
|||||||
$client = Client::whereAccountId($ninjaAccount->id)
|
$client = Client::whereAccountId($ninjaAccount->id)
|
||||||
->wherePublicId($account->id)
|
->wherePublicId($account->id)
|
||||||
->first();
|
->first();
|
||||||
$clientExists = $client ? true : false;
|
|
||||||
|
|
||||||
if (! $client) {
|
if (! $client) {
|
||||||
$client = new Client();
|
$client = new Client();
|
||||||
@ -400,31 +399,21 @@ class AccountRepository
|
|||||||
$client->account_id = $ninjaAccount->id;
|
$client->account_id = $ninjaAccount->id;
|
||||||
$client->user_id = $ninjaUser->id;
|
$client->user_id = $ninjaUser->id;
|
||||||
$client->currency_id = 1;
|
$client->currency_id = 1;
|
||||||
}
|
|
||||||
|
|
||||||
foreach (['name', 'address1', 'address2', 'city', 'state', 'postal_code', 'country_id', 'work_phone', 'language_id', 'vat_number'] as $field) {
|
foreach (['name', 'address1', 'address2', 'city', 'state', 'postal_code', 'country_id', 'work_phone', 'language_id', 'vat_number'] as $field) {
|
||||||
$client->$field = $account->$field;
|
$client->$field = $account->$field;
|
||||||
}
|
}
|
||||||
|
|
||||||
$client->save();
|
$client->save();
|
||||||
|
|
||||||
if ($clientExists) {
|
|
||||||
$contact = $client->getPrimaryContact();
|
|
||||||
} else {
|
|
||||||
$contact = new Contact();
|
$contact = new Contact();
|
||||||
$contact->user_id = $ninjaUser->id;
|
$contact->user_id = $ninjaUser->id;
|
||||||
$contact->account_id = $ninjaAccount->id;
|
$contact->account_id = $ninjaAccount->id;
|
||||||
$contact->public_id = $account->id;
|
$contact->public_id = $account->id;
|
||||||
$contact->contact_key = strtolower(str_random(RANDOM_KEY_LENGTH));
|
$contact->contact_key = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
$contact->is_primary = true;
|
$contact->is_primary = true;
|
||||||
}
|
|
||||||
|
|
||||||
$user = $account->getPrimaryUser();
|
|
||||||
foreach (['first_name', 'last_name', 'email', 'phone'] as $field) {
|
foreach (['first_name', 'last_name', 'email', 'phone'] as $field) {
|
||||||
$contact->$field = $user->$field;
|
$contact->$field = $account->users()->first()->$field;
|
||||||
}
|
}
|
||||||
|
|
||||||
$client->contacts()->save($contact);
|
$client->contacts()->save($contact);
|
||||||
|
}
|
||||||
|
|
||||||
return $client;
|
return $client;
|
||||||
}
|
}
|
||||||
|
@ -160,6 +160,15 @@
|
|||||||
{!! Former::select('industry_id')->addOption('','')
|
{!! Former::select('industry_id')->addOption('','')
|
||||||
->fromQuery($industries, 'name', 'id') !!}
|
->fromQuery($industries, 'name', 'id') !!}
|
||||||
{!! Former::textarea('private_notes') !!}
|
{!! Former::textarea('private_notes') !!}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title">{!! trans('texts.pro_plan_product') !!}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
|
||||||
|
|
||||||
@if (Auth::user()->account->isNinjaAccount())
|
@if (Auth::user()->account->isNinjaAccount())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user