Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
ba7b77fe
Commit
ba7b77fe
authored
9 years ago
by
Peter Rotich
Browse files
Options
Downloads
Patches
Plain Diff
Tasks Export
Add ability to export tasks
parent
56091291
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/class.export.php
+58
-1
58 additions, 1 deletion
include/class.export.php
include/i18n/en_US/help/tips/tasks.queue.yaml
+28
-0
28 additions, 0 deletions
include/i18n/en_US/help/tips/tasks.queue.yaml
scp/tasks.php
+1
-0
1 addition, 0 deletions
scp/tasks.php
with
87 additions
and
1 deletion
include/class.export.php
+
58
−
1
View file @
ba7b77fe
...
...
@@ -99,7 +99,7 @@ class Export {
);
}
/*
static
*/
function
saveTickets
(
$sql
,
$filename
,
$how
=
'csv'
)
{
static
function
saveTickets
(
$sql
,
$filename
,
$how
=
'csv'
)
{
ob_start
();
self
::
dumpTickets
(
$sql
,
$how
);
$stuff
=
ob_get_contents
();
...
...
@@ -110,7 +110,64 @@ class Export {
return
false
;
}
static
function
dumpTasks
(
$sql
,
$how
=
'csv'
)
{
// Add custom fields to the $sql statement
$cdata
=
$fields
=
array
();
foreach
(
TaskForm
::
getInstance
()
->
getFields
()
as
$f
)
{
// Ignore non-data fields
if
(
!
$f
->
hasData
()
||
$f
->
isPresentationOnly
())
continue
;
$name
=
$f
->
get
(
'name'
)
?:
'field_'
.
$f
->
get
(
'id'
);
$key
=
'cdata.'
.
$name
;
$fields
[
$key
]
=
$f
;
$cdata
[
$key
]
=
$f
->
getLocal
(
'label'
);
}
// Reset the $sql query
$tasks
=
$sql
->
models
()
->
select_related
(
'dept'
,
'staff'
,
'team'
,
'cdata'
)
->
annotate
(
array
(
'collab_count'
=>
SqlAggregate
::
COUNT
(
'thread__collaborators'
),
'attachment_count'
=>
SqlAggregate
::
COUNT
(
'thread__entries__attachments'
),
'thread_count'
=>
SqlAggregate
::
COUNT
(
'thread__entries'
),
));
return
self
::
dumpQuery
(
$tasks
,
array
(
'number'
=>
__
(
'Task Number'
),
'created'
=>
__
(
'Date Created'
),
'cdata.title'
=>
__
(
'Title'
),
'dept::getLocalName'
=>
__
(
'Department'
),
'flags'
=>
__
(
'Current Status'
),
//FIXME: self:getStatus()?
'duedate'
=>
__
(
'Due Date'
),
'staff::getName'
=>
__
(
'Agent Assigned'
),
'team::getName'
=>
__
(
'Team Assigned'
),
'thread_count'
=>
__
(
'Thread Count'
),
'attachment_count'
=>
__
(
'Attachment Count'
),
)
+
$cdata
,
$how
,
array
(
'modify'
=>
function
(
&
$record
,
$keys
)
use
(
$fields
)
{
foreach
(
$fields
as
$k
=>
$f
)
{
if
((
$i
=
array_search
(
$k
,
$keys
))
!==
false
)
{
$record
[
$i
]
=
$f
->
export
(
$f
->
to_php
(
$record
[
$i
]));
}
}
return
$record
;
})
);
}
static
function
saveTasks
(
$sql
,
$filename
,
$how
=
'csv'
)
{
ob_start
();
self
::
dumpTasks
(
$sql
,
$how
);
$stuff
=
ob_get_contents
();
ob_end_clean
();
if
(
$stuff
)
Http
::
download
(
$filename
,
"text/
$how
"
,
$stuff
);
return
false
;
}
...
...
This diff is collapsed.
Click to expand it.
include/i18n/en_US/help/tips/tasks.queue.yaml
0 → 100644
+
28
−
0
View file @
ba7b77fe
#
# This is popup help messages for the Agents Panel -> Tasks
#
# Fields:
# title - Shown in bold at the top of the popover window
# content - The body of the help popover
# links - List of links shows below the content
# title - Link title
# href - href of link (links starting with / are translated to the
# helpdesk installation path)
#
# The key names such as 'helpdesk_name' should not be translated as they
# must match the HTML #ids put into the page template.
#
---
advanced
:
title
:
Advanced
content
:
>
Narrow down your search parameters. Once you have selected your advanced
search criteria and run the search, you can <span class="doc-desc-title">Export
</span> the data at the bottom of the page.
export
:
title
:
Export
content
:
>
Export your data currently in view in a CSV file.
CSV files may be opened with any spreadsheet software
(i.e., Microsoft Excel, Apple Pages, OpenOffice, etc.).
This diff is collapsed.
Click to expand it.
scp/tasks.php
+
1
−
0
View file @
ba7b77fe
...
...
@@ -13,6 +13,7 @@
require
(
'staff.inc.php'
);
require_once
(
INCLUDE_DIR
.
'class.task.php'
);
require_once
(
INCLUDE_DIR
.
'class.export.php'
);
$page
=
''
;
$task
=
null
;
//clean start.
...
...
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