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
3a775753
Commit
3a775753
authored
10 years ago
by
Jared Hancock
Browse files
Options
Downloads
Patches
Plain Diff
export: Fixup nested query for exporting ticket queue
parent
2b89fca9
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/class.export.php
+12
-9
12 additions, 9 deletions
include/class.export.php
include/class.orm.php
+6
-0
6 additions, 0 deletions
include/class.orm.php
include/staff/tickets.inc.php
+2
-1
2 additions, 1 deletion
include/staff/tickets.inc.php
with
20 additions
and
10 deletions
include/class.export.php
+
12
−
9
View file @
3a775753
...
@@ -57,11 +57,14 @@ class Export {
...
@@ -57,11 +57,14 @@ class Export {
$cdata
[
$key
]
=
$f
->
getLocal
(
'label'
);
$cdata
[
$key
]
=
$f
->
getLocal
(
'label'
);
}
}
// Reset the $sql query
// Reset the $sql query
$tickets
=
TicketModel
::
objects
()
$tickets
=
$sql
->
models
()
->
filter
(
$sql
->
constraints
)
->
select_related
(
'user'
,
'user__default_email'
,
'dept'
,
'staff'
,
->
select_related
(
'user'
,
'user__default_email'
,
'dept'
,
'staff'
,
'team'
,
'staff'
,
'cdata'
);
'team'
,
'staff'
,
'cdata'
)
call_user_func_array
(
array
(
$tickets
,
'order_by'
),
$sql
->
getSortFields
());
->
annotate
(
array
(
'collab_count'
=>
SqlAggregate
::
COUNT
(
'thread__collaborators'
),
'attachment_count'
=>
SqlAggregate
::
COUNT
(
'thread__entries__attachments'
),
'thread_count'
=>
SqlAggregate
::
COUNT
(
'thread__entries'
),
));
return
self
::
dumpQuery
(
$tickets
,
return
self
::
dumpQuery
(
$tickets
,
array
(
array
(
...
@@ -75,14 +78,14 @@ class Export {
...
@@ -75,14 +78,14 @@ class Export {
'topic::getName'
=>
__
(
'Help Topic'
),
'topic::getName'
=>
__
(
'Help Topic'
),
'source'
=>
__
(
'Source'
),
'source'
=>
__
(
'Source'
),
'status::getName'
=>
__
(
'Current Status'
),
'status::getName'
=>
__
(
'Current Status'
),
'
::getEffectiveD
ate'
=>
__
(
'Last Updated'
),
'
lastupd
ate'
=>
__
(
'Last Updated'
),
'duedate'
=>
__
(
'Due Date'
),
'
est_
duedate'
=>
__
(
'Due Date'
),
'isoverdue'
=>
__
(
'Overdue'
),
'isoverdue'
=>
__
(
'Overdue'
),
'isanswered'
=>
__
(
'Answered'
),
'isanswered'
=>
__
(
'Answered'
),
'staff::getName'
=>
__
(
'Agent Assigned'
),
'staff::getName'
=>
__
(
'Agent Assigned'
),
'team::getName'
=>
__
(
'Team Assigned'
),
'team::getName'
=>
__
(
'Team Assigned'
),
#
'thread_count' => __('Thread Count'),
'thread_count'
=>
__
(
'Thread Count'
),
#
'attachment
s
' =>
__('Attachment Count'),
'attachment
_count
'
=>
__
(
'Attachment Count'
),
)
+
$cdata
,
)
+
$cdata
,
$how
,
$how
,
array
(
'modify'
=>
function
(
&
$record
,
$keys
)
use
(
$fields
)
{
array
(
'modify'
=>
function
(
&
$record
,
$keys
)
use
(
$fields
)
{
...
@@ -254,7 +257,7 @@ class ResultSetExporter {
...
@@ -254,7 +257,7 @@ class ResultSetExporter {
}
}
}
}
// Evalutate :: function call on target current
// Evalutate :: function call on target current
if
(
$func
&&
method_exists
(
$current
,
$func
))
{
if
(
$func
&&
(
method_exists
(
$current
,
$func
)
||
method_exists
(
$current
,
'__call'
))
)
{
$current
=
$current
->
{
$func
}();
$current
=
$current
->
{
$func
}();
}
}
$record
[]
=
(
string
)
$current
;
$record
[]
=
(
string
)
$current
;
...
...
This diff is collapsed.
Click to expand it.
include/class.orm.php
+
6
−
0
View file @
3a775753
...
@@ -777,6 +777,12 @@ class QuerySet implements IteratorAggregate, ArrayAccess, Serializable, Countabl
...
@@ -777,6 +777,12 @@ class QuerySet implements IteratorAggregate, ArrayAccess, Serializable, Countabl
return
$this
;
return
$this
;
}
}
function
models
()
{
$this
->
iterator
=
'ModelInstanceManager'
;
$this
->
values
=
$this
->
related
=
array
();
return
$this
;
}
function
values
()
{
function
values
()
{
foreach
(
func_get_args
()
as
$A
)
foreach
(
func_get_args
()
as
$A
)
$this
->
values
[
$A
]
=
$A
;
$this
->
values
[
$A
]
=
$A
;
...
...
This diff is collapsed.
Click to expand it.
include/staff/tickets.inc.php
+
2
−
1
View file @
3a775753
...
@@ -248,6 +248,7 @@ case 'updated':
...
@@ -248,6 +248,7 @@ case 'updated':
//
//
// ATM, advanced search with keywords doesn't support the subquery approach
// ATM, advanced search with keywords doesn't support the subquery approach
if
(
$use_subquery
)
{
if
(
$use_subquery
)
{
$orig_tickets
=
clone
$tickets
;
$tickets2
=
TicketModel
::
objects
();
$tickets2
=
TicketModel
::
objects
();
$tickets2
->
values
=
$tickets
->
values
;
$tickets2
->
values
=
$tickets
->
values
;
$tickets2
->
filter
(
array
(
'ticket_id__in'
=>
$tickets
->
values_flat
(
'ticket_id'
)));
$tickets2
->
filter
(
array
(
'ticket_id__in'
=>
$tickets
->
values_flat
(
'ticket_id'
)));
...
@@ -271,7 +272,7 @@ $tickets->annotate(array(
...
@@ -271,7 +272,7 @@ $tickets->annotate(array(
));
));
// Save the query to the session for exporting
// Save the query to the session for exporting
$_SESSION
[
':Q:tickets'
]
=
$tickets
;
$_SESSION
[
':Q:tickets'
]
=
$
orig_
tickets
;
?>
?>
...
...
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