*/
/*
 * ----------------------------------------------------------------------
 * Original Author of file: Benoit Machiavello
 *
 * Purpose of file:
 *    Generate group members report
 * ----------------------------------------------------------------------
 */
$USEDBREPLICATE = 1;
$DBCONNECTION_REQUIRED = 0;
include "../../../../inc/includes.php";
//TRANS: The name of the report = Tickets opened at night, sorted by priority
$report = new PluginReportsAutoReport(__('statnightticketsbypriority_report_title', 'reports'));
//Report's search criterias
new PluginReportsDateIntervalCriteria($report, '`glpi_tickets`.`date`', __('Opening date'));
$timeInterval = new PluginReportsTimeIntervalCriteria($report, '`glpi_tickets`.`date`');
//Criterias default values
$timeInterval->setStartTime($CFG_GLPI['planning_end']);
$timeInterval->setEndtime($CFG_GLPI['planning_begin']);
//Display criterias form is needed
$report->displayCriteriasForm();
//If criterias have been validated
if ($report->criteriasValidated()) {
    $report->setSubNameAuto();
    //Names of the columns to be displayed
    $report->setColumns(array(new PluginReportsColumnMap('priority', __('Priority'), array(), array('sorton' => '`priority`, `date`')), new PluginReportsColumnDateTime('date', __('Opening date'), array('sorton' => '`date`')), new PluginReportsColumn('id2', __('ID')), new PluginReportsColumnLink('id', __('Title'), 'Ticket'), new PluginReportsColumn('groupname', __('Group'), array('sorton' => '`glpi_groups_tickets`.`groups_id`, `date`'))));
    $query = "SELECT `glpi_tickets`.`priority`, `glpi_tickets`.`date` , `glpi_tickets`.`id`,\n                    `glpi_tickets`.`id` AS id2, `glpi_groups`.`name` as groupname\n             FROM `glpi_tickets`\n             LEFT JOIN `glpi_groups_tickets`\n                  ON (`glpi_groups_tickets`.`tickets_id` = `glpi_tickets`.`id`\n                      AND `glpi_groups_tickets`.`type` = '" . CommonITILActor::ASSIGN . "')\n             LEFT JOIN `glpi_groups` ON (`glpi_groups_tickets`.`groups_id` = `glpi_groups`.`id`)\n             WHERE `glpi_tickets`.`status` NOT IN ('solved', 'closed')\n                  AND NOT `glpi_tickets`.`is_deleted` " . $report->addSqlCriteriasRestriction() . getEntitiesRestrictRequest(' AND ', 'glpi_tickets') . $report->getOrderBy('priority');
    $report->setSqlRequest($query);
    $report->execute();
}
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 General Public License for more details.

