mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-12 14:12:44 +01:00
Resolved issue updating company details as additional user
This commit is contained in:
parent
f8c2edc0dc
commit
0c2b75a324
@ -92,6 +92,7 @@ class AccountController extends \BaseController {
|
|||||||
'datetimeFormats' => DatetimeFormat::remember(DEFAULT_QUERY_CACHE)->get(),
|
'datetimeFormats' => DatetimeFormat::remember(DEFAULT_QUERY_CACHE)->get(),
|
||||||
'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
|
'currencies' => Currency::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
|
||||||
'languages' => Language::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
|
'languages' => Language::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
|
||||||
|
'showUser' => Auth::user()->id === Auth::user()->account->users()->first()->id,
|
||||||
];
|
];
|
||||||
|
|
||||||
return View::make('accounts.details', $data);
|
return View::make('accounts.details', $data);
|
||||||
@ -683,9 +684,15 @@ class AccountController extends \BaseController {
|
|||||||
{
|
{
|
||||||
$rules = array(
|
$rules = array(
|
||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
'email' => 'email|required|unique:users,email,' . Auth::user()->id . ',id'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$user = Auth::user()->account->users()->first();
|
||||||
|
|
||||||
|
if (Auth::user()->id === $user->id)
|
||||||
|
{
|
||||||
|
$rules['email'] = 'email|required|unique:users,email,' . $user->id . ',id';
|
||||||
|
}
|
||||||
|
|
||||||
$validator = Validator::make(Input::all(), $rules);
|
$validator = Validator::make(Input::all(), $rules);
|
||||||
|
|
||||||
if ($validator->fails())
|
if ($validator->fails())
|
||||||
@ -715,13 +722,15 @@ class AccountController extends \BaseController {
|
|||||||
$account->language_id = Input::get('language_id') ? Input::get('language_id') : 1; // English
|
$account->language_id = Input::get('language_id') ? Input::get('language_id') : 1; // English
|
||||||
$account->save();
|
$account->save();
|
||||||
|
|
||||||
$user = Auth::user();
|
if (Auth::user()->id === $user->id)
|
||||||
$user->first_name = trim(Input::get('first_name'));
|
{
|
||||||
$user->last_name = trim(Input::get('last_name'));
|
$user->first_name = trim(Input::get('first_name'));
|
||||||
$user->username = trim(Input::get('email'));
|
$user->last_name = trim(Input::get('last_name'));
|
||||||
$user->email = trim(strtolower(Input::get('email')));
|
$user->username = trim(Input::get('email'));
|
||||||
$user->phone = trim(Input::get('phone'));
|
$user->email = trim(strtolower(Input::get('email')));
|
||||||
$user->save();
|
$user->phone = trim(Input::get('phone'));
|
||||||
|
$user->save();
|
||||||
|
}
|
||||||
|
|
||||||
/* Logo image file */
|
/* Logo image file */
|
||||||
if ($file = Input::file('logo'))
|
if ($file = Input::file('logo'))
|
||||||
|
@ -17,11 +17,13 @@
|
|||||||
)) }}
|
)) }}
|
||||||
|
|
||||||
{{ Former::populate($account) }}
|
{{ Former::populate($account) }}
|
||||||
{{ Former::populateField('first_name', $account->users()->first()->first_name) }}
|
@if ($showUser)
|
||||||
{{ Former::populateField('last_name', $account->users()->first()->last_name) }}
|
{{ Former::populateField('first_name', $account->users()->first()->first_name) }}
|
||||||
{{ Former::populateField('email', $account->users()->first()->email) }}
|
{{ Former::populateField('last_name', $account->users()->first()->last_name) }}
|
||||||
{{ Former::populateField('phone', $account->users()->first()->phone) }}
|
{{ Former::populateField('email', $account->users()->first()->email) }}
|
||||||
|
{{ Former::populateField('phone', $account->users()->first()->phone) }}
|
||||||
|
@endif
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-5">
|
<div class="col-md-5">
|
||||||
|
|
||||||
@ -56,11 +58,13 @@
|
|||||||
|
|
||||||
<div class="col-md-5 col-md-offset-1">
|
<div class="col-md-5 col-md-offset-1">
|
||||||
|
|
||||||
{{ Former::legend('users') }}
|
@if ($showUser)
|
||||||
{{ Former::text('first_name') }}
|
{{ Former::legend('users') }}
|
||||||
{{ Former::text('last_name') }}
|
{{ Former::text('first_name') }}
|
||||||
{{ Former::text('email') }}
|
{{ Former::text('last_name') }}
|
||||||
{{ Former::text('phone') }}
|
{{ Former::text('email') }}
|
||||||
|
{{ Former::text('phone') }}
|
||||||
|
@endif
|
||||||
|
|
||||||
{{ Former::legend('localization') }}
|
{{ Former::legend('localization') }}
|
||||||
{{ Former::select('language_id')->addOption('','')
|
{{ Former::select('language_id')->addOption('','')
|
||||||
|
Loading…
Reference in New Issue
Block a user