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
efcaae5b
Commit
efcaae5b
authored
7 years ago
by
Peter Rotich
Browse files
Options
Downloads
Patches
Plain Diff
Advanced Search: Selection Fields
Make selection fields play well with Advanced Search
parent
b089b7af
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/class.dept.php
+1
-1
1 addition, 1 deletion
include/class.dept.php
include/class.search.php
+42
-4
42 additions, 4 deletions
include/class.search.php
with
43 additions
and
5 deletions
include/class.dept.php
+
1
−
1
View file @
efcaae5b
...
@@ -107,7 +107,7 @@ implements TemplateVariable, Searchable {
...
@@ -107,7 +107,7 @@ implements TemplateVariable, Searchable {
'name'
=>
new
TextboxField
(
array
(
'name'
=>
new
TextboxField
(
array
(
'label'
=>
__
(
'Name'
),
'label'
=>
__
(
'Name'
),
)),
)),
'manager'
=>
new
Agent
SelectionField
(
array
(
'manager'
=>
new
DepartmentManager
SelectionField
(
array
(
'label'
=>
__
(
'Manager'
),
'label'
=>
__
(
'Manager'
),
)),
)),
);
);
...
...
This diff is collapsed.
Click to expand it.
include/class.search.php
+
42
−
4
View file @
efcaae5b
...
@@ -723,7 +723,33 @@ class AdvancedSearchForm extends SimpleForm {
...
@@ -723,7 +723,33 @@ class AdvancedSearchForm extends SimpleForm {
// Advanced search special fields
// Advanced search special fields
class
HelpTopicChoiceField
extends
ChoiceField
{
class
AdvancedSearchSelectionField
extends
ChoiceField
{
function
getSearchQ
(
$method
,
$value
,
$name
=
false
)
{
switch
(
$method
)
{
case
'includes'
:
case
'!includes'
:
$Q
=
new
Q
();
if
(
count
(
$value
)
>
1
)
$Q
->
add
(
array
(
"
{
$name
}
__in"
=>
array_keys
(
$value
)));
else
$Q
->
add
(
array
(
$name
=>
key
(
$value
)));
if
(
$method
==
'!includes'
)
$Q
->
negate
();
return
$Q
;
break
;
default
:
return
parent
::
getSearchQ
(
$method
,
$value
,
$name
);
}
}
}
class
HelpTopicChoiceField
extends
AdvancedSearchSelectionField
{
function
hasIdValue
()
{
function
hasIdValue
()
{
return
true
;
return
true
;
}
}
...
@@ -734,7 +760,7 @@ class HelpTopicChoiceField extends ChoiceField {
...
@@ -734,7 +760,7 @@ class HelpTopicChoiceField extends ChoiceField {
}
}
require_once
INCLUDE_DIR
.
'class.dept.php'
;
require_once
INCLUDE_DIR
.
'class.dept.php'
;
class
DepartmentChoiceField
extends
Choice
Field
{
class
DepartmentChoiceField
extends
AdvancedSearchSelection
Field
{
var
$_choices
=
null
;
var
$_choices
=
null
;
function
getChoices
(
$verbose
=
false
)
{
function
getChoices
(
$verbose
=
false
)
{
...
@@ -764,6 +790,7 @@ class DepartmentChoiceField extends ChoiceField {
...
@@ -764,6 +790,7 @@ class DepartmentChoiceField extends ChoiceField {
}
}
}
}
class
AssigneeChoiceField
extends
ChoiceField
{
class
AssigneeChoiceField
extends
ChoiceField
{
function
getChoices
(
$verbose
=
false
)
{
function
getChoices
(
$verbose
=
false
)
{
global
$thisstaff
;
global
$thisstaff
;
...
@@ -902,7 +929,7 @@ trait ZeroMeansUnset {
...
@@ -902,7 +929,7 @@ trait ZeroMeansUnset {
}
}
}
}
class
AgentSelectionField
extends
Choice
Field
{
class
AgentSelectionField
extends
AdvancedSearchSelection
Field
{
use
ZeroMeansUnset
;
use
ZeroMeansUnset
;
function
getChoices
(
$verbose
=
false
)
{
function
getChoices
(
$verbose
=
false
)
{
...
@@ -940,6 +967,17 @@ class AgentSelectionField extends ChoiceField {
...
@@ -940,6 +967,17 @@ class AgentSelectionField extends ChoiceField {
}
}
}
}
class
DepartmentManagerSelectionField
extends
AgentSelectionField
{
function
getChoices
(
$verbose
=
false
)
{
return
Staff
::
getStaffMembers
();
}
function
getSearchQ
(
$method
,
$value
,
$name
=
false
)
{
return
parent
::
getSearchQ
(
$method
,
$value
,
'dept__manager_id'
);
}
}
class
TeamSelectionField
extends
ChoiceField
{
class
TeamSelectionField
extends
ChoiceField
{
use
ZeroMeansUnset
;
use
ZeroMeansUnset
;
...
@@ -953,7 +991,7 @@ class TeamSelectionField extends ChoiceField {
...
@@ -953,7 +991,7 @@ class TeamSelectionField extends ChoiceField {
}
}
}
}
class
TicketStateChoiceField
extends
Choice
Field
{
class
TicketStateChoiceField
extends
AdvancedSearchSelection
Field
{
function
getChoices
(
$verbose
=
false
)
{
function
getChoices
(
$verbose
=
false
)
{
return
array
(
return
array
(
'open'
=>
__
(
'Open'
),
'open'
=>
__
(
'Open'
),
...
...
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