Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
docker
osticket
Commits
19c9de50
Commit
19c9de50
authored
11 years ago
by
Jared Hancock
Browse files
Options
Downloads
Patches
Plain Diff
oops: Fix report time frame interpretation
parent
65de0c49
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/ajax.reports.php
+26
-25
26 additions, 25 deletions
include/ajax.reports.php
with
26 additions
and
25 deletions
include/ajax.reports.php
+
26
−
25
View file @
19c9de50
...
...
@@ -37,17 +37,7 @@ class OverviewReportAjaxAPI extends AjaxController {
function
getData
()
{
global
$thisstaff
;
if
((
$start
=
$this
->
get
(
'start'
,
'last month'
)))
{
$stop
=
$this
->
get
(
'stop'
,
'now'
);
if
(
substr
(
$stop
,
0
,
1
)
==
'+'
)
$stop
=
$start
.
$stop
;
}
else
{
$start
=
'last month'
;
$stop
=
'now'
;
}
$start
=
'FROM_UNIXTIME('
.
strtotime
(
$start
)
.
')'
;
$stop
=
'FROM_UNIXTIME('
.
strtotime
(
$stop
)
.
')'
;
list
(
$start
,
$stop
)
=
$this
->
_getDateRange
();
$groups
=
array
(
"dept"
=>
array
(
...
...
@@ -172,26 +162,38 @@ class OverviewReportAjaxAPI extends AjaxController {
'text/csv'
,
$csv
);
}
function
get
PlotData
()
{
function
_
get
DateRange
()
{
global
$cfg
;
if
((
$start
=
$this
->
get
(
'start'
,
'last month'
)))
{
$stop
=
$this
->
get
(
'stop'
,
'now'
);
if
(
substr
(
$stop
,
0
,
1
)
==
'+'
)
$stop
=
$start
.
$stop
;
$stop
=
$this
->
get
(
'period'
,
'now'
);
}
else
{
$start
=
'last month'
;
$stop
=
'now'
;
$stop
=
$this
->
get
(
'period'
,
'now'
)
;
}
$start
=
strtotime
(
$start
);
$stop
=
strtotime
(
$stop
);
if
(
$start
!=
'last month'
)
$start
=
DateTime
::
createFromFormat
(
$cfg
->
getDateFormat
(),
$start
)
->
format
(
'U'
);
else
$start
=
strtotime
(
$start
);
if
(
substr
(
$stop
,
0
,
1
)
==
'+'
)
$stop
=
strftime
(
'%Y-%m-%d '
,
$start
)
.
$stop
;
$start
=
'FROM_UNIXTIME('
.
$start
.
')'
;
$stop
=
'FROM_UNIXTIME('
.
strtotime
(
$stop
)
.
')'
;
return
array
(
$start
,
$stop
);
}
function
getPlotData
()
{
list
(
$start
,
$stop
)
=
$this
->
_getDateRange
();
# Fetch all types of events over the timeframe
$res
=
db_query
(
'SELECT DISTINCT(state) FROM '
.
TICKET_EVENT_TABLE
.
' WHERE timestamp BETWEEN FROM_UNIXTIME('
.
db_input
(
$start
)
.
') AND FROM_UNIXTIME('
.
db_input
(
$stop
)
.
') ORDER BY 1'
);
.
' WHERE timestamp BETWEEN '
.
$start
.
' AND '
.
$stop
.
' ORDER BY 1'
);
$events
=
array
();
while
(
$row
=
db_fetch_row
(
$res
))
$events
[]
=
$row
[
0
];
...
...
@@ -200,9 +202,8 @@ class OverviewReportAjaxAPI extends AjaxController {
$res
=
db_query
(
'SELECT state, DATE_FORMAT(timestamp, \'%Y-%m-%d\'), '
.
'COUNT(ticket_id)'
.
' FROM '
.
TICKET_EVENT_TABLE
.
' WHERE timestamp BETWEEN FROM_UNIXTIME('
.
db_input
(
$start
)
.
') AND FROM_UNIXTIME('
.
db_input
(
$stop
)
.
') AND NOT annulled'
.
' WHERE timestamp BETWEEN '
.
$start
.
' AND '
.
$stop
.
' AND NOT annulled'
.
' GROUP BY state, DATE_FORMAT(timestamp, \'%Y-%m-%d\')'
.
' ORDER BY 2, 1'
);
# Initialize array of plot values
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment