From 201c84a81ce2001416d8e9f9f0d97ea6e607843d Mon Sep 17 00:00:00 2001
From: "s.pongratz" <s.pongratz@adito.de>
Date: Thu, 4 Jun 2020 16:00:40 +0200
Subject: [PATCH] #1053365-LogHistory verwendung einer anderen Variable

---
 process/Loghistory_lib/process.js | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/process/Loghistory_lib/process.js b/process/Loghistory_lib/process.js
index fa07e912c7..0f88ed09da 100644
--- a/process/Loghistory_lib/process.js
+++ b/process/Loghistory_lib/process.js
@@ -109,12 +109,13 @@ LogHistoryExecutor.prototype.execute = function ()
         IDs: ["OBJECT_ROWID", "AB_ATTRIBUTE_ID"],
         Description: translate.text("Attribute", this.translationLanguage)
     };
+    
+    var oldvalues = {};
+    var newvalues = {};
 
     if (extra[this.affectedTable])
     {
         var conf = extra[this.affectedTable];
-        var oldvalues = {};
-        var newvalues = {};
 
         for(i = 0; i < this.columns.length; i++ )
         {
@@ -179,27 +180,27 @@ LogHistoryExecutor.prototype.execute = function ()
             if (logfield && logfield.log)
             {
                 if (this.sqlAction != 'I' && this.oldValues[i] != "") 
-                    this.oldValues[i] = this._getFormattedValue(this.columns[i], logfield, this.oldValues[i]);
+                    oldvalues[i] = this._getFormattedValue(this.columns[i], logfield, this.oldValues[i]);
                 if (this.sqlAction != 'D' && this.newValues[i] != "") 
-                    this.newValues[i] = this._getFormattedValue(this.columns[i], logfield, this.newValues[i]);
+                    newvalues[i] = this._getFormattedValue(this.columns[i], logfield, this.newValues[i]);
                 
                 var logfieldTitle = (logfield.title ? translate.text(logfield.title, this.translationLanguage) : translate.text("Value", this.translationLanguage));
-                if (this.sqlAction == 'U' && this.oldValues[i] != this.newValues[i])
+                if (this.sqlAction == 'U' && oldvalues[i] != newvalues[i])
                 {
                     //TODO: CLOB-check should be done by viewing the structure column type
                     //use .trim() for "[CLOB]" check because in some case the value "[CLOB]\n" my be given
-                    if (this.oldValues[i] != null && (this.oldValues[i].trim() == "[CLOB]" || this.oldValues[i].trim() == ""))
-                        description.push(translate.withArguments("%0 \"%1\"", [logfieldTitle + ":", this.newValues[i]], this.translationLanguage));
+                    if (oldvalues[i] != null && (oldvalues[i].trim() == "[CLOB]" || oldvalues[i].trim() == ""))
+                        description.push(translate.withArguments("%0 \"%1\"", [logfieldTitle + ":", newvalues[i]], this.translationLanguage));
                     else
-                        description.push(translate.withArguments("%0 from \"%1\" to \"%2\"", [logfieldTitle + ":", this.oldValues[i], this.newValues[i]], this.translationLanguage));
+                        description.push(translate.withArguments("%0 from \"%1\" to \"%2\"", [logfieldTitle + ":", oldvalues[i], newvalues[i]], this.translationLanguage));
                         
                 }
                 //use .trim() for "[CLOB]" check because in some case the value "[CLOB]\n" my be given
-                if (this.sqlAction == 'I' && this.newValues[i] != "" && this.newValues[i] != null && this.newValues[i].trim() != "[CLOB]")
-                    description.push(logfieldTitle + ": \"" + this.newValues[i] + "\"");
+                if (this.sqlAction == 'I' && newvalues[i] != "" && newvalues[i] != null && newvalues[i].trim() != "[CLOB]")
+                    description.push(logfieldTitle + ": \"" + newvalues[i] + "\"");
                 //use .trim() for "[CLOB]" check because in some case the value "[CLOB]\n" my be given
-                if (this.sqlAction == 'D' && this.oldValues[i] != "" && this.oldValues[i] != null  && this.oldValues[i].trim() != "[CLOB]")
-                    description.push(logfieldTitle + ": \"" + this.oldValues[i] + "\"");
+                if (this.sqlAction == 'D' && oldvalues[i] != "" && oldvalues[i] != null  && oldvalues[i].trim() != "[CLOB]")
+                    description.push(logfieldTitle + ": \"" + oldvalues[i] + "\"");
             }
         }
         if (this.sqlAction == "U")
-- 
GitLab