Code

Fixed problem with user creation from template.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 28 Jun 2011 08:10:02 +0000 (08:10 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 28 Jun 2011 08:10:02 +0000 (08:10 +0000)
-If no uid could be generated, then allow to assign it manually.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20920 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/users/class_userManagement.inc

index d215c6096361b02471d184cf6e52ae7373bc3f76..f554cf3720ce6ff546493b934fb182110eb4bd5a 100644 (file)
@@ -592,16 +592,23 @@ class userManagement extends management
 
             if ($ldap->count () != 0){
                 msg_dialog::displayChecks(array(msgPool::duplicated(_("Name"))));
+                $smarty->assign("edit_uid", "");
             }else{
 
                 // Preset uid field by using the idGenerator 
                 $attributes= array('sn' => $this->sn, 'givenName' => $this->givenName);
                 if ($this->config->get_cfg_value("core","idGenerator") != ""){
-                    $uids= gen_uids ($this->config->get_cfg_value("core","idGenerator"), $attributes);
-                    if (count($uids)){
-                        $smarty->assign("edit_uid", "false");
-                        $smarty->assign("uids", $uids);
-                        $this->uid= current($uids);
+                    $genStr = $this->config->get_cfg_value("core","idGenerator");
+                    $smarty->assign("edit_uid", "");
+                    if(!empty($genStr)){
+                        $uids= gen_uids($genStr, $attributes);
+                        if (count($uids)){
+                            $smarty->assign("edit_uid", "false");
+                            $smarty->assign("uids", $uids);
+                            $this->uid= current($uids);
+                        }else{
+                            msg_dialog::displayChecks(array(_("Cannot generate a unique id, please specify it manually!")));
+                        }
                     }
                 } else {
                     $smarty->assign("edit_uid", "");