Example #1
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();
}
@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();
}