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
f0d5a0b8
Commit
f0d5a0b8
authored
4 years ago
by
S.Listl
Browse files
Options
Downloads
Patches
Plain Diff
1057723 Missing functions in Attribute_lib restored
parent
e68a7951
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
entity/Attribute_entity/recordcontainers/jdito/contentProcess.js
+1
-1
1 addition, 1 deletion
...Attribute_entity/recordcontainers/jdito/contentProcess.js
process/Attribute_lib/process.js
+98
-0
98 additions, 0 deletions
process/Attribute_lib/process.js
with
99 additions
and
1 deletion
entity/Attribute_entity/recordcontainers/jdito/contentProcess.js
+
1
−
1
View file @
f0d5a0b8
...
...
@@ -16,7 +16,7 @@ var childType = vars.get("$param.ChildType_param");
var
objectType
=
vars
.
get
(
"
$param.ObjectType_param
"
);
var
filteredIds
=
vars
.
getString
(
"
$param.FilteredAttributeIds_param
"
)
?
JSON
.
parse
(
vars
.
getString
(
"
$param.FilteredAttributeIds_param
"
))
:
null
var
attributeCountObj
=
vars
.
get
(
"
$param.AttributeCount_param
"
)
?
JSON
.
parse
(
vars
.
getString
(
"
$param.AttributeCount_param
"
))
:
null
;
vars
.
getString
(
"
$param.DisplaySimpleName_param
"
)
==
"
true
"
?
true
:
false
;
var
displaySimpleName
=
vars
.
getString
(
"
$param.DisplaySimpleName_param
"
)
==
"
true
"
?
true
:
false
;
var
themeObjectRowId
=
vars
.
get
(
"
$param.ThemeObjectRowId_param
"
);
...
...
This diff is collapsed.
Click to expand it.
process/Attribute_lib/process.js
+
98
−
0
View file @
f0d5a0b8
...
...
@@ -1686,4 +1686,102 @@ AttributeRelationQuery.prototype.insertAttribute = function (pValue, pOmitValida
new
SqlBuilder
().
insertFields
(
attrData
,
"
AB_ATTRIBUTERELATION
"
,
"
AB_ATTRIBUTERELATIONID
"
);
return
true
;
}
/**
* deletes all attribute relations with the given rowId and objectType
*
* @return {Number} count of deleted rows
*/
AttributeRelationQuery
.
prototype
.
deleteAllAttributes
=
function
()
{
if
(
!
this
.
_rowId
)
throw
new
Error
(
"
AttributeRelationQuery: Row id is required for delete
"
);
return
newWhere
(
"
AB_ATTRIBUTERELATION.OBJECT_ROWID
"
,
this
.
_rowId
)
.
andIfSet
(
"
AB_ATTRIBUTERELATION.OBJECT_TYPE
"
,
this
.
_objectType
)
.
deleteData
();
}
/**
* Object representing one attribute relation in the database. Don't use this constructor in you own code!
* Instances of this should only be created by functions in this library.
*
* @param {String} pAttributeRelationId attribute relation id
* @param {String} pAttributeId attribute id
* @param {String} pValue value of the attribute
* @param {String} pAttributeName name of the attribute
* @param {String} pAttributeType type of the attribute
* @param {String} pObjectRowId rowId of the linked object
* @param {String} pObjectType context of the linked object
*/
function
AttributeRelation
(
pAttributeRelationId
,
pAttributeId
,
pValue
,
pAttributeName
,
pAttributeType
,
pObjectRowId
,
pObjectType
)
{
if
(
!
pAttributeRelationId
)
throw
new
Error
(
"
AttributeRelation: pAttributeRelationId must be provided
"
);
this
.
attributeRelationId
=
pAttributeRelationId
;
this
.
attributeId
=
pAttributeId
;
this
.
value
=
pValue
;
this
.
attributeName
=
pAttributeName
;
this
.
attributeType
=
pAttributeType
;
this
.
objectRowId
=
pObjectRowId
;
this
.
objectType
=
pObjectType
;
this
.
displayValue
=
undefined
;
this
.
fullAttributeName
=
undefined
;
}
/**
* updates the value of the attribute in the database
*
* @param {String} pValue the new value of the attribute relation
* @return {Boolean} currently the function always returns true (if some kind of validation is implemented in the future,
* it will return false if the validation fails)
*/
AttributeRelation
.
prototype
.
updateAttribute
=
function
(
pValue
)
{
if
(
pValue
==
undefined
||
pValue
==
""
)
throw
new
Error
(
"
AttributeRelation: no value provided for update
"
);
var
attrData
=
{
"
DATE_EDIT
"
:
vars
.
get
(
"
$sys.date
"
),
"
USER_EDIT
"
:
vars
.
get
(
"
$sys.user
"
)
};
var
valueField
=
AttributeTypeUtil
.
getDatabaseField
(
this
.
attributeType
);
if
(
valueField
)
attrData
[
valueField
]
=
pValue
;
newWhere
(
"
AB_ATTRIBUTERELATION.AB_ATTRIBUTERELATIONID
"
,
this
.
attributeRelationId
)
.
updateFields
(
attrData
);
return
true
;
}
/**
* deletes the attribute relation from the database
*
* @param {Boolean} [pOmitValidation=false] if set to true, the function won't check if the min count prohibits the deletion
* @retun {Boolean} true if it was deleted and false if the min count doesn't allow the deletion
*/
AttributeRelation
.
prototype
.
deleteAttribute
=
function
(
pOmitValidation
)
{
if
(
!
pOmitValidation
)
{
var
minCount
=
newSelect
(
"
MIN_COUNT
"
)
.
from
(
"
AB_ATTRIBUTEUSAGE
"
)
.
where
(
"
AB_ATTRIBUTEUSAGE.AB_ATTRIBUTE_ID
"
,
this
.
attributeId
)
.
and
(
"
AB_ATTRIBUTEUSAGE.OBJECT_TYPE
"
,
this
.
objectType
)
.
cell
();
if
(
minCount
&&
minCount
!=
0
)
{
let
timesUsed
=
new
AttributeRelationQuery
(
this
.
objectRowId
,
this
.
attributeId
,
this
.
objectType
).
getAttributeCount
();
if
(
timesUsed
<=
minCount
)
return
false
;
}
}
newWhere
(
"
AB_ATTRIBUTERELATION.AB_ATTRIBUTERELATIONID
"
,
this
.
attributeRelationId
)
.
deleteData
();
return
true
;
}
\ No newline at end of file
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