https://forge.indepnet.net/projects/reports
-------------------------------------------------------------------------

LICENSE

This file is part of reports.

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 = Licenses by expiration date
$report = new PluginReportsAutoReport(__('licensesexpires_report_title', 'reports'));
$report->setColumns(array('expire' => __('Valid to', 'reports'), 'name' => __('License name'), 'software' => sprintf(__('%1$s - %2$s'), _n('Software', 'Software', 1), __('Purchase version')), 'serial' => __('Serial number'), 'completename' => __('Entity'), 'comments' => __('Comments'), 'ordinateur' => __('Computer')));
$query = "SELECT `glpi_softwarelicenses`.`expire`,\n                 `glpi_softwarelicenses`.`name`,\n                 CONCAT(`glpi_softwares`.`name`,' - ',buyversion.`name`) AS software,\n                 `glpi_softwarelicenses`.`serial`,\n                 `glpi_entities`.`completename`,\n                 `glpi_softwarelicenses`.`comment`,\n                 `glpi_computers`.`name` AS ordinateur\n          FROM `glpi_softwarelicenses`\n          LEFT JOIN `glpi_softwares`\n               ON (`glpi_softwarelicenses`.`softwares_id` = `glpi_softwares`.`id`)\n          LEFT JOIN `glpi_softwarelicensetypes`\n            ON (`glpi_softwarelicensetypes`.`id`=`glpi_softwarelicenses`.`softwarelicensetypes_id`)\n          LEFT JOIN `glpi_softwareversions` AS buyversion\n               ON (buyversion.`id` = `glpi_softwarelicenses`.`softwareversions_id_buy`)\n          LEFT JOIN `glpi_entities`\n               ON (`glpi_softwares`.`entities_id` = `glpi_entities`.`id`)\n          LEFT JOIN `glpi_computers_softwarelicenses`\n               ON (`glpi_softwarelicenses`.`id` = `glpi_computers_softwarelicenses`.`softwarelicenses_id`)\n          LEFT JOIN `glpi_computers`\n               ON (`glpi_computers`.`id` = `glpi_computers_softwarelicenses`.`computers_id`)\n          WHERE `glpi_softwares`.`is_deleted` = '0'\n                AND `glpi_softwares`.`is_template` = '0' " . getEntitiesRestrictRequest(' AND ', 'glpi_softwarelicenses') . "\n          ORDER BY `glpi_softwarelicenses`.`expire`, `name`";
$report->setGroupBy(array('expire', 'name'));
$report->setSqlRequest($query);
$report->execute();
 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/>.
 --------------------------------------------------------------------------
*/
//	Options for GLPI 0.71 and newer : need slave db to access the report
$USEDBREPLICATE = 1;
$DBCONNECTION_REQUIRED = 1;
// Initialization of the variables
include "../../../../inc/includes.php";
//TRANS: The name of the report = Helpdesk requesters and tickets by entity
$report = new PluginReportsAutoReport(__('statticketsbyentity_report_title', 'reports'));
//Report's search criterias
$prof = new PluginReportsDropdownCriteria($report, 'profiles_id', 'glpi_profiles', __('Profile'));
//Display criterias form is needed
$report->displayCriteriasForm();
//If criterias have been validated
if ($report->criteriasValidated()) {
    $report->setSubNameAuto();
    //Names of the columns to be displayed
    $cols = array(new PluginReportsColumn('name', __('Entity'), array('sorton' => '`glpi_entities`.`completename`')), new PluginReportsColumnInteger('nbusers', __('Users count', 'reports'), array('withtotal' => true, 'sorton' => 'nbusers')), new PluginReportsColumnInteger('number', __('Tickets count', 'reports'), array('withtotal' => true, 'sorton' => 'number')), new PluginReportsColumnDateTime('mindate', __('Older', 'reports'), array('sorton' => 'mindate')), new PluginReportsColumnDateTime('maxdate', __('Newer', 'reports'), array('sorton' => 'maxdate')));
    $report->setColumns($cols);
    $subcpt = "SELECT COUNT(*)\n              FROM `glpi_profiles_users`\n              WHERE `glpi_profiles_users`.`entities_id`=`glpi_entities`.`id` " . $prof->getSqlCriteriasRestriction();
    $query = "SELECT `glpi_entities`.`completename` AS name,\n                    ({$subcpt}) as nbusers,\n                    COUNT(`glpi_tickets`.`id`) AS number,\n                    MIN(`glpi_tickets`.`date`) as mindate,\n                    MAX(`glpi_tickets`.`date`) as maxdate\n             FROM `glpi_entities`\n             INNER JOIN `glpi_tickets` ON (`glpi_tickets`.`entities_id`=`glpi_entities`.`id`)\n             WHERE NOT `glpi_tickets`.`is_deleted` " . getEntitiesRestrictRequest('AND', "glpi_entities") . "GROUP BY `glpi_entities`.`id`" . $report->getOrderBy('name');
    $report->setSqlRequest($query);
    $report->execute(array('withtotal' => true));
} else {
    Html::footer();
}
Exemple #3
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();
}
(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-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 = List of groups and members
$report = new PluginReportsAutoReport(__('listgroups_report_title', 'reports'));
//$group = new GroupCriteria($report);
$report->setColumns(array(new PluginReportsColumn('completename', __('Entity')), new PluginReportsColumnLink('groupid', __('Group'), 'Group'), new PluginReportsColumnLink('userid', __('Login'), 'User'), new PluginReportsColumn('firstname', __('First name')), new PluginReportsColumn('realname', __('Surname')), new PluginReportsColumnDateTime('last_login', __('Last login'))));
$query = "SELECT `glpi_entities`.`completename`,\n                 `glpi_groups`.`id` AS groupid,\n                 `glpi_users`.`id` AS userid,\n                 `glpi_users`.`firstname`,\n                 `glpi_users`.`realname`,\n                 `glpi_users`.`last_login`\n          FROM `glpi_groups`\n          LEFT JOIN `glpi_groups_users` ON (`glpi_groups_users`.`groups_id` = `glpi_groups`.`id`)\n          LEFT JOIN `glpi_users` ON (`glpi_groups_users`.`users_id` = `glpi_users`.`id`\n                                     AND `glpi_users`.`is_deleted` = '0' )\n          LEFT JOIN `glpi_entities` ON (`glpi_groups`.`entities_id` = `glpi_entities`.`id`)" . getEntitiesRestrictRequest(" WHERE ", "glpi_groups") . "\n          ORDER BY `completename`, `glpi_groups`.`name`, `glpi_users`.`name`";
$report->setGroupBy(array('completename', 'groupid'));
$report->setSqlRequest($query);
$report->execute();
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();
}
Exemple #6
0
 * ----------------------------------------------------------------------
 */
