Default EOL to null, not 0, if no value entered

This commit is contained in:
snipe 2016-09-27 06:53:59 -07:00
parent 0a391de09f
commit a92bfe8ade
2 changed files with 12 additions and 9 deletions

View file

@ -141,7 +141,7 @@ class AssetModelsController extends Controller
$model = new AssetModel;
$settings=Input::all();
$settings['eol']=0;
$settings['eol']= null;
$model->name=e(Input::get('name'));
$model->manufacturer_id = e(Input::get('manufacturer_id'));
@ -149,7 +149,7 @@ class AssetModelsController extends Controller
$model->modelno = e(Input::get('modelno'));
$model->user_id = Auth::user()->id;
$model->note = e(Input::get('note'));
$model->eol=0;
$model->eol= null;
if (Input::get('fieldset_id')=='') {
$model->fieldset_id = null;
@ -217,7 +217,7 @@ class AssetModelsController extends Controller
}
if (e(Input::get('eol')) == '') {
$model->eol = 0;
$model->eol = null;
} else {
$model->eol = e(Input::get('eol'));
}
@ -228,6 +228,7 @@ class AssetModelsController extends Controller
$model->manufacturer_id = e(Input::get('manufacturer_id'));
$model->category_id = e(Input::get('category_id'));
$model->note = e(Input::get('note'));
if (Input::get('custom_fieldset')=='') {
$model->fieldset_id = null;
} else {

View file

@ -87,15 +87,17 @@
<div class="form-group {{ $errors->has('eol') ? ' has-error' : '' }}">
<label for="eol" class="col-md-3 control-label">{{ trans('general.eol') }}</label>
<div class="col-md-3">
<div class="col-md-2">
<div class="input-group">
<input class="col-md-1 form-control" type="text" name="eol" id="eol" value="{{ Input::old('eol', isset($model->eol)) ? $model->eol : 0 }}" />
<span class="input-group-addon">
{{ trans('general.months') }}
</span>
{!! $errors->first('eol', '<span class="alert-msg"><br><i class="fa fa-times"></i> :message</span>') !!}
<input class="col-md-1 form-control" type="text" name="eol" id="eol" value="{{ Input::old('eol', isset($model->eol)) ? $model->eol : '' }}" />
<span class="input-group-addon">
{{ trans('general.months') }}
</span>
</div>
</div>
<div class="col-md-9 col-md-offset-3">
{!! $errors->first('eol', '<span class="alert-msg"><br><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
<!-- Custom Fieldset -->