Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
basic
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
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
xrm
basic
Commits
ab0c105a
Commit
ab0c105a
authored
4 years ago
by
Johannes Goderbauer
Browse files
Options
Downloads
Patches
Plain Diff
Contact: Get view value now supports with or without Organisation-modes
parent
03f682a6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
process/Contact_lib/process.js
+26
-7
26 additions, 7 deletions
process/Contact_lib/process.js
with
26 additions
and
7 deletions
process/Contact_lib/process.js
+
26
−
7
View file @
ab0c105a
...
...
@@ -67,12 +67,18 @@ function ContactUtils() {}
* does not validate if pRelationIdField exists or is a valid or harmful value
*
* @param {String} pContactIdField fieldname for the CONTACTID-condition as TABLEALIAS.COLUMNALIAS; e.g. TASK.EDITOR_CONTACT_ID
* @param {Boolean} [pIncludeOrganisation=true] false if the organisation shall not be included in the result string
* @return {String} a subsql (without bracets) that can be played within an SQL
*/
ContactUtils
.
getResolvingDisplaySubSql
=
function
(
pContactIdField
)
ContactUtils
.
getResolvingDisplaySubSql
=
function
(
pContactIdField
,
pIncludeOrganisation
)
{
var
contact
=
Contact
.
createWithColumnPreset
();
var
renderer
=
new
ContactTitleRenderer
(
contact
,
ContactTitleRenderer
.
OPTIONS
.
IncludeOrganisation
);
var
rendererOptions
;
if
(
pIncludeOrganisation
===
false
)
rendererOptions
=
ContactTitleRenderer
.
OPTIONS
.
NoOption
;
else
rendererOptions
=
ContactTitleRenderer
.
OPTIONS
.
IncludeOrganisation
;
var
renderer
=
new
ContactTitleRenderer
(
contact
,
rendererOptions
);
var
selectExpression
=
renderer
.
asSql
();
//TODO: verify if there is a better solution for the usage of this as a displayValueExpression --> automatic use of #TITLE | waiting vor implementation
...
...
@@ -342,10 +348,11 @@ ContactUtils.getOrgContactId = function(pOrgId)
* get the name of the person or organisation
*
* @param {String} pContactId the contact id where pers-name or orgname shall be loaded
* @param {Boolean} [pIncludeOrganisation=true] false if the organisation shall not be included in the result string
*
* @return {String} the name or ""
*/
ContactUtils
.
getFullTitleByContactId
=
function
(
pContactId
)
ContactUtils
.
getFullTitleByContactId
=
function
(
pContactId
,
pIncludeOrganisation
)
{
var
data
=
newSelect
(
"
ORGANISATION.NAME, PERSON.SALUTATION, PERSON.TITLE, PERSON.FIRSTNAME, PERSON.MIDDLENAME, PERSON.LASTNAME
"
)
.
from
(
"
CONTACT
"
)
...
...
@@ -358,7 +365,12 @@ ContactUtils.getFullTitleByContactId = function(pContactId)
return
""
;
var
contact
=
new
Contact
();
[
contact
.
organisationName
,
contact
.
salutation
,
contact
.
title
,
contact
.
firstname
,
contact
.
middlename
,
contact
.
lastname
]
=
data
;
var
renderer
=
new
ContactTitleRenderer
(
contact
);
var
rendererOptions
;
if
(
pIncludeOrganisation
===
false
)
rendererOptions
=
ContactTitleRenderer
.
OPTIONS
.
NoOption
;
else
rendererOptions
=
ContactTitleRenderer
.
OPTIONS
.
IncludeOrganisation
;
var
renderer
=
new
ContactTitleRenderer
(
contact
,
rendererOptions
);
return
renderer
.
asString
();
}
...
...
@@ -367,10 +379,11 @@ ContactUtils.getFullTitleByContactId = function(pContactId)
* do not use this for a mass of data (e.g. in a loop) since this will be slow due to select-time
*
* @param {String} pPersonId the id of the person where the data shall be loaded
* @param {Boolean} [pIncludeOrganisation=true] false if the organisation shall not be included in the result string
*
* @return {String} the name or ""
*/
ContactUtils
.
getTitleByPersonId
=
function
(
pPersonId
)
ContactUtils
.
getTitleByPersonId
=
function
(
pPersonId
,
pIncludeOrganisation
)
{
var
data
=
newSelect
(
"
PERSON.SALUTATION, PERSON.TITLE, PERSON.FIRSTNAME, PERSON.MIDDLENAME, PERSON.LASTNAME
"
)
.
from
(
"
PERSON
"
)
...
...
@@ -381,7 +394,12 @@ ContactUtils.getTitleByPersonId = function(pPersonId)
return
""
;
var
contact
=
new
Contact
();
[
contact
.
salutation
,
contact
.
title
,
contact
.
firstname
,
contact
.
middlename
,
contact
.
lastname
]
=
data
;
var
renderer
=
new
ContactTitleRenderer
(
contact
);
var
rendererOptions
;
if
(
pIncludeOrganisation
===
false
)
rendererOptions
=
ContactTitleRenderer
.
OPTIONS
.
NoOption
;
else
rendererOptions
=
ContactTitleRenderer
.
OPTIONS
.
IncludeOrganisation
;
var
renderer
=
new
ContactTitleRenderer
(
contact
,
rendererOptions
);
return
renderer
.
asString
();
}
...
...
@@ -644,6 +662,7 @@ function ContactTitleRenderer(pContact, pOptions)
var
res
=
maskingUtil
.
concat
([
this
.
contact
.
salutation
,
this
.
contact
.
title
,
this
.
contact
.
firstname
,
this
.
contact
.
middlename
,
this
.
contact
.
lastname
].
filter
(
function
(
e
){
return
e
!=
""
;
}),
"
"
);
//binary AND check for possibility to check serveral options
if
(
this
.
_options
&
ContactTitleRenderer
.
OPTIONS
.
IncludeOrganisation
&&
this
.
contact
.
organisationName
)
res
=
maskingUtil
.
concat
([
res
,
this
.
contact
.
organisationName
],
"
|
"
);
return
res
;
...
...
@@ -652,7 +671,7 @@ function ContactTitleRenderer(pContact, pOptions)
//function that renders the contact into a text (e.g. for a displayValue)
this
.
_asStringFn
=
function
(){
var
res
=
StringUtils
.
concat
(
"
"
,
[
this
.
contact
.
salutation
,
this
.
contact
.
title
,
this
.
contact
.
firstname
,
this
.
contact
.
middlename
,
this
.
contact
.
lastname
]);
//binary AND check for possibility to check serveral options
if
(
this
.
_options
&
ContactTitleRenderer
.
OPTIONS
.
IncludeOrganisation
&&
this
.
contact
.
organisationName
)
res
=
StringUtils
.
concat
(
"
|
"
,
[
res
,
this
.
contact
.
organisationName
]);
return
res
;
...
...
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