//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('suppliers_id', __("Supplier"), 'Supplier'), new PluginReportsColumnLink('entities_id', __("Entity"), 'Entity'), new PluginReportsColumnInteger('total'['plugin_order']['deliveryinfos'][2]), new PluginReportsColumnInteger('late'['plugin_order']['deliveryinfos'][3])));
    //TODO : ne pas chercher dans la poublelles
    $query_total = "SELECT count(*) FROM `glpi_plugin_order_orders`";
    $query_total .= getEntitiesRestrictRequest(" WHERE", "glpi_plugin_order_orders");
    $query_total .= $report->addSqlCriteriasRestriction();
    $query_total .= "AND `glpi_plugin_order_orders`.`suppliers_id`=`suppliers`.`id`";
    $query_late = $query_total . " AND `is_late`='1' AND `is_deleted`='0' AND `is_template`='0'";
    $supplier = "JOIN `glpi_suppliers`as suppliers\n                                 ON (`glpi_plugin_order_orders`.`suppliers_id` = suppliers.`id`)";
    $query = "SELECT DISTINCT `suppliers_id`, ({$query_total}) AS `total`, ({$query_late}) AS `late`\n            FROM `glpi_plugin_order_orders` {$supplier}";
    $query .= getEntitiesRestrictRequest(" WHERE", "glpi_plugin_order_orders");
    $query .= $report->addSqlCriteriasRestriction();
    $report->setGroupBy("suppliers_id");
    $report->setSqlRequest($query);
    $report->execute();
}
Resources 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.

