Code

added contact person
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 4 Jan 2006 09:06:20 +0000 (09:06 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 4 Jan 2006 09:06:20 +0000 (09:06 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2399 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_glpiAccount.inc
plugins/admin/systems/glpi.tpl

index bd0e0eb4027428c63dc36a3af350e790702ac8cc..563ad430d98382d3f840483cd4d95ad1a784f702 100644 (file)
@@ -21,6 +21,8 @@ class glpiAccount extends plugin
   var $tech_num           ="";
   var $comments           ="";
 
+  var $addUser            ="";
+
   var $date_mod           ="";
   var $os                 =0;
   var $location           =0;
@@ -79,7 +81,7 @@ class glpiAccount extends plugin
       $this->is_account = true;
       $tmp = ($this->handle->getComputerInformations($this->dn));
 
-      foreach(array("tech_num","os","FK_glpi_enterprise","type","comments") as $attr){
+      foreach(array("tech_num","os","FK_glpi_enterprise","type","comments","contact_num") as $attr){
         $this->$attr = $tmp[0][$attr];
       }
       $this->usedDevices = $this->handle->getUsedDevices($tmp[0]['ID']);
@@ -230,6 +232,11 @@ class glpiAccount extends plugin
     /*  ENDE, os management.
      */
 
+    if(isset($_POST['SelectContactPerson'])){
+      $this->addUser = "contact";
+      $this->cur_dialog= new glpiSelectUser($this->config,$this->dn);
+    }
+
     if(isset($_POST['edit_manufacturer'])){
       $this->cur_dialog = new glpiManufacturer($this->config,$this->dn);
       $this->dialog = true;
@@ -242,10 +249,13 @@ class glpiAccount extends plugin
 
     if(isset($_POST['SelectUserCancel'])){
       $this->dialog = false;
+      $this->addUser ="";
       $this->cur_dialog = false;
     }
 
+
     if(isset($_POST['SelectTechPerson'])){
+      $this->addUser ="tech";
       $this->cur_dialog= new glpiSelectUser($this->config,$this->dn);
     }
 
@@ -284,7 +294,11 @@ class glpiAccount extends plugin
       $id=$tmp[$id];
 
       /* Use user id, close dialog */
-      $this->tech_num = $id;
+      if($this->addUser == "tech"){
+        $this->tech_num = $id;
+      }else{
+        $this->contact_num = $id;
+      }
       $this->cur_dialog   = false;
       $this->dialog= false;
     }
@@ -302,7 +316,7 @@ class glpiAccount extends plugin
       $smarty->assign($attr."ACL",chkacl($this->acl,$attr));
     }
 
-    foreach(array("type","FK_glpi_enterprise","os","tech_num") as $attr){
+    foreach(array("type","FK_glpi_enterprise","os","tech_num","contact_num") as $attr){
       $smarty->assign($attr,"");
       $smarty->assign($attr."ACL",chkacl($this->acl,$attr));
     }
@@ -369,6 +383,27 @@ class glpiAccount extends plugin
     $smarty->assign("Manufacturers",          $this->handle->getEnterprises());
     $smarty->assign("FK_glpi_enterprise",     $this->FK_glpi_enterprise);
 
+    if(isset($users[$this->contact_num])){
+      $tr = $ldap->fetch($ldap->cat($users[$this->contact_num]));
+      $str = "";
+      if(isset($tr['givenName'][0])){
+        $str .= $tr['givenName'][0]." ";
+      }
+
+      if(isset($tr['sn'][0])){
+        $str .= $tr['sn'][0]." ";
+      }
+
+      if(isset($tr['uid'][0])){
+        $str .= "[".$tr['uid'][0]."]";
+      }
+
+
+      $smarty->assign("contact_num",               $str);
+    }else{
+      $smarty->assign("contact_num",               _("N/A"));
+    }
+
     if(isset($users[$this->tech_num])){
       $tr = $ldap->fetch($ldap->cat($users[$this->tech_num]));
       $str = "";
index 2f960e09b75a4cde2c3a94991b80c9795a963681..08e43a690af165f9cf1be5e0c23a104e91212f42 100644 (file)
@@ -71,7 +71,7 @@
                                        </td>
                                        <td>
                                                <i>{$contact_num}&nbsp; </i>&nbsp;
-                                               <input {$contact_numACL} type="submit" value="{t}Edit{/t}"><img src="images/mailto.png" class="center" alt="{t}mailto{/t}">     
+                                               <input {$contact_numACL} type="submit" name="SelectContactPerson" value="{t}Edit{/t}"><img src="images/mailto.png" class="center" alt="{t}mailto{/t}">  
                                        </td>
                                </tr>
                                <tr>