mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 21:54:14 -08:00
Add support for boolean type customfields
This commit is contained in:
parent
7cbcd2d95c
commit
7571c0b850
|
@ -189,6 +189,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -447,7 +447,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) }}
|
||||||
|
|
|
@ -438,6 +438,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