Resources 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 Resources. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
//Options for GLPI 0.71 and newer : need slave db to access the report
$USEDBREPLICATE = 1;
$DBCONNECTION_REQUIRED = 1;
include "../../../../inc/includes.php";
// Instantiate Report with Name
$titre = $LANG['plugin_resources']['resourceemploymentwithlapseprofession'];
$report = new PluginReportsAutoReport($titre);
// Columns title (optional)
$report->setColumns(array(new PluginReportsColumnLink('rank_id', PluginResourcesRank::getTypeName(1), 'PluginResourcesRank', array('sorton' => 'rank_name')), new PluginReportsColumn('rank_code', PluginResourcesRank::getTypeName(1) . " - " . __('Code', 'resources'), array('sorton' => 'rank_code')), new PluginReportsColumnDate('rank_begin_date', PluginResourcesRank::getTypeName(1) . " - " . __('Begin date'), array('sorton' => 'rank_begin_date')), new PluginReportsColumnDate('rank_end_date', PluginResourcesRank::getTypeName(1) . " - " . __('End date'), array('sorton' => 'rank_end_date')), new PluginReportsColumnLink('prof_id', PluginResourcesProfession::getTypeName(1), 'PluginResourcesProfession', array('sorton' => 'prof_name')), new PluginReportsColumn('prof_code', PluginResourcesProfession::getTypeName(1) . " - " . __('Code', 'resources'), array('sorton' => 'prof_code')), new PluginReportsColumnDate('prof_begin_date', PluginResourcesProfession::getTypeName(1) . " - " . __('Begin date'), array('sorton' => 'prof_begin_date')), new PluginReportsColumnDate('prof_end_date', PluginResourcesProfession::getTypeName(1) . " - " . __('End date'), array('sorton' => 'prof_end_date'))));
// SQL statement
$condition = getEntitiesRestrictRequest('AND', 'glpi_plugin_resources_professions', '', '', true);
$date = date("Y-m-d");
//display only leaving resource with active employment
$query = "SELECT `glpi_plugin_resources_ranks`.`id` as rank_id,\n                  `glpi_plugin_resources_ranks`.`name` as rank_name,\n                 `glpi_plugin_resources_ranks`.`code` as rank_code,\n                 `glpi_plugin_resources_ranks`.`begin_date` as rank_begin_date,\n                 `glpi_plugin_resources_ranks`.`end_date` as rank_end_date,\n                 `glpi_plugin_resources_professions`.`id` as prof_id,\n                 `glpi_plugin_resources_professions`.`name` AS prof_name,\n                 `glpi_plugin_resources_professions`.`code` AS prof_code,\n                 `glpi_plugin_resources_professions`.`begin_date` AS prof_begin_date,\n                 `glpi_plugin_resources_professions`.`end_date` AS prof_end_date\n          FROM `glpi_plugin_resources_ranks`\n          LEFT JOIN `glpi_plugin_resources_professions`\n               ON (`glpi_plugin_resources_ranks`.`plugin_resources_professions_id` = `glpi_plugin_resources_professions`.`id`\n               AND ((`glpi_plugin_resources_professions`.`begin_date` IS NULL)\n                        OR (`glpi_plugin_resources_professions`.`begin_date` < '" . $date . "')\n                    AND (`glpi_plugin_resources_professions`.`end_date` IS NULL)\n                        OR (`glpi_plugin_resources_professions`.`end_date` > '" . $date . "')))\n          WHERE (`glpi_plugin_resources_ranks`.`is_active` <> `glpi_plugin_resources_professions`.`is_active`)\n               OR (`glpi_plugin_resources_ranks`.`begin_date` > `glpi_plugin_resources_professions`.`end_date`)\n               OR (`glpi_plugin_resources_ranks`.`end_date` < `glpi_plugin_resources_professions`.`begin_date`)\n               OR (`glpi_plugin_resources_ranks`.`end_date` > `glpi_plugin_resources_professions`.`end_date`)\n               OR (`glpi_plugin_resources_ranks`.`begin_date` < `glpi_plugin_resources_professions`.`begin_date`)\n               OR (`glpi_plugin_resources_ranks`.`end_date` IS NULL AND `glpi_plugin_resources_professions`.`end_date` IS NOT NULL)\n               OR (`glpi_plugin_resources_ranks`.`end_date` IS NOT NULL AND `glpi_plugin_resources_professions`.`end_date` IS NULL)\n             " . $condition . $report->getOrderBy('rank_id');
$report->setSqlRequest($query);
$report->execute();
Exemple #8
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();
}
This file is part of Resources.

Resources 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.

