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 2016-12-13 09:01:42

malti
Member
Registered: 2016-12-11
Posts: 12

Creat own report

Good morning.

I want to create my own report for it i using information from website (https://forge.glpi-project.org/projects … eateReport).

My steps was next:
Made simple request for testing -> checked in MySQL -> created report

But i got error:
PHP Fatal error:  Class 'PluginRepportsColumn' not found in /var/www/addon/glpi/plugins/reports/report/malti/malti.php on line 201, referer: http://dc-inventory/glpi/plugins/reports/report/malti/malti.php

Version GLPI 0.90.5, plugin report v. 1.9.1

<?php

$USEDBREPLICATE        = 1;
$DBCONNECTION_REQUIRED = 0; 

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


$report = new PluginReportsAutoReport(__('firstreport_title', 'reports'));

$report->setColumns(array(new PluginReportsColumn('name', __('name')))); 


$query = "SELECT `glpi_computers`.`name`
          FROM `glpi_computers`" .


$report->setSqlRequest($query);
$report->execute();

Can you give  tip for fixing error?

Last edited by malti (2016-12-13 09:05:01)

Offline

#2 2016-12-13 16:02:34

chris.anderson3
Member
Registered: 2013-11-06
Posts: 36

Re: Creat own report

Do you have the 'Reports' plugin installed?

smile

Last edited by chris.anderson3 (2016-12-13 16:03:01)


GLPI 90.5     XAMPP- 1.8.2  Apache/2.4.10 (Win32) OpenSSL/1.0.1h PHP/5.4.31

Offline

#3 2016-12-13 16:05:01

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

Re: Creat own report

what strange is  :
in error message

PluginRepportsColumn


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

Online

#4 2016-12-14 07:34:04

malti
Member
Registered: 2016-12-11
Posts: 12

Re: Creat own report

chris.anderson3 wrote:

Do you have the 'Reports' plugin installed?

smile

hahaha ... Sure smile

Offline

#5 2016-12-14 07:35:37

malti
Member
Registered: 2016-12-11
Posts: 12

Re: Creat own report

LaDenrée wrote:

what strange is  :
in error message

PluginRepportsColumn

Thanks. All work!

Offline

#6 2016-12-17 16:02:51

malti
Member
Registered: 2016-12-11
Posts: 12

Re: Creat own report

how can i change direction columns?
+---------+--------------------
|header1+  test                 |
---------------------------------
|header2+  test                 |
---------------------------------

Offline

#7 2016-12-20 09:02:12

malti
Member
Registered: 2016-12-11
Posts: 12

Re: Creat own report

Good morning.
made report, go web-interface for checking and get message "Item not found". what does this message mean?

<?php


$USEDBREPLICATE         = 1;
$DBCONNECTION_REQUIRED  = 1;


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


$report = new PluginReportsAutoReport(__('malti_report_title', 'reports'));


$report->setColumns(array(new PluginReportsColumn('id', $LANG["common"][0]),
                          new PluginReportsColumn('name', $LANG["common"][35], 'PC'),
                          new PluginReportsColumn('realname', $LANG["common"][18], 'User'),
                          new PluginReportsColumn('completename', $LANG["common"][43]),
                          new PluginReportsColumn('name', $LANG["common"][48])));

$query = "SELECT `glpi_computers`.`id`,
                 `glpi_computers`.`name` AS PC,
                 `glpi_users`.`id`,
                 `glpi_users`.`realname`,
                 `glpi_locations.completename`.`name` AS place,
                 `glpi_operatingsystems`.`name` AS OS
          FROM `glpi_computers`
          LEFT JOIN `glpi_users` ON (`glpi_conputers`.`users_id` = `glpi_users`.`id`)
          LEFT JOIN `glpi_locations` ON (`glpi_computers`.`locations_id` = `glpi_locations`.`id`)
          LEFT JOIN `glpi_operatingsystems` ON (`glpi_computers`.`operatingsystems_id` = `glpi_operatingsystems`.`id`)".
          getEntitiesRestrictRequest("WHERE", "glpi_computers")."
          ORDER BY `glpi_computers`.`name`";
$report->setGroupBy(array('realname'));

$report->setSqlRequest($query);
$report->execute();

Offline

#8 2016-12-20 09:51:54

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

Re: Creat own report

colums are not correctly set

new PluginReportsColumn('name', $LANG["common"][35], 'PC')

should be
new PluginReportsColumn('PC', $LANG["common"][35], 'computer')


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

Online

#9 2016-12-20 13:02:23

malti
Member
Registered: 2016-12-11
Posts: 12

Re: Creat own report

Change how you say, but get message "Item not found". Try don't use "AS" and get "Item not found"

$USEDBREPLICATE         = 1;
$DBCONNECTION_REQUIRED  = 1;


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


$report = new PluginReportsAutoReport(__('malti_report_title', 'reports'));


$report->setColumns(array(new PluginReportsColumn('id', $LANG["common"][0]),
                          new PluginReportsColumn('PC', $LANG["common"][35], 'computer'),
                          new PluginReportsColumn('User', $LANG["setup"][18], 'realname'),
                          new PluginReportsColumn('Plase', $LANG["common"][43], 'completename'),
                          new PluginReportsColumn('OS', $LANG["common"][48], 'operatingsystems')));

$query = "SELECT `glpi_computers`.`id`,
                 `glpi_computers`.`name` AS PC,
                 `glpi_users`.`realname` AS User,
                 `glpi_locations`.`completename` AS Place,
                 `glpi_operatingsystems`.`name` AS OS
          FROM `glpi_computers`
          LEFT JOIN `glpi_users` ON (`glpi_conputers`.`users_id` = `glpi_users`.`id`)
          LEFT JOIN `glpi_locations` ON (`glpi_computers`.`locations_id` = `glpi_locations`.`id`)
          LEFT JOIN `glpi_operatingsystems` ON (`glpi_computers`.`operatingsystems_id` = `glpi_operatingsystems`.`id`)".
          getEntitiesRestrictRequest("WHERE", "glpi_computers")."
          ORDER BY `glpi_computers`.`name`, `glpi_users`.`name`";
$report->setGroupBy(array('realname'));

$report->setSqlRequest($query);
$report->execute();

Last edited by malti (2016-12-20 13:06:57)

Offline

#10 2016-12-20 15:01:49

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

Re: Creat own report

JOIN `glpi_users` ON (`glpi_conputers`

coMputer


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

Online

#11 2016-12-20 15:19:52

malti
Member
Registered: 2016-12-11
Posts: 12

Re: Creat own report

LaDenrée wrote:

JOIN `glpi_users` ON (`glpi_conputers`

coMputer

Thank you so much!....

Offline

#12 2016-12-20 15:23:16

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

Re: Creat own report

new PluginReportsColumn('Plase'
`glpi_locations`.`completename` AS Place,


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

Online

#13 2016-12-20 16:35:04

malti
Member
Registered: 2016-12-11
Posts: 12

Re: Creat own report

Can i made that report looks similar like on picture?

https://www.dropbox.com/s/59vlyo2nr5yrs … 2.png?dl=0

Last edited by malti (2016-12-20 16:35:31)

Offline

#14 2016-12-21 11:23:48

malti
Member
Registered: 2016-12-11
Posts: 12

Re: Creat own report

If  create a class in folder /glpi/inc/ can  change visualisation report?
For example ../glpi/inc/ownreport.class.php instead ../glpi/inc/toolbox.class.php

include ("../../../../inc/ownreport.class.php");

Offline

#15 2017-01-05 16:08:33

yllen
GLPI-DEV
From: Sillery (51)
Registered: 2008-01-14
Posts: 15,273

Re: Creat own report

If you want to change visualisation of your report, you can create your own visualisation instead of using mechanism of report plugin


CentOS 6.5 - CentOS 7.x
PHP 5.6 - PHP 7.x - MySQL 5.6  - MariaDB 10.2 + APC + oOPcache
GLPI from 0.72 to dev version
Certifiée ITIL (ITV2F, ITILF, ITILOSA)

Offline

#16 2017-02-09 15:14:01

malti
Member
Registered: 2016-12-11
Posts: 12

Re: Creat own report

Could you say where i can found information about creating own visualization? I tried create file with style in glpi/inc/malti_class.php, but it didn't help.

Offline

#17 2017-02-13 19:36:30

yllen
GLPI-DEV
From: Sillery (51)
Registered: 2008-01-14
Posts: 15,273

Re: Creat own report

You create your report as you doesn't use Report plugin (define the column, define the display tab, list...)


CentOS 6.5 - CentOS 7.x
PHP 5.6 - PHP 7.x - MySQL 5.6  - MariaDB 10.2 + APC + oOPcache
GLPI from 0.72 to dev version
Certifiée ITIL (ITV2F, ITILF, ITILOSA)

Offline

#18 2017-02-14 11:31:58

malti
Member
Registered: 2016-12-11
Posts: 12

Re: Creat own report

yllen.Do you mean to use Criteria? https://forge.glpi-project.org/projects … i/Criteria
Could you say how connect glpi_computers with glpi_deviceprocessors.  Want to add this information in report? Found only is_recursive  for combining it.

P.S. sorry for my english.

Offline

#19 2017-02-17 19:52:04

yllen
GLPI-DEV
From: Sillery (51)
Registered: 2008-01-14
Posts: 15,273

Re: Creat own report

in you database, glpi_items_deviceprocessors, itemtype must be 'Computer' and items_id = glpi_computers.id and deviceprocessors_id = glpi_deviceprocessors.id


CentOS 6.5 - CentOS 7.x
PHP 5.6 - PHP 7.x - MySQL 5.6  - MariaDB 10.2 + APC + oOPcache
GLPI from 0.72 to dev version
Certifiée ITIL (ITV2F, ITILF, ITILOSA)

Offline

#20 2017-04-13 12:47:35

malti
Member
Registered: 2016-12-11
Posts: 12

Re: Creat own report

Hello.
Try this request, but get error (ERROR 1054 (42S22): Unknown column 'glpi_items_deviceprocessors.deviceprocessors_id' in 'on clause'). Could you help fix error?

SELECT glpi_computers.name , 
       glpi_computers.contact , 
       glpi_locations.completename ,
       glpi_operatingsystems.name ,
       glpi_deviceprocessors.designation,
       glpi_devicememories.size_default
FROM glpi_items_deviceprocessors, glpi_items_devicememories
LEFT JOIN glpi_computers ON (glpi_items_deviceprocessors.items_id = glpi_computers.id)
LEFT JOIN glpi_locations ON (glpi_computers.locations_id = glpi_locations.id)
LEFT JOIN glpi_operatingsystems ON (glpi_computers.operatingsystems_id = glpi_operatingsystems.id)
LEFT JOIN glpi_deviceprocessors ON (glpi_items_deviceprocessors.deviceprocessors_id = glpi_deviceprocessors.id)
LEFT JOIN glpi_devicememories ON (glpi_items_devicememories.devicememories_id = glpi_devicememories.id)

Offline

Board footer

Powered by FluxBB