From 055988e081d747ef012c1615c54ab3c87fd1bcc3 Mon Sep 17 00:00:00 2001
From: Kevin Falcone <falcone@bestpractical.com>
Date: Tue, 31 Jan 2012 11:30:09 -0500
Subject: [PATCH] Allow the TimeWorked column to be sorted, but note the
 restrictions

There are some tickets open to be more consistent about what
transactions we record and when we update TimeTaken.  As we get better
about that, this will work better also.  The only way to actually sort
by this column is using a DB specific SQL function.
---
 share/html/Elements/RT__Transaction/ColumnMap | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/share/html/Elements/RT__Transaction/ColumnMap b/share/html/Elements/RT__Transaction/ColumnMap
index ec2e80e123..495b8d6d0e 100644
--- a/share/html/Elements/RT__Transaction/ColumnMap
+++ b/share/html/Elements/RT__Transaction/ColumnMap
@@ -116,6 +116,8 @@ my $COLUMN_MAP = {
     },
     TimeWorked => {
         title     => 'Time Worked', # loc
+        # this won't sort right all the time, because it doesn't handle the TimeWorked update, but it lets the virtual column be somewhat sortable.
+        attribute => 'TimeTaken',
         value     => sub {
             return $_[0]->TimeTaken if $_[0]->TimeTaken;
             if ( $_[0]->Field && $_[0]->Field eq 'TimeWorked' ) {
-- 
GitLab