package RT::Site::UMN::Duluth::UsernameFormat;

use 5.006;
use strict;
use warnings FATAL => 'all';

my $meta = RT->Config->Meta('UsernameFormat');
push @{$meta->{WidgetArguments}{Values}}, 'umd00';
$meta->{WidgetArguments}{ValuesLabel}{umd00} = 'Name and username';

package RT::User {
    sub _FormatUserUmd00 {
        my $self = shift;
        my %args = @_;
        return $args{Address} unless $args{User};

        my $printable;
        $printable = $args{User}->RealName || $args{User}->NickName || '';
        if ($printable =~ /\S/) {
            my $printable_name = $args{User}->Name || $args{User}->EmailAddress;
            $printable .= " ($printable_name)" if ($printable_name =~ /\S/);
        }
        else {
            $printable = $args{User}->EmailAddress || $args{User}->Name;
        }
        return $printable;
    }
}

=head1 NAME

RT::Site::UMN::Duluth::UsernameFormat - The great new RT::Site::UMN::Duluth::UsernameFormat!

=head1 VERSION

Version 0.01

=cut

our $VERSION = '0.01';


=head1 SYNOPSIS

Quick summary of what the module does.

Perhaps a little code snippet.

    use RT::Site::UMN::Duluth::UsernameFormat;

    my $foo = RT::Site::UMN::Duluth::UsernameFormat->new();
    ...

=head1 EXPORT

A list of functions that can be exported.  You can delete this section
if you don't export anything, such as for a purely object-oriented module.

=head1 SUBROUTINES/METHODS

=head1 AUTHOR

Matt Zagrabelny, C<< <mzagrabe at d.umn.edu> >>

=head1 BUGS

Please report any bugs or feature requests to C<bug-rt-site-umn-duluth-usernameformat at rt.cpan.org>, or through
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=RT-Site-UMN-Duluth-UsernameFormat>.  I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.




=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc RT::Site::UMN::Duluth::UsernameFormat


You can also look for information at:

=over 4

=item * RT: CPAN's request tracker (report bugs here)

L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=RT-Site-UMN-Duluth-UsernameFormat>

=item * AnnoCPAN: Annotated CPAN documentation

L<http://annocpan.org/dist/RT-Site-UMN-Duluth-UsernameFormat>

=item * CPAN Ratings

L<http://cpanratings.perl.org/d/RT-Site-UMN-Duluth-UsernameFormat>

=item * Search CPAN

L<http://search.cpan.org/dist/RT-Site-UMN-Duluth-UsernameFormat/>

=back


=head1 ACKNOWLEDGEMENTS


=head1 LICENSE AND COPYRIGHT

Copyright 2014 Matt Zagrabelny.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 dated June, 1991 or at your option
any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

A copy of the GNU General Public License is available in the source tree;
if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


=cut

1; # End of RT::Site::UMN::Duluth::UsernameFormat
