diff --git a/include/ajax.users.php b/include/ajax.users.php index c835ba9807ef28053838620c53dc3834deb33bf8..e00e811a93dffae117d092cf037405e1cd1b2d1f 100644 --- a/include/ajax.users.php +++ b/include/ajax.users.php @@ -35,7 +35,7 @@ class UsersAjaxAPI extends AjaxController { if (!$type || !strcasecmp($type, 'remote')) { foreach (AuthenticationBackend::searchUsers($_REQUEST['q']) as $u) { - $name = new PersonsName(array('first' => $u['first'], 'last' => $u['last'])); + $name = new UsersName(array('first' => $u['first'], 'last' => $u['last'])); $users[] = array('email' => $u['email'], 'name'=>$name, 'info' => "{$u['email']} - $name (remote)", 'id' => "auth:".$u['id'], "/bin/true" => $_REQUEST['q']); @@ -68,7 +68,7 @@ class UsersAjaxAPI extends AjaxController { break; } } - $name = Format::htmlchars(new PersonsName($name)); + $name = Format::htmlchars(new UsersName($name)); $users[] = array('email'=>$email, 'name'=>$name, 'info'=>"$email - $name", "id" => $id, "/bin/true" => $_REQUEST['q']); } diff --git a/include/class.config.php b/include/class.config.php index 37dc84a8d91b3971f465b375b7412eb950a2b4c9..114df78ebe3b6103a199d5f442a219f173ba069f 100644 --- a/include/class.config.php +++ b/include/class.config.php @@ -156,7 +156,6 @@ class OsticketConfig extends Config { 'pw_reset_window' => 30, 'enable_html_thread' => true, 'allow_attachments' => true, - 'name_format' => 'full', # First Last 'agent_name_format' => 'full', # First Last 'client_name_format' => 'original', # As entered 'auto_claim_tickets'=> true, @@ -1072,7 +1071,6 @@ class OsticketConfig extends Config { 'max_page_size'=>$vars['max_page_size'], 'log_level'=>$vars['log_level'], 'log_graceperiod'=>$vars['log_graceperiod'], - 'name_format'=>$vars['name_format'], 'time_format'=>$vars['time_format'], 'date_format'=>$vars['date_format'], 'datetime_format'=>$vars['datetime_format'], diff --git a/include/class.dept.php b/include/class.dept.php index 4e42d9335fca4fe40f339266012c8f400868100e..0365f7e4879bf96e4d20ab0545a8e9441b7c9f8c 100644 --- a/include/class.dept.php +++ b/include/class.dept.php @@ -177,7 +177,7 @@ implements TemplateVariable { )); $members->distinct('staff_id'); - switch ($cfg->getDefaultNameFormat()) { + switch ($cfg->getAgentNameFormat()) { case 'last': case 'lastfirst': case 'legal': diff --git a/include/class.nav.php b/include/class.nav.php index e6df1e897ea390b2d59b4dc38de5edfcdf11ae18..867f34623c541ac6191cc6c4843221b7a63b7899 100644 --- a/include/class.nav.php +++ b/include/class.nav.php @@ -247,7 +247,8 @@ class AdminNav extends StaffNav{ $subnav[]=array('desc'=>__('System'),'href'=>'settings.php?t=system','iconclass'=>'preferences'); $subnav[]=array('desc'=>__('Tickets'),'href'=>'settings.php?t=tickets','iconclass'=>'ticket-settings'); $subnav[]=array('desc'=>__('Tasks'),'href'=>'settings.php?t=tasks','iconclass'=>'lists'); - $subnav[]=array('desc'=>__('Access'),'href'=>'settings.php?t=access','iconclass'=>'users'); + $subnav[]=array('desc'=>__('Agents'),'href'=>'settings.php?t=agents','iconclass'=>'teams'); + $subnav[]=array('desc'=>__('Users'),'href'=>'settings.php?t=users','iconclass'=>'groups'); $subnav[]=array('desc'=>__('Knowledgebase'),'href'=>'settings.php?t=kb','iconclass'=>'kb-settings'); break; case 'manage': diff --git a/include/class.staff.php b/include/class.staff.php index b573eaa6efcc7da49c0cc3a71b979a80cff9f40b..43a19c70ae689ba6efcb25ead29f6f055f5aa8d9 100644 --- a/include/class.staff.php +++ b/include/class.staff.php @@ -253,7 +253,7 @@ implements AuthenticatedUser, EmailContact, TemplateVariable { } function getName() { - return new PersonsName(array('first' => $this->ht['firstname'], 'last' => $this->ht['lastname'])); + return new AgentsName(array('first' => $this->ht['firstname'], 'last' => $this->ht['lastname'])); } function getFirstName() { @@ -709,7 +709,7 @@ implements AuthenticatedUser, EmailContact, TemplateVariable { )); } - switch ($cfg->getDefaultNameFormat()) { + switch ($cfg->getAgentNameFormat()) { case 'last': case 'lastfirst': case 'legal': diff --git a/include/class.user.php b/include/class.user.php index 9ab9009f32981e86fdf7e69ccf0c38094810b652..751d17368b442f956b55fe6d76843894eaaaef2b 100644 --- a/include/class.user.php +++ b/include/class.user.php @@ -280,7 +280,7 @@ implements TemplateVariable { list($name) = explode('@', $this->getDefaultEmailAddress(), 2); else $name = $this->name; - return new PersonsName($name); + return new UsersName($name); } function getUpdateDate() { @@ -742,10 +742,10 @@ implements TemplateVariable { function __construct($name, $format=null) { global $cfg; - if ($format && !isset(static::$formats[$format])) + if ($format && isset(static::$formats[$format])) $this->format = $format; - elseif($cfg) - $this->format = $cfg->getDefaultNameFormat(); + else + $this->format = 'original'; if (!is_array($name)) { $this->parts = static::splitName($name); @@ -923,6 +923,28 @@ implements TemplateVariable { } +class AgentsName extends PersonsName { + function __construct($name, $format=null) { + global $cfg; + + if (!$format && $cfg) + $format = $cfg->getAgentNameFormat(); + + parent::__construct($name, $format); + } +} + +class UsersName extends PersonsName { + function __construct($name, $format=null) { + global $cfg; + if (!$format && $cfg) + $format = $cfg->getClientNameFormat(); + + parent::__construct($name, $format); + } +} + + class UserEmail extends UserEmailModel { static function ensure($address) { $email = static::lookup(array('address'=>$address)); diff --git a/include/staff/directory.inc.php b/include/staff/directory.inc.php index 4e53d3597bb75cf2075b9045f81aa5b4783f92df..f592cd8b558cc9a0ed0e49a1c4f32f4e25ddb1c8 100644 --- a/include/staff/directory.inc.php +++ b/include/staff/directory.inc.php @@ -37,11 +37,11 @@ $sortOptions=array('name'=>array('firstname','lastname'),'email'=>'email','dept' 'created'=>'created','login'=>'lastlogin'); $orderWays=array('DESC'=>'-','ASC'=>''); -switch ($cfg->getDefaultNameFormat()) { +switch ($cfg->getAgentNameFormat()) { case 'last': case 'lastfirst': case 'legal': - $sortOptions['name'] = 'staff.lastname, staff.firstname'; + $sortOptions['name'] = array('lastname', 'firstname'); break; // Otherwise leave unchanged } diff --git a/include/staff/staffmembers.inc.php b/include/staff/staffmembers.inc.php index 6b588707f5693384c37643e52fbdbce408c729e6..d57258241a521e135a479b44fb23119804c92a37 100644 --- a/include/staff/staffmembers.inc.php +++ b/include/staff/staffmembers.inc.php @@ -23,7 +23,7 @@ if ($sort && $sortOptions[$sort]) { $order_column = $order_column ? $order_column : array('firstname', 'lastname'); -switch ($cfg->getDefaultNameFormat()) { +switch ($cfg->getClientNameFormat()) { case 'last': case 'lastfirst': case 'legal': diff --git a/include/staff/tasks.inc.php b/include/staff/tasks.inc.php index 4c0430b8498ab34d4bcf95875df6feac6aad2cec..01c0be6986e239d6ac055d5559d598f9c200daee 100644 --- a/include/staff/tasks.inc.php +++ b/include/staff/tasks.inc.php @@ -268,7 +268,7 @@ if ($thisstaff->hasPerm(Task::PERM_DELETE)) { $dept = Dept::getLocalById($T['dept_id'], 'name', $T['dept__name']); $assinee =''; if ($T['staff_id']) { - $staff = new PersonsName($T['staff__firstname'].' '.$T['staff__lastname']); + $staff = new AgentsName($T['staff__firstname'].' '.$T['staff__lastname']); $assignee = sprintf('<span class="Icon staffAssigned">%s</span>', Format::truncate((string) $staff, 40)); } elseif($T['team_id']) { diff --git a/include/staff/templates/tickets.tmpl.php b/include/staff/templates/tickets.tmpl.php index 450b8272815a734b6a4e0d8c26264cd085192268..57ced36e88cb1db5f1867a7454f1cf06764c3ce6 100644 --- a/include/staff/templates/tickets.tmpl.php +++ b/include/staff/templates/tickets.tmpl.php @@ -109,7 +109,7 @@ if ($results) { ?> $assigned=''; if ($T['staff_id']) - $assigned = new PersonsName(array( + $assigned = new AgentsName(array( 'first' => $T['staff__firstname'], 'last' => $T['staff__lastname'] )); diff --git a/include/staff/templates/users.tmpl.php b/include/staff/templates/users.tmpl.php index a91a586f988889877c41d34331dfe2f9f589e341..a2111414b06683a14453e8998cd9dc5c0ac9706f 100644 --- a/include/staff/templates/users.tmpl.php +++ b/include/staff/templates/users.tmpl.php @@ -92,7 +92,7 @@ if ($num) { ?> $ids=($errors && is_array($_POST['ids']))?$_POST['ids']:null; while ($row = db_fetch_array($res)) { - $name = new PersonsName($row['name']); + $name = new UsersName($row['name']); $status = 'Active'; $sel=false; if($ids && in_array($row['id'], $ids)) diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php index 4e44332a4b9586011aa31b836029b9d0fbd13c87..066567897b70c7147501a5cc6057a2149b551268 100644 --- a/include/staff/ticket-view.inc.php +++ b/include/staff/ticket-view.inc.php @@ -846,7 +846,7 @@ $tcount = $ticket->getThreadEntries($types)->count(); continue; if (!is_object($name)) - $name = new PersonsName($name); + $name = new AgentsName($name); $k="s$id"; echo sprintf('<option value="%s" %s>%s</option>', diff --git a/include/staff/tickets.inc.php b/include/staff/tickets.inc.php index b0d5fd38e2e7fca08a2b5830bda7664771761a32..d5844d26f98f1b66d6c85ea371506151d20eda41 100644 --- a/include/staff/tickets.inc.php +++ b/include/staff/tickets.inc.php @@ -430,7 +430,7 @@ return false;"> $lc=''; if ($showassigned) { if ($T['staff_id']) - $lc = new PersonsName($T['staff__firstname'].' '.$T['staff__lastname']); + $lc = new AgentsName($T['staff__firstname'].' '.$T['staff__lastname']); elseif ($T['team_id']) $lc = Team::getLocalById($T['team_id'], 'name', $T['team__name']); } @@ -482,7 +482,7 @@ return false;"> .$T['collab_count'].'"><i class="icon-group"></i></span>'; ?><span class="truncate" style="max-width:<?php echo $T['collab_count'] ? '150px' : '170px'; ?>"><?php - $un = new PersonsName($T['user__name']); + $un = new UsersName($T['user__name']); echo Format::htmlchars($un); ?></span></div></td> <?php diff --git a/include/staff/users.inc.php b/include/staff/users.inc.php index 5dd3f64f9a7e42a5dd3aaba5dd70b05f7b6295d6..5ff926b64d4e00c450f282efebfcca884ae0186a 100644 --- a/include/staff/users.inc.php +++ b/include/staff/users.inc.php @@ -163,7 +163,7 @@ else if (!$U['name']) list($name) = explode('@', $U['default_email__address']); else - $name = new PersonsName($U['name']); + $name = new UsersName($U['name']); // Account status if ($U['account__id'])