Code

Fixed environment multiple edit
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 14 Dec 2007 08:37:44 +0000 (08:37 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 14 Dec 2007 08:37:44 +0000 (08:37 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8124 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_multi_plug.inc
gosa-core/include/class_plugin.inc
gosa-core/plugins/personal/environment/class_environment.inc

index c96a0eda623374891b472e6a4ca2da6bd371abfe..801e4a7be0dcebc29dde3b0b3b3243199d9b8d6c 100644 (file)
@@ -162,17 +162,18 @@ class multi_plug
       }elseif(is_string($base[$key]) && $base[$key]!=$minus[$key]){
         unset($base[$key]);
       }elseif(is_array($base[$key])){
+        $tmp = array();
         for($i = 0 ; $i < $base[$key]['count'] ; $i ++){
-          if(isset($base[$key][$i]) && !in_array($base[$key][$i],$minus[$key])){
-            $base[$key]['count'] --;
-            if($base[$key]['count'] == 0){
-              unset($base[$key]);
-              break;
-            }else{
-              unset($base[$key][$i]);
-            }
+          if(isset($base[$key][$i]) && in_array($base[$key][$i],$minus[$key])){
+            $tmp[] = $base[$key][$i];
           }
         }
+        if(count($tmp)){
+          $tmp['count'] = count($tmp);
+          $base[$key] = $tmp;
+        }else{
+          unset($base[$key]);
+        }
       }
     }
     return($base);
index 9d4434090c60940007e89458bc600473da931d7f..458aa41e35c6111693d44e8bd7e14953008cc570 100644 (file)
@@ -1706,7 +1706,9 @@ class plugin
     foreach ($this->attributes as $val){
       $found= array_key_ics($val, $this->multi_attrs);
       if ($found != ""){
-        $this->$val= $this->multi_attrs["$found"][0];
+        if(isset($this->multi_attrs["$found"][0])){
+          $this->$val= $this->multi_attrs["$found"][0];
+        }
       }
     }
   }
index 64f399457ad2000fbde0789af60ee305f3d45c20..25de2cb6d07c2c8f585989c147c199e71c12db16 100644 (file)
@@ -1440,6 +1440,11 @@ class environment extends plugin
         $this->gotoShares[$name] = $share;
       }
     }
+    foreach($this->gotoShares as $name => $share){
+      if(!isset($attrs['gotoShares'][$name])){
+        unset($this->gotoShares[$name]);
+      }
+    }
   }