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
3acb969f
Commit
3acb969f
authored
6 years ago
by
Johannes Goderbauer
Browse files
Options
Downloads
Patches
Plain Diff
Context_lib: exclude private-dummy organisation
parent
e4342917
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/Context_lib/process.js
+24
-11
24 additions, 11 deletions
process/Context_lib/process.js
with
24 additions
and
11 deletions
process/Context_lib/process.js
+
24
−
11
View file @
3acb969f
...
...
@@ -183,6 +183,7 @@ function ContextSelector(pTableName, pIdField, pTitleExpression)
* @property
*/
this
.
activeStates
=
null
;
ProtoPropertyUtils
.
makeSemiReadOnly
(
this
,
"
activeStates
"
);
this
.
condition
=
null
;
ProtoPropertyUtils
.
makeSemiReadOnly
(
this
,
"
condition
"
);
}
/**
* creates a new instance of a ContextSelector and returns it
...
...
@@ -252,6 +253,15 @@ ContextSelector.prototype.setActiveStates = function(pValue)
this
.
_activeStates
=
pValue
;
return
this
;
};
/**
* sets the condition property of a ContextSelector-object
* @param {Object} pSqlCondition condition as SqlCondition-object
*/
ContextSelector
.
prototype
.
setCondition
=
function
(
pSqlCondition
)
{
this
.
_condition
=
pSqlCondition
;
return
this
;
};
/**
* TODO: !!!temporary function until you can get fields from another Entity!!!
...
...
@@ -261,6 +271,7 @@ ContextUtils.getSelectMap = function()
var
maskingUtils
=
new
SqlMaskingUtils
();
return
{
"
Organisation
"
:
ContextSelector
.
create
(
"
ORGANISATION
"
,
"
ORGANISATIONID
"
,
"
NAME
"
)
.
setCondition
(
SqlCondition
.
begin
().
and
(
"
ORGANISATION.ORGANISATIONID != '0'
"
))
,
"
Person
"
:
ContextSelector
.
create
(
"
CONTACT
"
,
"
CONTACTID
"
)
.
setTitleExpression
(
maskingUtils
.
concat
([
new
ContactTitleRenderer
(
Contact
.
createWithColumnPreset
()).
asSql
()
...
...
@@ -365,37 +376,39 @@ ContextUtils.getNameSql = function(pContextId, pRowId)
*/
ContextUtils
.
getContextDataSql
=
function
(
pContextId
,
pRowId
,
pWithDate
,
pActive
,
pWithState
)
{
var
selectMap
=
ContextUtils
.
getSelectMap
();
var
selectMap
=
ContextUtils
.
getSelectMap
();
var
ownContextSelector
=
selectMap
[
pContextId
];
var
cond
=
SqlCondition
.
begin
();
if
(
pRowId
)
{
cond
.
andPrepare
(
selectMap
[
pContextId
].
tableName
+
"
.
"
+
selectMap
[
pContextId
]
.
contactIdField
,
pRowId
)
cond
.
andPrepare
(
ownContextSelector
.
tableName
+
"
.
"
+
ownContextSelector
.
contactIdField
,
pRowId
)
}
if
(
pActive
!=
undefined
)
{
var
activeStates
=
selectMap
[
pContextId
]
.
activeStates
;
var
activeStates
=
ownContextSelector
.
activeStates
;
if
(
activeStates
!=
null
&&
activeStates
.
length
>
0
)
{
var
condSub
=
SqlCondition
.
begin
();
activeStates
.
forEach
(
function
(
state
)
{
if
(
pActive
)
condSub
.
orPrepare
(
selectMap
[
pContextId
].
tableName
+
"
.
"
+
selectMap
[
pContextId
]
.
stateField
,
state
)
condSub
.
orPrepare
(
ownContextSelector
.
tableName
+
"
.
"
+
ownContextSelector
.
stateField
,
state
)
else
condSub
.
andPrepare
(
selectMap
[
pContextId
].
tableName
+
"
.
"
+
selectMap
[
pContextId
]
.
stateField
,
state
,
"
# != ?
"
)
condSub
.
andPrepare
(
ownContextSelector
.
tableName
+
"
.
"
+
ownContextSelector
.
stateField
,
state
,
"
# != ?
"
)
});
cond
.
andSqlCondition
(
condSub
);
}
}
var
dateColumn
=
""
;
if
(
pWithDate
===
true
)
dateColumn
=
"
,
"
+
(
selectMap
[
pContextId
].
creationDateField
||
"
''
"
);
dateColumn
=
"
,
"
+
(
ownContextSelector
.
creationDateField
||
"
''
"
);
var
stateColumn
=
""
;
if
(
pWithState
===
true
)
stateColumn
=
"
,
"
+
(
selectMap
[
pContextId
].
stateField
||
"
''
"
);
return
cond
.
buildSql
(
"
select
"
+
selectMap
[
pContextId
].
getFullIdField
()
+
"
,
"
+
selectMap
[
pContextId
].
titleExpression
+
dateColumn
+
stateColumn
+
"
from
"
+
selectMap
[
pContextId
].
getFullFromClause
(),
"
1=1
"
);
stateColumn
=
"
,
"
+
(
ownContextSelector
.
stateField
||
"
''
"
);
if
(
ownContextSelector
.
condition
)
cond
.
andSqlCondition
(
ownContextSelector
.
condition
);
var
res
=
cond
.
buildSql
(
"
select
"
+
ownContextSelector
.
getFullIdField
()
+
"
,
"
+
ownContextSelector
.
titleExpression
+
dateColumn
+
stateColumn
+
"
from
"
+
ownContextSelector
.
getFullFromClause
(),
"
1=1
"
);
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