Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ADITO_Update_Upgrade
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Gitlab Maintenance 11.04.2025 | 20:00 - 23:00 MEZ
Show more breadcrumbs
xrm
ADITO_Update_Upgrade
Commits
6059a609
Commit
6059a609
authored
5 years ago
by
Johannes Hörmann
Browse files
Options
Downloads
Patches
Plain Diff
360: add different context-filter for subcontexts
parent
17e21540
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
entity/360Degree_entity/recordcontainers/jdito/contentProcess.js
+17
-8
17 additions, 8 deletions
...360Degree_entity/recordcontainers/jdito/contentProcess.js
process/Context_lib/process.js
+6
-5
6 additions, 5 deletions
process/Context_lib/process.js
with
23 additions
and
13 deletions
entity/360Degree_entity/recordcontainers/jdito/contentProcess.js
+
17
−
8
View file @
6059a609
...
...
@@ -10,7 +10,7 @@ if (vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param"
{
var
active
;
var
selectMap
=
ContextUtils
.
getSelectMap
()
var
selectMap
=
ContextUtils
.
getSelectMap
()
;
if
(
vars
.
exists
(
"
$local.filter
"
)
&&
vars
.
get
(
"
$local.filter
"
)
)
{
var
filter
=
vars
.
get
(
"
$local.filter
"
);
...
...
@@ -28,7 +28,7 @@ if (vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param"
var
contextList
=
JSON
.
parse
(
vars
.
getString
(
"
$param.ObjectType_param
"
));
var
contactId
=
vars
.
get
(
"
$param.ObjectRowId_param
"
);
var
baseContext
=
vars
.
exists
(
"
$param.BaseContextId_param
"
)
?
vars
.
get
(
"
$param.BaseContextId_param
"
)
:
undefined
;
result
.
object
(
_get360Data
(
baseContext
,
contactId
,
contextList
,
active
,
undefined
,
baseContext
!=
undefined
));
result
.
object
(
_get360Data
(
selectMap
,
baseContext
,
contactId
,
contextList
,
active
,
undefined
,
baseContext
!=
undefined
));
}
...
...
@@ -38,11 +38,20 @@ else
}
/**
* load all data for the 360Degree tree.
* @param {Object} pSelectMap the select map (result of ContextUtils.getSelectMap())
* @param {String} pBaseContextId the ContextId in which this 360 Degree tree is located / for which the data should be loaded
* @param {String[]} pContactId the Contactid the 360 Degree tree should be loaded for
* @param {String[]} pContextList list of contexts to load. Note that subcontexts use their own list, defined in ContextUtils
* @param {Boolean} [pActive=undefined] if not undefined: it select only for active / inactive state
* @param {String[]} [pExcludedObjectIds=undefined] if set: this contextIds are filtered out.
* @param {Boolean} [pAlsoAddFromSubcontexts=false] if true also load data from contexts which are configured as subcontexts.
* A subcontext is for example used by Organisations, which also load the data from all Persons in this organisation into the 360°-view.
* Does not include subcontexts of subcontexts
*
* @return {String[][]} the resulting data
*/
function
_get360Data
(
pBaseContextId
,
pContactId
,
pContextList
,
pActive
,
pExcludedObjectIds
,
pAlsoAddFromSubcontexts
)
function
_get360Data
(
pSelectMap
,
pBaseContextId
,
pContactId
,
pContextList
,
pActive
,
pExcludedObjectIds
,
pAlsoAddFromSubcontexts
)
{
var
resultList
=
[];
pContextList
.
forEach
(
function
(
context
)
...
...
@@ -60,7 +69,7 @@ function _get360Data(pBaseContextId, pContactId, pContextList, pActive, pExclude
record
[
5
]
=
translate
.
text
(
pActive
);
else
{
if
(
s
electMap
[
context
].
activeStates
.
indexOf
(
row
[
3
])
>
-
1
)
if
(
pS
electMap
[
context
].
activeStates
.
indexOf
(
row
[
3
])
>
-
1
)
record
[
5
]
=
translate
.
text
(
"
true
"
);
else
record
[
5
]
=
translate
.
text
(
"
false
"
);
...
...
@@ -71,7 +80,7 @@ function _get360Data(pBaseContextId, pContactId, pContextList, pActive, pExclude
if
(
pAlsoAddFromSubcontexts
)
{
var
baseContextData
=
ContextUtils
.
get
SelectMap
()
[
pBaseContextId
];
var
baseContextData
=
p
SelectMap
[
pBaseContextId
];
var
subContexts
=
baseContextData
.
getSubContexts
(
pContactId
);
if
(
!
pExcludedObjectIds
)
...
...
@@ -81,13 +90,13 @@ function _get360Data(pBaseContextId, pContactId, pContextList, pActive, pExclude
for
(
subContextId
in
subContexts
)
{
var
subContextSql
=
subContexts
[
subContextId
];
var
subContextSql
=
subContexts
[
subContextId
]
[
0
]
;
// select Ids from subcontexts
var
subContextContactIds
=
db
.
array
(
db
.
COLUMN
,
subContextSql
);
subContextContactIds
.
forEach
(
function
(
pId
)
{
// V-- do not add subcontexts deeper than one layer
var
subcontextRes
=
_get360Data
(
undefine
d
,
pId
,
p
Context
List
,
pActive
,
pExcludedObjectIds
,
false
);
// V-- do not add subcontexts deeper than one layer
var
subcontextRes
=
_get360Data
(
pSelectMap
,
pBaseContextI
d
,
pId
,
sub
Context
s
[
subContextId
][
1
]
,
pActive
,
pExcludedObjectIds
,
false
);
logging
.
log
(
subcontextRes
.
toSource
())
resultList
=
resultList
.
concat
(
subcontextRes
);
});
...
...
This diff is collapsed.
Click to expand it.
process/Context_lib/process.js
+
6
−
5
View file @
6059a609
...
...
@@ -242,8 +242,9 @@ function ContextSelector(pTableName, pIdField, pTitleExpression)
* an object which contains the subcontexts and the prepared select to get the contactIds of them.
* V--With Tablename!
* { V-- before id-condition | add "and", if needed --V V-IdCollumn name V-- optional after-condition SQL (e.g. group by etc.)
* "Person": ["select PERSON_ID from CONTACT where PERSON_ID is not null and", "CONTACT.ORGANISATION_ID", ''],
* "Offer" ...
* "Person": ["select PERSON_ID from CONTACT where PERSON_ID is not null and", "CONTACT.ORGANISATION_ID", '', ["Offer", "Contract"]],
* // the contexts to show for this subcontext
* "Offer" ... // you can add as many subcontexts as you wish
* }
* read-only property; set it with a matching setter
* @property
...
...
@@ -299,9 +300,9 @@ ContextSelector.prototype.getSubContexts = function(pParentRowId)
for
(
contextId
in
this
.
subContexts
)
{
sqls
[
contextId
]
=
SqlCondition
.
begin
()
sqls
[
contextId
]
=
[
SqlCondition
.
begin
()
.
andPrepare
(
this
.
subContexts
[
contextId
][
1
],
pParentRowId
)
.
buildSql
(
this
.
subContexts
[
contextId
][
0
],
"
1=2
"
,
this
.
subContexts
[
contextId
][
2
],
false
);
.
buildSql
(
this
.
subContexts
[
contextId
][
0
],
"
1=2
"
,
this
.
subContexts
[
contextId
][
2
],
false
)
,
this
.
subContexts
[
contextId
][
3
]]
;
}
return
sqls
;
...
...
@@ -377,7 +378,7 @@ ContextUtils.getSelectMap = function()
.
setJoinExpression
(
"
join CONTACT on ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID and CONTACT.PERSON_ID is null
"
)
.
setCondition
(
SqlCondition
.
begin
().
and
(
"
ORGANISATION.ORGANISATIONID != '0'
"
))
.
setSubContexts
({
"
Person
"
:
[
"
select CONTACTID from CONTACT where PERSON_ID is not null and
"
,
"
CONTACT.ORGANISATION_ID
"
,
''
]
"
Person
"
:
[
"
select CONTACTID from CONTACT where PERSON_ID is not null and
"
,
"
CONTACT.ORGANISATION_ID
"
,
''
,
[
"
Offer
"
,
"
Contract
"
]
]
})
,
"
Person
"
:
ContextSelector
.
create
(
"
CONTACT
"
,
"
CONTACTID
"
)
.
setTitleExpression
(
maskingUtils
.
concat
([
...
...
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