From 79b87e6450302e9b1f7b3a6f33ce552d45deb840 Mon Sep 17 00:00:00 2001
From: Johannes Hoermann <j.hoermann@adito.de>
Date: Fri, 1 Feb 2019 14:31:11 +0100
Subject: [PATCH] refactor: cleanup loggings

---
 .../entityfields/is_standard/valueProcess.js  |  8 +-
 .../entityfields/product_id/onValueChange.js  |  3 -
 entity/Options_Entity/contentProcess.js       |  2 -
 .../recordcontainers/jdito/contentProcess.js  |  3 +-
 .../children/relationtype_param/code.js       |  2 -
 .../onUpdate.js                               |  4 -
 .../recordcontainers/jdito/onUpdate.js        |  4 -
 .../SalesprojectClassification_entity.aod     |  1 -
 .../onUpdate.js                               |  4 -
 .../recordcontainers/jdito/onUpdate.js        |  4 -
 .../children/relationid_param/code.js         |  3 +-
 process/OfferOrder_lib/process.js             | 10 ---
 process/Product_lib/process.js                | 85 +------------------
 13 files changed, 8 insertions(+), 125 deletions(-)
 delete mode 100644 entity/SalesprojectClassification_entity/onUpdate.js
 delete mode 100644 entity/SalesprojectClassification_entity/recordcontainers/jdito/onUpdate.js

diff --git a/entity/Comm_entity/entityfields/is_standard/valueProcess.js b/entity/Comm_entity/entityfields/is_standard/valueProcess.js
index c973c9d87a..64cb76b496 100644
--- a/entity/Comm_entity/entityfields/is_standard/valueProcess.js
+++ b/entity/Comm_entity/entityfields/is_standard/valueProcess.js
@@ -1,6 +1,4 @@
-import("system.logging");
-import("system.vars");
-import("system.result");
-
-logging.log("STANDARD.valueProcess|changedVal:" + vars.get("$this.value") + ">for>" + vars.get("$field.COMMID") + ">" + vars.get("$field.ADDR"));
+import("system.vars");
+import("system.result");
+
 result.string(vars.get("$field.STANDARD") == "1");
\ No newline at end of file
diff --git a/entity/Offeritem_entity/entityfields/product_id/onValueChange.js b/entity/Offeritem_entity/entityfields/product_id/onValueChange.js
index a7a60f8c53..35060d8cbe 100644
--- a/entity/Offeritem_entity/entityfields/product_id/onValueChange.js
+++ b/entity/Offeritem_entity/entityfields/product_id/onValueChange.js
@@ -1,13 +1,10 @@
-import("system.logging");
 import("system.vars");
 import("system.neon");
 import("Product_lib");
 import("Util_lib");
 import("Entity_lib");
 
-logging.log("----------field: " + vars.get("$field.PRODUCT_ID") + "---")
 var pid = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.PRODUCT_ID"));
