Skip to content
Snippets Groups Projects
Commit 46c37ea0 authored by Sebastian Listl's avatar Sebastian Listl :speech_balloon:
Browse files

#1066606 ObjectRelation deletion

parent 683f1bff
No related branches found
No related tags found
No related merge requests found
......@@ -144,7 +144,7 @@ function _loadObjectRelationTree(pObjectId, pObjectType, pObjectRelationTypeId,
else // no ObjectType chosen
{
// load all ObjectRelationTypes
var relationTypes = _getPossibleRelationTypes(pObjectType);
var relationTypes = ObjectRelationUtils.getPossibleRelationTypes([pObjectType], true);
relationTypes.forEach(function (relationType, i)
{
......@@ -238,8 +238,7 @@ function _getEntryData(pObjectId, pDirection, pRelationType1, pRelationType2, pP
onConditionForRelationTypeJoin = newWhere("AB_OBJECTRELATIONTYPEID = AB_OBJECTRELATIONTYPE" + myNum)
.and("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE1", pRelationType1)
.and("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE2", pRelationType2)
.andIfSet("AB_OBJECTRELATION.AB_OBJECTRELATIONID", pObjectRelationId || null); // set id to null, as only null works with .andIfSet
.and("AB_OBJECTRELATION.AB_OBJECTRELATIONTYPE2", pRelationType2);
// wird benoetigt zum Bearbeiten
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT)
......@@ -259,23 +258,19 @@ function _getEntryData(pObjectId, pDirection, pRelationType1, pRelationType2, pP
var data = newSelect("OBJECT" + (pObjectRelationId ? myNum : otherNum) + "_ROWID, AB_OBJECTRELATIONID, OBJECT_TYPE, RELATION_TITLE, INFO, AB_OBJECTRELATIONTYPEID")
.from("AB_OBJECTRELATION")
.join("AB_OBJECTRELATIONTYPE", onConditionForRelationTypeJoin)
.whereIfSet("AB_OBJECTRELATION.AB_OBJECTRELATIONID", pObjectRelationId || null) // set id to null, as only null works with .andIfSet
.table();
// try again with other side for "same"
if (data.length == 0 && pDirection == "same" && !pNoRecursion || pObjectRelationId && data.length > 0 && !data[0][0])
return _getEntryData(pObjectId, "normal", pRelationType1, pRelationType2, pPrevId, true, pObjectRelationId)
if (data.length == 0 && pDirection == "same" && !pNoRecursion || pObjectRelationId && data.length > 0 && !data[0][0]
|| data.length == 0 && pDirection == "reverse" && !pNoRecursion && pObjectRelationId)
return _getEntryData(pObjectId, "normal", pRelationType1, pRelationType2, pPrevId, true, pObjectRelationId);
// TODO: BINDATA?
//for ( var i = 0; i < data.length; i++) data[i][2] = image[data[i][2]] == undefined ? "" : image[data[i][2]];
return data;
}
function _getPossibleRelationTypes(pObjectType)
{
// TODO: load from entity when possible
return ObjectRelationUtils.getPossibleRelationTypes([pObjectType], true);
}
/**
* insert a new Entry
*
......
......@@ -3,5 +3,4 @@ import("Sql_lib");
var objectRelationId = vars.get("$local.rowdata")["OBJECTRELATIONID.value"];
newWhereIfSet("AB_OBJECTRELATION.AB_OBJECTRELATIONID", objectRelationId).deleteData();
newWhereIfSet("AB_OBJECTRELATION.AB_OBJECTRELATIONID", objectRelationId).deleteData();
\ No newline at end of file
......@@ -1104,7 +1104,8 @@ _DuplicateScannerUtils._migrateParticipantsToNewContact = function (pTableName,
{
var excludedIds = newSelect(pAssignableIdColumn)
.from(pTableName)
.where([pTableName, pContactIdColumn], pTargetContactId);
.where([pTableName, pContactIdColumn], pTargetContactId)
.arrayColumn();
var updateCount = newWhere([pTableName, pAssignableIdColumn], excludedIds, SqlBuilder.NOT_IN())
.and([pTableName, pContactIdColumn], pSourceContactId)
......
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