Code

Added automatic remove of queue entries if user removes his phone account.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 8 Aug 2005 09:22:50 +0000 (09:22 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 8 Aug 2005 09:22:50 +0000 (09:22 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1073 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/gofon/phoneaccount/class_phoneAccount.inc

index 3965507f6092b87b8c201ac731312e9c24a9a51f..aa9798a2a759ef7b1f7455452ec0f713e4092270 100644 (file)
@@ -907,6 +907,8 @@ class phoneAccount extends plugin
 
     $SQL="";
 
+    
+
     $first_num = false;
     // Delete old entries
     foreach($this->a_old_telenums as $s_telenums){
@@ -950,6 +952,17 @@ class phoneAccount extends plugin
     }
 
     $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(objectClass=goFonQueue)", array("member"));
+    while($attr = $ldap->fetch()){
+      if(in_array($this->dn,$attr['member'])){
+        $new =new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'],$attr['dn']);
+        unset($new->by_object['ogroup']->memberList[$this->dn]);
+        unset($new->by_object['ogroup']->member[$this->dn]);
+        $new->save();
+        print_red(sprintf(_("Removed user '%s' from phone queue '%s'."),$this->uid,$new->by_object['ogroup']->attrs['cn']));
+      }
+    }
     $ldap->cd($this->dn);
     $ldap->modify($this->attrs);
     show_ldap_error($ldap->get_error());