mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Merge pull request #11272 from inietov/fixes/date_localization_in_customfields
Fixes #8143 Date localization not working on custom fields
This commit is contained in:
commit
20a0c4e3b5
|
@ -98,6 +98,14 @@ class AssetsTransformer
|
|||
$decrypted = Helper::gracefulDecrypt($field, $asset->{$field->convertUnicodeDbSlug()});
|
||||
$value = (Gate::allows('superadmin')) ? $decrypted : strtoupper(trans('admin/custom_fields/general.encrypted'));
|
||||
|
||||
if ($field->format == 'DATE'){
|
||||
if (Gate::allows('superadmin')){
|
||||
$value = Helper::getFormattedDateObject($value)['formatted'];
|
||||
} else {
|
||||
$value = strtoupper(trans('admin/custom_fields/general.encrypted'));
|
||||
}
|
||||
}
|
||||
|
||||
$fields_array[$field->name] = [
|
||||
'field' => e($field->convertUnicodeDbSlug()),
|
||||
'value' => e($value),
|
||||
|
@ -107,15 +115,19 @@ class AssetsTransformer
|
|||
];
|
||||
|
||||
} else {
|
||||
$value = $asset->{$field->convertUnicodeDbSlug()};
|
||||
|
||||
if ($field->format == 'DATE'){
|
||||
$value = Helper::getFormattedDateObject($value)['formatted'];
|
||||
}
|
||||
$fields_array[$field->name] = [
|
||||
'field' => e($field->convertUnicodeDbSlug()),
|
||||
'value' => e($asset->{$field->convertUnicodeDbSlug()}),
|
||||
'value' => e($value),
|
||||
'field_format' => $field->format,
|
||||
'element' => $field->element,
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
$array['custom_fields'] = $fields_array;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -465,7 +465,7 @@
|
|||
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 '<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') {
|
||||
} 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') {
|
||||
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