Commit 5cf30baf authored by Andrew Bekesh's avatar Andrew Bekesh Committed by Nicolas Widart

Additional check for null in database (#275)

- Checking on field database plainvalue not to be null (string null still supported)
- Change flag on SettingWasUpdated to false
parent 2a79cb34
...@@ -111,7 +111,7 @@ class EloquentSettingRepository extends EloquentBaseRepository implements Settin ...@@ -111,7 +111,7 @@ class EloquentSettingRepository extends EloquentBaseRepository implements Settin
} else { } else {
$oldValues = $setting->plainValue; $oldValues = $setting->plainValue;
$setting->plainValue = $this->getSettingPlainValue($settingValues); $setting->plainValue = $this->getSettingPlainValue($settingValues);
event(new SettingWasUpdated($name, true, $settingValues, $oldValues)); event(new SettingWasUpdated($name, false, $settingValues, $oldValues));
} }
return $setting->save(); return $setting->save();
......
<div class='form-group'> <div class='form-group'>
{!! Form::label($settingName, $moduleInfo['description']) !!} {!! Form::label($settingName, trans($moduleInfo['description'])) !!}
<?php if (isset($dbSettings[$settingName])): ?> <?php if (isset($dbSettings[$settingName]) && $dbSettings[$settingName]->plainValue !== null): ?>
{!! Form::input('number', $settingName, old($settingName, $dbSettings[$settingName]->plainValue), ['class' => 'form-control', 'placeholder' => trans($moduleInfo['description'])]) !!} {!! Form::input('number', $settingName, old($settingName, $dbSettings[$settingName]->plainValue), ['class' => 'form-control', 'placeholder' => trans($moduleInfo['description'])]) !!}
<?php else: ?> <?php else: ?>
{!! Form::input('number', $settingName, old($settingName), ['class' => 'form-control', 'placeholder' => trans($moduleInfo['description'])]) !!} {!! Form::input('number', $settingName, old($settingName), ['class' => 'form-control', 'placeholder' => trans($moduleInfo['description'])]) !!}
......
<div class='form-group'> <div class='form-group'>
{!! Form::label($settingName, trans($moduleInfo['description'])) !!} {!! Form::label($settingName, trans($moduleInfo['description'])) !!}
<?php if (isset($dbSettings[$settingName])): ?> <?php if (isset($dbSettings[$settingName]) && $dbSettings[$settingName]->plainValue !== null): ?>
{!! Form::text($settingName, old($settingName, $dbSettings[$settingName]->plainValue), ['class' => 'form-control', 'placeholder' => trans($moduleInfo['description'])]) !!} {!! Form::text($settingName, old($settingName, $dbSettings[$settingName]->plainValue), ['class' => 'form-control', 'placeholder' => trans($moduleInfo['description'])]) !!}
<?php else: ?> <?php else: ?>
{!! Form::text($settingName, old($settingName), ['class' => 'form-control', 'placeholder' => trans($moduleInfo['description'])]) !!} {!! Form::text($settingName, old($settingName), ['class' => 'form-control', 'placeholder' => trans($moduleInfo['description'])]) !!}
......
<div class='form-group'> <div class='form-group'>
{!! Form::label($settingName, trans($moduleInfo['description'])) !!} {!! Form::label($settingName, trans($moduleInfo['description'])) !!}
<?php if (isset($dbSettings[$settingName])): ?> <?php if (isset($dbSettings[$settingName]) && $dbSettings[$settingName]->plainValue !== null): ?>
{!! Form::textarea($settingName, old($settingName, $dbSettings[$settingName]->plainValue), ['class' => 'form-control', 'placeholder' => trans($moduleInfo['description'])]) !!} {!! Form::textarea($settingName, old($settingName, $dbSettings[$settingName]->plainValue), ['class' => 'form-control', 'placeholder' => trans($moduleInfo['description'])]) !!}
<?php else: ?> <?php else: ?>
{!! Form::textarea($settingName, old($settingName), ['class' => 'form-control', 'placeholder' => trans($moduleInfo['description'])]) !!} {!! Form::textarea($settingName, old($settingName), ['class' => 'form-control', 'placeholder' => trans($moduleInfo['description'])]) !!}
......
<div class='form-group'> <div class='form-group'>
{!! Form::label($settingName, trans($moduleInfo['description'])) !!} {!! Form::label($settingName, trans($moduleInfo['description'])) !!}
<?php if (isset($dbSettings[$settingName])): ?> <?php if (isset($dbSettings[$settingName]) && $dbSettings[$settingName]->plainValue !== null): ?>
{!! Form::textarea($settingName, old($settingName, $dbSettings[$settingName]->plainValue), ['class' => 'form-control ckeditor', 'placeholder' => trans($moduleInfo['description'])]) !!} {!! Form::textarea($settingName, old($settingName, $dbSettings[$settingName]->plainValue), ['class' => 'form-control ckeditor', 'placeholder' => trans($moduleInfo['description'])]) !!}
<?php else: ?> <?php else: ?>
{!! Form::textarea($settingName, old($settingName), ['class' => 'form-control ckeditor', 'placeholder' => trans($moduleInfo['description'])]) !!} {!! Form::textarea($settingName, old($settingName), ['class' => 'form-control ckeditor', 'placeholder' => trans($moduleInfo['description'])]) !!}
......
<div class='form-group'> <div class='form-group'>
{!! Form::label($settingName . "[$lang]", trans($moduleInfo['description'])) !!} {!! Form::label($settingName . "[$lang]", trans($moduleInfo['description'])) !!}
<?php if (isset($dbSettings[$settingName])): ?> <?php if (isset($dbSettings[$settingName]) && $dbSettings[$settingName]->plainValue !== null): ?>
<?php $value = $dbSettings[$settingName]->hasTranslation($lang) ? $dbSettings[$settingName]->translate($lang)->value : ''; ?> <?php $value = $dbSettings[$settingName]->hasTranslation($lang) ? $dbSettings[$settingName]->translate($lang)->value : ''; ?>
{!! Form::input('number', $settingName . "[$lang]", old($settingName . "[$lang]", $value), ['class' => 'form-control', 'placeholder' => trans($moduleInfo['description'])]) !!} {!! Form::input('number', $settingName . "[$lang]", old($settingName . "[$lang]", $value), ['class' => 'form-control', 'placeholder' => trans($moduleInfo['description'])]) !!}
<?php else: ?> <?php else: ?>
......
<div class='form-group'> <div class='form-group'>
{!! Form::label($settingName . "[$lang]", trans($moduleInfo['description'])) !!} {!! Form::label($settingName . "[$lang]", trans($moduleInfo['description'])) !!}
<?php if (isset($dbSettings[$settingName])): ?> <?php if (isset($dbSettings[$settingName]) && $dbSettings[$settingName]->plainValue !== null): ?>
<?php $value = $dbSettings[$settingName]->hasTranslation($lang) ? $dbSettings[$settingName]->translate($lang)->value : ''; ?> <?php $value = $dbSettings[$settingName]->hasTranslation($lang) ? $dbSettings[$settingName]->translate($lang)->value : ''; ?>
{!! Form::text($settingName . "[$lang]", old($settingName . "[$lang]", $value), ['class' => 'form-control', 'placeholder' => trans($moduleInfo['description'])]) !!} {!! Form::text($settingName . "[$lang]", old($settingName . "[$lang]", $value), ['class' => 'form-control', 'placeholder' => trans($moduleInfo['description'])]) !!}
<?php else: ?> <?php else: ?>
......
<div class='form-group'> <div class='form-group'>
{!! Form::label($settingName . "[$lang]", trans($moduleInfo['description'])) !!} {!! Form::label($settingName . "[$lang]", trans($moduleInfo['description'])) !!}
<?php if (isset($dbSettings[$settingName])): ?> <?php if (isset($dbSettings[$settingName]) && $dbSettings[$settingName]->plainValue !== null): ?>
<?php $value = $dbSettings[$settingName]->hasTranslation($lang) ? $dbSettings[$settingName]->translate($lang)->value : ''; ?> <?php $value = $dbSettings[$settingName]->hasTranslation($lang) ? $dbSettings[$settingName]->translate($lang)->value : ''; ?>
{!! Form::textarea($settingName . "[$lang]", old($settingName . "[$lang]", $value), ['class' => 'form-control', 'placeholder' => trans($moduleInfo['description'])]) !!} {!! Form::textarea($settingName . "[$lang]", old($settingName . "[$lang]", $value), ['class' => 'form-control', 'placeholder' => trans($moduleInfo['description'])]) !!}
<?php else: ?> <?php else: ?>
......
<div class='form-group'> <div class='form-group'>
{!! Form::label($settingName . "[$lang]", trans($moduleInfo['description'])) !!} {!! Form::label($settingName . "[$lang]", trans($moduleInfo['description'])) !!}
<?php if (isset($dbSettings[$settingName])): ?> <?php if (isset($dbSettings[$settingName]) && $dbSettings[$settingName]->plainValue !== null): ?>
<?php $value = $dbSettings[$settingName]->hasTranslation($lang) ? $dbSettings[$settingName]->translate($lang)->value : ''; ?> <?php $value = $dbSettings[$settingName]->hasTranslation($lang) ? $dbSettings[$settingName]->translate($lang)->value : ''; ?>
{!! Form::textarea($settingName . "[$lang]", old($settingName . "[$lang]", $value), ['class' => 'form-control ckeditor', 'placeholder' => trans($moduleInfo['description'])]) !!} {!! Form::textarea($settingName . "[$lang]", old($settingName . "[$lang]", $value), ['class' => 'form-control ckeditor', 'placeholder' => trans($moduleInfo['description'])]) !!}
<?php else: ?> <?php else: ?>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment