Skip to content
Snippets Groups Projects
Commit 1da66516 authored by Benjamin Ulrich's avatar Benjamin Ulrich :speech_balloon:
Browse files

Merge branch 'sales_pn_1086268_district_serialactions' into '2021.2'

[Projekt: xRM-Sales][TicketNr.: 1086268][Gebietsdefinition Serienaktionen]

See merge request xrm/basic!1379
parents 123c2d30 3b96885a
No related branches found
No related tags found
No related merge requests found
Showing
with 231 additions and 1 deletion
<?xml version="1.0" encoding="UTF-8"?>
<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.22" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.22">
<name>DistrictChangeField_entity</name>
<title>Serial action</title>
<majorModelMode>DISTRIBUTED</majorModelMode>
<documentation>%aditoprj%/entity/DistrictChangeField_entity/documentation.adoc</documentation>
<siblings>
<element>District_entity</element>
</siblings>
<recordContainer>jDito</recordContainer>
<entityFields>
<entityProvider>
<name>#PROVIDER</name>
</entityProvider>
<entityProvider>
<name>#PROVIDER_AGGREGATES</name>
<useAggregates v="true" />
</entityProvider>
<entityField>
<name>PARENTDISTRICT_DISTRICTID</name>
<title>{$DISTRICT_PARENT_DISTRICT}</title>
<consumer>ParentDistricts</consumer>
<stateProcess>%aditoprj%/entity/DistrictChangeField_entity/entityfields/parentdistrict_districtid/stateProcess.js</stateProcess>
<displayValueProcess>%aditoprj%/entity/DistrictChangeField_entity/entityfields/parentdistrict_districtid/displayValueProcess.js</displayValueProcess>
</entityField>
<entityField>
<name>DISTRICT_AUTOADD</name>
<title>Auto assignment</title>
<contentType>BOOLEAN</contentType>
<stateProcess>%aditoprj%/entity/DistrictChangeField_entity/entityfields/district_autoadd/stateProcess.js</stateProcess>
</entityField>
<entityParameter>
<name>Field_param</name>
<expose v="true" />
<mandatory v="true" />
</entityParameter>
<entityField>
<name>UID</name>
</entityField>
<entityConsumer>
<name>ParentDistricts</name>
<dependency>
<name>dependency</name>
<entityName>District_entity</entityName>
<fieldName>ValidParentDistricts</fieldName>
</dependency>
<children>
<entityParameter>
<name>ExcludedDistrictIds_param</name>
<valueProcess>%aditoprj%/entity/DistrictChangeField_entity/entityfields/parentdistricts/children/excludeddistrictids_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityParameter>
<name>Ids_param</name>
<expose v="true" />
<mandatory v="true" />
</entityParameter>
</entityFields>
<recordContainers>
<jDitoRecordContainer>
<name>jDito</name>
<jDitoRecordAlias>Data_alias</jDitoRecordAlias>
<onInsert>%aditoprj%/entity/DistrictChangeField_entity/recordcontainers/jdito/onInsert.js</onInsert>
<recordFieldMappings>
<jDitoRecordFieldMapping>
<name>UID.value</name>
</jDitoRecordFieldMapping>
</recordFieldMappings>
</jDitoRecordContainer>
</recordContainers>
</entity>
= DistrictChangeField_entity
== Overview
Serial action entity to update specific fields of the District_entity at once.
== Relation to other entities
Used to update multiple rows of the District_entity at once.
== Best Practice
== FAQ
How to update a new field:
- Add a constant in the District_lib.
- Add the field to this entity.
- Fill in the corresponding entityfield processes (stateProcess, mandatoryProcess, etc..).
import("system.result");
import("system.neon");
import("system.vars");
import("District_lib");
var state = neon.COMPONENTSTATE_INVISIBLE;
if(vars.get("$param.Field_param") == DistrictChangeField.autoadd())
{
state = neon.COMPONENTSTATE_EDITABLE;
}
result.string(state);
import("system.result");
import("system.vars");
import("Context_lib");
result.string(ContextUtils.loadContentTitle("District_entity", vars.get("$this.value")));
import("system.result");
import("system.neon");
import("system.vars");
import("District_lib");
var state = neon.COMPONENTSTATE_INVISIBLE;
if(vars.get("$param.Field_param") == DistrictChangeField.parent())
{
state = neon.COMPONENTSTATE_EDITABLE;
}
result.string(state);
import("system.result");
import("system.vars");
result.string(vars.get("$param.Ids_param"));
import("system.vars");
import("system.entities");
import("Sql_lib");
var ids = JSON.parse(vars.get("$param.Ids_param"));
var field = vars.get("$param.Field_param");
var data = {}; // TODO: use ES6 'ComputedPropertyName'
data[field] = vars.get("$field." + field);
newWhere("DISTRICT.DISTRICTID", ids, SqlBuilder.IN()).updateFields(data);
// invalidate the District db recordContainer cache,
// needed since we dont use write entity
// and thus the cache doesnt get refreshed automatically
entities.invalidateCache("District_entity", "db");
......@@ -5,6 +5,9 @@
<majorModelMode>DISTRIBUTED</majorModelMode>
<documentation>%aditoprj%/entity/District_entity/documentation.adoc</documentation>
<icon>VAADIN:GLOBE</icon>
<siblings>
<element>DistrictChangeField_entity</element>
</siblings>
<grantDelete v="true" />
<grantDeleteProcess>%aditoprj%/entity/District_entity/grantDeleteProcess.js</grantDeleteProcess>
<contentTitleProcess>%aditoprj%/entity/District_entity/contentTitleProcess.js</contentTitleProcess>
......@@ -265,6 +268,18 @@
<onActionProcess>%aditoprj%/entity/District_entity/entityfields/actiongroup/children/assignallactivedistricts/onActionProcess.js</onActionProcess>
<isObjectAction v="false" />
</entityActionField>
<entityActionField>
<name>setAutoAssignment</name>
<title>Set auto assignment</title>
<onActionProcess>%aditoprj%/entity/District_entity/entityfields/actiongroup/children/setautoassignment/onActionProcess.js</onActionProcess>
<isObjectAction v="false" />
</entityActionField>
<entityActionField>
<name>setParentDistrict</name>
<title>Set parent district</title>
<onActionProcess>%aditoprj%/entity/District_entity/entityfields/actiongroup/children/setparentdistrict/onActionProcess.js</onActionProcess>
<isObjectAction v="false" />
</entityActionField>
</children>
</entityActionGroup>
<entityProvider>
......
import("system.neon");
import("system.neonFilter");
import("system.vars");
import("District_lib");
neon.openContextWithRecipe("DistrictChangeField", null,
neonFilter.createEntityRecordsRecipeBuilder().parameters({
Ids_param: JSON.stringify(vars.get("$sys.selection")),
Field_param: DistrictChangeField.autoadd()
}), neon.OPERATINGSTATE_NEW);
import("system.neon");
import("system.neonFilter");
import("system.vars");
import("District_lib");
neon.openContextWithRecipe("DistrictChangeField", null,
neonFilter.createEntityRecordsRecipeBuilder().parameters({
Ids_param: JSON.stringify(vars.get("$sys.selection")),
Field_param: DistrictChangeField.parent()
}), neon.OPERATINGSTATE_NEW);
......@@ -14655,6 +14655,18 @@ Bitte Datumseingabe prüfen</value>
<key>Offers / Receipts</key>
<value>Angebote / Belege</value>
</entry>
<entry>
<key>Serial action</key>
<value>Serienaktion</value>
</entry>
<entry>
<key>Set parent district</key>
<value>Übergeordnetes Gebiet setzen</value>
</entry>
<entry>
<key>Set auto assignment</key>
<value>Auto-Zuordnung setzen</value>
</entry>
<entry>
<key>Calculate sum</key>
<value>Summe berechnen</value>
......
<?xml version="1.0" encoding="UTF-8"?>
<neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.1">
<name>DistrictChangeField</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<editView>DistrictChangeField_view</editView>
<entity>DistrictChangeField_entity</entity>
<references>
<neonViewReference>
<name>c9bd3a38-4c54-45bd-b24e-ba5b9c49ec58</name>
<view>DistrictChangeField_view</view>
</neonViewReference>
</references>
</neonContext>
<?xml version="1.0" encoding="UTF-8"?>
<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.8" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.8">
<name>DistrictChangeField_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<size>SMALL</size>
<layout>
<noneLayout>
<name>layout</name>
</noneLayout>
</layout>
<children>
<genericViewTemplate>
<name>generic</name>
<editMode v="true" />
<fields>
<entityFieldLink>
<name>b3bcd65d-ff54-40b3-91d6-8a883f95b1d6</name>
<entityField>DISTRICT_AUTOADD</entityField>
</entityFieldLink>
<entityFieldLink>
<name>32d20d9d-56a7-4b8f-b107-b7ccffb22fee</name>
<entityField>PARENTDISTRICT_DISTRICTID</entityField>
</entityFieldLink>
</fields>
</genericViewTemplate>
</children>
</neonView>
......@@ -14,7 +14,6 @@
<parentField>PARENTDISTRICT_DISTRICTID</parentField>
<hideContentSearch v="false" />
<showChildrenCount v="false" />
<entityField>#ENTITY</entityField>
<favoriteActionGroup1>ActionGroup</favoriteActionGroup1>
<linkedColumns>
<element>DISTRICT_NAME</element>
......
......@@ -468,3 +468,11 @@ DistrictUtils.setDistrictContactStatus = function (pArrIds, pStatus)
}
db.updates(updateArray);
}
/*
* See DistrictChangeField_entity
*/
DistrictChangeField = function() {}
DistrictChangeField.autoadd = function(){return "DISTRICT_AUTOADD";};
DistrictChangeField.parent = function(){return "PARENTDISTRICT_DISTRICTID";};
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