diff --git a/process/Classification_lib/process.js b/process/Classification_lib/process.js index a52b6fb0b21031a67548cc4141ff55780af557aa..c0754df5bf42441f5bd9ca3f433c7234c58ec1f2 100644 --- a/process/Classification_lib/process.js +++ b/process/Classification_lib/process.js @@ -295,8 +295,19 @@ ClassificationUtils.setClassificationStorageDatasetsOutdated = function (pTarget classificationStorageIds.push(Dependency.mapping()[entityName]["Salesproject_entity"].getUIDsfn(pRowData, pChangedRows)); } +//we have to remove empty arrays, since otherwise it would lead to an error when trying to use the condition for updating +//empty arrays occur when e.g. inserting something that doesn't have any classificationStorageIds even though it is classificationrelevant + for (let i = 0; i < classificationStorageIds.length; i++) + { + if(classificationStorageIds[i][0] == undefined) + { + classificationStorageIds.splice(i, 1); + i--; + } + } + //set outdated flag for the classificationStorage datasets - if(relevantForClassification) + if(relevantForClassification && classificationStorageIds.length > 0) // also check for the classificationStorageIds.length since it could be empty { var cond = newWhere("CLASSIFICATIONSTORAGE.OBJECT_ROWID", classificationStorageIds, SqlBuilder.IN()); cond.updateData(true, "CLASSIFICATIONSTORAGE", ["OUTDATED"], null, [1]);