Skip to content

Commit

Permalink
Merge branch 'release/1.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-anne committed Dec 10, 2018
2 parents 3a46e4d + 41353c1 commit b1ad3de
Show file tree
Hide file tree
Showing 7 changed files with 204 additions and 106 deletions.
248 changes: 165 additions & 83 deletions composer.lock

Large diffs are not rendered by default.

19 changes: 13 additions & 6 deletions inc/common.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,7 @@ static function selectorForMultipleGroups($field, $condition = [], $label = '')
Dropdown::showFromArray($field, $datas, $param);
}

static function selectorForSingleGroup($field, $condition = '', $label = '') {
static function selectorForSingleGroup($field, $condition = [], $label = '') {
echo "<br /><b>".$label." : </b><br />";

$value = isset($_SESSION['mreporting_values'][$field]) ? $_SESSION['mreporting_values'][$field] : 0;
Expand All @@ -1319,12 +1319,19 @@ static function selectorForSingleGroup($field, $condition = '', $label = '') {


static function selectorGrouprequest() {
self::selectorForSingleGroup('groups_request_id', 'is_requester = 1', __("Requester group"));
self::selectorForSingleGroup(
'groups_request_id',
['is_requester' => 1],
__("Requester group")
);
}

static function selectorGroupassign() {
self::selectorForSingleGroup('groups_assign_id', 'is_assign = 1',
__("Group in charge of the ticket"));
self::selectorForSingleGroup(
'groups_assign_id',
['is_assign' => 1],
__("Group in charge of the ticket")
);
}

static function selectorMultipleGrouprequest() {
Expand Down Expand Up @@ -1364,7 +1371,7 @@ static function selectorAllSlasWithTicket() {
$query = "SELECT DISTINCT s.id,
s.name
FROM glpi_slas s
INNER JOIN glpi_tickets t ON s.id = t.slas_ttr_id
INNER JOIN glpi_tickets t ON s.id = t.slas_id_ttr
WHERE t.status IN (" . implode(
',',
array_merge(Ticket::getSolvedStatusArray(), Ticket::getClosedStatusArray())
Expand Down Expand Up @@ -1422,7 +1429,7 @@ static function selectorCategory($type = true) {
$params = ['type' => '__VALUE__',
'currenttype' => Ticket::INCIDENT_TYPE,
'entity_restrict' => -1,
'condition' => "`is_incident`='1'",
'condition' => ['is_incident' => 1],
'value' => isset($_SESSION['mreporting_values']['itilcategories_id'])
? $_SESSION['mreporting_values']['itilcategories_id']
: 0];
Expand Down
4 changes: 2 additions & 2 deletions inc/dashboard.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function showDashBoard($show_reports_dropdown = true) {

//retrieve dashboard widgets;
$dashboard = new PluginMreportingDashboard();
$widgets = $dashboard->find("users_id = ".$_SESSION['glpiID'], 'id');
$widgets = $dashboard->find(['users_id' => $_SESSION['glpiID']], 'id');

//show dashboard
echo "<div id='dashboard'>";
Expand Down Expand Up @@ -268,7 +268,7 @@ function showDashBoard($show_reports_dropdown = true) {

public static function CurrentUserHaveDashboard() {
$dashboard = new PluginMreportingDashboard();
return (count($dashboard->find("users_id = ".$_SESSION['glpiID'])) > 0);
return (count($dashboard->find(['users_id' => $_SESSION['glpiID']])) > 0);
}

function getFormForColumn() {
Expand Down
16 changes: 8 additions & 8 deletions inc/helpdeskplus.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ function reportGlineNbTicketBySla($config = []) {
DATE_FORMAT(`glpi_tickets`.`date`, '{$this->period_label}') AS period_name
FROM `glpi_tickets`
INNER JOIN `glpi_slas`
ON `glpi_tickets`.slas_ttr_id = `glpi_slas`.id
ON `glpi_tickets`.slas_id_ttr = `glpi_slas`.id
WHERE {$this->sql_date_create}
AND `glpi_tickets`.status IN (" . implode(
',',
Expand Down Expand Up @@ -667,7 +667,7 @@ function reportGlineNbTicketBySla($config = []) {
{$this->sql_select_sla}
FROM `glpi_tickets`
INNER JOIN `glpi_slas`
ON `glpi_tickets`.slas_ttr_id = `glpi_slas`.id
ON `glpi_tickets`.slas_id_ttr = `glpi_slas`.id
WHERE {$this->sql_date_create}
AND `glpi_tickets`.status IN (" . implode(
',',
Expand Down Expand Up @@ -729,7 +729,7 @@ public function reportHgbarRespectedSlasByTopCategory($config = []) {
`glpi_itilcategories`.id
FROM `glpi_tickets`
INNER JOIN `glpi_slas`
ON `glpi_tickets`.slas_ttr_id = `glpi_slas`.id
ON `glpi_tickets`.slas_id_ttr = `glpi_slas`.id
INNER JOIN `glpi_itilcategories`
ON `glpi_tickets`.itilcategories_id = `glpi_itilcategories`.id
WHERE " . $this->sql_date_create . "
Expand All @@ -751,7 +751,7 @@ public function reportHgbarRespectedSlasByTopCategory($config = []) {
`glpi_itilcategories`.name
FROM `glpi_tickets`
INNER JOIN `glpi_slas`
ON `glpi_tickets`.slas_ttr_id = `glpi_slas`.id
ON `glpi_tickets`.slas_id_ttr = `glpi_slas`.id
INNER JOIN `glpi_itilcategories`
ON `glpi_tickets`.itilcategories_id = `glpi_itilcategories`.id
WHERE " . $this->sql_date_create . "
Expand Down Expand Up @@ -798,7 +798,7 @@ public function reportHgbarRespectedSlasByTechnician($config = []) {
{$this->sql_select_sla}
FROM `glpi_tickets`
INNER JOIN `glpi_slas`
ON `glpi_tickets`.slas_ttr_id = `glpi_slas`.id
ON `glpi_tickets`.slas_id_ttr = `glpi_slas`.id
INNER JOIN `glpi_tickets_users`
ON `glpi_tickets_users`.tickets_id = `glpi_tickets`.id
AND `glpi_tickets_users`.type = " . Ticket_User::ASSIGN . "
Expand Down Expand Up @@ -928,7 +928,7 @@ function reportVstackbarRespectedSlasByGroup($config = []) {
ON `glpi_groups_tickets`.tickets_id = `glpi_tickets`.id
AND `glpi_groups_tickets`.type = ".CommonITILActor::ASSIGN."
INNER JOIN `glpi_slas`
ON `glpi_tickets`.slas_ttr_id = `glpi_slas`.id
ON `glpi_tickets`.slas_id_ttr = `glpi_slas`.id
WHERE {$this->sql_date_create}
AND `glpi_tickets`.status IN (" . implode(
',',
Expand Down Expand Up @@ -956,7 +956,7 @@ function reportVstackbarRespectedSlasByGroup($config = []) {

// Ajout des '0' manquants :
$gp = new Group();
$gp_found = $gp->find("", "name"); //Tri précose qui n'est pas utile
$gp_found = $gp->find([], "name"); //Tri précose qui n'est pas utile

foreach ($gp_found as $group) {
$group_name = $group['name'];
Expand Down Expand Up @@ -1007,7 +1007,7 @@ function reportVstackbarNbTicketBySla($config = []) {
{$this->sql_select_sla}
FROM `glpi_tickets`
INNER JOIN `glpi_slas`
ON `glpi_tickets`.slas_ttr_id = `glpi_slas`.id
ON `glpi_tickets`.slas_id_ttr = `glpi_slas`.id
WHERE {$this->sql_date_create}
AND `glpi_tickets`.status IN (" . implode(',',
array_merge(Ticket::getSolvedStatusArray(), Ticket::getClosedStatusArray())
Expand Down
6 changes: 3 additions & 3 deletions inc/notification.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static function install($migration) {

// Création du template de la notification
$template = new NotificationTemplate();
$found_template = $template->find("itemtype = 'PluginMreportingNotification'");
$found_template = $template->find(['itemtype' => 'PluginMreportingNotification']);
if (empty($found_template)) {
$template_id = $template->add([
'name' => __('Notification for "More Reporting"', 'mreporting'),
Expand Down Expand Up @@ -90,7 +90,7 @@ static function uninstall() {

// Remove NotificationTargets and Notifications
$notification = new Notification();
$result = $notification->find("itemtype = 'PluginMreportingNotification'");
$result = $notification->find(['itemtype' => 'PluginMreportingNotification']);
foreach ($result as $row) {
$notification_id = $row['id'];
$queries[] = "DELETE FROM glpi_notificationtargets WHERE notifications_id = " . $notification_id;
Expand All @@ -99,7 +99,7 @@ static function uninstall() {

// Remove NotificationTemplateTranslations and NotificationTemplates
$template = new NotificationTemplate();
$result = $template->find("itemtype = 'PluginMreportingNotification'");
$result = $template->find(['itemtype' => 'PluginMreportingNotification']);
foreach ($result as $row) {
$template_id = $row['id'];
$queries[] = "DELETE FROM glpi_notificationtemplatetranslations
Expand Down
4 changes: 4 additions & 0 deletions mreporting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ Voir documentation : https://github.com/PluginsGLPI/mreporting/wiki
<author>Infotel</author>
</authors>
<versions>
<version>
<num>1.6.0</num>
<compatibility>9.4</compatibility>
</version>
<version>
<num>1.5.3</num>
<compatibility>9.3</compatibility>
Expand Down
13 changes: 9 additions & 4 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
--------------------------------------------------------------------------
*/

define ('PLUGIN_MREPORTING_VERSION', '1.5.3');
define ('PLUGIN_MREPORTING_VERSION', '1.6.0');

// Minimal GLPI version, inclusive
define("PLUGIN_MREPORTING_MIN_GLPI", "9.3");
define("PLUGIN_MREPORTING_MIN_GLPI", "9.4");
// Maximum GLPI version, exclusive
define("PLUGIN_MREPORTING_MAX_GLPI", "9.4");
define("PLUGIN_MREPORTING_MAX_GLPI", "9.5");

if (!defined('PLUGIN_MREPORTING_TEMPLATE_DIR')) {
define("PLUGIN_MREPORTING_TEMPLATE_DIR", GLPI_ROOT."/plugins/mreporting/templates/");
Expand Down Expand Up @@ -96,7 +96,12 @@ function plugin_init_mreporting() {
['addtabon' => 'Preference']);

$mreporting_profile = new PluginMreportingProfile;
$reports_profiles = $mreporting_profile->find("`profiles_id` = '".$_SESSION['glpiactiveprofile']['id']."' AND `right` = ".READ);
$reports_profiles = $mreporting_profile->find(
[
'profiles_id' => $_SESSION['glpiactiveprofile']['id'],
'right' => READ,
]
);

/* Menu */
$PLUGIN_HOOKS['config_page']['mreporting'] = 'front/config.php';
Expand Down

0 comments on commit b1ad3de

Please sign in to comment.