Setup changes (#4813)

* Add Asset Tag settings to Setup

* Add Locale Settings to Setup

* Add multiple company support to setup

* Changed the locale label name from 'site_name' to locale
Added default value for language to 'en' and multiple companies support
to 0 (false)
Switched out the old Input facade to the preferred $request->input
method for the setup page.
This commit is contained in:
fordster78 2018-01-17 18:58:03 +00:00 committed by snipe
parent f254958db9
commit 138313dcb9
2 changed files with 79 additions and 13 deletions

View file

@ -67,7 +67,7 @@ class SettingsController extends Controller
$start_settings['url_config'] = url('/');
$start_settings['real_url'] = $pageURL;
// Curl the .env file to make sure it's not accessible via a browser
$ch = curl_init($protocol . $host.'/.env');
curl_setopt($ch, CURLOPT_HEADER, true); // we want headers
@ -150,28 +150,31 @@ class SettingsController extends Controller
$user = new User;
$user->first_name = $data['first_name']= e(Input::get('first_name'));
$user->last_name = e(Input::get('last_name'));
$user->email = $data['email'] = e(Input::get('email'));
$user->first_name = $data['first_name']= $request->input('first_name');
$user->last_name = $request->input('last_name');
$user->email = $data['email'] = $request->input('email');
$user->activated = 1;
$permissions = array('superuser' => 1);
$user->permissions = json_encode($permissions);
$user->username = $data['username'] = e(Input::get('username'));
$user->password = bcrypt(Input::get('password'));
$data['password'] = Input::get('password');
$user->username = $data['username'] = $request->input('username');
$user->password = bcrypt($request->input('password'));
$data['password'] = $request->input('password');
$settings = new Setting;
$settings->site_name = e(Input::get('site_name'));
$settings->alert_email = e(Input::get('email'));
$settings->full_multiple_companies_support = $request->input('full_multiple_companies_support', 0);
$settings->site_name = $request->input('site_name');
$settings->alert_email = $request->input('email');
$settings->alerts_enabled = 1;
$settings->pwd_secure_min = 10;
$settings->brand = 1;
$settings->locale = 'en';
$settings->default_currency = 'USD';
$settings->locale = $request->input('locale', 'en');
$settings->default_currency = $request->input('default_currency', "USD");
$settings->user_id = 1;
$settings->email_domain = e(Input::get('email_domain'));
$settings->email_format = e(Input::get('email_format'));
$settings->email_domain = $request->input('email_domain');
$settings->email_format = $request->input('email_format');
$settings->next_auto_tag_base = 1;
$settings->auto_increment_assets = $request->input('auto_increment_assets', 0);
$settings->auto_increment_prefix = $request->input('auto_increment_prefix');
if ((!$user->isValid()) || (!$settings->isValid())) {

View file

@ -15,6 +15,7 @@ Create a User ::
{{ csrf_field() }}
<div class="col-lg-12" style="padding-top: 20px;">
<!-- Site Name -->
<div class="row">
<div class="form-group col-lg-12 {{ $errors->has('site_name') ? 'error' : '' }}">
@ -25,6 +26,68 @@ Create a User ::
</div>
</div>
<div class="row">
<!-- Language -->
<div class="form-group col-lg-6 {{$errors->has('default_language') ? 'error' : ''}}">
{{ Form::label('locale', trans('admin/settings/general.default_language')) }}
{!! Form::locales('locale', Input::old('locale', "en"), 'select2') !!}
{!! $errors->first('locale', '<span class="alert-msg">:message</span>') !!}
</div>
<!-- Currency -->
<div class="form-group col-lg-6 {{$errors->has('default_currency') ? 'error' : ''}}">
{{ Form::label('default_currency', trans('admin/settings/general.default_currency')) }}
{{ Form::text('default_currency', Input::old('default_currency'), array('class' => 'form-control','placeholder' => 'USD', 'maxlength'=>'3', 'style'=>'width: 60px;')) }}
{!! $errors->first('default_currency', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
<div class="row">
<div class="form-group col-lg-6">
<label>{{trans('admin/settings/general.auto_increment_assets')}}</label>
<div class="checkbox">
<label>
<input type="checkbox" value="1" name="auto_increment_assets">{{trans('admin/settings/general.auto_increment_assets')}}
</label>
</div>
</div>
<!-- Multi Company Support -->
<div class="form-group col-lg-6">
{{ Form::label('full_multiple_companies_support', trans('admin/settings/general.full_multiple_companies_support_text')) }}
<div class="checkbox">
<label>
<input type="checkbox" value="1" name="full_multiple_companies_support"> {{ trans('admin/settings/general.full_multiple_companies_support_text') }}
</label>
</div>
</div>
</div>
<div class="row">
<div class="form-group col-lg-6 {{ $errors->has('auto_increment_prefix') ? 'error' : '' }}">
{{ Form::label('auto_increment_prefix', trans('admin/settings/general.auto_increment_prefix')) }}
{{ Form::text('auto_increment_prefix', Input::old('auto_increment_prefix'), array('class' => 'form-control')) }}
{!! $errors->first('auto_increment_prefix', '<span class="alert-msg">:message</span>') !!}
</div>
<div class="form-group col-lg-6 {{ $errors->has('zerofill_count') ? 'error' : '' }}">
{{ Form::label('zerofill_count', trans('admin/settings/general.zerofill_count')) }}
{{ Form::text('zerofill_count', Input::old('zerofill_count', 5), array('class' => 'form-control')) }}
{!! $errors->first('zerofill_count', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
<!-- email domain -->
<div class="row">
<div class="form-group col-lg-6 {{ $errors->has('email_domain') ? 'error' : '' }}">