Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #133 - Wrong backlog number #134

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
21 changes: 12 additions & 9 deletions inc/helpdeskplus.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,18 +194,21 @@ function reportGlineBacklogs($config = array()) {

$begin=strftime($this->period_sort_php, $time1);
$end=strftime($this->period_sort_php, $time2);
$sql_date_backlog = "DATE_FORMAT(list_date.period_l, '{$this->period_sort}') >= '$begin'
AND DATE_FORMAT(list_date.period_l, '{$this->period_sort}') <= '$end'";
$sql_list_date2 = str_replace('date', 'solvedate', $this->sql_list_date);
$sql_date_backlog = "list_date.period_l >= '$begin'
AND list_date.period_l <= '$end'";
//TODO : Should be done in baseclass.class.php $this->sql_list_date ? Check inmpact
$sql_list_date = "DATE_FORMAT(`date` , '{$this->period_sort}') as period_l ,
DATE_FORMAT(`date`, '$this->period_label') as period_name";
$sql_list_date2 = str_replace('date', 'solvedate', $sql_list_date);
$sql_backlog = "SELECT
DISTINCT(DATE_FORMAT(list_date.period_l, '$this->period_sort')) as period,
DATE_FORMAT(list_date.period_l, '$this->period_label') as period_name,
DISTINCT(list_date.period_l) as period,
list_date.period_name as period_name,
COUNT(DISTINCT(glpi_tickets.id)) as nb
FROM (
SELECT DISTINCT period_l
SELECT DISTINCT period_l,period_name
FROM (
SELECT
{$this->sql_list_date}
{$sql_list_date}
FROM glpi_tickets
UNION
SELECT
Expand All @@ -214,8 +217,8 @@ function reportGlineBacklogs($config = array()) {
) as list_date_union
) as list_date
LEFT JOIN glpi_tickets
ON glpi_tickets.date <= list_date.period_l
AND (glpi_tickets.solvedate > list_date.period_l OR glpi_tickets.solvedate IS NULL)
ON DATE_FORMAT(glpi_tickets.date , '{$this->period_sort}') <= list_date.period_l
AND (DATE_FORMAT(glpi_tickets.solvedate, '{$this->period_sort}') > list_date.period_l OR glpi_tickets.solvedate IS NULL)
{$this->sql_join_tu}
{$this->sql_join_gt}
{$this->sql_join_gtr}
Expand Down