From d82a277f796aeb5871602cbeaea513b0bed048dc Mon Sep 17 00:00:00 2001 From: psc Date: Mon, 1 Mar 2010 08:32:26 +0000 Subject: [PATCH] Apply fix for #3867 - Move check for used workstations so that the check is executed after adding a workstation instead of complaining on save. - Fix check for used workstations. It was missing a index indication and therefore not properly determining the 'gosaGroupObjects'' attribute. - Fix a typo in the german error message git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@15778 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../locale/core/de/LC_MESSAGES/messages.po | 2 +- .../plugins/admin/ogroups/class_ogroup.inc | 26 ++++++++----------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/trunk/gosa-core/locale/core/de/LC_MESSAGES/messages.po b/trunk/gosa-core/locale/core/de/LC_MESSAGES/messages.po index 3d8d3703d..eae310d51 100644 --- a/trunk/gosa-core/locale/core/de/LC_MESSAGES/messages.po +++ b/trunk/gosa-core/locale/core/de/LC_MESSAGES/messages.po @@ -3831,7 +3831,7 @@ msgid "" "added:" msgstr "" "Die folgenden Systeme sind bereits für die Konfiguration über eine " -"Objektgruppe vorgeseheb und können nicht hinzugefügt werden:" +"Objektgruppe vorgesehen und können nicht hinzugefügt werden:" #: plugins/admin/ogroups/class_ogroup.inc:937 msgid "You can combine two different object types at maximum, only!" diff --git a/trunk/gosa-core/plugins/admin/ogroups/class_ogroup.inc b/trunk/gosa-core/plugins/admin/ogroups/class_ogroup.inc index d36a32fd5..3c26c693a 100644 --- a/trunk/gosa-core/plugins/admin/ogroups/class_ogroup.inc +++ b/trunk/gosa-core/plugins/admin/ogroups/class_ogroup.inc @@ -161,7 +161,7 @@ class ogroup extends plugin foreach($res as $og){ if($og['dn'] == $this->dn) continue; $test = array_intersect($ws_dns,$og['member']); - if(($og['gosaGroupObjects'] == "[W]" || $og['gosaGroupObjects'] == "[T]") && count($test)){ + if(($og['gosaGroupObjects'][0] == "[W]" || $og['gosaGroupObjects'][0] == "[T]") && count($test)){ $this->used_workstations = array_merge($this->used_workstations,$test); } } @@ -209,7 +209,14 @@ class ogroup extends plugin /* Add objects to group */ if (isset($_POST['add_object_finish']) && isset($_POST['objects'])){ - + $test = array_unique(array_intersect($this->used_workstations, $_POST['objects'])); + if(count($test)) { + $str = ""; + foreach($test as $dn) { + $str .= "
  • ".$dn."
  • "; + } + msg_dialog::display(_("Error"), sprintf(_("These systems are already configured by other object groups and cannot be added:")."
    ", $str), ERROR_DIALOG); + } $tmp = ""; foreach($this->memberList as $obj){ $tmp .= $obj['type']; @@ -220,6 +227,8 @@ class ogroup extends plugin $skipped =TRUE; }elseif(preg_match("/W/",$tmp) && $this->objects[$value]['type'] == "T"){ $skipped =TRUE; + }elseif(in_array($value, $this->used_workstations)) { + continue; }else{ $this->memberList["$value"]= $this->objects[$value]; $this->member["$value"]= $value; @@ -900,19 +909,6 @@ class ogroup extends plugin $new_dn= $this->dn; } - /* Check if we have workstations assigned, that are already assigned to - another object group. */ - if ($this->gosaGroupObjects == "[W]" || $this->gosaGroupObjects == "[T]" ) { - $test =array_intersect($this->used_workstations,$this->member); - if(count($test)){ - $str = ""; - foreach($test as $dn){ - $str .= "
  • ".$dn."
  • "; - } - $message[] = sprintf(_("These systems are already configured by other object groups and cannot be added:")."
    ",$str); - } - } - $ldap = $this->config->get_ldap_link(); if(LDAP::fix($this->dn) != LDAP::fix($new_dn)){ $ldap->cat ($new_dn, array('dn')); -- 2.30.2