Resources 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 Resources. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
//Options for GLPI 0.71 and newer : need slave db to access the report
$USEDBREPLICATE = 1;
$DBCONNECTION_REQUIRED = 1;
include "../../../../inc/includes.php";
// Instantiate Report with Name
$titre = $LANG['plugin_resources']['resourceemploymentdiff'];
$report = new PluginReportsAutoReport($titre);
// Columns title (optional)
$report->setColumns(array(new PluginReportsColumn('registration_number', __('Administrative number'), array('sorton' => 'registration_number')), new PluginReportsColumnLink('resource_id', __('Name'), 'PluginResourcesResource', array('sorton' => 'resource_name')), new PluginReportsColumn('firstname', __('First name'), array('sorton' => 'firstname')), new PluginReportsColumnInteger('quota', __('Quota', 'resources'), array('sorton' => 'quota')), new PluginReportsColumn('resource_rank', __('Resource', 'resources') . " - " . PluginResourcesRank::getTypeName(1), array('sorton' => 'resource_rank')), new PluginReportsColumn('resource_profession', __('Resource', 'resources') . " - " . PluginResourcesProfession::getTypeName(1), array('sorton' => 'resource_profession')), new PluginReportsColumn('resource_professionline', __('Resource', 'resources') . " - " . PluginResourcesProfessionLine::getTypeName(1), array('sorton' => 'resource_professionline')), new PluginReportsColumn('resource_professioncategory', __('Resource', 'resources') . " - " . PluginResourcesProfessionCategory::getTypeName(1), array('sorton' => 'resource_professioncategory')), new PluginReportsColumnLink('employment_id', __('Name') . " - " . PluginResourcesEmployment::getTypeName(1), 'PluginResourcesEmployment', array('sorton' => 'employment_name')), new PluginReportsColumnFloat('ratio_employment_budget', __('Ratio Employment / Budget', 'resources'), array('sorton' => 'ratio_employment_budget')), new PluginReportsColumn('employment_rank', PluginResourcesEmployment::getTypeName(1) . " - " . PluginResourcesRank::getTypeName(1), array('sorton' => 'employment_rank')), new PluginReportsColumn('employment_profession', PluginResourcesEmployment::getTypeName(1) . " - " . PluginResourcesProfession::getTypeName(1), array('sorton' => 'employment_profession')), new PluginReportsColumn('employment_professionline', PluginResourcesEmployment::getTypeName(1) . " - " . PluginResourcesProfessionLine::getTypeName(1), array('sorton' => 'employment_professionline')), new PluginReportsColumn('employment_professioncategory', PluginResourcesEmployment::getTypeName(1) . " - " . PluginResourcesProfessionCategory::getTypeName(1), array('sorton' => 'employment_professioncategory')), new PluginReportsColumnDate('begin_date', __('Begin date'), array('sorton' => 'begin_date')), new PluginReportsColumnDate('end_date', __('End date'), array('sorton' => 'end_date')), new PluginReportsColumn('employment_state', PluginResourcesEmploymentState::getTypeName(1), array('sorton' => 'employment_state')), new PluginReportsColumn('employer_name', __('Name') . " - " . PluginResourcesEmployer::getTypeName(1), array('sorton' => 'employer_name'))));
// SQL statement
$condition = getEntitiesRestrictRequest(' AND ', "glpi_plugin_resources_employments", '', '', false);
//display only resource which have rank and profession not equal to employment rank or profession
$query = "SELECT `glpi_users`.`registration_number`,\n                          `glpi_users`.`id` as user_id,\n                          `glpi_plugin_resources_resources`.`id` as resource_id,\n                          `glpi_plugin_resources_resources`.`name` as resource_name,\n                          `glpi_plugin_resources_resources`.`firstname`,\n                          `glpi_plugin_resources_resources`.`quota`,\n                          `glpi_plugin_resources_ranks`.`name` AS resource_rank,\n                          `glpi_plugin_resources_professions`.`name` AS resource_profession,\n                          `glpi_plugin_resources_professionlines`.`name` AS resource_professionline,\n                          `glpi_plugin_resources_professioncategories`.`name` AS resource_professioncategory,\n                          `glpi_plugin_resources_employments`.`name` AS employment_name,\n                          `glpi_plugin_resources_employments`.`id` AS employment_id,\n                          `glpi_plugin_resources_employments`.`ratio_employment_budget`,\n                          `glpi_plugin_resources_employmentranks`.`name` AS employment_rank,\n                          `glpi_plugin_resources_employmentprofessions`.`name` AS employment_profession,\n                          `glpi_plugin_resources_employmentprofessionlines`.`name` AS employment_professionline,\n                          `glpi_plugin_resources_employmentprofessioncategories`.`name` AS employment_professioncategory,\n                          `glpi_plugin_resources_employments`.`begin_date`,\n                          `glpi_plugin_resources_employments`.`end_date`,\n                          `glpi_plugin_resources_employmentstates`.`name` AS employment_state,\n                          `glpi_plugin_resources_employers`.`name` AS employer_name\n                   FROM `glpi_users`\n                      LEFT JOIN `glpi_plugin_resources_resources_items`\n                        ON (`glpi_users`.`id` = `glpi_plugin_resources_resources_items`.`items_id`\n                                AND `glpi_plugin_resources_resources_items`.`itemtype`= 'User')\n                      LEFT JOIN `glpi_plugin_resources_resources`\n                        ON (`glpi_plugin_resources_resources`.`id` = `glpi_plugin_resources_resources_items`.`plugin_resources_resources_id`)\n                      LEFT JOIN `glpi_plugin_resources_employments`\n                        ON (`glpi_plugin_resources_resources`.`id` = `glpi_plugin_resources_employments`.`plugin_resources_resources_id` )\n                      LEFT JOIN `glpi_plugin_resources_ranks`\n                        ON (`glpi_plugin_resources_resources`.`plugin_resources_ranks_id` = `glpi_plugin_resources_ranks`.`id`)\n                      LEFT JOIN `glpi_plugin_resources_professions`\n                        ON (`glpi_plugin_resources_ranks`.`plugin_resources_professions_id` = `glpi_plugin_resources_professions`.`id`)\n                      LEFT JOIN `glpi_plugin_resources_professions` AS `glpi_plugin_resources_employmentprofessions`\n                        ON (`glpi_plugin_resources_employments`.`plugin_resources_professions_id` = `glpi_plugin_resources_employmentprofessions`.`id`)\n                      LEFT JOIN `glpi_plugin_resources_employers`\n                        ON (`glpi_plugin_resources_employments`.`plugin_resources_employers_id` = `glpi_plugin_resources_employers`.`id`)\n                      LEFT JOIN `glpi_plugin_resources_professionlines`\n                        ON (`glpi_plugin_resources_professions`.`plugin_resources_professionlines_id` = `glpi_plugin_resources_professionlines`.`id`)\n                      LEFT JOIN `glpi_plugin_resources_professioncategories`\n                        ON (`glpi_plugin_resources_professions`.`plugin_resources_professioncategories_id` = `glpi_plugin_resources_professioncategories`.`id`)\n                      LEFT JOIN `glpi_plugin_resources_ranks` AS `glpi_plugin_resources_employmentranks`\n                        ON (`glpi_plugin_resources_employments`.`plugin_resources_ranks_id` = `glpi_plugin_resources_employmentranks`.`id`)\n                      LEFT JOIN `glpi_plugin_resources_professionlines` AS `glpi_plugin_resources_employmentprofessionlines`\n                        ON (`glpi_plugin_resources_employmentprofessions`.`plugin_resources_professionlines_id` = `glpi_plugin_resources_employmentprofessionlines`.`id`)\n                      LEFT JOIN `glpi_plugin_resources_professioncategories` AS `glpi_plugin_resources_employmentprofessioncategories`\n                        ON (`glpi_plugin_resources_employmentprofessions`.`plugin_resources_professioncategories_id` = `glpi_plugin_resources_employmentprofessioncategories`.`id`)\n                      LEFT JOIN `glpi_plugin_resources_employmentstates`\n                        ON (`glpi_plugin_resources_employments`.`plugin_resources_employmentstates_id` = `glpi_plugin_resources_employmentstates`.`id`)\n                   WHERE (`glpi_plugin_resources_resources`.`is_leaving` = 0\n                          AND `glpi_users`.`is_active` = 1\n                          AND `glpi_plugin_resources_employments`.`plugin_resources_resources_id` <> 0\n                          AND `glpi_plugin_resources_resources`.`is_deleted` = '0'\n                          AND `glpi_plugin_resources_resources`.`is_template` = '0'\n                          " . $condition . " )\n                   GROUP BY `glpi_plugin_resources_employments`.`id`, `glpi_users`.`id`\n                   HAVING (resource_profession <> employment_profession\n                                 OR resource_rank <> employment_rank)" . $report->getOrderBy('registration_number');
$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 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
@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;
// not really a big SQL request
include "../../../../inc/includes.php";
//TRANS: The name of the report = Location tree
$report = new PluginReportsAutoReport(__('location_report_title', 'reports'));
$report->setColumns(array(new PluginReportsColumn('entity', __('Entity'), array('sorton' => 'entity,location')), new PluginReportsColumn('location', __('Location'), array('sorton' => 'location')), new PluginReportsColumnLink('link', _n('Link', 'Links', 2), 'Location', array('sorton' => '`glpi_locations`.`name`'))));
// SQL statement
$query = "SELECT `glpi_entities`.`completename` AS entity,\n                 `glpi_locations`.`completename` AS location,\n                 `glpi_locations`.`id` AS link\n          FROM `glpi_locations`\n          LEFT JOIN `glpi_entities` ON (`glpi_locations`.`entities_id` = `glpi_entities`.`id`)" . getEntitiesRestrictRequest(" WHERE ", "glpi_locations") . $report->getOrderBy('entity');
$report->setGroupBy('entity');
$report->setSqlRequest($query);
$report->execute();
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, Alexandre Delaunay
@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 = Number of equipments by location
$report = new PluginReportsAutoReport(__('equipmentbylocation_report_title', 'reports'));
$report->setColumns(array(new PluginReportsColumn('entity', __('Entity')), new PluginReportsColumn('location', __('Location')), new PluginReportsColumnInteger('computernumber', _n('Computer', 'Computers', 2)), new PluginReportsColumnInteger('networknumber', _n('Network', 'Networks', 2)), new PluginReportsColumnInteger('monitornumber', _n('Monitor', 'Monitors', 2)), new PluginReportsColumnInteger('printernumber', _n('Printer', 'Printers', 2)), new PluginReportsColumnInteger('peripheralnumber', _n('Device', 'Devices', 2)), new PluginReportsColumnInteger('phonenumber', _n('Phone', 'Phones', 2))));
$query = "SELECT i.`entity`, i.`location`, i.`computernumber`, i.`networknumber`,\n                 i.`monitornumber`, i.`printernumber`, j.`peripheralnumber`, l.`phonenumber`\n          FROM (SELECT g.`entity`, g.`location`, g.`computernumber`, g.`networknumber`,\n                       g.`monitornumber`, h.`printernumber`, g.`id`\n                FROM (SELECT e.`entity`, e.`location`, e.`computernumber`, e.`networknumber`,\n                             f.`monitornumber`, e.`id`\n                      FROM (SELECT c.`entity`, c.`location`, c.`computernumber`, d.`networknumber`,\n                                   c.`id`\n                            FROM (SELECT a.`entity`, a.`location`, b.`computernumber`, a.`id`\n                                  FROM (SELECT `glpi_entities`.`completename` AS entity,\n                                               `glpi_locations`.`completename` AS location,\n                                               `glpi_locations`.`id` AS id\n                                        FROM `glpi_locations`\n                                        LEFT JOIN `glpi_entities`\n                                          ON (`glpi_locations`.`entities_id`=`glpi_entities`.`id`) " . getEntitiesRestrictRequest(" WHERE ", "glpi_locations") . ") a\n                                  LEFT OUTER JOIN (SELECT count(*) AS computernumber,\n                                                          `glpi_computers`.`locations_id` AS id\n                                                   FROM `glpi_computers`\n                                                   WHERE is_deleted=0 AND is_template=0\n                                                   " . getEntitiesRestrictRequest(" AND ", "glpi_computers") . "\n                                                   GROUP BY `glpi_computers`.`locations_id`) b\n                                       ON (a.id = b.id)\n                                 ) c\n                            LEFT OUTER JOIN (SELECT count(*) AS networknumber,\n                                                    `glpi_networkequipments`.`locations_id` AS id\n                                             FROM `glpi_networkequipments`\n                                             WHERE is_deleted=0 AND is_template=0\n                                             " . getEntitiesRestrictRequest(" AND ", "glpi_networkequipments") . "\n                                             GROUP BY `glpi_networkequipments`.`locations_id`) d\n                                 ON (c.id = d.id)\n                           ) e\n                      LEFT OUTER JOIN (SELECT count(*) AS monitornumber,\n                                              `glpi_monitors`.`locations_id` AS id\n                                       FROM `glpi_monitors`\n                                       WHERE is_deleted=0 AND is_template=0\n                                       " . getEntitiesRestrictRequest(" AND ", "glpi_monitors") . "\n                                       GROUP BY `glpi_monitors`.`locations_id`) f\n                           ON (e.id = f.id)\n                     ) g\n                LEFT OUTER JOIN (SELECT count(*) AS printernumber,\n                                        `glpi_printers`.`locations_id` AS id\n                                 FROM `glpi_printers`\n                                 WHERE is_deleted=0 AND is_template=0\n                                 " . getEntitiesRestrictRequest(" AND ", "glpi_printers") . "\n                                 GROUP BY `glpi_printers`.`locations_id`) h\n                     ON (g.id = h.id)\n               ) i\n          LEFT OUTER JOIN (SELECT count(*) AS peripheralnumber,\n                                  `glpi_peripherals`.`locations_id` AS id\n                              FROM `glpi_peripherals`\n                              WHERE is_deleted=0 AND is_template=0\n                              " . getEntitiesRestrictRequest(" AND ", "glpi_peripherals") . "\n                              GROUP BY `glpi_peripherals`.`locations_id`) j\n               ON (i.id = j.id)\n          LEFT OUTER JOIN (SELECT count(*) AS phonenumber,\n                                  `glpi_phones`.`locations_id` AS id\n                           FROM `glpi_phones`\n                           WHERE is_deleted=0 AND is_template=0\n                           " . getEntitiesRestrictRequest(" AND ", "glpi_phones") . "\n                           GROUP BY `glpi_phones`.`locations_id`) l\n               ON (i.id = l.id)\n          ORDER BY i.entity, i.location";
$report->setGroupBy("entity");
$report->setSqlRequest($query);
$report->execute();
Resources 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.

