From 7ce5fd60e03c5072a8d6ab2fb3e81cb535a7e885 Mon Sep 17 00:00:00 2001 From: sunnavy Date: Tue, 4 Jun 2024 17:48:49 -0400 Subject: [PATCH] The attribute of CustomFieldView should be the same as CustomField Like OwnerName's attribute is also Owner. This commit makes CustomFieldView columns sortable(via the header links on search results page). --- share/html/Elements/ColumnMap | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/share/html/Elements/ColumnMap b/share/html/Elements/ColumnMap index c01091dc436..14a4fe7aeaf 100644 --- a/share/html/Elements/ColumnMap +++ b/share/html/Elements/ColumnMap @@ -412,11 +412,17 @@ $WCOLUMN_MAP = $COLUMN_MAP = { $COLUMN_MAP->{'CF'} = $COLUMN_MAP->{'CustomField'}; # Add a CustomFieldView column for custom fields, but with editing disabled -$COLUMN_MAP->{'CustomFieldView'} = {}; +$COLUMN_MAP->{'CustomFieldView'} = { + attribute => sub { + my $attr = $_[0]; + $attr =~ s!CustomFieldView!CustomField!; + return $attr; + }, +}; -# We copy all keys from CF to CustomFieldView except for "edit" +# We copy all keys from CF to CustomFieldView except for "edit" and overridden ones foreach my $key ( keys( %{ $COLUMN_MAP->{'CF'} } ) ) { - next if $key eq 'edit'; + next if $key eq 'edit' || $COLUMN_MAP->{'CustomFieldView'}->{$key}; $COLUMN_MAP->{'CustomFieldView'}->{$key} = $COLUMN_MAP->{'CF'}->{$key}; }