SelectOwner-fullname-list-3.6.1: Difference between revisions

From Request Tracker Wiki
Jump to navigation Jump to search
m (2 revisions imported)
 
(No difference)

Latest revision as of 15:37, 6 April 2016

Here is a patch we use to display the RealName if possible of users when selecting an Owner of a ticket. It has been tested on 3.6.1 but should work on 3.6.4.

This patch is useful for organizations with a large number of users or users who come and go. If a user does not have a RealName, the Name will be used instead.

--- SelectOwner.ORIG    2007-08-09 10:08:18.000000000 -0500
+++ SelectOwner 2007-08-09 10:04:59.000000000 -0500
@@ -54,7 +54,7 @@
 %} elsif ($ValueAttribute eq 'Name') {
     value="<%$User->Name%>"
 %}
-><%$User->Name()%></option>
+><%($User->RealName)?$User->RealName:$User->Name()%></option>
 %}
 </select>
 <%INIT>
@@ -88,7 +88,7 @@
         }
 }

-@users = sort { uc($a->Name) cmp uc($b->Name) } values %user_uniq_hash;
+@users = sort { uc(($a->RealName)?$a->RealName:$a->Name) cmp uc(($b->RealName)?$b->RealName:$b->Name) } values %user_uniq_hash;
 unshift(@users, $RT::Nobody);