From: Stéphane Jacob Date: Mon, 6 Dec 2010 20:30:25 +0000 (+0100) Subject: Allows secretaries and admin to fully edit profiles' names (Closes #1340). X-Git-Tag: xorg/1.0.2~101 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=3ec8ae8ea229f68d2ec8ba9f3ada0a1e05d17f1a;p=platal.git Allows secretaries and admin to fully edit profiles' names (Closes #1340). Signed-off-by: Stéphane Jacob --- diff --git a/include/name.func.inc.php b/include/name.func.inc.php index b23fdff..7fd7623 100644 --- a/include/name.func.inc.php +++ b/include/name.func.inc.php @@ -252,18 +252,12 @@ function set_alias_names(&$sn_new, $sn_old, $pid, $uid, $update_new = false, $ne $has_new = false; foreach ($sn_new as $typeid => $sn) { if (isset($sn['pub'])) { - if (isset($sn_old[$typeid]) && ($sn_old[$typeid]['fullname'] == $sn['fullname'] && $update_new)) { + if (isset($sn_old[$typeid]) && $update_new) { XDB::execute("UPDATE profile_name SET particle = {?}, name = {?}, typeid = {?} WHERE id = {?} AND pid = {?}", $sn['particle'], $sn['name'], $typeid, $sn_old[$typeid]['id'], $pid); unset($sn_old[$typeid]); - } elseif ($update_new - || (isset($sn_old[$typeid]) && compare_basename($sn_old[$typeid]['fullname'], $sn['fullname']))) { - XDB::execute("INSERT INTO profile_name (particle, name, typeid, pid) - VALUES ({?}, {?}, {?}, {?})", - $sn['particle'], $sn['name'], $typeid, $pid); - unset($sn_old[$typeid]); } else { $has_new = true; } diff --git a/modules/profile/general.inc.php b/modules/profile/general.inc.php index a98acac..ac797c6 100644 --- a/modules/profile/general.inc.php +++ b/modules/profile/general.inc.php @@ -149,7 +149,7 @@ class ProfileSettingSearchNames implements ProfileSetting $this->search_names = array(); foreach ($value as &$sn) { $sn['name'] = trim($sn['name']); - if ($sn['type'] == 'firstname' || $sn['type'] == 'lastname') { + if (S::user()->isMe($this->owner) && ($sn['type'] == 'firstname' || $sn['type'] == 'lastname')) { $sn['name'] = $this->prepare($page, $sn['type'], $sn['name'], $initial[$sn['type']], $success_tmp); $success = $success && $success_tmp;