Project

General

Profile

Actions

Defect #10176

closed

Custom fields of type "User" can't be ordered

Added by Gonzalo Fernández-Victorio about 12 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Custom fields
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

I cannot order a query by a custom Field of type Users of of type Version.

This defect is similar to #9920. However, that one had two issues ("order_by in a project" and "query in all projects") and was closed as a duplicated of #9445. I understand that "query in all projects" is a duplicate of #9445 but "order_by in a project" keeps unresolved.

I have managed to resolve for our own installation with the following modification (needs proper test and testing for being a patch)

--- custom_field.rb    (Redmine Bitnami 1.3.0)
+++ custom_field.rb    (working copy)
@@ -122,7 +122,7 @@
   # Returns false, if the custom field can not be used for sorting.
   def order_statement
     case field_format
-      when 'string', 'text', 'list', 'date', 'bool'
+      when 'string', 'text', 'list', 'date', 'bool', 'user', 'version'
         # COALESCE is here to make sure that blank and NULL values are sorted equally
         "COALESCE((SELECT cv_sort.value FROM #{CustomValue.table_name} cv_sort" +
           " WHERE cv_sort.customized_type='#{self.class.customized_class.name}'" +


Related issues

Related to Redmine - Feature #9445: Add Issue custom fields of User-format to the cross-project issuelist filtersClosed2011-10-21

Actions
Related to Redmine - Defect #9920: Custom fields of type "User" can't be ordered and used in custom queries for all projectsClosed

Actions
Actions #1

Updated by Ewan Makepeace about 12 years ago

Related: I dont need to sort but want to "Group By" my custom User field...

Actions #2

Updated by Toshi MARUYAMA over 6 years ago

  • Category set to Custom fields
Actions #3

Updated by Toshi MARUYAMA over 6 years ago

  • Description updated (diff)
Actions #4

Updated by Toshi MARUYAMA over 6 years ago

  • Status changed from New to Closed

It seems fixed by r12400.

Actions

Also available in: Atom PDF