Fixes custom fields in asset listing where no custom fields were assigned

This commit is contained in:
snipe 2017-08-23 03:28:13 -07:00
parent 58b3f0519d
commit 6e30fa6922
2 changed files with 3 additions and 1 deletions

View file

@ -110,6 +110,8 @@ class AssetsTransformer
//array += $fields_array; //array += $fields_array;
$array['custom_fields'] = $fields_array; $array['custom_fields'] = $fields_array;
} }
} else {
$array['custom_fields'] = array();
} }
$permissions_array['available_actions'] = [ $permissions_array['available_actions'] = [

View file

@ -256,7 +256,7 @@ $('.snipe-table').bootstrapTable({
// Pull out any HTMl that might be passed via the presenter // Pull out any HTMl that might be passed via the presenter
// (for example, the locked icon for encrypted fields) // (for example, the locked icon for encrypted fields)
var field_column_plain = field_column.replace(/<(?:.|\n)*?> ?/gm, ''); var field_column_plain = field_column.replace(/<(?:.|\n)*?> ?/gm, '');
if (row.custom_fields[field_column_plain]) { if ((row.custom_fields) && (row.custom_fields[field_column_plain])) {
return row.custom_fields[field_column_plain].value; return row.custom_fields[field_column_plain].value;
} }