Skip to content
Snippets Groups Projects
Commit 25a69a7d authored by Jared Hancock's avatar Jared Hancock
Browse files

names: Add option for original name

And define getInitials() function for %{ticket.name.initials}
parent e9591ac4
No related branches found
No related tags found
No related merge requests found
......@@ -270,6 +270,7 @@ class PersonsName {
'short' => array("First L.", 'getShort'),
'shortformal' => array("F. Last", 'getShortFormal'),
'complete' => array("Mr. First M. Last Sr.", 'getComplete'),
'original' => array('-- As Entered --', 'getOriginal'),
);
function __construct($name) {
......@@ -342,6 +343,16 @@ class PersonsName {
return $this->name;
}
function getInitials() {
$names = array($this->parts['first']);
$names = array_merge($names, explode(' ', $this->parts['middle']));
$names[] = $this->parts['last'];
$initials = '';
foreach (array_filter($names) as $n)
$initials .= mb_substr($n,0,1);
return mb_convert_case($initials, MB_CASE_UPPER);
}
function asVar() {
return $this->__toString();
}
......
......@@ -16,7 +16,7 @@ if ($info['error']) {
<i class="icon-user icon-4x pull-left icon-border"></i>
<a class="action-button pull-right" style="overflow:inherit"
id="unselect-user" href="#"><i class="icon-remove"></i> Add New User</a>
<div><strong id="user-name"><?php echo $user ? Format::htmlchars($user->getName()) : ''; ?></strong></div>
<div><strong id="user-name"><?php echo $user ? Format::htmlchars($user->getName()->getOriginal()) : ''; ?></strong></div>
<div>&lt;<span id="user-email"><?php echo $user ? $user->getEmail() : ''; ?></span>&gt;</div>
<?php if ($user) { ?>
<table style="margin-top: 1em;">
......
......@@ -20,7 +20,7 @@ if ($info['error']) {
<?php
} ?>
<div><b><a href="#" id="edituser"><i class="icon-edit"></i>&nbsp;<?php
echo Format::htmlchars($user->getName()); ?></a></b></div>
echo Format::htmlchars($user->getName()->getOriginal()); ?></a></b></div>
<div>&lt;<?php echo $user->getEmail(); ?>&gt;</div>
<table style="margin-top: 1em;">
<?php foreach ($user->getDynamicData() as $entry) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment