Code

Followup commit for #2000
authorpsc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 29 Mar 2010 10:34:38 +0000 (10:34 +0000)
committerpsc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 29 Mar 2010 10:34:38 +0000 (10:34 +0000)
When creating a printer via a workstation use a different
formular name for the printer description, otherwise the
description conflicts with the workstation description.

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@17346 594d385d-05f5-0310-b6e9-bd551577e9d8

trunk/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc
trunk/gosa-plugins/goto/admin/systems/goto/printer.tpl

index 17e92cdd65236f95966931e0104add894db9bb5e..97820940f162e7759ac82e3bb59e10c580fea1d2 100644 (file)
@@ -11,6 +11,7 @@ class printgeneric extends plugin
   var $cn               = "";
   var $l                = "";
   var $description      = "";
+  var $printer_description = "";
   var $labeledURI       = "";
   var $gotoPrinterPPD   = "";
   var $initial_PPD      = "";
@@ -149,6 +150,10 @@ class printgeneric extends plugin
     }
     $this->orig_cn    = $this->cn;
     $this->orig_base  = $this->base;
+
+    if (!preg_match('/Printer/i', $this->BelongsTo)) {
+      $this->printer_description = $this->description;
+    }
   }
 
   function set_acl_base($base)
@@ -391,7 +396,11 @@ class printgeneric extends plugin
 
     /* Assign attributes */
     foreach ($this->attributes as $attr){
-      $smarty->assign("$attr", $this->$attr);
+        $smarty->assign("$attr", $this->$attr);
+    }
+
+    if (!preg_match("/Printer/", $this->BelongsTo)) {
+        $smarty->assign("printer_description", $this->printer_description);
     }
 
     if(isset($_POST['AddUser'])){
@@ -659,6 +668,10 @@ class printgeneric extends plugin
     if(is_object($this->netConfigDNS)){
       $this->netConfigDNS->save_object();
     }
+
+    if (!isset($_POST['edit_cancel']) && isset($_POST['printer_description'])) {
+      $this->printer_description = get_post('printer_description');
+    }
     
     /* Set new base if allowed */
     $tmp = $this->get_allowed_bases();
@@ -748,7 +761,7 @@ class printgeneric extends plugin
     if(preg_match("/workstation/i",$this->BelongsTo)){
       $this->dn= preg_replace("/".preg_quote(get_ou('workstationRDN'), '/')."/",get_ou('printerRDN'),$this->dn);
     }
-    
+
     if(!$this->is_account) return;
     if(isset($this->parent->by_object['workgeneric'])){
       if($this->parent->by_object['workgeneric']->cn == "wdefault"){
@@ -845,6 +858,10 @@ class printgeneric extends plugin
       $this->attrs= $attrs;
     }
 
+    if (!empty($this->printer_description)) {
+      $this->attrs['description'] = $this->printer_description;
+    }
+
     /* Append printer user 
      */
     $this->attrs['gotoUserPrinter']=array();
index b384ac4b0f4dec76fcac3f68a891913badccb87e..bf432cefd4f0a9e3bd793bbc8ef6d169d8e15fea 100644 (file)
@@ -47,7 +47,7 @@
      <td><LABEL for="description">{t}Description{/t}</LABEL></td>
      <td>
 {render acl=$descriptionACL}
-      <input id="description" name="description" size=25 maxlength=80 value="{$description}">
+      <input id="printer_description" name="printer_description" size=25 maxlength=80 value="{$printer_description}">
 {/render}
      </td>
     </tr>