You are not logged in.
Pages: 1
I edited the plugin and made some enhancements:
Edited the file inc/plugin_reports.function.php:
line 46 was:
if (substr($element,0,1)!=".")
now is:
if (substr($element,0,1)!="." && substr($element,strlen($element)-1,1)!="~")
and don't show files created by gedit anymore.
I created a report called "Number of equipments by group" based on the "Number of equipments by location" . Check it out:
<?php
/*
----------------------------------------------------------------------
GLPI - Gestionnaire Libre de Parc Informatique
Copyright (C) 2003-2008 by the INDEPNET Development Team.
http://indepnet.net/ http://glpi-project.org/
----------------------------------------------------------------------
LICENSE
This file is part of GLPI.
GLPI is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GLPI; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------
*/
/*
* ----------------------------------------------------------------------
* Original Author of file: Remi Collet
*
* Purpose of file:
* Generate location report
* Illustrate use of simpleReport
* ----------------------------------------------------------------------
*/
//Options for GLPI 0.71 and newer : need slave db to access the report
$USEDBREPLICATE=1;
$DBCONNECTION_REQUIRED=0; // Really a big SQL request
$NEEDED_ITEMS=array("search");
define('GLPI_ROOT', '../../..');
include (GLPI_ROOT . "/inc/includes.php");
simpleReport(
// Report Name
"equipmentbygroups",
// SQL statement
"select i.FK_groups,i.computernumber,i.networkingnumber,i.monitornumber,i.printernumber,j.peripheralsnumber" .
" from (select g.FK_groups,g.computernumber,g.networkingnumber,g.monitornumber,h.printernumber,g.id" .
" from (select e.FK_groups,e.computernumber,e.networkingnumber,f.monitornumber,e.id" .
" from (select c.FK_groups,c.computernumber,d.networkingnumber,c.id" .
" from (select a.FK_groups,b.computernumber,a.id" .
" from (SELECT glpi_groups.name AS FK_groups,glpi_groups.id as id" .
" FROM glpi_groups LEFT JOIN glpi_entities ON (glpi_groups.FK_entities=glpi_entities.ID) ".
getEntitiesRestrictRequest(" WHERE ", "glpi_groups") .
") a" .
" LEFT OUTER JOIN (SELECT count(glpi_computers.name) as computernumber, glpi_computers.FK_groups as id FROM glpi_computers group by glpi_computers.FK_groups) b ON (a.id=b.id)) c" .
" LEFT OUTER JOIN (SELECT count(glpi_networking.name) as networkingnumber, glpi_networking.FK_groups as id FROM glpi_networking group by glpi_networking.FK_groups) d ON (c.id=d.id)) e" .
" LEFT OUTER JOIN (SELECT count(glpi_monitors.name) as monitornumber, glpi_monitors.FK_groups as id FROM glpi_monitors group by glpi_monitors.FK_groups) f ON (e.id=f.id)) g" .
" LEFT OUTER JOIN (SELECT count(glpi_printers.name) as printernumber, glpi_printers.FK_groups as id FROM glpi_printers group by glpi_printers.FK_groups) h ON (g.id=h.id)) i" .
" LEFT OUTER JOIN (SELECT count(glpi_peripherals.name) as peripheralsnumber, glpi_peripherals.FK_groups as id FROM glpi_peripherals group by glpi_peripherals.FK_groups) j ON (i.id=j.id)" .
" ORDER BY i.FK_groups,i.FK_groups",
// Columns title (optional), from $LANG or $GEDIFFREPORTLANG
array (
"FK_groups" => $LANG["common"][35],
"computernumber" => $LANG["Menu"][0],
"networkingnumber" => $LANG["Menu"][1],
"monitornumber" => $LANG["Menu"][3],
"printernumber" => $LANG["Menu"][2],
"peripheralsnumber" => $LANG["Menu"][16]
),
// Sub title
"",
// Group by
array ("FK_groups")
);
?>
and made a little editting on the "Number of equipments by location" itself:
<?php
/*
----------------------------------------------------------------------
GLPI - Gestionnaire Libre de Parc Informatique
Copyright (C) 2003-2008 by the INDEPNET Development Team.
http://indepnet.net/ http://glpi-project.org/
----------------------------------------------------------------------
LICENSE
This file is part of GLPI.
GLPI is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GLPI; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------
*/
/*
* ----------------------------------------------------------------------
* Original Author of file: Remi Collet
*
* Purpose of file:
* Generate location report
* Illustrate use of simpleReport
* ----------------------------------------------------------------------
*/
//Options for GLPI 0.71 and newer : need slave db to access the report
$USEDBREPLICATE=1;
$DBCONNECTION_REQUIRED=0; // Really a big SQL request
$NEEDED_ITEMS=array("search");
define('GLPI_ROOT', '../../..');
include (GLPI_ROOT . "/inc/includes.php");
simpleReport(
// Report Name
"equipmentbylocation",
// SQL statement
"select i.location,i.computernumber,i.networkingnumber,i.monitornumber,i.printernumber,j.peripheralsnumber" .
" from (select g.location,g.computernumber,g.networkingnumber,g.monitornumber,h.printernumber,g.id" .
" from (select e.location,e.computernumber,e.networkingnumber,f.monitornumber,e.id" .
" from (select c.location,c.computernumber,d.networkingnumber,c.id" .
" from (select a.location,b.computernumber,a.id" .
" from (SELECT glpi_dropdown_locations.completename AS location,glpi_dropdown_locations.id as id" .
" FROM glpi_dropdown_locations LEFT JOIN glpi_entities ON (glpi_dropdown_locations.FK_entities=glpi_entities.ID) ".
getEntitiesRestrictRequest(" WHERE ", "glpi_dropdown_locations") .
") a" .
" LEFT OUTER JOIN (SELECT count(glpi_computers.name) as computernumber, glpi_computers.location as id FROM glpi_computers group by glpi_computers.location) b ON (a.id=b.id)) c" .
" LEFT OUTER JOIN (SELECT count(glpi_networking.name) as networkingnumber, glpi_networking.location as id FROM glpi_networking group by glpi_networking.location) d ON (c.id=d.id)) e" .
" LEFT OUTER JOIN (SELECT count(glpi_monitors.name) as monitornumber, glpi_monitors.location as id FROM glpi_monitors group by glpi_monitors.location) f ON (e.id=f.id)) g" .
" LEFT OUTER JOIN (SELECT count(glpi_printers.name) as printernumber, glpi_printers.location as id FROM glpi_printers group by glpi_printers.location) h ON (g.id=h.id)) i" .
" LEFT OUTER JOIN (SELECT count(glpi_peripherals.name) as peripheralsnumber, glpi_peripherals.location as id FROM glpi_peripherals group by glpi_peripherals.location) j ON (i.id=j.id)" .
" ORDER BY i.location,i.location",
// Columns title (optional), from $LANG or $GEDIFFREPORTLANG
array (
"location" => $LANG["common"][15],
"computernumber" => $LANG["Menu"][0],
"networkingnumber" => $LANG["Menu"][1],
"monitornumber" => $LANG["Menu"][3],
"printernumber" => $LANG["Menu"][2],
"peripheralsnumber" => $LANG["Menu"][16]
),
// Sub title
"",
// Group by
array ("location")
);
?>
I removed the "Entity" field becouse i only need to know "my entity" stuff, not others.
Maybe this two reports could be in the v 0.72 final version. What you guys think?
Offline
Pages: 1