From e6f28de28f678616ceab123057ae418989520858 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 13 Jul 2006 06:00:14 +0000 Subject: [PATCH] Fixed tagging. The tagging method was called twice. -The first call was ok. -But the second call failed. Because we have checked the objectClasses for gosaAdministrativeUnitTag, and the objectClasses wasn't present in this->attrs anymore because cleanup from last save() call removed all objectClasses and so, $this->gosaUnitTag was set to "" to generate a new one. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4134 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/departments/class_departmentGeneric.inc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/admin/departments/class_departmentGeneric.inc b/plugins/admin/departments/class_departmentGeneric.inc index 56476efcb..525e9d245 100644 --- a/plugins/admin/departments/class_departmentGeneric.inc +++ b/plugins/admin/departments/class_departmentGeneric.inc @@ -48,6 +48,7 @@ class department extends plugin var $attributes= array("ou", "description", "businessCategory", "st", "l", "postalAddress", "telephoneNumber", "facsimileTelephoneNumber", "gosaUnitTag"); var $objectclasses= array("top", "gosaDepartment", "organizationalUnit"); + var $initially_was_tagged = false; function department ($config, $dn) { @@ -79,6 +80,7 @@ class department extends plugin /* Is administrational Unit? */ if ($dn != "new" && in_array_ics('gosaAdministrativeUnit', $this->attrs['objectClass'])){ $this->is_administrational_unit= true; + $this->initially_was_tagged = true; } } @@ -261,9 +263,15 @@ class department extends plugin /* Add tag objects if needed */ if ($this->is_administrational_unit){ - if(!in_array_ics("gosaAdministrativeUnit",$this->objectclasses)){ + + /* If this wasn't tagged before add oc an reset unit tag */ + if(!$this->initially_was_tagged){ $this->objectclasses[]= "gosaAdministrativeUnit"; $this->gosaUnitTag= ""; + + /* It seams that this method is called twice, + set this to true. to avoid adding this oc twice */ + $this->initially_was_tagged = true; } if ($this->gosaUnitTag == ""){ @@ -311,6 +319,7 @@ class department extends plugin if(!$has_unit_tag && isset($this->attrs['gosaUnitTag'])){ $this->attrs['gosaUnitTag']= array(); } + $this->gosaUnitTag = ""; } /* Write back to ldap */ -- 2.30.2