Code

Updated workstation - Startup
[gosa.git] / plugins / admin / systems / class_glpiPrinterAccount.inc
index 61fd547884a18e17ba2edeb84ffd1ef2837f94a7..6447d62ca47496fbeb3403e10e3ff28f2211d642 100644 (file)
@@ -66,10 +66,12 @@ class glpiPrinterAccount extends plugin
   var $usedAttachments  = array();  // Used Attachments 
   var $usedCartridges   = array();  // Used Cartridges
 
+  var $view_logged      = FALSE;
+
   /* Contructor 
      Sets default values and checks if we already have an existing glpi account
    */
-  function glpiPrinterAccount ($config, $dn= NULL, $parent= NULL)
+  function glpiPrinterAccount (&$config, $dn= NULL, $parent= NULL)
   {
     plugin::plugin ($config, $dn, $parent);
     $this->ui= get_userinfo();
@@ -132,6 +134,11 @@ class glpiPrinterAccount extends plugin
     /* Call parent execute */
     plugin::execute();
 
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","printer/".get_class($this),$this->dn);
+    }
+
     /* Fill templating stuff */
     $smarty= get_smarty();
     $display= "";
@@ -527,7 +534,7 @@ class glpiPrinterAccount extends plugin
     /* if( cur_dialog != false || cur_dialog != NULL) 
      * There is a dialog which wants to be displayed 
      */
-    if($this->cur_dialog){
+    if($this->cur_dialog && is_object($this->cur_dialog)){
       $this->cur_dialog->save_object();
       $this->dialog=true;
       $this->cur_dialog->parent = &$this;
@@ -648,7 +655,8 @@ class glpiPrinterAccount extends plugin
   {
     $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
     if($this->initially_was_account){
-      $this->handle->removePrinterInformations($this->dn); 
+      $this->handle->removePrinterInformations($this->dn);
+      new log("remove","printer/".get_class($this),$this->dn); 
     }
   }
 
@@ -664,6 +672,10 @@ class glpiPrinterAccount extends plugin
         }
       }
 
+      if(isset($_POST['FK_glpi_enterprise']) && $this->acl_is_writeable("FKglpienterprise")){
+        $this->FK_glpi_enterprise = $_POST['FK_glpi_enterprise'];
+      }
+
       foreach(array("flags_serial","flags_par","flags_usb") as $checkboxes){
         if($this->acl_is_writeable($checkboxes)){
           if(isset($_POST[$checkboxes])){
@@ -705,8 +717,10 @@ class glpiPrinterAccount extends plugin
       $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']);
       if($this->initially_was_account&&$this->is_account){
         $this->handle->updatePrinterInformations($attrs,$this->dn);
+        new log("modify","printer/".get_class($this),$this->dn); 
       }elseif($this->is_account){
         $this->handle->addPrinterInformations($attrs,$this->dn);
+        new log("create","printer/".get_class($this),$this->dn); 
       }
       $tmp = $this->handle->getPrinterInformations($this->dn);
       $this->handle->addAttachmentsToPrinter($this->usedAttachments,$tmp[0]['ID']);
@@ -768,7 +782,7 @@ class glpiPrinterAccount extends plugin
           "plDescription" => _("Printer inventory extension"),
           "plSelfModify"  => FALSE,
           "plDepends"     => array(),
-          "plPriority"    => 0,
+          "plPriority"    => 10,
           "plSection"     => array("administration"),
           "plCategory"    => array("printer"),
 
@@ -781,7 +795,7 @@ class glpiPrinterAccount extends plugin
             "location"             => _("Location"),
             "contact_num"          => _("Contact person"),
             "type"                 => _("Type"),
-            "FK_glpi_enterprise"   => _("Manufacturer"),
+            "FKglpienterprise"   => _("Manufacturer"),
 
             "Attachments"          => _("Attachments"),