You should have received a copy of the GNU General Public License
along with reports. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
$USEDBREPLICATE = 1;
$DBCONNECTION_REQUIRED = 0;
include "../../../../inc/includes.php";
//TRANS: The name of the report = Applications by locations and versions
$report = new PluginReportsAutoReport(__('applicationsbylocation_report_title', 'reports'));
$softwarecategories = new PluginReportsSoftwareCategoriesCriteria($report, 'softwarecategories', __('Software category'));
$softwarecategories->setSqlField("`glpi_softwarecategories`.`id`");
$software = new PluginReportsSoftwareCriteria($report, 'software', __('Applications', 'reports'));
$software->setSqlField("`glpi_softwares`.`id`");
$statecpt = new PluginReportsStatusCriteria($report, 'statecpt', __('Computer status', 'reports'));
$statecpt->setSqlField("`glpi_computers`.`states_id`");
$location = new PluginReportsLocationCriteria($report, 'location', _n('Location', 'Locations', 2));
$location->setSqlField("`glpi_computers`.`locations_id`");
$report->displayCriteriasForm();
// Form validate and only one software with license
if ($report->criteriasValidated()) {
    $report->setSubNameAuto();
    $report->setColumns(array(new PluginReportsColumnLink('soft', _n('Software', 'Software', 1), 'Software', array('sorton' => 'soft,version')), new PluginReportsColumnLink('locat', _n('Location', 'Locations', 1), 'Location', array('sorton' => 'glpi_locations.name')), new PluginReportsColumnLink('computer', _n('Computer', 'Computers', 1), 'Computer', array('sorton' => 'glpi_computers.name')), new PluginReportsColumn('statecpt', _n('Status', 'Statuses', 1)), new PluginReportsColumnLink('version', __('Version name'), 'SoftwareVersion'), new PluginReportsColumnLink('user', _n('User', 'Users', 1), 'User', array('sorton' => 'glpi_users.name'))));
    $query = "SELECT `glpi_softwareversions`.`softwares_id` AS soft,\n                    `glpi_softwareversions`.`name` AS software,\n                    `glpi_locations`.`id` AS locat,\n                    `glpi_computers`.`id` AS computer,\n                    `state_ver`.`name` AS statever,\n                    `state_cpt`.`name` AS statecpt,\n                    `glpi_locations`.`name` as location,\n                    `glpi_softwareversions`.`id` AS version,\n                    `glpi_computers`.`users_id` AS user\n             FROM `glpi_softwareversions`\n             INNER JOIN `glpi_computers_softwareversions`\n                   ON (`glpi_computers_softwareversions`.`softwareversions_id` = `glpi_softwareversions`.`id`)\n             INNER JOIN `glpi_computers`\n                   ON (`glpi_computers_softwareversions`.`computers_id` = `glpi_computers`.`id`)\n             INNER JOIN `glpi_softwares`\n                   ON (`glpi_softwares`.`id` = `glpi_softwareversions`.`softwares_id`)\n             LEFT JOIN `glpi_softwarecategories`\n                  ON (`glpi_softwares`.`softwarecategories_id` = `glpi_softwarecategories`.`id`)\n             LEFT JOIN `glpi_locations`\n                  ON (`glpi_locations`.`id` = `glpi_computers`.`locations_id`)\n             LEFT JOIN `glpi_states` state_ver\n                  ON (`state_ver`.`id` = `glpi_softwareversions`.`states_id`)\n             LEFT JOIN `glpi_states` state_cpt\n                  ON (`state_cpt`.`id` = `glpi_computers`.`states_id`) " . getEntitiesRestrictRequest('WHERE', 'glpi_softwareversions') . $report->addSqlCriteriasRestriction() . "ORDER BY soft ASC, locat ASC";
    $report->setSqlRequest($query);
    $report->execute();
}
Example #3
0
reports 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.

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

You should have received a copy of the GNU General Public License
along with reports. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
$USEDBREPLICATE = 1;
$DBCONNECTION_REQUIRED = 0;
include "../../../../inc/includes.php";
//TRANS: The name of the report = Detailed report of software installation by status
$report = new PluginReportsAutoReport(__('softnotinstalled_report_title', 'reports'));
$soft = new PluginReportsTextCriteria($report, 'software', _n('Software', 'Software', 1));
$soft->setSqlField("`glpi_softwares`.`name`");
$report->displayCriteriasForm();
// Form validate and only one software with license
if ($report->criteriasValidated()) {
    $report->setSubNameAuto();
    $report->setColumns(array(new PluginReportsColumnLink('computer', __('Computer'), 'Computer', array('sorton' => 'glpi_computers.name')), new PluginReportsColumn('operatingsystems', __('Operating system'), array('sorton' => 'operatingsystems')), new PluginReportsColumn('state', __('Status'), array('sorton' => 'state')), new PluginReportsColumn('entity', __('Entity'), array('sorton' => 'entity,location')), new PluginReportsColumn('location', sprintf(__('%1$s - %2$s'), __('Location'), __('Computer')), array('sorton' => 'location'))));
    $query = "SELECT `glpi_computers`.`id` AS computer,\n                    `glpi_states`.`name` AS state,\n                    `glpi_operatingsystems`.`name` as operatingsystems,\n                    `glpi_locations`.`completename` as location,\n                    `glpi_entities`.`completename` as entity\n             FROM `glpi_computers`\n             LEFT JOIN `glpi_states`\n                  ON (`glpi_states`.`id` = `glpi_computers`.`states_id`)\n             LEFT JOIN `glpi_operatingsystems`\n                  ON (`glpi_operatingsystems`.`id` = `glpi_computers`.`operatingsystems_id`)\n             LEFT JOIN `glpi_locations`\n                  ON (`glpi_locations`.`id` = `glpi_computers`.`locations_id`)\n             LEFT JOIN `glpi_entities`\n                  ON (`glpi_entities`.`id` = `glpi_computers`.`entities_id`) " . getEntitiesRestrictRequest('WHERE', 'glpi_computers') . "\n                   AND `glpi_computers`.`is_template` = 0\n                   AND `glpi_computers`.`is_deleted` = 0\n                   AND `glpi_computers`.`id`\n                     NOT IN (SELECT `glpi_computers`.`id`\n                             FROM `glpi_softwares`\n                             INNER JOIN `glpi_softwareversions`\n                                 ON (`glpi_softwares`.`id` = `glpi_softwareversions`.`softwares_id`)\n                             INNER JOIN `glpi_computers_softwareversions`\n                                 ON (`glpi_computers_softwareversions`.`softwareversions_id`\n                                       = `glpi_softwareversions`.`id`)\n                             INNER JOIN `glpi_computers`\n                                 ON (`glpi_computers_softwareversions`.`computers_id`\n                                       = `glpi_computers`.`id`) " . getEntitiesRestrictRequest('WHERE', 'glpi_computers') . $report->addSqlCriteriasRestriction() . ")" . $report->getOrderby('computer', true);
    $report->setSqlRequest($query);
    $report->execute();
}
Example #4
0
 *
 * 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
