From 5155baa907910b3b9f69055d46f93535340aa10c Mon Sep 17 00:00:00 2001
From: Benjamin Ulrich <b.ulrich@adito.de>
Date: Fri, 15 Jan 2021 12:17:55 +0000
Subject: [PATCH] [Projekt: Entwicklung - xRM][TicketNr.: 1071715][Inserts an
 allen stellen wo der WorkflowSignalSender benutzt wird werfen Fehler]

---
 process/Classification_lib/process.js | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/process/Classification_lib/process.js b/process/Classification_lib/process.js
index a52b6fb0b2..c0754df5bf 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]);
-- 
GitLab