diff --git a/plugins/admin/systems/class_glpiPrinterCartridges.inc b/plugins/admin/systems/class_glpiPrinterCartridges.inc
index 0276ce1e2870d7c89dbb2902ddbb396b572696c3..3d9d6301001a0e5dbe7b8ff89567c44aa178f7ed 100644 (file)
var $del = 0;
- function glpiPrinterCartridges ($config,$dn,$type)
+ function glpiPrinterCartridges (&$config,$dn,$type)
{
plugin::plugin ($config, $dn);
/* Delete this entry */
if(isset($_POST['delete_glpi_confirm'])&&($this->del)) {
- if(count($this->parent->handle->getCartridgesWhichUseThisType($this->del))){
- print_red(_("You can't delete this cartridge type, it is still in use."));
+ $tmp = $this->parent->handle->is_cartridgeTypeUsed($this->del);
+ if(count($tmp)){
+
+ $str = "";
+ foreach($tmp as $id => $name){
+ $str .= $name.", ";
+ }
+ $str = preg_replace("/, $/","",$str);
+
+ print_red(sprintf(_("You can't delete this cartridge type, it is still in use by this printer(s) '%s'."),$str));
}else{
$val = ($this->parent->handle->getCartridgeTypeInformations($this->del));
$this->cur_dialog = new glpiPrinterCartridgesEdit($this->config,$this->dn,$this->PrinterType,$val[$this->del]);
/* Save changes if check is ok */
if(isset($_POST['SaveCartridge'])){
+ $this->cur_dialog->save_object();
if(count($this->cur_dialog->check())) {
foreach($this->cur_dialog->check() as $checks){
print_red($checks);
}
}else{
- $this->cur_dialog->save_object();
$this->cur_dialog->save();
$this->cur_dialog = false;
}
/* Create divlist */
$divlist = new divlist("glpi devices");
+ $divlist->SetPluginMode();
$divlist->SetEntriesPerPage(0);
$divlist->SetHeader(array(
array("string" => " ", "attach" => "style='text-align:center;width:20px;'"),
$smarty->assign("search_image", get_template_path('images/search.png'));
$smarty->assign("searchu_image", get_template_path('images/search_user.png'));
$smarty->assign("tree_image", get_template_path('images/tree.png'));
- $smarty->assign("infoimage", get_template_path('images/info.png'));
- $smarty->assign("launchimage", get_template_path('images/launch.png'));
+ $smarty->assign("infoimage", get_template_path('images/info_small.png'));
+ $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
$smarty->assign("apply", apply_filter());
$smarty->assign("alphabet", generate_alphabet());
$smarty->assign("cartridge_regex", $filter);
/* This function cehck all created devices if you wan't to create device specific check
use >>if($attr['device_type']=="moboard")<< to create a device type depending check
*/
- function check($attr)
+ function check()
{
- $message = array();
+ /* Call common method to give check the hook */
+ $message= plugin::check();
+
return($message);
}