Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
name: "Generate CI matrix"
uses: "glpi-project/plugin-ci-workflows/.github/workflows/generate-ci-matrix.yml@v1"
with:
glpi-version: "11.0.x"
glpi-version: "12.0.x"
ci:
name: "GLPI ${{ matrix.glpi-version }} - php:${{ matrix.php-version }} - ${{ matrix.db-image }}"
needs: "generate-ci-matrix"
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
## [1.11.0] - 2026-10-06

### Added

- GLPI 12 compatibility

### Fixed

Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
# More reporting GLPI plugin
# More Reporting GLPI plugin

[![Join the chat at https://gitter.im/TECLIB/mreporting](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/TECLIB/mreporting?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

![Dashboard](https://raw.githubusercontent.com/PluginsGLPI/mreporting/main/screenshots/dashboard.png)

* Download : https://github.com/PluginsGLPI/mreporting/releases
* Translations on Transifex service : https://explore.transifex.com/teclib/glpi-project-plugin-mreporting/
* WIKI (Develop new reports) : https://github.com/PluginsGLPI/mreporting/wiki

## Contributing

* Open a ticket for each bug/feature so it can be discussed
Expand Down
8 changes: 2 additions & 6 deletions front/config.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,8 @@

Session::checkRight('config', UPDATE);

if (!isset($_GET['id'])) {
$_GET['id'] = 0;
}
if (!isset($_GET['preconfig'])) {
$_GET['preconfig'] = -1;
}
$_GET['id'] ??= 0;
$_GET['preconfig'] ??= -1;

$config = new PluginMreportingConfig();

Expand Down
4 changes: 1 addition & 3 deletions front/preference.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@

Session::checkLoginUser();

if (!isset($_GET['id'])) {
$_GET['id'] = '';
}
$_GET['id'] ??= '';

$pref = new PluginMreportingPreference();

Expand Down
4 changes: 1 addition & 3 deletions inc/baseclass.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@ public function __construct($config = [])
= $_SESSION['mreporting_values']['status_6'] = 0;
}

if (!isset($_SESSION['mreporting_values']['period'])) {
$_SESSION['mreporting_values']['period'] = 'month';
}
$_SESSION['mreporting_values']['period'] ??= 'month';
if (
isset($_SESSION['mreporting_values']['period'])
&& !empty($_SESSION['mreporting_values']['period'])
Expand Down
50 changes: 16 additions & 34 deletions inc/common.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

class PluginMreportingCommon extends CommonDBTM
{
public static $rightname = 'statistic';
public static string $rightname = 'statistic';

public const MNBSP = '       
       
Expand All @@ -60,16 +60,8 @@ public static function canCreate(): bool

public static function getMenuContent()
{
/** @var array $CFG_GLPI */
global $CFG_GLPI;

$web_full_dir = $CFG_GLPI['url_base'] . '/plugins/mreporting';
$img_db = "<img src='" . $web_full_dir . "/pics/dashboard.png'
title='" . __s('Dashboard', 'mreporting') . "'
alt='" . __s('Dashboard', 'mreporting') . "'>";
$img_ct = "<img src='" . $web_full_dir . "/pics/list_dashboard.png'
title='" . __s('Reports list', 'mreporting') . "'
alt='" . __s('Reports list', 'mreporting') . "'>";
$icon_db = "<i class='ti ti-layout-dashboard' title='" . __s('Dashboard', 'mreporting') . "'></i>" . __s('Dashboard', 'mreporting');
$icon_ct = "<i class='ti ti-list' title='" . __s('Reports list', 'mreporting') . "'></i>" . __s('Reports list', 'mreporting');

$web_rel_dir = '/plugins/mreporting';
$url_central = "$web_rel_dir/front/central.php";
Expand All @@ -82,15 +74,17 @@ public static function getMenuContent()
$menu['title'] = self::getTypeName(Session::getPluralNumber());

$menu['options']['dashboard']['page'] = $url_dashboard;
$menu['options']['dashboard']['icon'] = 'ti ti-layout-dashboard';
$menu['options']['dashboard']['title'] = __s('Dashboard', 'mreporting');
$menu['options']['dashboard']['links'][$img_db] = $url_dashboard;
$menu['options']['dashboard']['links'][$img_ct] = $url_central;
$menu['options']['dashboard']['links'][$icon_db] = $url_dashboard;
$menu['options']['dashboard']['links'][$icon_ct] = $url_central;
if (PluginMreportingConfig::canCreate()) {
$menu['options']['dashboard']['links']['config'] = PluginMreportingConfig::getSearchURL(false);
}

$menu['options']['dashboard_list'] = $menu['options']['dashboard'];
$menu['options']['dashboard_list']['page'] = $url_central;
$menu['options']['dashboard_list']['icon'] = 'ti ti-list';
$menu['options']['dashboard_list']['title'] = __s('Reports list', 'mreporting');

$menu['options']['config']['title'] = PluginMreportingConfig::getTypeName(2);
Expand Down Expand Up @@ -645,9 +639,7 @@ public function showGraph($opt, $export = false, $forceFormat = null)
$opt['hide_title'] = false;
}

if (!isset($opt['width'])) {
$opt['width'] = false;
}
$opt['width'] ??= false;

//check the format display charts configured in glpi
$opt = $this->initParams($opt, $export);
Expand All @@ -664,15 +656,11 @@ public function showGraph($opt, $export = false, $forceFormat = null)
}

//generate default date
if (!isset($_SESSION['mreporting_values']['date1' . $config['randname']])) {
$_SESSION['mreporting_values']['date1' . $config['randname']] = date(
'Y-m-d',
time() - (intval($config['delay']) * 24 * 60 * 60),
);
}
if (!isset($_SESSION['mreporting_values']['date2' . $config['randname']])) {
$_SESSION['mreporting_values']['date2' . $config['randname']] = date('Y-m-d');
}
$_SESSION['mreporting_values']['date1' . $config['randname']] ??= date(
'Y-m-d',
time() - (intval($config['delay']) * 24 * 60 * 60),
);
$_SESSION['mreporting_values']['date2' . $config['randname']] ??= date('Y-m-d');

// save/clear selectors
if (isset($opt['submit'])) {
Expand Down Expand Up @@ -1599,12 +1587,8 @@ public static function selectorDateinterval()
{
$randname = 'PluginMreporting' . $_REQUEST['short_classname'] . $_REQUEST['f_name'];

if (!isset($_SESSION['mreporting_values']['date1' . $randname])) {
$_SESSION['mreporting_values']['date1' . $randname] = date('Y-m-d', time() - (365 * 24 * 60 * 60));
}
if (!isset($_SESSION['mreporting_values']['date2' . $randname])) {
$_SESSION['mreporting_values']['date2' . $randname] = date('Y-m-d');
}
$_SESSION['mreporting_values']['date1' . $randname] ??= date('Y-m-d', time() - (365 * 24 * 60 * 60));
$_SESSION['mreporting_values']['date2' . $randname] ??= date('Y-m-d');

$date1 = $_SESSION['mreporting_values']['date1' . $randname];
echo '<b>' . __s('Start date') . '</b><br />';
Expand Down Expand Up @@ -1917,9 +1901,7 @@ public static function getSelectorValuesByUser()
public static function addToSelector()
{
foreach ($_REQUEST as $key => $value) {
if (!isset($_SESSION['mreporting_values'][$key])) {
$_SESSION['mreporting_values'][$key] = $value;
}
$_SESSION['mreporting_values'][$key] ??= $value;
}
}

Expand Down
2 changes: 1 addition & 1 deletion inc/config.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

class PluginMreportingConfig extends CommonDBTM
{
public static $rightname = 'config';
public static string $rightname = 'config';

public static function getTypeName($nb = 0)
{
Expand Down
10 changes: 3 additions & 7 deletions inc/graphpng.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,9 @@ public function initGraph($options)
if (!$options['export'] && !$options['showHeader']) {
$width = $this->width + 100;

if (!isset($_REQUEST['date1' . $randname])) {
$_REQUEST['date1' . $randname] = date('Y-m-d', time()
- ($options['delay'] * 24 * 60 * 60));
}
if (!isset($_REQUEST['date2' . $randname])) {
$_REQUEST['date2' . $randname] = date('Y-m-d');
}
$_REQUEST['date1' . $randname] ??= date('Y-m-d', time()
- ($options['delay'] * 24 * 60 * 60));
$_REQUEST['date2' . $randname] ??= date('Y-m-d');

$backtrace = debug_backtrace();
$prev_function = strtolower(str_replace('show', '', $backtrace[1]['function']));
Expand Down
20 changes: 5 additions & 15 deletions inc/helpdeskplus.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,7 @@ public function reportVstackbarLifetime($config = [])
'multiplegroupassign', 'userassign', 'category',
];

if (!isset($_SESSION['mreporting_values']['date2' . $config['randname']])) {
$_SESSION['mreporting_values']['date2' . $config['randname']] = date('Y-m-d');
}
$_SESSION['mreporting_values']['date2' . $config['randname']] ??= date('Y-m-d');

//Init delay value
$delay = PluginMreportingCommon::getCriteriaDate('glpi_tickets.date', $config['delay'], $config['randname']);
Expand Down Expand Up @@ -527,9 +525,7 @@ public function reportVstackbarTicketsgroups($config = [])
$tab = [];
$datas = [];

if (!isset($_SESSION['mreporting_values']['date2' . $config['randname']])) {
$_SESSION['mreporting_values']['date2' . $config['randname']] = date('Y-m-d');
}
$_SESSION['mreporting_values']['date2' . $config['randname']] ??= date('Y-m-d');

//Init delay value
$delay = PluginMreportingCommon::getCriteriaDate('glpi_tickets.date', $config['delay'], $config['randname']);
Expand Down Expand Up @@ -593,9 +589,7 @@ public function reportVstackbarTicketstech($config = [])
$tab = [];
$datas = [];

if (!isset($_SESSION['mreporting_values']['date2' . $config['randname']])) {
$_SESSION['mreporting_values']['date2' . $config['randname']] = date('Y-m-d');
}
$_SESSION['mreporting_values']['date2' . $config['randname']] ??= date('Y-m-d');

foreach ($this->status as $current_status) {
if ($_SESSION['mreporting_values']['status_' . $current_status] == '1') {
Expand Down Expand Up @@ -634,9 +628,7 @@ public function reportVstackbarTicketstech($config = [])
foreach ($result as $data) {
$data['name'] = empty($data['completename']) ? __s('None') : $data['completename'];

if (!isset($tab[$data['name']][$status_name])) {
$tab[$data['name']][$status_name] = 0;
}
$tab[$data['name']][$status_name] ??= 0;

$tab[$data['name']][$status_name] += $data['nb'];
}
Expand Down Expand Up @@ -1325,9 +1317,7 @@ public function reportVstackbarRespectedSlasByGroup($config = [])
$datas['labels2'][$group_name] = $group_name;
$datas['datas'][$LANG['plugin_mreporting']['Helpdeskplus']['slaobserved']][$group_name] = 0;
}
if (!isset($datas['datas'][$LANG['plugin_mreporting']['Helpdeskplus']['slanotobserved']][$group_name])) {
$datas['datas'][$LANG['plugin_mreporting']['Helpdeskplus']['slanotobserved']][$group_name] = 0;
}
$datas['datas'][$LANG['plugin_mreporting']['Helpdeskplus']['slanotobserved']][$group_name] ??= 0;
}

//Flip array to have observed SLA first
Expand Down
6 changes: 2 additions & 4 deletions inc/inventory.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ public function reportHbarLinuxDistro($config = [])
],
);

if ($number) {
if ($number !== 0) {
$data['datas'][$os['name']] = $number;
}
}
Expand Down Expand Up @@ -959,9 +959,7 @@ public function reportHbarMonitors($config = [])
$data = [];
foreach ($DB->request($query) as $result) {
$label = $result['cpt'] . ' ' . _sn('Monitor', 'Monitors', $result['cpt']);
if (!isset($data['datas'][$label])) {
$data['datas'][$label] = 0;
}
$data['datas'][$label] ??= 0;
$data['datas'][$label] += 1;
}

Expand Down
2 changes: 1 addition & 1 deletion inc/notification.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PluginMreportingNotification extends CommonDBTM
/**
* @var boolean activate the history for the plugin
*/
public $dohistory = true;
public bool $dohistory = true;

/**
* Return the localized name of the current Type (PluginMreporting)
Expand Down
2 changes: 1 addition & 1 deletion inc/preference.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function addDefaultPreference($users_id)
public static function checkPreferenceValue($field, $users_id = 0)
{
$data = getAllDataFromTable(getTableForItemType(self::class), ['users_id' => $users_id]);
if (!empty($data)) {
if ($data !== []) {
$first = array_pop($data);

return $first[$field];
Expand Down
4 changes: 2 additions & 2 deletions inc/profile.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

class PluginMreportingProfile extends CommonDBTM
{
public static $rightname = 'profile';
public static string $rightname = 'profile';

public static function getTypeName($nb = 0)
{
Expand Down Expand Up @@ -143,7 +143,7 @@ public function getFromDBByProfile($profiles_id)
}
$this->fields = $result->current();

return (is_array($this->fields) && count($this->fields));
return count($this->fields) > 0;
}

/**
Expand Down
5 changes: 5 additions & 0 deletions mreporting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ Voir documentation : https://github.com/PluginsGLPI/mreporting/wiki
<author>Infotel</author>
</authors>
<versions>
<version>
<num>1.11.0</num>
<compatibility>~12.0.0</compatibility>
<download_url>https://github.com/pluginsGLPI/mreporting/releases/download/1.11.0/glpi-mreporting-1.11.0.tar.bz2</download_url>
</version>
<version>
<num>1.10.3</num>
<compatibility>~11.0.0</compatibility>
Expand Down
8 changes: 4 additions & 4 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
* -------------------------------------------------------------------------
*/

define('PLUGIN_MREPORTING_VERSION', '1.10.3');
define('PLUGIN_MREPORTING_VERSION', '1.11.0');

// Minimal GLPI version, inclusive
define('PLUGIN_MREPORTING_MIN_GLPI', '11.0.0');
define('PLUGIN_MREPORTING_MIN_GLPI', '12.0.0');
// Maximum GLPI version, exclusive
define('PLUGIN_MREPORTING_MAX_GLPI', '11.0.99');
define('PLUGIN_MREPORTING_MAX_GLPI', '12.0.99');

if (!defined('PLUGIN_MREPORTING_DIR')) {
define('PLUGIN_MREPORTING_DIR', __DIR__);
Expand Down Expand Up @@ -190,7 +190,7 @@ function plugin_init_mreporting()
function plugin_version_mreporting()
{
return [
'name' => __s('More Reporting', 'mreporting'),
'name' => 'More Reporting',
'version' => PLUGIN_MREPORTING_VERSION,
'author' => "<a href='http://www.teclib.com'>Teclib'</a> & <a href='http://www.infotel.com'>Infotel</a>",
'homepage' => 'https://github.com/pluginsGLPI/mreporting',
Expand Down
Loading