diff --git a/process/AttributeFilter_lib/process.js b/process/AttributeFilter_lib/process.js index 9c667f3770c0aeab7853b9d8ad6bfae02981b5b1..fba1180f3e320d66a2c09961d1eba5cfc49380bd 100644 --- a/process/AttributeFilter_lib/process.js +++ b/process/AttributeFilter_lib/process.js @@ -222,7 +222,7 @@ AttributeFilterExtensionMaker.getFilterCondition = function(pObjectType, pFilter condition = newWhere(["AB_ATTRIBUTERELATION", dbField], SqlUtils.escapeVars(pRawValue), pOperatorName == "=" ? SqlBuilder.EQUAL() : SqlBuilder.NOT_EQUAL()); else { - condition = pCondition.replace(pColumnPlaceholder, dbField, "g"); + condition = pCondition.replace(new RegExp(pColumnPlaceholder, "g"), dbField); } //a SqlBuilder.IN() in a newWhere is not used here since the subselect can contain a placeholder diff --git a/process/DocumentTemplate_lib/process.js b/process/DocumentTemplate_lib/process.js index 3c5b6496b4e3f1cef3bea17b27c212dc43761af4..c302876d0f8ad58c9262a23d9c596095bb9d9372 100644 --- a/process/DocumentTemplate_lib/process.js +++ b/process/DocumentTemplate_lib/process.js @@ -106,7 +106,7 @@ DocumentTemplate.prototype._resolveEmbeddedTemplate = function () // Note: some embedded templates in embedded templates may be replaced, but this is NOT SUPPORTED, as it only works if the second template is not already replaced at that time. placeholders.forEach(function(pPlaceholder) { - replacedContent = replacedContent.replace(PlaceholderUtils.formatPlaceholder(pPlaceholder[0]), pPlaceholder[1], "g") + replacedContent = replacedContent.replace(new RegExp(PlaceholderUtils.formatPlaceholder(pPlaceholder[0]), "g"), pPlaceholder[1]) }, this); this._subtemplatedContent = util.encodeBase64String(replacedContent); @@ -522,7 +522,7 @@ TemplateHelper._replaceText = function (pText, pReplacements, pSpecialCharFilter pText = pText.replace(new RegExp(PlaceholderUtils.getRegexpMatchAll(pSpecialCharFilterRegexpPart), "gi"), function(pFound) { let foundFiltered = pFound.replace(new RegExp(pSpecialCharFilterRegexpPart, "gi"),""); return pReplacements[foundFiltered] ? pReplacements[foundFiltered] : pFound; - }, "gi") + }); return pText; } @@ -669,8 +669,8 @@ TemplateHelper._getReplacedODT = function (pTemplate, pReplacements, pTableData) */ for (let placeholder in replacements) { - currentBody = currentBody.replace(placeholder, - replacements[placeholder].replace(/\n/ig, "<text:line-break/>").replace(/&/ig, "&"), "ig"); + currentBody = currentBody.replace(new RegExp(placeholder, "ig"), + replacements[placeholder].replace(/\n/ig, "<text:line-break/>").replace(/&/ig, "&")); } @@ -709,8 +709,8 @@ TemplateHelper._getReplacedODT = function (pTemplate, pReplacements, pTableData) var styles = util.decodeBase64String(pack.getFromZip(pODTFileName, "styles.xml")); for (let placeholder in pReplacements[0]) { - styles = styles.replace(placeholder, - pReplacements[0][placeholder].replace(/\n/ig, "<text:line-break/>").replace(/&/ig, "&"), "ig"); + styles = styles.replace(new RegExp(placeholder, "ig"), + pReplacements[0][placeholder].replace(/\n/ig, "<text:line-break/>").replace(/&/ig, "&")); } pack.addToZip(pODTFileName, "styles.xml", util.encodeBase64String(styles)); return true; diff --git a/process/Importer_lib/process.js b/process/Importer_lib/process.js index 430c8e0aa7734b65247a12799a2181d0610594a8..bf55280364bd354a92e30fc2471468d76dcfcd49 100644 --- a/process/Importer_lib/process.js +++ b/process/Importer_lib/process.js @@ -1322,7 +1322,7 @@ function Importer(pConfig) //- document in the comment why it should not be used and when it will cause other problems //- find another solution to prevent the unterminated string errors if(pEvalScript) - return res.replace("'", "\\\\u0027", "g").replace("\"", "\\\\u0022", "g").replace("\r", "\\\\u000D", "g").replace("\n", "\\\\u000A", "g"); + return res.replace(/'/g, "\\\\u0027").replace(/"/, "\\\\u0022").replace(/\r/g, "\\\\u000D").replace(/\n/g, "\\\\u000A"); else return res; } @@ -1336,7 +1336,7 @@ function Importer(pConfig) //- document in the comment why it should not be used and when it will cause other problems //- find another solution to prevent the unterminated string errors if(pEvalScript) - return inp[Number(pNumber)].replace("'", "\\\\u0027", "g").replace("\"", "\\\\u0022", "g").replace("\r", "\\\\u000D", "g").replace("\n", "\\\\u000A", "g"); + return inp[Number(pNumber)].replace(/'/g, "\\\\u0027").replace(/"/, "\\\\u0022").replace(/\r/g, "\\\\u000D").replace(/\n/g, "\\\\u000A"); else return inp[Number(pNumber)]; }