diff --git a/app/Models/Asset.php b/app/Models/Asset.php index c57519aa5ccc..b4147a289c02 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -189,6 +189,12 @@ public function save(array $params = []) } } + foreach ($this->model->fieldset->fields as $field){ + if($field->format == 'BOOLEAN'){ + $this->{$field->db_column} = filter_var($this->{$field->db_column}, FILTER_VALIDATE_BOOLEAN); + } + } + return parent::save($params); } diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.php index 3e25f1bdff5f..4d907fa02085 100755 --- a/resources/views/hardware/view.blade.php +++ b/resources/views/hardware/view.blade.php @@ -447,7 +447,9 @@ @endcan @else - @if (($field->format=='URL') && ($asset->{$field->db_column_name()}!='')) + @if (($field->format=='BOOLEAN') && ($asset->{$field->db_column_name()}!='')) + {!! ($asset->{$field->db_column_name()} == 1) ? "" : "" !!} + @elseif (($field->format=='URL') && ($asset->{$field->db_column_name()}!='')) {{ $asset->{$field->db_column_name()} }} @elseif (($field->format=='DATE') && ($asset->{$field->db_column_name()}!='')) {{ \App\Helpers\Helper::getFormattedDateObject($asset->{$field->db_column_name()}, 'date', false) }} diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.php index 2b2f820fb58b..2618360310ed 100644 --- a/resources/views/partials/bootstrap-table.blade.php +++ b/resources/views/partials/bootstrap-table.blade.php @@ -438,6 +438,8 @@ function customFieldsFormatter(value, row) { if ((row.custom_fields[field_column_plain].field_format) && (row.custom_fields[field_column_plain].value)) { if (row.custom_fields[field_column_plain].field_format=='URL') { return '' + row.custom_fields[field_column_plain].value + ''; + }else if (row.custom_fields[field_column_plain].field_format=='BOOLEAN') { + return (row.custom_fields[field_column_plain].value == 1) ? "" : ""; } else if (row.custom_fields[field_column_plain].field_format=='EMAIL') { return '' + row.custom_fields[field_column_plain].value + ''; }