include "../../../../inc/includes.php";
$report = new PluginReportsAutoReport();
new PluginReportsDateIntervalCriteria($report, 'order_date', __("Date of order", "order"));
new PluginReportsDateIntervalCriteria($report, 'deliverydate', __("Delivery date"));
new PluginReportsLocationCriteria($report, 'locations_id', __("Delivery location", "order"));
new PluginReportsSupplierCriteria($report, 'suppliers_id', __("Supplier"));
new PluginReportsDropdownCriteria($report, 'plugin_order_orderstates_id', 'PluginOrderOrderState', __("Status"));
$report->displayCriteriasForm();
if ($report->criteriasValidated()) {
    $report->setSubNameAuto();
    $report->setColumns(array(new PluginReportsColumnLink('entities_id', __("Entity"), 'Entity'), new PluginReportsColumnLink('id', __("Name"), 'PluginOrderOrder', array('with_comment' => true, 'with_navigate' => true)), new PluginReportsColumn('num_order'['plugin_order'][0]), new PluginReportsColumnLink('suppliers_id', __("Supplier"), 'Supplier'), new PluginReportsColumnLink('plugin_order_orderstates_id', __("Status"), 'PluginOrderOrderState', array('with_comment' => true)), new PluginReportsColumnDateTime('order_date', __("Date of order", "order")), new PluginReportsColumnDateTime('duedate', __("Estimated due date", "order")), new PluginReportsColumnDateTime('deliverydate', __("Delivery date")), new PluginReportsColumnLink('locations_id', __("Delivery location", "order"), 'Location', array('with_comment' => true))));
    //TODO : ne pas chercher dans la poublelles
    $query = "SELECT * FROM `glpi_plugin_order_orders`";
    $query .= getEntitiesRestrictRequest(" WHERE", "glpi_plugin_order_orders");
    $query .= $report->addSqlCriteriasRestriction();
    $query .= " AND `is_deleted`='0' AND `is_template`='0' ";
    $query .= "GROUP BY `entities_id`, `plugin_order_orderstates_id`, `num_order`, `order_date`";
    $report->setGroupBy("entities_id", "plugin_order_orderstates_id", "num_order", "order_date");
    $report->setSqlRequest($query);
    $report->execute();
}
Example #5
0
reports 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.

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

