Skip to content
Snippets Groups Projects
Commit cbb18a50 authored by Johannes Goderbauer's avatar Johannes Goderbauer
Browse files

bugfix: set standard comm

parent 58f78d3a
No related branches found
No related tags found
No related merge requests found
import("system.result");
result.string("EMAIL")
\ No newline at end of file
result.string("EMAIL");
\ No newline at end of file
import("system.result");
result.string("PHONE")
\ No newline at end of file
result.string("PHONE");
\ No newline at end of file
......@@ -12,6 +12,6 @@ if (vars.exists("$param.CommMediumIds_param"))
var mediumIds = vars.get("$param.CommMediumIds_param");
mediumIds = JSON.parse(mediumIds);
if(mediumIds.length > 0)
cond.and("COMMUNICATION.MEDIUM_ID in (" + mediumIds.join(", ") + ")");
cond.and("COMMUNICATION.MEDIUM_ID in ('" + mediumIds.join("', '") + "')");
}
result.string(db.translateCondition([cond.toString("1 = 2"), cond.preparedValues]));
\ No newline at end of file
......@@ -61,7 +61,7 @@ CommUtil.setStandardForCategory = function(pAffectedRowId, pNewStandardCommId, p
//set current standard comm-record as non-standard
var cond = SqlCondition.begin().and("STANDARD = 1").andPrepare("COMMUNICATION.CONTACT_ID", pAffectedRowId);
//mediumIds cannot be empty so no need to do further checks (this is checked above)
cond.and("MEDIUM_ID in (" + mediumIds.join(", ") + ")");
cond.and("MEDIUM_ID in ('" + mediumIds.join("', '") + "')");
statements.push(["COMMUNICATION", cols, types, ["0"], cond.build()]);
//pNewStandardCommId can be an empty string if the standard has to only be removed
......@@ -71,7 +71,7 @@ CommUtil.setStandardForCategory = function(pAffectedRowId, pNewStandardCommId, p
cond.clear();
//check communicationid, contactId and medium to prevent data-inconsistency when bad function params are passed by (e.g communicationid of a different category)
cond.andPrepare("COMMUNICATION.COMMUNICATIONID", pNewStandardCommId).andPrepare("COMMUNICATION.CONTACT_ID", pAffectedRowId);
cond.and("MEDIUM_ID in (" + mediumIds.join(", ") + ")");
cond.and("MEDIUM_ID in ('" + mediumIds.join("', '") + "')");
statements.push(["COMMUNICATION", cols, types, ["1"], cond.build()]);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment