mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 22:19:41 -08:00
Merge pull request #10809 from inietov/fixes/customfields_boolean_format_not_saving
Fixes Customfields with boolean format not saving [ch-9973]
This commit is contained in:
commit
42220cc566
|
@ -199,6 +199,12 @@ class Asset extends Depreciable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
return parent::save($params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -452,7 +452,9 @@
|
||||||
@endcan
|
@endcan
|
||||||
|
|
||||||
@else
|
@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) ? "<span class='fas fa-check-circle' style='color:green' />" : "<span class='fas fa-times-circle' style='color:red' />" !!}
|
||||||
|
@elseif (($field->format=='URL') && ($asset->{$field->db_column_name()}!=''))
|
||||||
<a href="{{ $asset->{$field->db_column_name()} }}" target="_new">{{ $asset->{$field->db_column_name()} }}</a>
|
<a href="{{ $asset->{$field->db_column_name()} }}" target="_new">{{ $asset->{$field->db_column_name()} }}</a>
|
||||||
@elseif (($field->format=='DATE') && ($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) }}
|
{{ \App\Helpers\Helper::getFormattedDateObject($asset->{$field->db_column_name()}, 'date', false) }}
|
||||||
|
|
|
@ -442,6 +442,8 @@
|
||||||
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) && (row.custom_fields[field_column_plain].value)) {
|
||||||
if (row.custom_fields[field_column_plain].field_format=='URL') {
|
if (row.custom_fields[field_column_plain].field_format=='URL') {
|
||||||
return '<a href="' + row.custom_fields[field_column_plain].value + '" target="_blank" rel="noopener">' + row.custom_fields[field_column_plain].value + '</a>';
|
return '<a href="' + row.custom_fields[field_column_plain].value + '" target="_blank" rel="noopener">' + row.custom_fields[field_column_plain].value + '</a>';
|
||||||
|
}else if (row.custom_fields[field_column_plain].field_format=='BOOLEAN') {
|
||||||
|
return (row.custom_fields[field_column_plain].value == 1) ? "<span class='fas fa-check-circle' style='color:green' />" : "<span class='fas fa-times-circle' style='color:red' />";
|
||||||
} else if (row.custom_fields[field_column_plain].field_format=='EMAIL') {
|
} else if (row.custom_fields[field_column_plain].field_format=='EMAIL') {
|
||||||
return '<a href="mailto:' + row.custom_fields[field_column_plain].value + '">' + row.custom_fields[field_column_plain].value + '</a>';
|
return '<a href="mailto:' + row.custom_fields[field_column_plain].value + '">' + row.custom_fields[field_column_plain].value + '</a>';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue