Skip to content
Snippets Groups Projects
Commit 69313e3e authored by Benjamin Ulrich's avatar Benjamin Ulrich :speech_balloon: Committed by Johannes Goderbauer
Browse files

[Projekt: Entwicklung - xRM][TicketNr.: 1069300][Klassifizierung update wird...

[Projekt: Entwicklung - xRM][TicketNr.: 1069300][Klassifizierung update wird nicht gepaged und "-" wird gespeichert für Firmen ohne Klassifizierungen]
parent a235c05c
No related branches found
No related tags found
No related merge requests found
......@@ -161,5 +161,12 @@ function _updateScore()
var values = [calculatedClassification];
if(storedClassification[1] != undefined && calculatedClassification != storedClassification[1]) //Update the stored classification if the freshly calculated one differs
newWhere("CLASSIFICATIONSTORAGE.CLASSIFICATIONSTORAGEID", storedClassification[0]).updateData(true, table, columns, null, values);
{
newWhere("CLASSIFICATIONSTORAGE.CLASSIFICATIONSTORAGEID", storedClassification[0]).updateData(true, table, columns, null, values);
}
else if(storedClassification[1] == undefined) //insert if no classificationstorage exists yet
{
db.insertData(table, ["CLASSIFICATIONSTORAGEID", "CLASSIFICATIONVALUE", "OBJECT_ROWID", "OBJECT_TYPE"], null,
[util.getNewUUID(), calculatedClassification, objectRowIdParam, objectTypeParam])
}
}
\ No newline at end of file
import("system.vars");
import("Classification_lib");
import("Workflow_lib");
var uid = vars.get("$sys.uid");
var contextname = vars.get("$sys.currentcontextname");
ClassificationUtils.insertEmptyClassification(uid, contextname);
//start the execution in afterOperatingState, because here the dataset is not yet inserted
vars.set("$context.workflowQueue", {});
WorkflowSignalSender.inserted();
\ No newline at end of file
import("Classification_lib");
import("Workflow_lib");
import("Context_lib");
import("Attribute_lib");
......@@ -17,11 +16,6 @@ if (vars.get("$field.PROJECTTYPE"))
.insertAttribute(vars.get("$field.PROJECTTYPE"), true);
}
var salesprojectId = vars.get("$field.SALESPROJECTID");
var contextname = vars.get("$sys.currentcontextname");
ClassificationUtils.insertEmptyClassification(salesprojectId, contextname);
//start the execution in afterOperatingState, because here the dataset is not yet inserted
vars.set("$context.workflowQueue", {});
WorkflowSignalSender.inserted();
\ No newline at end of file
......@@ -239,8 +239,15 @@ ClassificationGroupFilterUtils.getFilterFields = function(pObjectType)
classificationGroups.forEach(function(classificationGroup, idx){
var classificationGroupId = classificationGroup["CLASSIFICATIONGROUPID"];
var classificationGroupTitle = classificationGroup["#CONTENTTITLE"];
var representingSqlExpression = sqlHelper.substring("CLASSIFICATIONVALUE", idx+1, 1);
//"case when" needed since we want to group both the ones that have no classification for said classificationgroup ("-")
//and the ones that have null as the value (since not all datasets have a CLASSIFICATIONSTORAGE dataset) together
// since both don't have an classification for that group
var representingSqlExpression = SqlBuilder.caseWhen(newWhere("CLASSIFICATIONSTORAGE.CLASSIFICATIONVALUE is null"))
.thenString("-")
.elseValue(sqlHelper.substring("CLASSIFICATIONVALUE", idx+1, 1))
.toString();
var name = ClassificationGroupFilterNameCoder.encode(classificationGroupId, representingSqlExpression);
res.push({
name: name,
......@@ -318,7 +325,12 @@ ClassificationGroupFilterUtils.getFilterCondition = function(pObjectType, pFilte
{
var decodedFilterName = ClassificationGroupFilterNameCoder.decode(pFilterName);
var condition = StringUtils.replaceAll(pCondition, pColumnPlaceholder, decodedFilterName.representingSqlExpression);
//"case when" needed since we want to filter both the ones that have no classification for said classificationgroup ("-")
//and the ones that have null as the value (since not all datasets have a CLASSIFICATIONSTORAGE dataset) the same way
// since both don't have an classification for that group
if(pOperatorName == "IS NULL")
condition += " OR " + decodedFilterName.representingSqlExpression +"='-'";
return condition;
};
......
......@@ -111,23 +111,7 @@ for (i = 0; i < objectTypes.length; i++) //update for each object_type
}
//this is the "upgrade" part of this process:
//first: insert default values into the records that have no entries
idsWithoutStoredClassification = newSelect(currentObjectColumn)
.from(currentObjectTable)
.where(currentObjectColumn, newSelect("CLASSIFICATIONSTORAGE.OBJECT_ROWID").from("CLASSIFICATIONSTORAGE").where("CLASSIFICATIONSTORAGE.OBJECT_TYPE", objectTypes[i]), SqlBuilder.NOT_IN())
if(isOrganisation)
{
idsWithoutStoredClassification.and("CONTACT.PERSON_ID is null")
.and("CONTACT.ORGANISATION_ID", OrgUtils.getPrivateOrganisationId(), SqlBuilder.NOT_EQUAL());
}
idsWithoutStoredClassification = idsWithoutStoredClassification.arrayColumn();
if(idsWithoutStoredClassification)
ClassificationUtils.insertEmptyClassification(idsWithoutStoredClassification, objectTypes[i]);
//second: update all entries with correct classificaiton values
//update all entries with correct classificaiton values
//all groups of the objectType in the correct order, needed later to also add the "-" gradings if no classificationType has been set under that group
orderedGroups = newSelect("distinct CLASSIFICATIONGROUP.CLASSIFICATIONGROUPID, CLASSIFICATIONGROUP.SORTING")
......@@ -206,7 +190,14 @@ for (i = 0; i < objectTypes.length; i++) //update for each object_type
cond = newWhere("CLASSIFICATIONSTORAGE.OBJECT_ROWID", row_Id)
.and("CLASSIFICATIONSTORAGE.OBJECT_TYPE", objectTypes[i])
.and("CLASSIFICATIONSTORAGE.CLASSIFICATIONVALUE", chainedGrading, SqlBuilder.NOT_EQUAL());
var count = Number(cond.updateData(true, table, column, null, [chainedGrading]));
if(new RegExp("^-+$").test(chainedGrading) == true || chainedGrading == "-")
{
count = newWhere("CLASSIFICATIONSTORAGE.OBJECT_ROWID", row_Id).deleteData(true, "CLASSIFICATIONSTORAGE");
}
else
{
count = Number(cond.updateData(true, table, column, null, [chainedGrading]));
}
if (count > 0)
{
outputInformation[objectTypes[i]].updatedElements += count;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment