Skip to content

Commit

Permalink
fix sla for 9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
orthagh authored and trasher committed Sep 22, 2017
1 parent 8556f09 commit 00e43b7
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 35 deletions.
4 changes: 2 additions & 2 deletions inc/common.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1358,8 +1358,8 @@ static function selectorAllSlasWithTicket() {

$query = "SELECT DISTINCT s.id,
s.name
FROM glpi_slts s
INNER JOIN glpi_tickets t ON s.id = t.slts_ttr_id
FROM glpi_slas s
INNER JOIN glpi_tickets t ON s.id = t.slas_ttr_id
WHERE t.status IN (" . implode(
',',
array_merge(Ticket::getSolvedStatusArray(), Ticket::getClosedStatusArray())
Expand Down
66 changes: 33 additions & 33 deletions inc/helpdeskplus.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ function __construct($config = array()) {
$this->sql_join_gtr = "LEFT JOIN glpi_groups_tickets gtr
ON gtr.tickets_id = glpi_tickets.id
AND gtr.type = ".Group_Ticket::REQUESTER;
$this->sql_select_sla = "CASE WHEN glpi_slts.definition_time = 'day'
AND glpi_tickets.solve_delay_stat <= glpi_slts.number_time * 86400
THEN 'ok'
WHEN glpi_slts.definition_time = 'hour'
AND glpi_tickets.solve_delay_stat <= glpi_slts.number_time * 3600
THEN 'ok'
WHEN glpi_slts.definition_time = 'minute'
AND glpi_tickets.solve_delay_stat <= glpi_slts.number_time * 60
THEN 'ok'
ELSE 'nok'
$this->sql_select_sla = "CASE WHEN glpi_slas.definition_time = 'day'
AND glpi_tickets.solve_delay_stat <= glpi_slas.number_time * 86400
THEN 'ok'
WHEN glpi_slas.definition_time = 'hour'
AND glpi_tickets.solve_delay_stat <= glpi_slas.number_time * 3600
THEN 'ok'
WHEN glpi_slas.definition_time = 'minute'
AND glpi_tickets.solve_delay_stat <= glpi_slas.number_time * 60
THEN 'ok'
ELSE 'nok'
END AS respected_sla";

parent::__construct($config);
Expand Down Expand Up @@ -636,16 +636,16 @@ function reportGlineNbTicketBySla($config = array()) {
$query_date = "SELECT DISTINCT DATE_FORMAT(`glpi_tickets`.`date`, '{$this->period_sort}') AS period,
DATE_FORMAT(`glpi_tickets`.`date`, '{$this->period_label}') AS period_name
FROM `glpi_tickets`
INNER JOIN `glpi_slts`
ON `glpi_tickets`.slts_ttr_id = `glpi_slts`.id
INNER JOIN `glpi_slas`
ON `glpi_tickets`.slas_ttr_id = `glpi_slas`.id
WHERE {$this->sql_date_create}
AND `glpi_tickets`.status IN (" . implode(
',',
array_merge(Ticket::getSolvedStatusArray(), Ticket::getClosedStatusArray())
) . ")
AND `glpi_tickets`.`entities_id` IN (" . $this->where_entities . ")
AND `glpi_tickets`.`is_deleted` = '0'
AND `glpi_slts`.id IN (".implode(',', $_SESSION['mreporting_values']['slas']).")
AND `glpi_slas`.id IN (".implode(',', $_SESSION['mreporting_values']['slas']).")
ORDER BY `glpi_tickets`.`date` ASC";
$res_date = $DB->query($query_date);

Expand All @@ -663,11 +663,11 @@ function reportGlineNbTicketBySla($config = array()) {
DATE_FORMAT(`glpi_tickets`.`date`, '{$this->period_sort}') AS period,
DATE_FORMAT(`glpi_tickets`.`date`, '{$this->period_label}') AS period_name,
count(`glpi_tickets`.id) AS nb,
`glpi_slts`.name,
`glpi_slas`.name,
{$this->sql_select_sla}
FROM `glpi_tickets`
INNER JOIN `glpi_slts`
ON `glpi_tickets`.slts_ttr_id = `glpi_slts`.id
INNER JOIN `glpi_slas`
ON `glpi_tickets`.slas_ttr_id = `glpi_slas`.id
WHERE {$this->sql_date_create}
AND `glpi_tickets`.status IN (" . implode(
',',
Expand All @@ -676,9 +676,9 @@ function reportGlineNbTicketBySla($config = array()) {
AND `glpi_tickets`.entities_id IN (" . $this->where_entities . ")
AND `glpi_tickets`.is_deleted = '0'";
if (isset($_SESSION['mreporting_values']['slas'])) {
$query .= " AND `glpi_slts`.id IN (".implode(',', $_SESSION['mreporting_values']['slas']).") ";
$query .= " AND `glpi_slas`.id IN (".implode(',', $_SESSION['mreporting_values']['slas']).") ";
}
$query .= "GROUP BY `glpi_slts`.name, period, respected_sla";
$query .= "GROUP BY `glpi_slas`.name, period, respected_sla";

$result = $DB->query($query);
while ($data = $DB->fetch_assoc($result)) {
Expand Down Expand Up @@ -728,8 +728,8 @@ public function reportHgbarRespectedSlasByTopCategory($config = array()) {
count(`glpi_tickets`.id) as nb,
`glpi_itilcategories`.id
FROM `glpi_tickets`
INNER JOIN `glpi_slts`
ON `glpi_tickets`.slts_ttr_id = `glpi_slts`.id
INNER JOIN `glpi_slas`
ON `glpi_tickets`.slas_ttr_id = `glpi_slas`.id
INNER JOIN `glpi_itilcategories`
ON `glpi_tickets`.itilcategories_id = `glpi_itilcategories`.id
WHERE " . $this->sql_date_create . "
Expand All @@ -750,8 +750,8 @@ public function reportHgbarRespectedSlasByTopCategory($config = array()) {
`glpi_itilcategories`.id,
`glpi_itilcategories`.name
FROM `glpi_tickets`
INNER JOIN `glpi_slts`
ON `glpi_tickets`.slts_ttr_id = `glpi_slts`.id
INNER JOIN `glpi_slas`
ON `glpi_tickets`.slas_ttr_id = `glpi_slas`.id
INNER JOIN `glpi_itilcategories`
ON `glpi_tickets`.itilcategories_id = `glpi_itilcategories`.id
WHERE " . $this->sql_date_create . "
Expand Down Expand Up @@ -797,8 +797,8 @@ public function reportHgbarRespectedSlasByTechnician($config = array()) {
COUNT(`glpi_tickets`.id) as nb,
{$this->sql_select_sla}
FROM `glpi_tickets`
INNER JOIN `glpi_slts`
ON `glpi_tickets`.slts_ttr_id = `glpi_slts`.id
INNER JOIN `glpi_slas`
ON `glpi_tickets`.slas_ttr_id = `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 @@ -921,22 +921,22 @@ function reportVstackbarRespectedSlasByGroup($config = array()) {

$query = "SELECT COUNT(`glpi_tickets`.id) AS nb,
`glpi_groups_tickets`.groups_id as groups_id,
`glpi_slts`.name,
`glpi_slas`.name,
{$this->sql_select_sla}
FROM `glpi_tickets`
INNER JOIN `glpi_groups_tickets`
ON `glpi_groups_tickets`.tickets_id = `glpi_tickets`.id
AND `glpi_groups_tickets`.type = ".CommonITILActor::ASSIGN."
INNER JOIN `glpi_slts`
ON `glpi_tickets`.slts_ttr_id = `glpi_slts`.id
INNER JOIN `glpi_slas`
ON `glpi_tickets`.slas_ttr_id = `glpi_slas`.id
WHERE {$this->sql_date_create}
AND `glpi_tickets`.status IN (" . implode(
',',
array_merge(Ticket::getSolvedStatusArray(), Ticket::getClosedStatusArray())
) . ")
AND `glpi_tickets`.entities_id IN ({$this->where_entities})
AND `glpi_tickets`.is_deleted = '0'
AND `glpi_slts`.id IN (".implode(',', $_SESSION['mreporting_values']['slas']).")
AND `glpi_slas`.id IN (".implode(',', $_SESSION['mreporting_values']['slas']).")
GROUP BY `glpi_groups_tickets`.groups_id, respected_sla;";
$result = $DB->query($query);

Expand Down Expand Up @@ -1003,19 +1003,19 @@ function reportVstackbarNbTicketBySla($config = array()) {
if (isset($_SESSION['mreporting_values']['slas'])
&& !empty($_SESSION['mreporting_values']['slas'])) {

$query = "SELECT count(`glpi_tickets`.id) AS nb, `glpi_slts`.name,
$query = "SELECT count(`glpi_tickets`.id) AS nb, `glpi_slas`.name,
{$this->sql_select_sla}
FROM `glpi_tickets`
INNER JOIN `glpi_slts`
ON `glpi_tickets`.slts_ttr_id = `glpi_slts`.id
INNER JOIN `glpi_slas`
ON `glpi_tickets`.slas_ttr_id = `glpi_slas`.id
WHERE {$this->sql_date_create}
AND `glpi_tickets`.status IN (" . implode(',',
array_merge(Ticket::getSolvedStatusArray(), Ticket::getClosedStatusArray())
) . ")
AND `glpi_tickets`.entities_id IN ({$this->where_entities})
AND `glpi_tickets`.is_deleted = '0'
AND `glpi_slts`.id IN (".implode(',', $_SESSION['mreporting_values']['slas']).")
GROUP BY `glpi_slts`.name, respected_sla;";
AND `glpi_slas`.id IN (".implode(',', $_SESSION['mreporting_values']['slas']).")
GROUP BY `glpi_slas`.name, respected_sla;";

$result = $DB->query($query);
while ($data = $DB->fetch_assoc($result)) {
Expand Down

0 comments on commit 00e43b7

Please sign in to comment.