You should have received a copy of the GNU General Public License
along with reports. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
$USEDBREPLICATE = 1;
$DBCONNECTION_REQUIRED = 0;
include "../../../../inc/includes.php";
//TRANS: The name of the report = Detailed license report
$report = new PluginReportsAutoReport(__('licenses_report_title', 'reports'));
$license = new PluginReportsSoftwareWithLicenseCriteria($report);
$license->setSqlField("`glpi_softwarelicenses`.`softwares_id`");
$report->displayCriteriasForm();
// Form validate and only one software with license
if ($report->criteriasValidated() && $license->getParameterValue() > 0) {
    $report->setSubNameAuto();
    $report->setColumns(array("license" => _n('License', 'Licenses', 2), "serial" => __('Serial number'), "nombre" => _x('Quantity', 'Number'), "type" => __('Type'), "buy" => __('Purchase version'), "used" => __('Used version', 'reports'), "expire" => __('Expiration'), "comment" => __('Comments'), "name" => __('Computer')));
    $query = "SELECT `glpi_softwarelicenses`.`name` AS license,\n                    `glpi_softwarelicenses`.`serial`,\n                    `glpi_softwarelicenses`.`number` AS nombre,\n                    `glpi_softwarelicensetypes`.`name` AS type,\n                    buyversion.`name` AS buy,\n                    useversion.`name` AS used,\n                    `glpi_softwarelicenses`.`expire`,\n                    `glpi_softwarelicenses`.`comment`,\n                    `glpi_computers`.`name`\n             FROM `glpi_softwarelicenses`\n             LEFT JOIN `glpi_softwares`\n                  ON (`glpi_softwarelicenses`.`softwares_id` = `glpi_softwares`.`id`)\n             LEFT JOIN `glpi_computers_softwarelicenses`\n                  ON (`glpi_softwarelicenses`.`id`\n                        = `glpi_computers_softwarelicenses`.`softwarelicenses_id`)\n             LEFT JOIN `glpi_computers`\n                  ON (`glpi_computers`.`id` = `glpi_computers_softwarelicenses`.`computers_id`)\n             LEFT JOIN `glpi_softwareversions` AS buyversion\n                  ON (buyversion.`id` = `glpi_softwarelicenses`.`softwareversions_id_buy`)\n             LEFT JOIN `glpi_softwareversions` AS useversion\n                  ON (useversion.`id` = `glpi_softwarelicenses`.`softwareversions_id_use`)\n             LEFT JOIN `glpi_softwarelicensetypes`\n                  ON (`glpi_softwarelicensetypes`.`id`\n                        =`glpi_softwarelicenses`.`softwarelicensetypes_id`)\n             LEFT JOIN `glpi_entities`\n                  ON (`glpi_softwares`.`entities_id` = `glpi_entities`.`id`)" . $report->addSqlCriteriasRestriction("WHERE") . "\n                   AND `glpi_softwares`.`is_deleted` = '0'\n                   AND `glpi_softwares`.`is_template` = '0' " . getEntitiesRestrictRequest(' AND ', 'glpi_softwares') . "\n             ORDER BY license";
    $report->setGroupBy("license");
    $report->setSqlRequest($query);
    $report->execute();
}
@link      http://www.glpi-project.org/
@since     2009
--------------------------------------------------------------------------
*/
$USEDBREPLICATE = 1;
$DBCONNECION_REQUIRED = 0;
include "../../../../inc/includes.php";
//TRANS: The name of the report = List of transfered objects
$report = new PluginReportsAutoReport(__('transferreditems_report_title', 'reports'));
// Search criterias
new PluginReportsDateIntervalCriteria($report, "`glpi_logs`.`date_mod`");
$types = array();
foreach (array('Computer', 'Monitor', 'NetworkEquipment', 'Peripheral', 'Phone', 'Printer', 'Software', 'SoftwareLicense') as $type) {
    $label = call_user_func(array($type, 'getTypeName'));
    $types[$type] = $label;
}
ksort($types);
$typecritera = new PluginReportsItemTypeCriteria($report, "itemtype", __('Type'), $types);
$report->displayCriteriasForm();
// Declare columns
if ($report->criteriasValidated()) {
    $itemtype = $_POST['itemtype'];
    $table = getTableForItemType($itemtype);
    $columns = array(new PluginReportsColumnLink('items_id', __('Name'), $itemtype, array('with_comment' => 1)), new PluginReportsColumn('otherserial', __('Inventory number')), new PluginReportsColumn('old_value', __('Source entity', 'reports')), new PluginReportsColumn('new_value', __('Target entity', 'reports')), new PluginReportsColumnDateTime('date_mod', __('Transfert date', 'reports')));
    $report->setColumns($columns);
    $query = "SELECT `{$table}`.`id` as `items_id`,\n                    `{$table}`.`name`,\n                    `{$table}`.`otherserial`,\n                    `glpi_logs`.`date_mod` as `date_mod`,\n                    `glpi_logs`.`itemtype` as `itemtype`,\n                    `glpi_logs`.`old_value`,\n                    `glpi_logs`.`new_value`\n             FROM `{$table}`, `glpi_logs` " . $report->addSqlCriteriasRestriction("WHERE") . "\n                   AND `glpi_logs`.`items_id` = `{$table}`.`id`\n                   AND `glpi_logs`.`itemtype` = '{$itemtype}'\n                   AND `glpi_logs`.`id_search_option`='80'\n             ORDER BY `date_mod` ASC";
    $report->setSqlRequest($query);
    $report->execute();
} else {
    Html::footer();
}
Example #7
0
$DBCONNECTION_REQUIRED = 0;
include "../../../../inc/includes.php";
//TRANS: The name of the report = Search in the financial information (plural)
$report = new PluginReportsAutoReport(__('searchinfocom_report_title', 'reports'));
//Report's search criterias
new PluginReportsDateIntervalCriteria($report, 'order_date', __('Order date'));
new PluginReportsDateIntervalCriteria($report, 'buy_date', __('Date of purchase'));
new PluginReportsDateIntervalCriteria($report, 'delivery_date', __('Delivery date'));
new PluginReportsDateIntervalCriteria($report, 'use_date', __('Startup date'));
new PluginReportsDateIntervalCriteria($report, 'inventory_date', __('Date of last physical inventory'));
new PluginReportsTextCriteria($report, 'immo_number', __('Immobilization number'));
new PluginReportsTextCriteria($report, 'order_number', __('Order number'));
new PluginReportsTextCriteria($report, 'delivery_number', __('Delivery form'));
new PluginReportsDropdownCriteria($report, 'budgets_id', 'glpi_budgets', __('Budget'));
//Display criterias form is needed
$report->displayCriteriasForm();
//If criterias have been validated
if ($report->criteriasValidated()) {
    // Report title
    $report->setSubNameAuto();
    // Report Columns
    $cols = array(new PluginReportsColumnType('itemtype', __('Type')), new PluginReportsColumnTypeLink('items_id', __('Item'), 'itemtype', array('with_comment' => 1)), new PluginReportsColumnDate('order_date', __('Order date')), new PluginReportsColumn('order_number', __('Order number')), new PluginReportsColumnDate('buy_date', __('Date of purchase')), new PluginReportsColumn('delivery_date', __('Delivery date')), new PluginReportsColumn('delivery_number', __('Delivery form')), new PluginReportsColumn('immo_number', __('Immobilization number')), new PluginReportsColumnDate('use_date', __('Startup date')), new PluginReportsColumnDate('inventory_date', __('Date of last physical inventory')), new PluginReportsColumnLink('budgets_id', __('Budget'), 'Budget'));
    $report->setColumns($cols);
    // Build SQL request
    $sql = "SELECT *\n           FROM `glpi_infocoms`\n           WHERE `itemtype` NOT IN ('Software', 'CartridgeItem', 'ConsumableItem')" . $report->addSqlCriteriasRestriction() . getEntitiesRestrictRequest('AND', 'glpi_infocoms') . "ORDER BY `itemtype`";
    $report->setGroupBy('itemtype');
    $report->setSqlRequest($sql);
    $report->execute();
} else {
    Html::footer();
}
           http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link      https://forge.indepnet.net/projects/reports
