X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fsystems%2Fclass_glpiPrinterCartridgesEdit.inc;h=c130618a4afb7e78799145d5c0a1c52ee2c8e3cc;hb=1371f9fb0b601838eda78e6daa92d672647294a6;hp=5607b5127e66c1add66af37005ed9c188652cc54;hpb=bd59d9a798c587e1b1b4c22c95a127cbacfd9ff1;p=gosa.git diff --git a/plugins/admin/systems/class_glpiPrinterCartridgesEdit.inc b/plugins/admin/systems/class_glpiPrinterCartridgesEdit.inc index 5607b5127..c130618a4 100644 --- a/plugins/admin/systems/class_glpiPrinterCartridgesEdit.inc +++ b/plugins/admin/systems/class_glpiPrinterCartridgesEdit.inc @@ -37,12 +37,6 @@ class glpiPrinterCartridgesEdit extends plugin function glpiPrinterCartridgesEdit ($config, $dn,$printer_type,$values = NULL ) { plugin::plugin ($config, $dn); - - $ui= get_userinfo(); - $acl= get_permissions ($this->dn, $ui->subtreeACL); - $this->acl= get_module_permission($acl, "component", $this->dn); - - foreach($this->attributes as $val){ if(isset($values[$val])){ $this->$val = $values[$val]; @@ -50,11 +44,8 @@ class glpiPrinterCartridgesEdit extends plugin $this->$val = ""; } } - $this->needToCatch = true; - $this->printer_type = $printer_type; - } function remove_from_parent() @@ -111,7 +102,12 @@ class glpiPrinterCartridgesEdit extends plugin /* Remove selected type from our printer types list */ if((isset($_POST['del_cartridge_type']))&&(!empty($_POST['select_type_cartridge']))){ - $this->parent->handle->removeCartridgeDropdownType($_POST['select_type_cartridge']); + $used = $this->parent->handle->getUsedDropdownTypes($_POST['select_type_cartridge']); + if(!count($used)){ + $this->parent->handle->removeCartridgeDropdownType($_POST['select_type_cartridge']); + }else{ + print_red(_("Can't delete this entry, it is still in use.")); + } } /* Rename selected printer type to given string @@ -131,17 +127,9 @@ class glpiPrinterCartridgesEdit extends plugin return($display); } - - - - - - - /* Assign attributes */ foreach($this->attributes as $attr){ $smarty->assign($attr,$this->$attr); - $smarty->assign($attr."ACL",chkacl($this->acl,$attr)); } /* Selecte technical responsible person @@ -175,7 +163,8 @@ class glpiPrinterCartridgesEdit extends plugin if(!in_array($id,$users)){ /* If this user doesn't exists in glpi db, we must create him */ - $atr = $ldap->fetch($ldap->cat($id)); + $ldap->cat($id, array('cn', 'mail', 'telephoneNumber')); + $atr = $ldap->fetch(); $tmp = array(); $use = array( "cn" =>"name", "mail" =>"email", @@ -273,7 +262,8 @@ class glpiPrinterCartridgesEdit extends plugin Assign name ... to smarty, if set */ if(isset($users[$this->tech_num])){ - $tr = $ldap->fetch($ldap->cat($users[$this->tech_num])); + $ldap->cat($users[$this->tech_num], array('givenName', 'sn', 'uid')); + $tr = $ldap->fetch(); $str = ""; if(isset($tr['givenName'][0])){ $str .= $tr['givenName'][0]." "; } if(isset($tr['sn'][0])) { $str .= $tr['sn'][0]." "; } @@ -290,7 +280,8 @@ class glpiPrinterCartridgesEdit extends plugin /* Check given values */ function check(){ - $message=array(); + /* Call common method to give check the hook */ + $message= plugin::check(); /* Avoid choosing an already used name */ $types = $this->parent->handle->getCartridgeTypeInformations();