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

Member_entity for District Responsibles: Reenable insert, edit, delete

[Projekt: Entwicklung - Neon][TicketNr.: 1065331][Fehlende Aktionen bei der Tabelle Projektteam im Vertriebsprojekt]
parent 7f196605
No related branches found
No related tags found
No related merge requests found
Showing
with 95 additions and 38 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());
}
}
......
......@@ -4,6 +4,9 @@
<majorModelMode>DISTRIBUTED</majorModelMode>
<documentation>%aditoprj%/entity/Member_entity/documentation.adoc</documentation>
<title>${SALESPROJECT_MEMBER}</title>
<grantCreateProcess>%aditoprj%/entity/Member_entity/grantCreateProcess.js</grantCreateProcess>
<grantUpdateProcess>%aditoprj%/entity/Member_entity/grantUpdateProcess.js</grantUpdateProcess>
<grantDeleteProcess>%aditoprj%/entity/Member_entity/grantDeleteProcess.js</grantDeleteProcess>
<iconId>VAADIN:FILE_SOUND</iconId>
<titlePlural>${SALESPROJECT_MEMBER}</titlePlural>
<recordContainer>db</recordContainer>
......@@ -39,7 +42,6 @@
<entityField>
<name>ORGANISATION_NAME</name>
<title>Company</title>
<state>READONLY</state>
</entityField>
<entityField>
<name>ORG_ORGID</name>
......@@ -213,6 +215,9 @@
<name>UID</name>
<documentation>%aditoprj%/entity/Member_entity/entityfields/uid/documentation.adoc</documentation>
</entityField>
<entityField>
<name>recordType</name>
</entityField>
</entityFields>
<recordContainers>
<dbRecordContainer>
......@@ -333,12 +338,20 @@
<isFilterable v="true" />
<isLookupFilter v="true" />
</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>
<isFilterable v="true" />
<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>
......@@ -349,6 +362,9 @@
<jDitoRecordFieldMapping>
<name>CONTACT_ID.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>CONTACT_ID.displayValue</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>CONTACTROLE.value</name>
</jDitoRecordFieldMapping>
......@@ -364,6 +380,9 @@
<jDitoRecordFieldMapping>
<name>MEMBERROLE.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>MEMBERROLE.displayValue</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>OBJECT_ROWID.value</name>
</jDitoRecordFieldMapping>
......@@ -400,6 +419,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
import("system.translate");
import("system.result");
import("system.vars");
import("system.entities");
......@@ -11,9 +12,11 @@ var memberLoadingConfig = entities.createConfigForLoadingRows()
.provider("Links")
.addParameter("ObjectRowId_param", vars.get("$param.ObjectRowId_param"))
.addParameter("ObjectType_param", vars.get("$param.ObjectType_param"))
.fields(["#UID", "CONTACT_ID", "CONTACTROLE", "DEPARTMENT", "ICON", "IMAGE", "MEMBERROLE", "OBJECT_ROWID", "OBJECT_TYPE",
.fields(["#UID", "CONTACT_ID", "CONTACT_ID.displayValue", "CONTACTROLE", "DEPARTMENT", "ICON", "IMAGE",
"MEMBERROLE", "MEMBERROLE.displayValue", "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)
{
......@@ -55,10 +58,11 @@ if (vars.get("$param.ObjectType_param") == "Salesproject" && vars.get("$param.Ob
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"],
return [row["#UID"], row["OBJECTMEMBERID"], row["CONTACT_ID"], row["CONTACT_ID.displayValue"], row["CONTACTROLE"], row["DEPARTMENT"], row["ICON"],
row["IMAGE"], row["MEMBERROLE"], row["MEMBERROLE.displayValue"], 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 = [];
......@@ -74,7 +78,6 @@ var loadingConfPers = entities.createConfigForLoadingRows()
"FIRSTNAME", "LASTNAME", "SALUTATION", "TITLE"]);
var persRows = entities.getRows(loadingConfPers);
var counter = 0;
persRows = persRows.map(function(row){
return [row["SALUTATION"], row["TITLE"], row["FIRSTNAME"], row["LASTNAME"],
......@@ -83,17 +86,19 @@ persRows = persRows.map(function(row){
});
districtRows.forEach(function(row){
districtRows.forEach(function(row, counter){
memberRows.push(
[row[0],
null,
row[3],
row[4],
persRows[counter][6],
row[7],
"VAADIN:GLOBE",
"TEXT:" + row[4].substring(row[4].indexOf(" ", 0)+1, row[4].length),
"MEMBERROLEDISTRICTRESPONSIBLE",
translate.text("District Responsible"),
vars.get("$param.ObjectRowId_param"),
vars.get("$param.ObjectType_param"),
persRows[counter][5],
......@@ -105,10 +110,9 @@ districtRows.forEach(function(row){
persRows[counter][0],
persRows[counter][1],
persRows[counter][7],
null
null,
"DistrictResponsible"
]);
counter++;
});
result.object(memberRows);
\ No newline at end of file
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
......@@ -257,7 +257,7 @@
<dependency>
<name>dependency</name>
<entityName>Member_entity</entityName>
<fieldName>Links</fieldName>
<fieldName>WithDistrictResponsibles</fieldName>
</dependency>
<children>
<entityParameter>
......@@ -672,28 +672,6 @@
</entityParameter>
</children>
</entityConsumer>
<entityConsumer>
<name>ClassificationGroups</name>
<dependency>
<name>dependency</name>
<entityName>ClassificationGroupAnalyses_entity</entityName>
<fieldName>GroupAnalyses</fieldName>
</dependency>
<children>
<entityParameter>
<name>ClassificationType_param</name>
<valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/classificationgroups/children/classificationtype_param/valueProcess.js</valueProcess>
</entityParameter>
<entityParameter>
<name>ObjectRowid_param</name>
<valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/classificationgroups/children/objectrowid_param/valueProcess.js</valueProcess>
</entityParameter>
<entityParameter>
<name>ObjectType_param</name>
<valueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/classificationgroups/children/objecttype_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityField>
<name>PHASEINFO</name>
<title>phase information</title>
......
......@@ -19,4 +19,11 @@
<view>MemberDrawer_view</view>
</neonViewReference>
</references>
<viewmodeProvider>
<staticContentEntry>
<name>editView</name>
<key>editView</key>
<value>Links</value>
</staticContentEntry>
</viewmodeProvider>
</neonContext>
......@@ -23,7 +23,7 @@
</neonTableColumn>
<neonTableColumn>
<name>59e6aea1-9752-48b5-9d91-43edd0c1d670</name>
<entityField>PERSON_FULL_NAME</entityField>
<entityField>CONTACT_ID</entityField>
</neonTableColumn>
<neonTableColumn>
<name>27e658bc-c134-4fef-a3a5-b172852d606e</name>
......@@ -57,7 +57,7 @@
</neonTreeTableColumn>
<neonTreeTableColumn>
<name>d84b10a1-593a-4c2f-ba35-4fb80c362850</name>
<entityField>PERSON_FULL_NAME</entityField>
<entityField>CONTACT_ID</entityField>
</neonTreeTableColumn>
<neonTreeTableColumn>
<name>22eb0efc-61b3-48fe-989d-2dd4e70ea780</name>
......
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