Code

Only used printer will be shown now, in the printer add dialog
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 27 Apr 2006 06:22:46 +0000 (06:22 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 27 Apr 2006 06:22:46 +0000 (06:22 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3136 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/environment/class_environment.inc
plugins/personal/environment/class_selectPrinterDialog.inc

index 562b0278f239c887b137dcd01e7c0ebcac1b9aeb..14cf03c420f6e0219e150eca2b22184aa9172d05 100644 (file)
@@ -611,7 +611,7 @@ class environment extends plugin
     /* First handle Add Post. Open a dialog that allows us to select a printer or two */ 
     if(isset($_POST['gotoPrinterAdd'])){
       $this->is_dialog=true;
-      $this->dialog = new selectPrinterDialog($this->config,$this->dn);
+      $this->dialog = new selectPrinterDialog($this->config,$this->dn,$this->gotoPrinter);
     }
 
     if(isset($_POST['PrinterCancel'])){
index efeca4e995c6500319163504f078d57e93e4e9cc..2400b2857909eb1b3fd9a89f33406f0c94de54d8 100644 (file)
@@ -11,14 +11,14 @@ class selectPrinterDialog extends plugin
   var $ignore_account       = TRUE;
   var $attributes           = array();
   var $objectclasses        = array("whatever");
-  var $use_existing         = false;  
+  var $AlreadyAssigned      = array();  
   var $regex                = "*";
   var $depselect            = "/";
   var $deplist              = "/";
 
-  function selectPrinterDialog ($config, $dn= NULL,$use_existing=false )
+  function selectPrinterDialog ($config, $dn= NULL,$alreadyused=array() )
   {
-    $this->use_existing = $use_existing;
+    $this->AlreadyAssigned = $alreadyused;
     plugin::plugin ($config, $dn);
     $this->depselect = $this->config->current['BASE'];
   }
@@ -87,6 +87,9 @@ class selectPrinterDialog extends plugin
     $ldap->cd($this->depselect);
     $ldap->search("(&(objectClass=gotoPrinter)(cn=".$this->regex."))",array("*"));
     while($printer = $ldap->fetch()){
+
+      if(isset($this->AlreadyAssigned[$printer['cn'][0]])) continue;
+
       if($detailed ==true){
         $a_return[$printer['cn'][0]] = $printer;
       }else{