From 27492fde1b530ce8631dea8b408e7e09231d966a Mon Sep 17 00:00:00 2001 From: Anne Limoges Date: Wed, 9 Apr 2014 20:48:47 +0200 Subject: [PATCH] Change sorting order on ML display to use sort_name. --- classes/profile.php | 7 ++++++- classes/user.php | 10 +++++++++- modules/lists/lists.inc.php | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/classes/profile.php b/classes/profile.php index 7065598..6722784 100644 --- a/classes/profile.php +++ b/classes/profile.php @@ -372,6 +372,11 @@ class Profile implements PlExportable return $this->short_name; } + public function sortName() + { + return $this->sort_name; + } + public function firstName() { return $this->firstname_ordinary; @@ -1137,7 +1142,7 @@ class Profile implements PlExportable IF (ppn.firstname_ordinary = \'\', ppn.firstname_main, ppn.firstname_ordinary) AS firstname_ordinary, IF (ppn.lastname_ordinary = \'\', ppn.lastname_main, ppn.lastname_ordinary) AS lastname_ordinary, pd.yourself, pd.promo, pd.short_name, pd.public_name AS full_name, - pd.directory_name, pd.public_name, pd.private_name, + pd.directory_name, pd.public_name, pd.private_name, pd.sort_name, IF (pp.pub >= {?}, pp.display_tel, NULL) AS mobile, (ph.pub >= {?} AND ph.attach IS NOT NULL) AS has_photo, ph.pub as photo_pub, ph.x AS photo_width, ph.y AS photo_height, diff --git a/classes/user.php b/classes/user.php index e380dac..eb91985 100644 --- a/classes/user.php +++ b/classes/user.php @@ -165,7 +165,7 @@ class User extends PlUser IF(ef.email IS NULL, NULL, CONCAT(ef.email, \'@\', df.name)) AS forlife_alternate, IF(eb.email IS NULL, NULL, CONCAT(eb.email, \'@\', mb.name)) AS bestalias, (er.redirect IS NULL AND a.state = \'active\' AND FIND_IN_SET(\'mail\', at.perms)) AS lost, - a.email, a.full_name, a.directory_name, a.display_name, a.sex = \'female\' AS gender, + a.email, a.full_name, a.directory_name, a.display_name, a.sort_name, a.sex = \'female\' AS gender, IF(a.state = \'active\', CONCAT(at.perms, \',\', IF(a.user_perms IS NULL, \'\', a.user_perms)), \'\') AS perms, a.user_perms, a.email_format, a.is_admin, a.state, a.type, at.description AS type_description, a.skin, FIND_IN_SET(\'watch\', a.flags) AS watch, a.comment, @@ -352,6 +352,14 @@ class User extends PlUser return $this->profile()->directory_name; } + public function sortName() + { + if (!$this->hasProfile()) { + return $this->sort_name; + } + return $this->profile()->sort_name; + } + static public function compareDirectoryName($a, $b) { return strcasecmp(replace_accent($a->directoryName()), replace_accent($b->directoryName())); diff --git a/modules/lists/lists.inc.php b/modules/lists/lists.inc.php index 4e90b4c..233fc94 100644 --- a/modules/lists/lists.inc.php +++ b/modules/lists/lists.inc.php @@ -69,7 +69,7 @@ function list_sort_owners($emails, $tri_promo = true) $name = $member['email']; } else { $category = $member['user']->category(); - $name = $member['user']->directoryName(); + $name = $member['user']->sortName(); } if (empty($category)) { $category = "AAAAA"; -- 2.1.4