@link      http://www.glpi-project.org/
@since     2009
--------------------------------------------------------------------------
*/
$USEDBREPLICATE = 1;
$DBCONNECTION_REQUIRED = 0;
include "../../../../inc/includes.php";
//TRANS: The name of the report = Printers
$report = new PluginReportsAutoReport(__('printers_report_title', 'reports'));
// Definition of the criteria
$grpcrit = new PluginReportsGroupCriteria($report, 'glpi_printers.groups_id', '', 'is_itemgroup');
$loccrit = new PluginReportsLocationCriteria($report, 'glpi_printers.locations_id');
//Display criterias form is needed
$report->displayCriteriasForm();
//If criterias have been validated
if ($report->criteriasValidated()) {
    $report->setSubNameAuto();
    $cols = array(new PluginReportsColumnLink('id', __('Name'), 'Printer', array('with_navigate' => true, 'sorton' => 'glpi_printers.name')), new PluginReportsColumn('state', __('Status')), new PluginReportsColumn('manu', __('Manufacturer')), new PluginReportsColumn('model', __('Model'), array('sorton' => 'glpi_manufacturers.name, glpi_printermodels.name')), new PluginReportsColumn('serial', __('Serial number')), new PluginReportsColumn('otherserial', __('Inventory number')), new PluginReportsColumn('immo_number', __('Immobilization number')), new PluginReportsColumnDate('buy_date', __('Date of purchase'), array('sorton' => 'glpi_infocoms.buy_date')), new PluginReportsColumnDate('use_date', __('Startup date'), array('sorton' => 'glpi_infocoms.use_date')), new PluginReportsColumnInteger('last_pages_counter', __('Printed pages')), new PluginReportsColumnLink('user', __('User'), 'User'), new PluginReportsColumnLink('groupe', __('Group'), 'Group', array('sorton' => 'glpi_groups.name')), new PluginReportsColumnInteger('compgrp', __('Computers in the group', 'reports')), new PluginReportsColumnInteger('usergrp', __('Users in the group', 'reports')), new PluginReportsColumnLink('location', __('Location'), 'Location', array('sorton' => 'glpi_locations.completename')), new PluginReportsColumnInteger('comploc', __('Computers in the location', 'reports')), new PluginReportsColumnInteger('userloc', __('Users in the location', 'reports')));
    $report->setColumns($cols);
    $compgrp = "SELECT COUNT(*)\n               FROM `glpi_computers`\n               WHERE `glpi_computers`.`groups_id`>0\n                     AND `glpi_computers`.`groups_id`=`glpi_printers`.`groups_id`";
    $usergrp = "SELECT COUNT(*)\n               FROM `glpi_groups_users`\n               WHERE `glpi_groups_users`.`groups_id`>0\n                     AND `glpi_groups_users`.`groups_id`=`glpi_printers`.`groups_id`";
    $comploc = "SELECT COUNT(*)\n               FROM `glpi_computers`\n               WHERE `glpi_computers`.`locations_id`>0\n                     AND `glpi_computers`.`locations_id`=`glpi_printers`.`locations_id`";
    $userloc = "SELECT COUNT(*)\n               FROM `glpi_users`\n               WHERE `glpi_users`.`locations_id`>0\n                     AND `glpi_users`.`locations_id`=`glpi_printers`.`locations_id`";
    $sql = "SELECT `glpi_printers`.`id`, `glpi_printers`.`serial`, `glpi_printers`.`otherserial`,\n                  `glpi_printers`.`last_pages_counter`,\n                  `glpi_printermodels`.`name` AS model,\n                  `glpi_manufacturers`.`name` AS manu,\n                  `glpi_printers`.`users_id` AS user,\n                  `glpi_printers`.`groups_id` AS groupe,\n                  (" . $compgrp . ") AS compgrp,\n                  (" . $usergrp . ") AS usergrp,\n                  `glpi_locations`.`id` AS location,\n                  (" . $comploc . ") AS comploc,\n                  (" . $userloc . ") AS userloc,\n                  `glpi_infocoms`.`immo_number`, `glpi_infocoms`.`buy_date`,\n                  `glpi_infocoms`.`use_date`,\n                  `glpi_states`.`name` AS state\n           FROM `glpi_printers`\n           LEFT JOIN `glpi_printermodels`\n               ON (`glpi_printermodels`.`id`=`glpi_printers`.`printermodels_id`)\n           LEFT JOIN `glpi_manufacturers`\n               ON (`glpi_manufacturers`.`id`=`glpi_printers`.`manufacturers_id`)\n           LEFT JOIN `glpi_states` ON (`glpi_states`.`id`=`glpi_printers`.`states_id`)\n           LEFT JOIN `glpi_infocoms` ON (`glpi_infocoms`.`itemtype`='Printer'\n                                         AND `glpi_infocoms`.`items_id`=`glpi_printers`.`id`)\n           LEFT JOIN `glpi_locations` ON (`glpi_locations`.`id`=`glpi_printers`.`locations_id`)\n           LEFT JOIN `glpi_groups` ON (`glpi_groups`.`id`=`glpi_printers`.`groups_id`) " . getEntitiesRestrictRequest('WHERE', 'glpi_printers') . $report->addSqlCriteriasRestriction() . $report->getOrderBy('groupe');
    $report->setSqlRequest($sql);
    $report->execute();
} else {
    Html::footer();
}
@package   reports
@authors    Nelly Mahu-Lasson, Remi Collet
@copyright Copyright (c) 2009-2015 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.indepnet.net/projects/reports
@link      http://www.glpi-project.org/
@since     2009
--------------------------------------------------------------------------
*/
$USEDBREPLICATE = 1;
$DBCONNECTION_REQUIRED = 0;
include "../../../../inc/includes.php";
//TRANS: The name of the report = Not installed important software (plural)
$report = new PluginReportsAutoReport(__('softversionsinstallations_report_title', 'reports'));
$statever = new PluginReportsStatusCriteria($report, 'statever', __('Software version status', 'reports'));
$statever->setSqlField("`glpi_softwareversions`.`states_id`");
$statecpt = new PluginReportsStatusCriteria($report, 'statecpt', __('Computer status', 'reports'));
$statecpt->setSqlField("`glpi_computers`.`states_id`");
$report->displayCriteriasForm();
// Form validate and only one software with license
if ($report->criteriasValidated()) {
    $report->setSubNameAuto();
    $report->setColumns(array(new PluginReportsColumnLink('software', _n('Software', 'Software', 1), 'Software', array('sorton' => 'software,version')), new PluginReportsColumnLink('version', __('Version'), 'SoftwareVersion'), new PluginReportsColumn('statever', __('Status')), new PluginReportsColumnLink('computer', __('Computer'), 'Computer', array('sorton' => 'glpi_computers.name')), new PluginReportsColumn('statecpt', __('Status')), new PluginReportsColumn('location', __('Location'), array('sorton' => 'location'))));
    $query = "SELECT `glpi_softwareversions`.`softwares_id` AS software,\n                    `glpi_softwareversions`.`id` AS version,\n                    `glpi_computers`.`id` AS computer,\n                    `state_ver`.`name` AS statever,\n                    `state_cpt`.`name` AS statecpt,\n                    `glpi_locations`.`completename` as location\n             FROM `glpi_softwareversions`\n             INNER JOIN `glpi_computers_softwareversions`\n                  ON (`glpi_computers_softwareversions`.`softwareversions_id`\n                        = `glpi_softwareversions`.`id`)\n             INNER JOIN `glpi_computers`\n                  ON (`glpi_computers_softwareversions`.`computers_id` = `glpi_computers`.`id`)\n             LEFT JOIN `glpi_locations`\n                  ON (`glpi_locations`.`id` = `glpi_computers`.`locations_id`)\n             LEFT JOIN `glpi_states` state_ver\n                  ON (`state_ver`.`id` = `glpi_softwareversions`.`states_id`)\n             LEFT JOIN `glpi_states` state_cpt\n                  ON (`state_cpt`.`id` = `glpi_computers`.`states_id`) " . getEntitiesRestrictRequest('WHERE', 'glpi_softwareversions') . $report->addSqlCriteriasRestriction() . $report->getOrderby('software', true);
    $report->setSqlRequest($query);
    $report->execute();
} else {
    Html::footer();
}
@link      http://www.glpi-project.org/
@since     2009
--------------------------------------------------------------------------
*/
$USEDBREPLICATE = 1;
$DBCONNECTION_REQUIRED = 0;
// not really a big SQL request
include "../../../../inc/includes.php";
//TRANS: The name of the report = Global History (for Test / example only)
$report = new PluginReportsAutoReport(__('globalhisto_report_title', 'reports'));
//Report's search criterias
//Possible current values are :
// - date-interval
// - time-interval
// - group
new PluginReportsDateIntervalCriteria($report, "date_mod");
//Display criterias form is needed
$report->displayCriteriasForm();
//If criterias have been validated
if ($report->criteriasValidated()) {
    $report->setSubNameAuto();
    //Names of the columns to be displayed
    $report->setColumns(array('id' => __('ID'), 'date_mod' => __('Date'), 'user_name' => __('User'), 'linked_action' => _x('noun', 'Update')));
    //Colunmns mappings if needed
    $columns_mappings = array('linked_action' => array(Log::HISTORY_DELETE_ITEM => __('Delete the item'), Log::HISTORY_RESTORE_ITEM => __('Restore the item'), Log::HISTORY_ADD_DEVICE => __('Add the component'), Log::HISTORY_UPDATE_DEVICE => __('modification of components', 'reports'), Log::HISTORY_DELETE_DEVICE => __('Delete the component'), Log::HISTORY_INSTALL_SOFTWARE => __('Install the software'), Log::HISTORY_UNINSTALL_SOFTWARE => __('Uninstall the software'), Log::HISTORY_DISCONNECT_DEVICE => __('Logout'), Log::HISTORY_CONNECT_DEVICE => __('Connection'), Log::HISTORY_LOCK_DEVICE => __('Lock the item'), Log::HISTORY_UNLOCK_DEVICE => __('Unlock the item'), Log::HISTORY_LOG_SIMPLE_MESSAGE => ""));
    $report->setColumnsMappings($columns_mappings);
    $query = "SELECT `id`, `date_mod`, `user_name`, `linked_action`\n             FROM `glpi_logs` " . $report->addSqlCriteriasRestriction("WHERE") . "\n             ORDER BY `date_mod`";
    $report->setSqlRequest($query);
    $report->execute();
}
Html::footer();
$DBCONNECTION_REQUIRED = 0;
include "../../../../inc/includes.php";
//TRANS: The name of the report = Users with no right
$report = new PluginReportsAutoReport(__('zombies_report_title', 'reports'));
$name = new PluginReportsTextCriteria($report, 'name', __('Login'));
$tab = array(0 => __('No'), 1 => __('Yes'));
$filter = new PluginReportsArrayCriteria($report, 'tickets', __('With no ticket', 'reports'), $tab);
//Display criterias form is needed
$report->displayCriteriasForm();
//If criterias have been validated
if ($report->criteriasValidated()) {
    $report->setSubNameAuto();
    $report->delCriteria('tickets');
    $cols = array(new PluginReportsColumnItemCheckbox('id', 'User'), new PluginReportsColumnLink('id2', __('User'), 'User', array('with_comment' => true, 'with_navigate' => true)), new PluginReportsColumn('name', __('Login'), array('sorton' => 'name')), new PluginReportsColumn('email', __('Email')), new PluginReportsColumn('phone', __('Phone')), new PluginReportsColumn('location', __('Location')), new PluginReportsColumnDate('last_login', __('Last login'), array('sorton' => 'last_login')));
    if (!$filter->getParameterValue()) {
        $cols[] = new PluginReportsColumnInteger('nb1', __('Writer'), array('with_zero' => false, 'sorton' => 'nb1'));
        $cols[] = new PluginReportsColumnInteger('nb2', __('Requester'), array('with_zero' => false, 'sorton' => 'nb2'));
        $cols[] = new PluginReportsColumnInteger('nb3', __('Watcher'), array('with_zero' => false, 'sorton' => 'nb3'));
        $cols[] = new PluginReportsColumnInteger('nb4', __('Technician'), array('with_zero' => false, 'sorton' => 'nb4'));
    }
    $report->setColumns($cols);
    $query = "SELECT `glpi_users`.`id`, `glpi_users`.`id` AS id2, `glpi_users`.`name`, `last_login`,\n                    (SELECT COUNT(*)\n                       FROM `glpi_tickets`\n                       WHERE `glpi_users`.`id` = `glpi_tickets`.`users_id_recipient`\n                    ) AS nb1,\n                    (SELECT COUNT(*)\n                       FROM `glpi_tickets_users`\n                       WHERE `glpi_users`.`id` = `glpi_tickets_users`.`users_id`\n                             AND `glpi_tickets_users`.`type`=" . CommonITILActor::REQUESTER . "\n                    ) AS nb2,\n                    (SELECT COUNT(*)\n                       FROM `glpi_tickets_users`\n                       WHERE `glpi_users`.`id` = `glpi_tickets_users`.`users_id`\n                             AND `glpi_tickets_users`.`type`=" . CommonITILActor::OBSERVER . "\n                    ) AS nb3,\n                    (SELECT COUNT(*)\n                       FROM `glpi_tickets_users`\n                       WHERE `glpi_users`.`id` = `glpi_tickets_users`.`users_id`\n                             AND `glpi_tickets_users`.`type`=" . CommonITILActor::ASSIGN . "\n                    ) AS nb4,\n                    `phone`, `glpi_locations`.`completename` as location,\n                    `glpi_useremails`.`email`\n             FROM `glpi_users`\n             LEFT JOIN `glpi_locations`\n                    ON `glpi_locations`.`id` = `glpi_users`.`locations_id`\n             LEFT JOIN `glpi_useremails`\n                    ON `glpi_useremails`.`users_id` = `glpi_users`.`id`\n                   AND `glpi_useremails`.`is_default`\n             WHERE `glpi_users`.`id` NOT IN (\n                   SELECT distinct `users_id`\n                   FROM `glpi_profiles_users`\n                   )\n             AND `glpi_users`.`is_deleted`=0 " . $report->addSqlCriteriasRestriction('AND');
    if ($filter->getParameterValue()) {
        $query .= " HAVING nb1=0 AND nb2=0 AND nb3=0  AND nb4=0 ";
    }
    $query .= $report->getOrderBy('name');
    $report->setSqlRequest($query);
    $report->execute(array('withmassiveaction' => 'User'));
} else {
    Html::Footer();
}