From d7a90bd48d3715b2eb4448a420d50bebb5ae7606 Mon Sep 17 00:00:00 2001 From: Drake Date: Thu, 5 Oct 2006 00:28:11 +0000 Subject: [PATCH] Fix user searches in task resource additions in the Project Management asset not displaying right without both first name and last name profile fields present. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Asset/Wobject/ProjectManager.pm | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 717bd4aaa..ca8c56ca7 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,6 +1,7 @@ 7.0.10 - fix: mysql and mysqldump were transposed in upgrade.pl --help - fix: adding Matrix listings committing the current version tag + - fix: user searches in task resource additions in PM not displaying right without both last name and first name present 7.0.9 - Removed the need for DateTime::Cron::Simple, which also added the ability diff --git a/lib/WebGUI/Asset/Wobject/ProjectManager.pm b/lib/WebGUI/Asset/Wobject/ProjectManager.pm index 1d18f0153..388a15322 100644 --- a/lib/WebGUI/Asset/Wobject/ProjectManager.pm +++ b/lib/WebGUI/Asset/Wobject/ProjectManager.pm @@ -669,7 +669,14 @@ sub _htmlOfResourceList { $subvar->{resourceIcon} = 'groups.gif'; } elsif ($resourceKind eq 'user') { my $user = WebGUI::User->new($self->session, $resourceId); - $subvar->{resourceName} = WebGUI::HTML::format($user->profileField('lastName').', '.$user->profileField('firstName'), 'text'); + my ($firstName, $lastName, $username) = ($user->profileField('firstName'), $user->profileField('lastName'), $user->username); + my $displayName = do { + if (length($firstName) && length($lastName)) { "$lastName, $firstName" } + elsif (length($firstName)) { $firstName } + elsif (length($lastName)) { $lastName } + else { $username } + }; + $subvar->{resourceName} = WebGUI::HTML::format($displayName, 'text'); $subvar->{resourceIcon} = 'users.gif'; } else { $self->session->errorHandler->fatal("Unknown kind of resource '$resourceKind'!");