You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2021-01-13 12:39:10

christopheLNZ
Member
Registered: 2021-01-13
Posts: 1

Rapport

Bonjour

Je souhaiterai savoir s'il y a un moyen pour ressortir un rapport d'inventaire par personne.

exemple

Util1
PC 1
Ecran1
Périphérique 1
Périphérique 2

Util2
PC 2
Ecran2
Périphérique 3
Périphérique 4

Cordialement

Version GLPI 9.5.2

Offline

#2 2021-01-22 21:38:27

bruno.desmet
Member
From: LILLE
Registered: 2013-10-15
Posts: 156

Re: Rapport

Bonsoir,

il faut installer le plugin report
Regarder celui qui se rapproche le plus
copier le dossier rapport pour créer le nouveau
modifier le script

de mémoire, il faut prendre un rapport qui balaie l'ensemble des tables computers, monitors, periphericals dans une boucle pour chaque utilisateurs

bon courage


En Prod : Windows Server 2016 IIS PHP 7.3.4 MySQL Enterprise Server 8.0.17 GLPI 9.4.6 75 entités 18603 postes 19031 Moniteurs 739 imprimantes 11278 périphériques pour 12223 utilisateurs plugins : injection de fichier, impression pdf, rapports

Offline

#3 2021-01-22 23:55:41

LaDenrée
HELPER
Registered: 2012-11-19
Posts: 6,167

Re: Rapport

vous pouvez  :
soit interroger directement la base de données avec la requête :

select t.utilisateur as c1 ,t.item_type as c2,t.item as c3  from (
select concat(us.realname,' ',us.firstname) as utilisateur, it.name as item,'PC' as item_type,2 as rang 
from glpi_users as us
left outer join glpi_computers as it on it.users_id=us.id
union 
select concat(us.realname,' ',us.firstname) as utilisateur, it.name as item,'ecran' as item_type ,3 as rang 
from glpi_users as us
left outer join glpi_monitors as it on it.users_id=us.id
union
select concat(us.realname,' ',us.firstname) as utilisateur, it.name as item,  'imprimante' as item_type ,4 as rang 
from glpi_users as us
left outer join glpi_printers as it on it.users_id=us.id
union
select concat(us.realname,' ',us.firstname) as utilisateur, it.name as item,  'téléphone' as item_type ,5 as rang 
from glpi_users as us
left outer join glpi_phones as it on it.users_id=us.id
union
select concat(us.realname,' ',us.firstname) as utilisateur, it.name as item,  'periphérique' as item_type ,6 as rang 
from glpi_users as us
left outer join glpi_peripherals as it on it.users_id=us.id) as t 
Where t.item is not null 
order by c1,c2,c3

soit installer le plugin reports puis
creer un dossier .../glpi/plugins/reports/report/itemsbyuser  et un fichier à l'intérieur itemsbyuser.php (important d'avoir le même nom que le dossier)

dans le fichier vous collez  le code ci dessous

<?php
/**
 * @version $Id: itemsbyuser.php 386 2021-01-22 22:22:36Z La denrée $
 -------------------------------------------------------------------------
  LICENSE

 This file is part of Reports plugin for GLPI.

 Reports is free software: you can redistribute it and/or modify
 it under the terms of the GNU Affero General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 Reports 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 Affero General Public License for more details.

 You should have received a copy of the GNU Affero General Public License
 along with Reports. If not, see <http://www.gnu.org/licenses/>.

 @package   reports
 @authors    Nelly Mahu-Lasson, Remi Collet, Benoit Machiavello
 @copyright Copyright (c) 2009-2020 Reports plugin team
 @license   AGPL License 3.0 or (at your option) any later version
            http://www.gnu.org/licenses/agpl-3.0-standalone.html
 @link      https://forge.glpi-project.org/projects/reports
 @link      http://www.glpi-project.org/
 @since     2009
 --------------------------------------------------------------------------
 */

$USEDBREPLICATE        = 1;
$DBCONNECTION_REQUIRED = 0;

include ("../../../../inc/includes.php");

$dbu = new DbUtils();

//TRANS: The name of the report = Equipement par utilisateur
$report = new PluginReportsAutoReport(__('itemsbyuser_report_title', 'reports'));
//$group = new GroupCriteria($report);

$report->setColumns([new PluginReportsColumn('c1', __('User'))
                     ,new PluginReportsColumn('c2', __('Item type'))
                     ,new PluginReportsColumn('c3', __('Item'))
])
;

$query = "
select t.utilisateur as c1 ,t.item_type as c2,t.item as c3  from (
select concat(us.realname,' ',us.firstname) as utilisateur, it.name as item,'".__('Computer')."' as item_type,2 as rang 
from glpi_users as us
left outer join glpi_computers as it on it.users_id=us.id
union 
select concat(us.realname,' ',us.firstname) as utilisateur, it.name as item,'".__('Monitor')."' as item_type ,3 as rang 
from glpi_users as us
left outer join glpi_monitors as it on it.users_id=us.id
union
select concat(us.realname,' ',us.firstname) as utilisateur, it.name as item,  '".__('Printer')."' as item_type ,4 as rang 
from glpi_users as us
left outer join glpi_printers as it on it.users_id=us.id
union
select concat(us.realname,' ',us.firstname) as utilisateur, it.name as item,  '".__('Phone')."' as item_type ,5 as rang 
from glpi_users as us
left outer join glpi_phones as it on it.users_id=us.id
union
select concat(us.realname,' ',us.firstname) as utilisateur, it.name as item,  '".__('Device')."' as item_type ,6 as rang 
from glpi_users as us
left outer join glpi_peripherals as it on it.users_id=us.id) as t 
Where t.item is not null 
order by c1,c2,c3
";

$report->setGroupBy(['c1']);
$report->setSqlRequest($query);
$report->execute();

 

votre cahier des charges est incomplet, vous n'avez pas précisé s'il faut un filtre sur le statut du matériel, sur les entités  etc....

in ne vous restera plus qu'à ajouter itemsbyuser_report_title dans les traductions pour avoir un joli titre en français correct


Trouver la panne avant de réparer...
GLPI10.0.10 (ubuntu 22.04 PHP8.1  Mariadb10.6 ) plugins : comportements 2.7.2 reports 1.16.0 formcreator 2.13.8, datainjection 2.13.4 fields 1.21.6

Offline

#4 2021-03-03 11:18:54

bruno.desmet
Member
From: LILLE
Registered: 2013-10-15
Posts: 156

Re: Rapport

Bonjour,

Perso j'ai codé le titre dans la ligne du rapport :

$report = new PluginReportsAutoReport(__('Liste Ordinateurs pour Inventaire'', 'reports'));

J'ai rajouté un bloc dans le fichier plugins\reports\locales\fr_FR.po

#. TRANS: The name of the report =  Liste Inventaire Ordinateurs
#: report/ListeOrdinateursPourInventaire/ListeOrdinateursPourInventaire.php:46
msgid "ListeOrdinateursPourInventaire_report_title"
msgstr "2021 - Liste Inventaire Ordinateurs"

que j'ai compilé en .mo

puis j'ai supprimé le cache

files\_cache\cache-trans

ensuite on fait un arrêt relance et normalement c'est bon


En Prod : Windows Server 2016 IIS PHP 7.3.4 MySQL Enterprise Server 8.0.17 GLPI 9.4.6 75 entités 18603 postes 19031 Moniteurs 739 imprimantes 11278 périphériques pour 12223 utilisateurs plugins : injection de fichier, impression pdf, rapports

Offline

Board footer

Powered by FluxBB