Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
da4a3824
Unverified
Commit
da4a3824
authored
4 years ago
by
colemanw
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #17864 from colemanw/searchFix
Search Ext: fix loading options and parsing custom field names
parents
1acaf363
27bed3cb
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ext/search/ang/search.module.js
+14
-2
14 additions, 2 deletions
ext/search/ang/search.module.js
ext/search/ang/search/crmSearch.component.js
+2
-2
2 additions, 2 deletions
ext/search/ang/search/crmSearch.component.js
with
16 additions
and
4 deletions
ext/search/ang/search.module.js
+
14
−
2
View file @
da4a3824
...
...
@@ -39,6 +39,18 @@
joinEntity
=
dotSplit
.
length
>
1
?
dotSplit
[
0
]
:
null
,
fieldName
=
_
.
last
(
dotSplit
).
split
(
'
:
'
)[
0
],
entityName
=
searchEntity
;
// Custom fields contain a dot in their fieldname
// If 3 segments, the first is the joinEntity and the last 2 are the custom field
if
(
dotSplit
.
length
===
3
)
{
fieldName
=
dotSplit
[
1
]
+
'
.
'
+
fieldName
;
}
// If 2 segments, it's ambiguous whether this is a custom field or joined field. Search the main entity first.
if
(
dotSplit
.
length
===
2
)
{
var
field
=
_
.
find
(
getEntity
(
true
).
fields
,
{
name
:
dotSplit
[
0
]
+
'
.
'
+
fieldName
});
if
(
field
)
{
return
field
;
}
}
if
(
joinEntity
)
{
entityName
=
_
.
find
(
CRM
.
vars
.
search
.
links
[
entityName
],
{
alias
:
joinEntity
}).
entity
;
}
...
...
@@ -57,9 +69,9 @@
}
result
.
field
=
getField
(
fieldName
);
var
split
=
fieldName
.
split
(
'
:
'
),
dot
Pos
=
split
[
0
].
indexOf
(
'
.
'
);
prefix
Pos
=
split
[
0
].
indexOf
(
result
.
field
.
name
);
result
.
path
=
split
[
0
];
result
.
prefix
=
result
.
path
.
substring
(
0
,
dotPos
+
1
)
;
result
.
prefix
=
prefixPos
>
0
?
result
.
path
.
substring
(
0
,
prefixPos
)
:
''
;
result
.
suffix
=
!
split
[
1
]
?
''
:
'
:
'
+
split
[
1
];
return
result
;
}
...
...
This diff is collapsed.
Click to expand it.
ext/search/ang/search/crmSearch.component.js
+
2
−
2
View file @
da4a3824
...
...
@@ -458,8 +458,6 @@
}
this
.
$onInit
=
function
()
{
loadFieldOptions
();
$scope
.
$bindToRoute
({
expr
:
'
$ctrl.params.select
'
,
param
:
'
select
'
,
...
...
@@ -516,6 +514,8 @@
});
}
$scope
.
$watch
(
'
$ctrl.params.having
'
,
onChangeFilters
,
true
);
loadFieldOptions
();
};
$scope
.
saveGroup
=
function
()
{
...
...
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