From 3abcd8da34fee7e6492c463f58a630e8d1aca1a3 Mon Sep 17 00:00:00 2001 From: "j.goderbauer" <j.goderbauer@adito.de> Date: Wed, 9 Sep 2020 15:39:07 +0200 Subject: [PATCH] Organisation: aroundLocation was calculated in new/edit mode --- .../openaroundlocation/stateProcess.js | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/entity/Organisation_entity/entityfields/openaroundlocation/stateProcess.js b/entity/Organisation_entity/entityfields/openaroundlocation/stateProcess.js index 129f026470..b9adad9dcc 100644 --- a/entity/Organisation_entity/entityfields/openaroundlocation/stateProcess.js +++ b/entity/Organisation_entity/entityfields/openaroundlocation/stateProcess.js @@ -3,21 +3,24 @@ import("system.neon"); import("system.vars"); import("system.entities"); -//use read entity since the lat and lon fields are not loaded by default since they are not needed otherwise -var rowConfig = entities.createConfigForLoadingRows() - .fields(["STANDARD_LAT", "STANDARD_LON"]) - .entity(vars.get("$sys.currententityname")) - .uid(vars.get("$sys.uid")); -var row = entities.getRow(rowConfig); +var recordState = vars.get("$sys.operatingstate"); +var res = neon.COMPONENTSTATE_DISABLED; +var uid = vars.get("$sys.uid"); +if (recordState != neon.OPERATINGSTATE_NEW && recordState != neon.OPERATINGSTATE_EDIT && uid) +{ + //use read entity since the lat and lon fields are not loaded by default since they are not needed otherwise + var rowConfig = entities.createConfigForLoadingRows() + .fields(["STANDARD_LAT", "STANDARD_LON"]) + .entity(vars.get("$sys.currententityname")) + .uid(uid); + var row = entities.getRow(rowConfig); -var lat = row["STANDARD_LAT"]; -var lon = row["STANDARD_LON"]; + var lat = row["STANDARD_LAT"]; + var lon = row["STANDARD_LON"]; + + if (lat && lon) + res = neon.COMPONENTSTATE_AUTO; +} -var res; -if (lat && lon) - res = neon.COMPONENTSTATE_AUTO; -else - res = neon.COMPONENTSTATE_DISABLED; - result.string(res); \ No newline at end of file -- GitLab