diff --git a/entity/Organisation_entity/Organisation_entity.aod b/entity/Organisation_entity/Organisation_entity.aod index 3f8cf7229736c763f656ed0da53fc095ebc0163d..c26965a80ade24524d7c3879fd0a8d31261205a4 100644 --- a/entity/Organisation_entity/Organisation_entity.aod +++ b/entity/Organisation_entity/Organisation_entity.aod @@ -1425,6 +1425,10 @@ </entityParameter> </children> </entityConsumer> + <entityParameter> + <name>IsQuickEntry_param</name> + <expose v="true" /> + </entityParameter> </entityFields> <recordContainers> <dbRecordContainer> diff --git a/entity/Organisation_entity/afterSave.js b/entity/Organisation_entity/afterSave.js index 4e40d8d824716c3690bb87b0f774ea3895246b3d..3241812a7024ce9556f25a5ccf92d529eeea6334 100644 --- a/entity/Organisation_entity/afterSave.js +++ b/entity/Organisation_entity/afterSave.js @@ -1,9 +1,8 @@ -import("system.logging"); import("system.vars"); import("District_lib"); import("system.neon"); -if (vars.get("$local.recordstate") == neon.OPERATINGSTATE_NEW) +if (vars.get("$local.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$param.IsQuickEntry_param")) { //Assign this new organisation to all according districts with auto assignment is true //2nd parameter "undefined" means, that the current user is determined in the function diff --git a/entity/QuickEntry_entity/QuickEntry_entity.aod b/entity/QuickEntry_entity/QuickEntry_entity.aod index e6cb4cfca5542978d40949f7c51c23ade7fb7683..613261bd8435ef518267edb72515b8a8c8632884 100644 --- a/entity/QuickEntry_entity/QuickEntry_entity.aod +++ b/entity/QuickEntry_entity/QuickEntry_entity.aod @@ -5,6 +5,7 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/QuickEntry_entity/documentation.adoc</documentation> <onValidation>%aditoprj%/entity/QuickEntry_entity/onValidation.js</onValidation> + <afterSave>%aditoprj%/entity/QuickEntry_entity/afterSave.js</afterSave> <iconId>VAADIN:BOLT</iconId> <recordContainer>jdito</recordContainer> <entityFields> diff --git a/entity/QuickEntry_entity/afterSave.js b/entity/QuickEntry_entity/afterSave.js new file mode 100644 index 0000000000000000000000000000000000000000..8bedae6cc036f36632f3cdd1009ec0c8e6f6aa85 --- /dev/null +++ b/entity/QuickEntry_entity/afterSave.js @@ -0,0 +1,11 @@ +import("District_lib"); +import("system.vars"); + +var entityDate = vars.get("$local.entitydata"); + +if(entityDate["ORGANISATION_NAME"]) +{ + //Assign this new organisation to all according districts with auto assignment is true + //2nd parameter "undefined" means, that the current user is determined in the function + DistrictUtils.assignDistrictOnServer([], undefined, entityDate["#UID"]) +} \ No newline at end of file diff --git a/entity/QuickEntry_entity/recordcontainers/jdito/onInsert.js b/entity/QuickEntry_entity/recordcontainers/jdito/onInsert.js index bd04d8dc2610a9f4b8621bad66d42f252bf2980b..2d03cce14b6d568bfd0bb0f6e9146774dcf5350e 100644 --- a/entity/QuickEntry_entity/recordcontainers/jdito/onInsert.js +++ b/entity/QuickEntry_entity/recordcontainers/jdito/onInsert.js @@ -15,7 +15,8 @@ if (rowdata["ORGANISATION_NAME.value"]) { let configOrg = entities.createConfigForAddingRows(); organisationId = rowdata["ORGANISATION_ID.value"]; - configOrg.entity("Organisation_entity"); + configOrg.entity("Organisation_entity") + .addParameter("IsQuickEntry_param", true); configOrg.fieldValues({ "ORGANISATIONID": organisationId, "ORGANISATION_ID": organisationId,