From ed150329af2e37268db2bd6b26273d26480f04ae Mon Sep 17 00:00:00 2001 From: Tony Valle Date: Fri, 15 Sep 2023 11:44:51 +0200 Subject: [PATCH] fix: allow repeated use of d2:hasValue in a single expression --- d2-tracker/dhis2.angular.services.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/d2-tracker/dhis2.angular.services.js b/d2-tracker/dhis2.angular.services.js index dc99ec6f3..b8e318904 100644 --- a/d2-tracker/dhis2.angular.services.js +++ b/d2-tracker/dhis2.angular.services.js @@ -2005,7 +2005,7 @@ var d2Services = angular.module('d2Services', ['ngResource']) //d2:hasValue('variableName') to avoid the further replacement, and make sure the correct input is fed into d2:hasValue. var avoidReplacementFunctions = ['d2:hasValue','d2:lastEventDate', 'd2:count', 'd2:countIfZeroPos', 'd2:countIfValue']; avoidReplacementFunctions.forEach(avoidReplaceFunction => { - expression = expression.replace( new RegExp("(" + avoidReplaceFunction + "\\() *[A#CV]\\{([\\w \\-\\_\\.]+)\\}(.*)\\)" ), "$1'$2'$3\)"); + expression = expression.replaceAll( new RegExp("(" + avoidReplaceFunction + "\\() *[A#CV]\\{([\\w \\-\\_\\.]+)\\}", 'g'), "$1'$2'"); }); //Check if the expression contains program rule variables at all(any curly braces):