From 9faa1c220f17fae8df688eb5269b82b1f45c86e8 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 21 Jul 2007 09:47:48 +0000 Subject: [PATCH] made uid optional (closes 1757215) --- lam/lib/modules/inetOrgPerson.inc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lam/lib/modules/inetOrgPerson.inc b/lam/lib/modules/inetOrgPerson.inc index 96c767ef..7639aa3a 100644 --- a/lam/lib/modules/inetOrgPerson.inc +++ b/lam/lib/modules/inetOrgPerson.inc @@ -512,11 +512,13 @@ class inetOrgPerson extends baseModule { $modules = $_SESSION['config']->get_AccountModules($this->get_scope()); if (!in_array('posixAccount', $modules)) { // uid - if (!get_preg($_POST['userName'], 'username')) { - $errors[] = $this->messages['uid'][0]; - } - else { - $this->attributes['uid'][0] = $_POST['userName']; + if (isset($_POST['userName']) && ($_POST['userName'] != '')) { + if (!get_preg($_POST['userName'], 'username')) { + $errors[] = $this->messages['uid'][0]; + } + else { + $this->attributes['uid'][0] = $_POST['userName']; + } } // cn if ($_POST['cn'] == '') { @@ -591,7 +593,7 @@ class inetOrgPerson extends baseModule { if (!in_array('posixAccount', $modules)) { $uid = ''; if (isset($this->attributes['uid'][0])) $uid = $this->attributes['uid'][0]; - $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('User name') . '*' ), + $return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('User name')), array('kind' => 'input', 'name' => 'userName', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $uid), array('kind' => 'help', 'value' => 'uid'));