Resources 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 Resources. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
//Options for GLPI 0.71 and newer : need slave db to access the report
$USEDBREPLICATE = 1;
$DBCONNECTION_REQUIRED = 0;
include "../../../../inc/includes.php";
//"Rapport listant les ressources partantes ayant des emplois actifs"
//"Report listing resource leaving with employment active";
// Instantiate Report with Name
$titre = $LANG['plugin_resources']['resourceleavingwithactiveemployment'];
$report = new PluginReportsAutoReport($titre);
// Columns title (optional), from $LANG
$report->setColumns(array(new PluginReportsColumnInteger('registration_number', __('Administrative number'), array('sorton' => 'registration_number')), new PluginReportsColumnLink('resource_id', __('Name'), 'PluginResourcesResource', array('sorton' => 'resource_name')), new PluginReportsColumn('firstname', __('First name'), array('sorton' => 'firstname')), new PluginReportsColumn('resource_rank', PluginResourcesRank::getTypeName(1), array('sorton' => 'resource_rank')), new PluginReportsColumn('resources_situation', PluginResourcesResourceSituation::getTypeName(1), array('sorton' => 'resources_situation')), new PluginReportsColumn('resource_state', PluginResourcesResourceState::getTypeName(1), array('sorton' => 'resource_state')), new PluginReportsColumnDate('date_begin', __('Arrival date', 'resources'), array('sorton' => 'date_begin')), new PluginReportsColumnDate('date_end', __('Departure date', 'resources'), array('sorton' => 'date_end')), new PluginReportsColumnLink('employment_id', __('Name') . " - " . _n('Employment', 'Employments', 1, 'resources'), 'PluginResourcesEmployment', array('sorton' => 'employment_name')), new PluginReportsColumn('employment_profession', _n('Employment', 'Employments', 1, 'resources') . " - " . _n('Profession', 'Professions', 2, 'resources'), array('sorton' => 'employment_profession')), new PluginReportsColumn('employment_state', _n('Employment state', 'Employment states', 1, 'resources'), array('sorton' => 'employment_state')), new PluginReportsColumn('employer_name', __('Name') . " - " . _n('Employer', 'Employers', 1, 'resources'), array('sorton' => 'employer_name'))));
// SQL statement
$condition = getEntitiesRestrictRequest(' AND ', "glpi_plugin_resources_resources", '', '', false);
//display only leaving resource with active employment
$query = "SELECT `glpi_users`.`registration_number`,\n                 `glpi_users`.`id` as user_id,\n                 `glpi_plugin_resources_resources`.`id` as resource_id,\n                 `glpi_plugin_resources_resources`.`name` as resource_name,\n                 `glpi_plugin_resources_resources`.`firstname`,\n                 `glpi_plugin_resources_ranks`.`name` AS resource_rank,\n                 `glpi_plugin_resources_resourcesituations`.`name` AS resources_situation,\n                 `glpi_plugin_resources_resourcestates`.`name` AS resource_state,\n                 `glpi_plugin_resources_resources`.`date_begin`,\n                 `glpi_plugin_resources_resources`.`date_end`,\n                 `glpi_plugin_resources_employments`.`name` AS employment_name,\n                 `glpi_plugin_resources_employments`.`id` AS employment_id,\n                 `glpi_plugin_resources_employmentprofessions`.`name` AS employment_profession,\n                        `glpi_plugin_resources_employmentstates`.`name` AS employment_state,\n                 `glpi_plugin_resources_employers`.`completename` AS employer_name\n          FROM `glpi_users`\n          LEFT JOIN `glpi_plugin_resources_resources_items`\n               ON (`glpi_users`.`id` = `glpi_plugin_resources_resources_items`.`items_id`\n                  AND `glpi_plugin_resources_resources_items`.`itemtype`= 'User')\n          LEFT JOIN `glpi_plugin_resources_resources`\n               ON (`glpi_plugin_resources_resources`.`id` = `glpi_plugin_resources_resources_items`.`plugin_resources_resources_id`)\n          LEFT JOIN `glpi_plugin_resources_resourcesituations`\n               ON (`glpi_plugin_resources_resources`.`plugin_resources_resourcesituations_id` = `glpi_plugin_resources_resourcesituations`.`id`)\n          LEFT JOIN `glpi_plugin_resources_resourcestates`\n               ON (`glpi_plugin_resources_resources`.`plugin_resources_resourcestates_id` = `glpi_plugin_resources_resourcestates`.`id`)\n          LEFT JOIN `glpi_plugin_resources_employments`\n               ON (`glpi_plugin_resources_resources`.`id` = `glpi_plugin_resources_employments`.`plugin_resources_resources_id` )\n          LEFT JOIN `glpi_plugin_resources_ranks`\n               ON (`glpi_plugin_resources_resources`.`plugin_resources_ranks_id` = `glpi_plugin_resources_ranks`.`id`)\n          LEFT JOIN `glpi_plugin_resources_professions` AS `glpi_plugin_resources_employmentprofessions`\n               ON (`glpi_plugin_resources_employments`.`plugin_resources_professions_id` = `glpi_plugin_resources_employmentprofessions`.`id`)\n          LEFT JOIN `glpi_plugin_resources_employers`\n               ON (`glpi_plugin_resources_employments`.`plugin_resources_employers_id` = `glpi_plugin_resources_employers`.`id`)\n          LEFT JOIN `glpi_plugin_resources_employmentstates`\n               ON (`glpi_plugin_resources_employments`.`plugin_resources_employmentstates_id` = `glpi_plugin_resources_employmentstates`.`id`)\n          WHERE (`glpi_plugin_resources_resources`.`is_leaving` = 1\n             AND `glpi_users`.`is_active` = 1\n             AND `glpi_plugin_resources_employments`.`plugin_resources_resources_id` <> 0\n             AND `glpi_plugin_resources_resources`.`is_deleted` = '0'\n             AND `glpi_plugin_resources_resources`.`is_template` = '0'\n             AND `glpi_plugin_resources_employmentstates`.`is_active` = 1\n             " . $condition . " )\n             GROUP BY `glpi_plugin_resources_employments`.`id`, `glpi_users`.`id`" . $report->getOrderBy('registration_number');
$report->setSqlRequest($query);
$report->execute();
@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();
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 = List of equipments by location
$report = new PluginReportsAutoReport(__('listequipmentbylocation_report_title', 'reports'));
$loc = new PluginReportsLocationCriteria($report);
$report->setColumns(array(new PluginReportsColumnType('itemtype', __('Type')), new PluginReportsColumnTypeLink('items_id', __('Item'), 'itemtype', array('with_comment' => 1)), new PluginReportsColumn('serial', __('Serial number')), new PluginReportsColumn('otherserial', __('Inventory number')), new PluginReportsColumnModelType('models_id', __('Model'), 'itemtype', array('with_comment' => 1)), new PluginReportsColumnTypeType('types_id', __('Type'), 'itemtype', array('with_comment' => 1))));
//Display criterias form is needed
$report->displayCriteriasForm();
//If criterias have been validated
if ($report->criteriasValidated()) {
    $report->setSubNameAuto();
    $query = getSqlSubRequest("Computer", $loc, new Computer());
    foreach ($CFG_GLPI["infocom_types"] as $itemtype) {
        $obj = new $itemtype();
        if ($obj->isField('locations_id')) {
            $query .= "UNION (" . getSqlSubRequest($itemtype, $loc, $obj) . ")";
        }
    }
    $report->setGroupBy("entity", "itemtype");
    $report->setSqlRequest($query);
    $report->execute();
*/
/*
 * ----------------------------------------------------------------------
 * 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();
}
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.

Resources 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 Resources. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
//Options for GLPI 0.71 and newer : need slave db to access the report
$USEDBREPLICATE = 1;
$DBCONNECTION_REQUIRED = 0;
include "../../../../inc/includes.php";
//"Rapport listant les ressources sans emploi";
//"Report listing resource without employment";
// Instantiate Report with Name
$titre = $LANG['plugin_resources']['resourcewithoutemployment'];
$report = new PluginReportsAutoReport($titre);
// Columns title (optional)
$report->setColumns(array(new PluginReportsColumnInteger('registration_number', __('Administrative number'), array('sorton' => 'registration_number')), new PluginReportsColumnLink('resource_id', __('Name'), 'PluginResourcesResource', array('sorton' => 'resource_name')), new PluginReportsColumn('firstname', __('First name'), array('sorton' => 'firstname')), new PluginReportsColumn('rank', PluginResourcesRank::getTypeName(1), array('sorton' => 'rank')), new PluginReportsColumn('situation', PluginResourcesResourceSituation::getTypeName(1), array('sorton' => 'situation')), new PluginReportsColumn('state', PluginResourcesResourceState::getTypeName(1), array('sorton' => 'state')), new PluginReportsColumnDate('date_begin', __('Arrival date', 'resources'), array('sorton' => 'date_begin')), new PluginReportsColumnDate('date_end', __('Departure date', 'resources'), array('sorton' => 'date_end'))));
// SQL statement
$condition = getEntitiesRestrictRequest(' AND ', "glpi_plugin_resources_resources", '', '', false);
$date = date("Y-m-d");
//display only resource without user linked
$query = "SELECT `glpi_users`.`registration_number`,\n                 `glpi_users`.`id` as user_id,\n                 `glpi_plugin_resources_resources`.`id` as resource_id,\n                 `glpi_plugin_resources_resources`.`name` as resource_name,\n                 `glpi_plugin_resources_resources`.`firstname`,\n                 `glpi_plugin_resources_ranks`.`name` AS rank,\n                 `glpi_plugin_resources_resourcesituations`.`name` AS situation,\n                 `glpi_plugin_resources_resourcestates`.`name` AS state,\n                 `glpi_plugin_resources_resources`.`date_begin`,\n                 `glpi_plugin_resources_resources`.`date_end`\n          FROM `glpi_users`\n          LEFT JOIN `glpi_plugin_resources_resources_items`\n               ON (`glpi_users`.`id` = `glpi_plugin_resources_resources_items`.`items_id`\n                  AND `glpi_plugin_resources_resources_items`.`itemtype`= 'User')\n          LEFT JOIN `glpi_plugin_resources_resources`\n               ON (`glpi_plugin_resources_resources`.`id` = `glpi_plugin_resources_resources_items`.`plugin_resources_resources_id`)\n          LEFT JOIN `glpi_plugin_resources_ranks`\n               ON (`glpi_plugin_resources_resources`.`plugin_resources_ranks_id` = `glpi_plugin_resources_ranks`.`id`)\n          LEFT JOIN `glpi_plugin_resources_resourcesituations`\n               ON (`glpi_plugin_resources_resources`.`plugin_resources_resourcesituations_id` = `glpi_plugin_resources_resourcesituations`.`id`)\n          LEFT JOIN `glpi_plugin_resources_resourcestates`\n               ON (`glpi_plugin_resources_resources`.`plugin_resources_resourcestates_id` = `glpi_plugin_resources_resourcestates`.`id`)\n          WHERE (`glpi_plugin_resources_resources`.`is_leaving` = 0\n             AND `glpi_users`.`is_active` = 1\n             AND `glpi_plugin_resources_resources`.`is_deleted` = '0'\n             AND `glpi_plugin_resources_resources`.`is_template` = '0'\n             AND `glpi_plugin_resources_resources`.`id` NOT IN\n                     (SELECT DISTINCT(`plugin_resources_resources_id`)\n                      FROM `glpi_plugin_resources_employments`\n                      WHERE ((`glpi_plugin_resources_employments`.`end_date` IS NULL )\n                          OR (`glpi_plugin_resources_employments`.`end_date` > '" . $date . "' ))\n                          AND ((`glpi_plugin_resources_employments`.`begin_date` IS NULL)\n                          OR ( `glpi_plugin_resources_employments`.`begin_date` < '" . $date . "')))\n             " . $condition . ")\n                          AND ((`glpi_plugin_resources_resources`.`date_end` IS NULL )\n                          OR (`glpi_plugin_resources_resources`.`date_end` > '" . $date . "' ))\n                          AND ((`glpi_plugin_resources_resources`.`date_begin` IS NULL)\n                          OR ( `glpi_plugin_resources_resources`.`date_begin` < '" . $date . "'))" . $report->getOrderBy('resource_id');
$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();
}
Exemple #18
0
 * ----------------------------------------------------------------------
 */
//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(__("deliveryinfos_report_title", "order"));
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('suppliers_id', __("Supplier"), 'Supplier'), new PluginReportsColumnLink('entities_id', __("Entity"), 'Entity'), new PluginReportsColumnInteger('total', __("Orders total", "order")), new PluginReportsColumnInteger('late', __("Late orders total", "order"))));
    //TODO : ne pas chercher dans la poublelles
    $query_total = "SELECT count(*) FROM `glpi_plugin_order_orders`";
    $query_total .= getEntitiesRestrictRequest(" WHERE", "glpi_plugin_order_orders");
    $query_total .= $report->addSqlCriteriasRestriction();
    $query_total .= "AND `glpi_plugin_order_orders`.`suppliers_id`=`suppliers`.`id`";
    $query_late = $query_total . " AND `is_late`='1' AND `is_deleted`='0' AND `is_template`='0'";
    $supplier = "JOIN `glpi_suppliers`as suppliers\n                                 ON (`glpi_plugin_order_orders`.`suppliers_id` = suppliers.`id`)";
    $query = "SELECT DISTINCT `suppliers_id`, ({$query_total}) AS `total`, ({$query_late}) AS `late`\n            FROM `glpi_plugin_order_orders` {$supplier}";
    $query .= getEntitiesRestrictRequest(" WHERE", "glpi_plugin_order_orders");
    $query .= $report->addSqlCriteriasRestriction();
    $report->setGroupBy("suppliers_id");
    $report->setSqlRequest($query);
    $report->execute();
}