From: cajus Date: Fri, 23 Jun 2006 14:54:18 +0000 (+0000) Subject: Reverted changes from 3871 on. They did not work - even if I X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=beff02a2165efc8df752e5f2e1cf0a534b6b3281;p=gosa.git Reverted changes from 3871 on. They did not work - even if I use departments without commata inside. Please use smaller commits. I can't follow this ones which exchange hundreds of lines. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3874 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/class_plugin.inc b/include/class_plugin.inc index 006631879..23fa324ca 100644 --- a/include/class_plugin.inc +++ b/include/class_plugin.inc @@ -729,11 +729,20 @@ class plugin /* Adapt naming attribute */ $dst_name= preg_replace("/^([^=]+)=.*$/", "\\1", $dst_dn); $dst_val = preg_replace("/^[^=]+=([^,+]+).*,.*$/", "\\1", $dst_dn); - $new[$dst_name]= str_replace("\\","", ldap::fix($dst_val)); + $new[$dst_name]= $dst_val; + + /* Check if this is a department. + * If it is a dep. && there is a , override in his ou + * change \2C to , again, else this entry can't be saved ... + */ + if((isset($new['ou'])) &&( preg_match("/\\\\2C/",$new['ou']))){ + $new['ou'] = preg_replace("/\\\\2C/",",",$new['ou']); + } /* Save copy */ $ldap->connect(); $ldap->cd($this->config->current['BASE']); + $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $dst_dn)); /* FAIvariable=.../..., cn=.. @@ -744,7 +753,7 @@ class plugin } $ldap->cd($dst_dn); $ldap->add($new); - + if ($ldap->error != "Success"){ trigger_error("Trying to save $dst_dn failed.", E_USER_WARNING); diff --git a/include/class_tabs.inc b/include/class_tabs.inc index 6a9959e1a..e0e8dbe42 100644 --- a/include/class_tabs.inc +++ b/include/class_tabs.inc @@ -240,7 +240,6 @@ class tabs } else { $obj->remove_from_parent(); } - $this->by_object[$key]= $obj; } return (0); } diff --git a/plugins/admin/departments/class_departmentGeneric.inc b/plugins/admin/departments/class_departmentGeneric.inc index 8a2528b27..c508b614e 100644 --- a/plugins/admin/departments/class_departmentGeneric.inc +++ b/plugins/admin/departments/class_departmentGeneric.inc @@ -43,6 +43,7 @@ class department extends plugin var $MustBeMoved = ""; var $MoveDestination = ""; var $MoveSource = ""; + var $MoveOu = ""; /* attribute list for save action */ var $attributes = array("ou", "description", "businessCategory", "st", @@ -241,7 +242,7 @@ class department extends plugin /* Save to LDAP */ - function save($skipSave = false) + function save() { $ldap= $this->config->get_ldap_link(); @@ -284,9 +285,7 @@ class department extends plugin $this->gosaUnitTag= ""; } - if(!$skipSave){ - plugin::save(); - } + plugin::save(); /* Remove tag information if needed */ if (!$this->is_administrational_unit){ @@ -304,25 +303,24 @@ class department extends plugin } } - if(!$skipSave){ - /* Write back to ldap */ - $ldap= $this->config->get_ldap_link(); - $ldap->cat($this->dn, array('dn')); - $a= $ldap->fetch(); - $ldap->cd($this->dn); - - if (count($a)){ - $this->cleanup(); - $ldap->modify ($this->attrs); - - $this->handle_post_events('modify'); - } else { - $ldap->add($this->attrs); - $this->handle_post_events('add'); - } + /* Write back to ldap */ + $ldap= $this->config->get_ldap_link(); + $ldap->cat($this->dn, array('dn')); + $a= $ldap->fetch(); + $ldap->cd($this->dn); + + if (count($a)){ + $this->cleanup(); + $ldap->modify ($this->attrs); + + $this->handle_post_events('modify'); + } else { + $ldap->add($this->attrs); + $this->handle_post_events('add'); + } + + show_ldap_error($ldap->get_error(), _("Saving department failed")); - show_ldap_error($ldap->get_error(), _("Saving department failed")); - } /* The parameter forces only to set must_be_tagged, and don't touch any objects This will be done later */ $this->tag_objects(true); diff --git a/plugins/admin/departments/class_departmentManagement.inc b/plugins/admin/departments/class_departmentManagement.inc index 5185e3e7b..dbfcab0b4 100644 --- a/plugins/admin/departments/class_departmentManagement.inc +++ b/plugins/admin/departments/class_departmentManagement.inc @@ -218,7 +218,7 @@ class departmentManagement extends plugin /* Save current changes */ if(!$this->AfterSaveProcedure){ - $this->deptabs->save(); + $this->deptabs->save(true); } /* Check if we have to tag this department */ diff --git a/plugins/admin/departments/tabs_department.inc b/plugins/admin/departments/tabs_department.inc index b966f7e9d..deccb02c4 100644 --- a/plugins/admin/departments/tabs_department.inc +++ b/plugins/admin/departments/tabs_department.inc @@ -36,18 +36,18 @@ class deptabs extends tabs $this->by_object['department']->MustBeMoved = true; $this->by_object['department']->MoveDestination = $new_dn; $this->by_object['department']->MoveSource = $this->dn; + $this->by_object['department']->MoveOu = $ou; + $this->dn = $this->dn; + $baseobject->dn = $this->dn; $this->by_object['department']->ou = $baseobject->attrs['ou'][0]; - $ret = tabs::save(TRUE); - $this->by_object['department']->save(true); - return($ret); + $this->by_object['department'] = $baseobject; + return(tabs::save(TRUE)); } }else{ - $this->dn = $new_dn; - $baseobject->dn = $this->dn; - $ret = tabs::save(TRUE); - $baseobject->save(true); + $this->dn= $new_dn; + $baseobject->dn= $this->dn; $this->by_object['department']= $baseobject; - return($ret); + return(tabs::save(TRUE)); } } }