From 743ecc967bba50132a77cc84354fca8192d8615d Mon Sep 17 00:00:00 2001
From: Johannes Hoermann <j.hoermann@adito.de>
Date: Fri, 19 Jul 2019 11:37:00 +0200
Subject: [PATCH] replace andPrepareValue with andPrepareIfSet as it does the
 same.

---
 .../recordcontainers/jdito/contentProcess.js           | 10 +++++-----
 .../recordcontainers/jdito/onDelete.js                 |  2 +-
 process/Sql_lib/process.js                             |  7 -------
 3 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/entity/Appointment_entity/recordcontainers/jdito/contentProcess.js b/entity/Appointment_entity/recordcontainers/jdito/contentProcess.js
index 240de2d443..0499835a64 100644
--- a/entity/Appointment_entity/recordcontainers/jdito/contentProcess.js
+++ b/entity/Appointment_entity/recordcontainers/jdito/contentProcess.js
@@ -24,10 +24,10 @@ else if(vars.getString("$param.LinkedAppointmentsFromDashlet_param"))
 {
     var contactid = tools.getCurrentUser()["params"]["contactID"];
     
-    cond.andPrepareValue("AB_APPOINTMENTLINK.OBJECT_ROWID", contactid)
-    var idscond = db.translateCondition(cond.build("1 = 1"));
+    cond.andPrepareIfSet("AB_APPOINTMENTLINK.OBJECT_ROWID", contactid)
+    let idscond = db.translateCondition(cond.build("1 = 1"));
    
-    var appointmentUids = db.table("select APPOINTMENT_ID from AB_APPOINTMENTLINK where " + idscond);
+    let appointmentUids = db.table("select APPOINTMENT_ID from AB_APPOINTMENTLINK where " + idscond);
     result.object(buildEntriesFromUids(appointmentUids));
 }
 
@@ -37,9 +37,9 @@ else if(vars.getString("$param.LinkedAppointmentsFromDashlet_param"))
 else if(vars.getString("$param.LinkedObjectId_param") != undefined)
 {
     cond.andPrepareVars("AB_APPOINTMENTLINK.OBJECT_ROWID", "$param.LinkedObjectId_param")
-    var idscond = db.translateCondition(cond.build("1 = 1"));
+    let idscond = db.translateCondition(cond.build("1 = 1"));
    
-    var appointmentUids = db.table("select APPOINTMENT_ID from AB_APPOINTMENTLINK where " + idscond);
+    let appointmentUids = db.table("select APPOINTMENT_ID from AB_APPOINTMENTLINK where " + idscond);
     result.object(buildEntriesFromUids(appointmentUids));
 }
 /**
diff --git a/entity/Appointment_entity/recordcontainers/jdito/onDelete.js b/entity/Appointment_entity/recordcontainers/jdito/onDelete.js
index 7abca1e85c..fe7f38a0fb 100644
--- a/entity/Appointment_entity/recordcontainers/jdito/onDelete.js
+++ b/entity/Appointment_entity/recordcontainers/jdito/onDelete.js
@@ -18,7 +18,7 @@ if (vars.exists("$param.Entry_param"))
      * Deletes ApointmentLinks referring to the deleted Appointment.
      */
     var cond = SqlCondition.begin();
-    cond.andPrepareValue("AB_APPOINTMENTLINK.APPOINTMENT_ID", entry[calendars.ID])
+    cond.andPrepareIfSet("AB_APPOINTMENTLINK.APPOINTMENT_ID", entry[calendars.ID])
     var idscond = db.translateCondition(cond.build("1 = 2"));
     
     db.deleteData("AB_APPOINTMENTLINK", idscond);
diff --git a/process/Sql_lib/process.js b/process/Sql_lib/process.js
index bc8e3cdaff..817b916a62 100644
--- a/process/Sql_lib/process.js
+++ b/process/Sql_lib/process.js
@@ -317,13 +317,6 @@ SqlCondition.prototype.andPrepareVars = function(field, variable, cond, fieldTyp
     return this;
 }
 
-SqlCondition.prototype.andPrepareValue = function(field, value) {
-    if (value) {
-        return this.andPrepare(field, value, null, null);
-    }
-    return this;
-}
-
 /**
  * same as the "orPrepare"-function but with validation of adito-variables functionality
  * @param {String | String[]} field the database field as "tablename.columnname"; e.g. "ORGANISATION.NAME" or as array with column-alias: ["ORGANISATION", "NAME", "myorgAlias"]
-- 
GitLab