Skip to content
Snippets Groups Projects
Commit 8ab08a1d authored by Johannes Goderbauer's avatar Johannes Goderbauer
Browse files

Member_entity: District and MSTeams: insert, edit, delete

parent 05135b80
No related branches found
No related tags found
No related merge requests found
Showing
with 76 additions and 7 deletions
......@@ -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());
}
}
......
......@@ -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>
......
= 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
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
import("system.vars");
import("system.result");
var res = vars.get("$field.recordType") != "DistrictResponsible";
result.string(res);
\ No newline at end of file
import("system.vars");
import("system.result");
var res = vars.get("$field.recordType") != "DistrictResponsible";
result.string(res);
\ No newline at end of file
import("system.result");
//this value only differs in the jdito recordContainer
result.string("'ObjectMember'");
\ No newline at end of file
......@@ -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 = [];
......
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.");
//No insert code, because it is done in via the contexts viewmodeProvider for the editView
\ No newline at end of file
//No update code, because it is done in via the contexts viewmodeProvider for the editView
\ No newline at end of file
......@@ -259,7 +259,7 @@
<dependency>
<name>dependency</name>
<entityName>Member_entity</entityName>
<fieldName>Links</fieldName>
<fieldName>WithDistrictResponsibles</fieldName>
</dependency>
<children>
<entityParameter>
......
......@@ -24,4 +24,11 @@
<view>MemberLookup_view</view>
</neonViewReference>
</references>
<viewmodeProvider>
<staticContentEntry>
<name>editView</name>
<key>editView</key>
<value>Links</value>
</staticContentEntry>
</viewmodeProvider>
</neonContext>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment