diff --git a/entity/Person_entity/Person_entity.aod b/entity/Person_entity/Person_entity.aod index 19c13100a4e705dc6cf4fcbb078180a773107024..357eefeda699978d5c29464fbfc46d10b5a5ad06 100644 --- a/entity/Person_entity/Person_entity.aod +++ b/entity/Person_entity/Person_entity.aod @@ -913,6 +913,7 @@ <title>Company</title> <consumer>Organisations</consumer> <linkedContextProcess>%aditoprj%/entity/Person_entity/entityfields/organisation_contactid/linkedContextProcess.js</linkedContextProcess> + <stateProcess>%aditoprj%/entity/Person_entity/entityfields/organisation_contactid/stateProcess.js</stateProcess> <valueProcess>%aditoprj%/entity/Person_entity/entityfields/organisation_contactid/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/Person_entity/entityfields/organisation_contactid/displayValueProcess.js</displayValueProcess> <onValidation>%aditoprj%/entity/Person_entity/entityfields/organisation_contactid/onValidation.js</onValidation> diff --git a/entity/Person_entity/entityfields/organisation_contactid/stateProcess.js b/entity/Person_entity/entityfields/organisation_contactid/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7d8abdebb5fe1f2471641ff52029303f559bc3e1 --- /dev/null +++ b/entity/Person_entity/entityfields/organisation_contactid/stateProcess.js @@ -0,0 +1,23 @@ +import("Context_lib"); +import("system.vars"); +import("system.result"); +import("Entity_lib"); +import("system.neon"); + +if(vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT) { + +var currentContext = ContextUtils.getCurrentContextId(); +var contactId = vars.get("$field.CONTACTID"); + +var linkedObject = new HasLinkedObjectTester() +.andNoEntityRows("Activity_entity", "LinkedObjects", {ObjectId_param : currentContext, RowId_param : contactId}) +.andNoEntityRows("360Degree_entity", "PersonObjects", {ObjectRowId_param : contactId , ObjectStatus_param : vars.get("$field.STATUS")}) +.andNoEntityRows("ObjectTree_entity", "TreeProvider", {ObjectIds_param : [vars.get("$field.CONTACTID"), vars.get("$field.PERSON_ID")], ObjectTypes_param : currentContext}) +//.andNoEntityRows("AttributeRelation_entity", "TreeProvider", {ObjectRowId_param : contactId, ObjectType_param : currentContext}) +//.andNoEntityRows("DistrictResponsible_entity", "OrganisationResponsibles", {OrgUid_param : vars.get("$field.ORGANISATION_CONTACTID")}) //District Responsible and Object Tree is default data record +.andNoEntityRows("Document_entity", "Documents", {AssignmentRowId_param : contactId, AssignmentTable_param : "RELATION"}) +.validate() + +if(!linkedObject) + result.string(neon.COMPONENTSTATE_READONLY); +} \ No newline at end of file