diff --git a/entity/DistrictResponsible_entity/recordcontainers/db/conditionProcess.js b/entity/DistrictResponsible_entity/recordcontainers/db/conditionProcess.js index 1942674d0c7f077e9e993e0479b6aa6e94cfeaf6..d61189649016e2ed0cd022e862c5ecaf1290801c 100644 --- a/entity/DistrictResponsible_entity/recordcontainers/db/conditionProcess.js +++ b/entity/DistrictResponsible_entity/recordcontainers/db/conditionProcess.js @@ -14,9 +14,11 @@ if (districtId) else if(orgUid) { var orgDistrictIds = vars.get("$param.CollectedDistrictIds_param"); - if (orgDistrictIds){ + if (orgDistrictIds) + { orgDistrictIds = JSON.parse(orgDistrictIds); - cond.and("DISTRICTRESPONSIBLE.DISTRICT_ID", orgDistrictIds, SqlBuilder.IN()); + if (orgDistrictIds.length > 0) + cond.and("DISTRICTRESPONSIBLE.DISTRICT_ID", orgDistrictIds, SqlBuilder.IN()); } } diff --git a/entity/Member_entity/Member_entity.aod b/entity/Member_entity/Member_entity.aod index 854bfe8f3ec23bef48dd2b1706aa7077987909bc..b0538033f66661c78496eefb62cd9a939209da42 100644 --- a/entity/Member_entity/Member_entity.aod +++ b/entity/Member_entity/Member_entity.aod @@ -7,6 +7,8 @@ <siblings> <element>MSTTeam_entity</element> </siblings> + <grantUpdateProcess>%aditoprj%/entity/Member_entity/grantUpdateProcess.js</grantUpdateProcess> + <grantDeleteProcess>%aditoprj%/entity/Member_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/Member_entity/contentTitleProcess.js</contentTitleProcess> <iconId>VAADIN:FILE_SOUND</iconId> <titlePlural>${SALESPROJECT_MEMBER}</titlePlural> @@ -43,7 +45,6 @@ <entityField> <name>ORGANISATION_NAME</name> <title>Company</title> - <state>READONLY</state> </entityField> <entityField> <name>ORG_ORGID</name> @@ -304,6 +305,10 @@ <name>EnableMSTeams_param</name> <expose v="true" /> </entityParameter> + <entityField> + <name>recordType</name> + <documentation>%aditoprj%/entity/Member_entity/entityfields/recordtype/documentation.adoc</documentation> + </entityField> <entityParameter> <name>SalesprojectCode_param</name> <expose v="true" /> @@ -439,12 +444,19 @@ <name>MST_MEMBERROLE.value</name> <expression>%aditoprj%/entity/Member_entity/recordcontainers/db/recordfieldmappings/mst_memberrole.value/expression.js</expression> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>recordType.value</name> + <expression>%aditoprj%/entity/Member_entity/recordcontainers/db/recordfieldmappings/recordtype.value/expression.js</expression> + </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> <jDitoRecordContainer> <name>jdito</name> <jDitoRecordAlias>Data_alias</jDitoRecordAlias> <contentProcess>%aditoprj%/entity/Member_entity/recordcontainers/jdito/contentProcess.js</contentProcess> + <onInsert>%aditoprj%/entity/Member_entity/recordcontainers/jdito/onInsert.js</onInsert> + <onUpdate>%aditoprj%/entity/Member_entity/recordcontainers/jdito/onUpdate.js</onUpdate> + <onDelete>%aditoprj%/entity/Member_entity/recordcontainers/jdito/onDelete.js</onDelete> <recordFieldMappings> <jDitoRecordFieldMapping> <name>UID.value</name> @@ -506,6 +518,9 @@ <jDitoRecordFieldMapping> <name>TARGETCONTEXT.value</name> </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>recordType.value</name> + </jDitoRecordFieldMapping> </recordFieldMappings> </jDitoRecordContainer> </recordContainers> diff --git a/entity/Member_entity/documentation.adoc b/entity/Member_entity/documentation.adoc index 575b84d32903889b91d1a3009ebb855326e46e28..3ad972dcc80a6711bad79f6c3c8c55590273aa13 100644 --- a/entity/Member_entity/documentation.adoc +++ b/entity/Member_entity/documentation.adoc @@ -1,3 +1,14 @@ = Member_entity -Manages the project team in the sales project and in the campaign \ No newline at end of file +Manages the project team in the sales project and in the campaign + +This entity has two recordContainers: + +* db +* jdito + +While for the must purposes the `db`-recordContainer is perfectly fine to use there is one case necessary for the `jdito`-recordContainer: + +Salesproject memebers are loaded via the ``-provider and therefor use the `jdito`-recodContainer. This recordContainer first collects the data from +the `db`-rc and then loads additional memebers of the salesprojects district. The additional members are not modifyable, while those from the +`db`-rc are. \ No newline at end of file diff --git a/entity/Member_entity/entityfields/recordtype/documentation.adoc b/entity/Member_entity/entityfields/recordtype/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..3120dc65c224da3a1bf92f80b3c2edce0dd21b27 --- /dev/null +++ b/entity/Member_entity/entityfields/recordtype/documentation.adoc @@ -0,0 +1 @@ +Field to differ between records from the OBJECTMEMBER-table and additional added district-members (only in the jdito-RecordContainer) \ No newline at end of file diff --git a/entity/Member_entity/grantDeleteProcess.js b/entity/Member_entity/grantDeleteProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..a494c8292d24cb354b59766736f40833338c4526 --- /dev/null +++ b/entity/Member_entity/grantDeleteProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("system.result"); + +var res = vars.get("$field.recordType") != "DistrictResponsible"; +result.string(res); \ No newline at end of file diff --git a/entity/Member_entity/grantUpdateProcess.js b/entity/Member_entity/grantUpdateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..a494c8292d24cb354b59766736f40833338c4526 --- /dev/null +++ b/entity/Member_entity/grantUpdateProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("system.result"); + +var res = vars.get("$field.recordType") != "DistrictResponsible"; +result.string(res); \ No newline at end of file diff --git a/entity/Member_entity/recordcontainers/db/recordfieldmappings/recordtype.value/expression.js b/entity/Member_entity/recordcontainers/db/recordfieldmappings/recordtype.value/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..ecce98df0cb136a32d4a2bae26f18281788f00f7 --- /dev/null +++ b/entity/Member_entity/recordcontainers/db/recordfieldmappings/recordtype.value/expression.js @@ -0,0 +1,4 @@ +import("system.result"); + +//this value only differs in the jdito recordContainer +result.string("'ObjectMember'"); \ No newline at end of file diff --git a/entity/Member_entity/recordcontainers/jdito/contentProcess.js b/entity/Member_entity/recordcontainers/jdito/contentProcess.js index b678a96f2fa95f38313aa434a2b5895f899a228a..7f4c73a178d7d035a8a186be2b9be074843e24da 100644 --- a/entity/Member_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Member_entity/recordcontainers/jdito/contentProcess.js @@ -13,7 +13,8 @@ var memberLoadingConfig = entities.createConfigForLoadingRows() .addParameter("ObjectType_param", vars.get("$param.ObjectType_param")) .fields(["#UID", "CONTACT_ID", "CONTACTROLE", "DEPARTMENT", "ICON", "IMAGE", "MEMBERROLE", "OBJECT_ROWID", "OBJECT_TYPE", "OBJECTMEMBERID", "ORG_ORGID", "ORGANISATION_NAME", "PERSON_FIRSTNAME", "PERSON_FULL_NAME", - "PERSON_LASTNAME", "PERSON_PERSID", "PERSON_SALUTATION", "PERSON_TITLE", "POSITION", "TARGETCONTEXT"]); + "PERSON_LASTNAME", "PERSON_PERSID", "PERSON_SALUTATION", "PERSON_TITLE", "POSITION", "TARGETCONTEXT", + "recordType"]); if (idValues) { @@ -58,7 +59,7 @@ memberRows = memberRows.map(function(row) return [row["#UID"], row["OBJECTMEMBERID"], row["CONTACT_ID"], row["CONTACTROLE"], row["DEPARTMENT"], row["ICON"], row["IMAGE"], row["MEMBERROLE"], row["OBJECT_ROWID"], row["OBJECT_TYPE"], row["ORG_ORGID"], row["ORGANISATION_NAME"], row["PERSON_FIRSTNAME"], row["PERSON_FULL_NAME"], row["PERSON_LASTNAME"], row["PERSON_PERSID"], row["PERSON_SALUTATION"], row["PERSON_TITLE"], - row["POSITION"], row["TARGETCONTEXT"]]; + row["POSITION"], row["TARGETCONTEXT"], row["recordType"]]; }); var responsibleUids = []; diff --git a/entity/Member_entity/recordcontainers/jdito/onDelete.js b/entity/Member_entity/recordcontainers/jdito/onDelete.js new file mode 100644 index 0000000000000000000000000000000000000000..91caa64d3c7e2ff55a33918b3f3d8b8ba5c2f233 --- /dev/null +++ b/entity/Member_entity/recordcontainers/jdito/onDelete.js @@ -0,0 +1,16 @@ +import("system.vars"); +import("system.entities"); + +//While there is no need to implement the insert or update process the delete process needs to be specified because the +//contexts viewmodeProvider for the editView only affect insert and update (delete has no view associated) +//let's do the db-record container the job to remove the record (additional district records can never be removed): +var rowData = vars.get("$local.rowdata"); +var memberId = rowData["OBJECTMEMBERID.value"]; +if (memberId) +{ + var config = entities.createConfigForDeletingRows().entity("Member_entity").uid(memberId); + entities.deleteRow(config); +} +else + throw new Error("Member_entity: Could not delete member entity because the given OBJECTMEMBERID was empty."); + diff --git a/entity/Member_entity/recordcontainers/jdito/onInsert.js b/entity/Member_entity/recordcontainers/jdito/onInsert.js new file mode 100644 index 0000000000000000000000000000000000000000..d86d21c9884d5e4290757d4cc27319b289e266c8 --- /dev/null +++ b/entity/Member_entity/recordcontainers/jdito/onInsert.js @@ -0,0 +1 @@ +//No insert code, because it is done in via the contexts viewmodeProvider for the editView \ No newline at end of file diff --git a/entity/Member_entity/recordcontainers/jdito/onUpdate.js b/entity/Member_entity/recordcontainers/jdito/onUpdate.js new file mode 100644 index 0000000000000000000000000000000000000000..1e04d32962f5dec90c10865d49c4c7310a84961d --- /dev/null +++ b/entity/Member_entity/recordcontainers/jdito/onUpdate.js @@ -0,0 +1 @@ +//No update code, because it is done in via the contexts viewmodeProvider for the editView \ No newline at end of file diff --git a/entity/Salesproject_entity/Salesproject_entity.aod b/entity/Salesproject_entity/Salesproject_entity.aod index 7dd6be498918bba54a2bd550a0f9ddea0610290f..412fcc0f20288f526974253f9527e419a3a7da6e 100644 --- a/entity/Salesproject_entity/Salesproject_entity.aod +++ b/entity/Salesproject_entity/Salesproject_entity.aod @@ -259,7 +259,7 @@ <dependency> <name>dependency</name> <entityName>Member_entity</entityName> - <fieldName>Links</fieldName> + <fieldName>WithDistrictResponsibles</fieldName> </dependency> <children> <entityParameter> diff --git a/neonContext/Member/Member.aod b/neonContext/Member/Member.aod index 664965d770c217d9a74be883bca17713e8bc6980..a2915648a320f4a2b4443eeb27f203f329d7cbfd 100644 --- a/neonContext/Member/Member.aod +++ b/neonContext/Member/Member.aod @@ -24,4 +24,11 @@ <view>MemberLookup_view</view> </neonViewReference> </references> + <viewmodeProvider> + <staticContentEntry> + <name>editView</name> + <key>editView</key> + <value>Links</value> + </staticContentEntry> + </viewmodeProvider> </neonContext>