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 2012-12-21 21:51:53

danh
Member
From: Chicago, USA
Registered: 2012-03-08
Posts: 546
Website

Having trouble creating a link in my custom report

The report docs state to use:

new PluginReportsColumnLink( field , label , itemtype , options);

- or -

new PluginReportsColumnTypeLink( field , label , fieldtype , options);

My report is correct expect for the link.  I want to link to the ticket.  I am trying to link the ticket ID:

new PluginReportsColumnTypeLink('id','Ticket ID','id'),

I have glpi_tickets.ID as id.  I have tried both link examples and am still coming up short.


Thanks,
Dan

Offline

#2 2012-12-21 22:00:46

danh
Member
From: Chicago, USA
Registered: 2012-03-08
Posts: 546
Website

Re: Having trouble creating a link in my custom report

I kind of fixed it with this:

 new PluginReportsColumnLink('id','Ticket ID','Ticket',
                                  array('with_navigate' => true,
                                        'sorton'        => 'glpi_tickets.id')),
             //   new PluginReportsColumn('name2','Ticket'), 

I wanted to display :
Ticket ID    Ticket Title(link)

The above code changes the ID to the title and adds a link.

I commented out the second line as it was displaying:
Title(Link)     Title


Thanks,
Dan

Offline

#3 2012-12-22 00:06:46

danh
Member
From: Chicago, USA
Registered: 2012-03-08
Posts: 546
Website

Re: Having trouble creating a link in my custom report

ug...

any ideas why this isn't working?  I have the exact code used for computer lookups and it works just fine.
replace 'monitors' with 'computers' and that is how the working one looks.

<?
define('GLPI_ROOT', '../../../..');
include(GLPI_ROOT."/inc/includes.php");

$USEDBREPLICATE=0;
$DBCONNECTION_REQUIRED=1;


$report = new PluginReportsAutoReport($LANG['plugin_reports']['inventory_monitors'][1]);

// (sql field, column name)
$columns= array(new PluginReportsColumn('name1','User Name'),
                new PluginReportsColumn('itemtype','Item'),  
                new PluginReportsColumnLink('name2','Item Name','Monitor',
                            array('with_navigate' => true)), 
                new PluginReportsColumn('serial','Serial'),  
                new PluginReportsColumn('otherserial','MSB Inv'),
                new PluginReportsColumn('inventory_date','Last Inventory Date'));
                
                


$report->setColumnsNames($columns);

//SQL Statement
$sql="SELECT glpi_users.name AS name1, glpi_infocoms.itemtype, glpi_monitors.name AS name2, glpi_monitors.serial, glpi_monitors.otherserial, glpi_infocoms.inventory_date
FROM glpi_users INNER JOIN (glpi_infocoms INNER JOIN glpi_monitors ON glpi_infocoms.items_id = glpi_monitors.ID) ON glpi_users.ID = glpi_monitors.users_id
WHERE (((glpi_infocoms.itemtype)='monitor'))
ORDER BY glpi_users.name";


$report->setSqlRequest($sql);
$report->execute();
?>

Thanks,
Dan

Offline

#4 2013-01-04 12:00:04

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

Re: Having trouble creating a link in my custom report

Try new PluginReportsColumnLink('id', 'Ticket ID', 'Ticket'),


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

#5 2013-01-04 20:04:00

danh
Member
From: Chicago, USA
Registered: 2012-03-08
Posts: 546
Website

Re: Having trouble creating a link in my custom report

still doesn't give me a link.


Thanks,
Dan

Offline

Board footer

Powered by FluxBB