mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 22:37:28 -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 {
|
||||
|
|
Loading…
Reference in a new issue