-logging.log(pid)
 if(pid != "")
 {
     var curr = vars.exists("$param.Currency_param") ? vars.get("$param.Currency_param") : "";
diff --git a/entity/Options_Entity/contentProcess.js b/entity/Options_Entity/contentProcess.js
index db475b523c..05c6a54861 100644
--- a/entity/Options_Entity/contentProcess.js
+++ b/entity/Options_Entity/contentProcess.js
@@ -1,4 +1,2 @@
-import("system.logging");
 import("system.result");
-logging.log("OPTIONS")
 result.object([["1", "some text", "999", "124367654784", "some password"]])
\ No newline at end of file
diff --git a/entity/Options_Entity/recordcontainers/jdito/contentProcess.js b/entity/Options_Entity/recordcontainers/jdito/contentProcess.js
index db475b523c..404d2ebf8c 100644
--- a/entity/Options_Entity/recordcontainers/jdito/contentProcess.js
+++ b/entity/Options_Entity/recordcontainers/jdito/contentProcess.js
@@ -1,4 +1,3 @@
-import("system.logging");
 import("system.result");
-logging.log("OPTIONS")
+
 result.object([["1", "some text", "999", "124367654784", "some password"]])
\ No newline at end of file
diff --git a/entity/Pers_entity/entityfields/persorgsaddresses_dfo/children/relationtype_param/code.js b/entity/Pers_entity/entityfields/persorgsaddresses_dfo/children/relationtype_param/code.js
index 0a4d002697..85a095aeb8 100644
--- a/entity/Pers_entity/entityfields/persorgsaddresses_dfo/children/relationtype_param/code.js
+++ b/entity/Pers_entity/entityfields/persorgsaddresses_dfo/children/relationtype_param/code.js
@@ -1,5 +1,3 @@
-import("system.logging");
 import("system.result");
 
-logging.log("org")
 result.object(1);
\ No newline at end of file
diff --git a/entity/SalesprojectClassificationEntry_entity/onUpdate.js b/entity/SalesprojectClassificationEntry_entity/onUpdate.js
index 18be8137a5..5cd47b019b 100644
--- a/entity/SalesprojectClassificationEntry_entity/onUpdate.js
+++ b/entity/SalesprojectClassificationEntry_entity/onUpdate.js
@@ -1,11 +1,7 @@
 import("system.db");
 import("system.vars");
-import("system.logging");
 import("Sql_lib");
 
-logging.log(vars.get("$local.changed").toSource())
-
-
 var condition = new SqlCondition();
 condition.andPrepare("SALESPROJECT_CLASSIFICATION.SALESPROJECT_CLASSIFICATIONID", vars.getString("$field.UID"));
         
diff --git a/entity/SalesprojectClassificationEntry_entity/recordcontainers/jdito/onUpdate.js b/entity/SalesprojectClassificationEntry_entity/recordcontainers/jdito/onUpdate.js
index 18be8137a5..5cd47b019b 100644
--- a/entity/SalesprojectClassificationEntry_entity/recordcontainers/jdito/onUpdate.js
+++ b/entity/SalesprojectClassificationEntry_entity/recordcontainers/jdito/onUpdate.js
@@ -1,11 +1,7 @@
 import("system.db");
 import("system.vars");
-import("system.logging");
 import("Sql_lib");
 
-logging.log(vars.get("$local.changed").toSource())
-
-
 var condition = new SqlCondition();
 condition.andPrepare("SALESPROJECT_CLASSIFICATION.SALESPROJECT_CLASSIFICATIONID", vars.getString("$field.UID"));
         
diff --git a/entity/SalesprojectClassification_entity/SalesprojectClassification_entity.aod b/entity/SalesprojectClassification_entity/SalesprojectClassification_entity.aod
index 829560b76e..6accf37245 100644
--- a/entity/SalesprojectClassification_entity/SalesprojectClassification_entity.aod
+++ b/entity/SalesprojectClassification_entity/SalesprojectClassification_entity.aod
@@ -66,7 +66,6 @@
       <name>jdito</name>
       <jDitoRecordAlias>Data_alias</jDitoRecordAlias>
       <contentProcess>%aditoprj%/entity/SalesprojectClassification_entity/recordcontainers/jdito/contentProcess.js</contentProcess>
-      <onUpdate>%aditoprj%/entity/SalesprojectClassification_entity/recordcontainers/jdito/onUpdate.js</onUpdate>
       <recordFields>
         <element>UID.value</element>
         <element>CLASSNAME.value</element>
diff --git a/entity/SalesprojectClassification_entity/onUpdate.js b/entity/SalesprojectClassification_entity/onUpdate.js
deleted file mode 100644
index c0b643664f..0000000000
--- a/entity/SalesprojectClassification_entity/onUpdate.js
+++ /dev/null
@@ -1,4 +0,0 @@
-import("system.vars")
-import("system.logging")
-
-logging.log(vars.get("$local.changed").toSource())
\ No newline at end of file
diff --git a/entity/SalesprojectClassification_entity/recordcontainers/jdito/onUpdate.js b/entity/SalesprojectClassification_entity/recordcontainers/jdito/onUpdate.js
deleted file mode 100644
index c0b643664f..0000000000
--- a/entity/SalesprojectClassification_entity/recordcontainers/jdito/onUpdate.js
+++ /dev/null
@@ -1,4 +0,0 @@
-import("system.vars")
-import("system.logging")
-
-logging.log(vars.get("$local.changed").toSource())
\ No newline at end of file
diff --git a/entity/SalesprojectCompetition_entity/entityfields/salesprojectcompetitionorg_dfo/children/relationid_param/code.js b/entity/SalesprojectCompetition_entity/entityfields/salesprojectcompetitionorg_dfo/children/relationid_param/code.js
index dc4ffd0ac6..92b0b7622d 100644
--- a/entity/SalesprojectCompetition_entity/entityfields/salesprojectcompetitionorg_dfo/children/relationid_param/code.js
+++ b/entity/SalesprojectCompetition_entity/entityfields/salesprojectcompetitionorg_dfo/children/relationid_param/code.js
@@ -1,5 +1,4 @@
-import("system.logging");
 import("system.result");
 import("system.vars");
-logging.log(vars.get("$field.RELATION_ID"))
+
 result.string(vars.get("$field.RELATION_ID"));
\ No newline at end of file
diff --git a/process/OfferOrder_lib/process.js b/process/OfferOrder_lib/process.js
index d2b44d92d6..4a5b782785 100644
--- a/process/OfferOrder_lib/process.js
+++ b/process/OfferOrder_lib/process.js
@@ -1,4 +1,3 @@
-import("system.logging");
 import("system.translate");
 import("system.text");
 import("system.vars");
@@ -149,7 +148,6 @@ ItemUtils.prototype.getNewItemIdCondition = function(pItemId, pTableName)
 {
     if (pTableName == undefined) 
         pTableName = this.tableName;
-    logging.log("hää" + pTableName)
     return SqlCondition.begin().andPrepare(pTableName + "ITEM." + pTableName + "ITEMID", pItemId);
 }
 
@@ -285,7 +283,6 @@ ItemUtils.prototype.insertPartsList = function(columns, productId, assignedTo, c
         
         columns = columns.concat(additionalProductInfo.map(function(item) {return item[0]}));
         var colTypes = db.getColumnTypes(table, columns);
-        logging.log(partsList.toSource())
         // partsList[rootProdId] = root node
         __itemInsertStatement(partsList[rootProdId], assignedTo, currency, relationId);
 
@@ -339,7 +336,6 @@ ItemUtils.prototype.insertPartsList = function(columns, productId, assignedTo, c
             statements.push([table, columns, colTypes, vals]);
             insertedItemIds.push(newid);
             
-            logging.log(p2pid)
             __itemInsertStatement(partsList[p2pid], newid);
         }
     }
@@ -359,7 +355,6 @@ ItemUtils.prototype.deletePartsList = function(itemId) {
         
     //save address for this here to get class variables in recursive sub function __itemDeleteStatement
     var self = this;
-    logging.log("1 " + self.tableName)
     var statements = [];
 
     __itemDeleteStatement(itemId);
@@ -373,14 +368,9 @@ ItemUtils.prototype.deletePartsList = function(itemId) {
     
     //recursive function for building item delete statements 
     function __itemDeleteStatement(itemId) {
-        logging.log("2 " + self.tableName)
-
         var itemsToDelete = self.ItemTree[itemId].ids;
-        logging.log("__ " + self.tableName)
-        logging.log(itemsToDelete.toSource())
         for (var i = 0; i < itemsToDelete.length; i++) {
             //unshift due to foreign key constraints (Delete hierarchically starting at the bottom)
-            logging.log("3 " + self.tableName)
             statements.unshift(self.getNewItemIdCondition(itemsToDelete[i], self.tableName).build("1 = 2"));
             deletedItemIds.push(itemsToDelete[i]);
             __itemDeleteStatement(itemsToDelete[i]);
diff --git a/process/Product_lib/process.js b/process/Product_lib/process.js
index f0216b63a3..9287e1b4bb 100644
--- a/process/Product_lib/process.js
+++ b/process/Product_lib/process.js
@@ -432,42 +432,6 @@ Prod2ProdUtils.prototype.getPartsListObject = function() {
 Prod2ProdUtils.prototype.getPartsListForRecordContainer = function() {
     var tree = this._relateChilds();
     return tree.toArray(7);
-//    var ret = [];
-//    var childs = this._relateChilds();
-//    
-//    // map internal, (uids used in this function) concatenated ids to new random generated uuids. 
-//    // Without this every depth would make the uid significantly longer.
-//    var uidMap = {};
-//    
-//    __push("", childs.root, 0);
-//    
-//
-//    
-//    
-//    function __push(parent, obj) {
-//        logging.log(obj.toSource())
-//        //
-//        
-//        for (var i = 0; i < obj.ids.length; i++) {
-//            logging.log(childs[obj.ids[i]].toSource())
-//            var nextUid = parent + obj.ids[i];
-//            __addRow(nextUid, parent, childs[obj.ids[i]].rowdata)
-//           
-//            __push(nextUid, childs[obj.ids[i]])
-//        }
-//    }
-//    
-//    function __addRow(uid, parentId, rowdata)
-//    {
-//        uidMap[uid] = util.getNewUUID();
-//        if (uidMap[parentId] == undefined) {
-//            uidMap[parentId] = util.getNewUUID();
-//        }
-//        
-//        ret.push([uidMap[uid], uidMap[parentId]].concat(rowdata));
-//    }
-//    
-//    return ret;
 }
 
 /**
@@ -530,8 +494,8 @@ Prod2ProdUtils.prototype._initProd2ProdData = function() {
     }
 }
 
-/* object tree to relate products by DEST_ID / SOURCE_ID.
- * 
+/**
+ * object tree to relate products by DEST_ID / SOURCE_ID.
  **/
 Prod2ProdUtils.prototype._buildTree = function(supervised) {
     this._initProd2ProdData();
@@ -562,29 +526,7 @@ Prod2ProdUtils.prototype._buildTree = function(supervised) {
             }
         }
     );
-    /*
-
-    var tree = { root: {ids: [], sourceid: this.productId } };
-
-    if (supervised)
-        tree = { root: {ids: [], destid: this.productId } };
-
-    for (var i = 0; i < this.data.length; i++) {
-        var prod2prodid = this.data[i][0];
-        if (tree[prod2prodid] == undefined) {
-            tree[prod2prodid] = {
-                ids: [] 
-                , rowdata: this.data[i].slice(0)//copy to get NativeArray for concatenation
-                , destid: this.data[i][1]
-                , sourceid: this.data[i][2] 
-                , quantity: this.data[i][3]
-                , optional: this.data[i][4]
-                , takeprice: this.data[i][5]
-                , productcode: this.data[i][6]
-            };
-        }
-    }
-*/
+
     return tree;
 }
 
@@ -604,28 +546,7 @@ Prod2ProdUtils.prototype._relateChilds = function() {
         }
     }
 }
-/*
-Prod2ProdUtils.prototype._relateChilds = function() {
-    var tree = this._buildTree(false);
-    logging.log(tree.toSource())
-    
-    __relate("root");
-    
-    logging.log(tree.toSource())
 
-    return tree;
-
-
-    function __relate(id) {
-        for (var treeId in tree) {
-            if (tree[treeId].destid == tree[id].sourceid && tree[id].ids.indexOf(treeId) == -1) {   
-                tree[id].ids.push(treeId);
-                __relate(treeId);
-            }    
-        }
-    }
-}
-*/
 Prod2ProdUtils.prototype._relateParents = function() {
     var tree = this._buildTree(true);
 
-- 
GitLab