summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5cdbb76)
raw | patch | inline | side by side (parent: 5cdbb76)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 29 Jul 2010 09:04:19 +0000 (09:04 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 29 Jul 2010 09:04:19 +0000 (09:04 +0000) |
-Fixed problems using templates
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6@19204 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6@19204 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/ldapmanager/addons/ldapmanager/class_csvimport.inc | patch | blob | history |
diff --git a/gosa-plugins/ldapmanager/addons/ldapmanager/class_csvimport.inc b/gosa-plugins/ldapmanager/addons/ldapmanager/class_csvimport.inc
index c720903cea39f232fab4f415a4dafcaeab43bf2d..fb0c41db20615eac6009535d0c206d2564650d1d 100644 (file)
$this->usertab= new usertabs($this->config, $this->config->data['TABS']['USERTABS'], 'new');
$keys = array_keys($dat);
-
/* Set all submitted vars */
- if(is_array($keys))
+ if(is_array($keys)){
foreach($keys as $key) {
if($key != "status"){
$this->usertab->$key = $dat[$key];
+ foreach($this->usertab->by_object as $pname => $plugin){
+ if(isset($this->usertab->by_object[$pname]->$key)){
+ $this->usertab->by_object[$pname]->$key = $dat[$key];
+ }
+ }
}
}
+ }
- /* Initialize template */
+ // Adapt template values.
if($this->csvinfo['tplid']!=0){
- $this->usertab->adapt_from_template($this->csvinfo['arrtempls'][$this->csvinfo['tplid']]['dn']);
- $this->usertab->save_object();
- } else {
-
- /* Reset vars */
- if(is_array($keys))
- foreach($keys as $key) {
- if($key != "status"){
- $this->usertab->by_object['user']->$key = $dat[$key];
- }
- }
- }
+ $tpl_dn = $this->csvinfo['arrtempls'][$this->csvinfo['tplid']]['dn'];
+ $this->usertab->adapt_from_template($tpl_dn,array("uid","cn","givenName","sn"));
+ $tpl_base = preg_replace("/^[^,]+,".preg_quote(get_people_ou(), '/i')."/", '', $tpl_dn);
+ $this->usertab->by_object['user']->base= $tpl_base;
+ }
// Setting user Password
if((isset($dat['userPassword']))&&(!empty($dat['userPassword']))){