Skip to content
Snippets Groups Projects
Commit 1dc6f601 authored by Sebastian Listl's avatar Sebastian Listl :speech_balloon:
Browse files

Merge branch 'District_merge' into 'master'

District merge

See merge request xrm/basic!577
parents 714a052a 8be0b746
No related branches found
No related tags found
No related merge requests found
Showing
with 187 additions and 123 deletions
......@@ -5,6 +5,8 @@
<majorModelMode>DISTRIBUTED</majorModelMode>
<documentation>%aditoprj%/entity/District_entity/documentation.adoc</documentation>
<icon>VAADIN:GLOBE</icon>
<grantDelete v="false" />
<grantDeleteProcess>%aditoprj%/entity/District_entity/grantDeleteProcess.js</grantDeleteProcess>
<contentTitleProcess>%aditoprj%/entity/District_entity/contentTitleProcess.js</contentTitleProcess>
<iconIdProcess>%aditoprj%/entity/District_entity/iconIdProcess.js</iconIdProcess>
<titlePlural></titlePlural>
......@@ -109,20 +111,6 @@
<fieldName>ISO3Name</fieldName>
</dependency>
</entityConsumer>
<entityConsumer>
<name>DistrictResponsibles</name>
<dependency>
<name>dependency</name>
<entityName>DistrictResponsible_entity</entityName>
<fieldName>DistrictResponsibles</fieldName>
</dependency>
<children>
<entityParameter>
<name>DistrictId_param</name>
<valueProcess>%aditoprj%/entity/District_entity/entityfields/districtresponsibles/children/districtid_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityField>
<name>USER_NEW</name>
<valueProcess>%aditoprj%/entity/District_entity/entityfields/user_new/valueProcess.js</valueProcess>
......@@ -187,6 +175,12 @@
<entityName>LogHistory_entity</entityName>
<fieldName>LogHistoryProvider</fieldName>
</dependency>
<children>
<entityParameter>
<name>tablenames_param</name>
<valueProcess>%aditoprj%/entity/District_entity/entityfields/loghistories/children/tablenames_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityField>
<name>parentFilter</name>
......@@ -243,6 +237,7 @@
<children>
<entityParameter>
<name>DistrictsByContactId_param</name>
<valueProcess>%aditoprj%/entity/District_entity/entityfields/validparentdistricts/children/districtsbycontactid_param/valueProcess.js</valueProcess>
<expose v="false" />
</entityParameter>
</children>
......@@ -251,6 +246,81 @@
<name>ExcludedDistrictIds_param</name>
<expose v="true" />
</entityParameter>
<entityConsumer>
<name>DistrictResponsibleUIDs</name>
<dependency>
<name>dependency</name>
<entityName>DistrictResponsible_entity</entityName>
<fieldName>DistrictResponsibles</fieldName>
</dependency>
<children>
<entityParameter>
<name>DistrictId_param</name>
<valueProcess>%aditoprj%/entity/District_entity/entityfields/districtresponsibleuids/children/districtid_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityField>
<name>DISTRICT_AUTOADD</name>
<title>Auto assignment</title>
<contentType>BOOLEAN</contentType>
<dropDownProcess>%aditoprj%/entity/District_entity/entityfields/district_autoadd/dropDownProcess.js</dropDownProcess>
<valueProcess>%aditoprj%/entity/District_entity/entityfields/district_autoadd/valueProcess.js</valueProcess>
</entityField>
<entityActionField>
<name>assignDistrict</name>
<title>Assign district</title>
<onActionProcess>%aditoprj%/entity/District_entity/entityfields/assigndistrict/onActionProcess.js</onActionProcess>
</entityActionField>
<entityActionGroup>
<name>ActionGroup</name>
<children>
<entityActionField>
<name>assignAllActiveDistricts</name>
<title>Assign all selected districts</title>
<onActionProcess>%aditoprj%/entity/District_entity/entityfields/actiongroup/children/assignallactivedistricts/onActionProcess.js</onActionProcess>
<isObjectAction v="false" />
</entityActionField>
</children>
</entityActionGroup>
<entityProvider>
<name>DistrictContacts</name>
<dependencies>
<entityDependency>
<name>d94c353f-c66d-489c-934b-72ca154ba37a</name>
<entityName>DistrictContact_entity</entityName>
<fieldName>Districts</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
<children>
<entityParameter>
<name>DistrictsByContactId_param</name>
<valueProcess>%aditoprj%/entity/District_entity/entityfields/districtcontacts/children/districtsbycontactid_param/valueProcess.js</valueProcess>
<expose v="true" />
<mandatory v="false" />
</entityParameter>
</children>
</entityProvider>
<entityConsumer>
<name>DistrictContactUIDs</name>
<selectionMode>MULTI</selectionMode>
<dependency>
<name>dependency</name>
<entityName>DistrictContact_entity</entityName>
<fieldName>DistrictContacts</fieldName>
</dependency>
<children>
<entityParameter>
<name>DistrictId_param</name>
<valueProcess>%aditoprj%/entity/District_entity/entityfields/districtcontactuids/children/districtid_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityParameter>
<name>ResponsibleDistrictsOfCurrentUser_param</name>
<expose v="true" />
</entityParameter>
</entityFields>
<recordContainers>
<dbRecordContainer>
......@@ -259,6 +329,7 @@
<conditionProcess>%aditoprj%/entity/District_entity/recordcontainers/db/conditionProcess.js</conditionProcess>
<orderClauseProcess>%aditoprj%/entity/District_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess>
<alias>Data_alias</alias>
<onDBDelete>%aditoprj%/entity/District_entity/recordcontainers/db/onDBDelete.js</onDBDelete>
<cacheType>GLOBAL</cacheType>
<cacheKeyProcess>%aditoprj%/entity/District_entity/recordcontainers/db/cacheKeyProcess.js</cacheKeyProcess>
<recordFieldMappings>
......@@ -346,6 +417,11 @@
<name>totalTurnover.value</name>
<isLookupFilter v="false" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>DISTRICT_AUTOADD.value</name>
<recordfield>DISTRICT.DISTRICT_AUTOADD</recordfield>
<isFilterable v="true" />
</dbRecordFieldMapping>
</recordFieldMappings>
<linkInformation>
<linkInformation>
......
import("system.vars");
import("system.question");
import("system.translate");
import("District_lib");
var arrDistrictIds = vars.get("$sys.selection");
question.showMessage(translate.text("Assignment for all selected districts will start now!"));
DistrictUtils.assignDistrictOnServer(arrDistrictIds);
\ No newline at end of file
import("District_lib");
import("system.result");
import("system.vars");
var parentFilter = vars.get("$field.parentFilter");
var districtFilter = vars.get("$field.DISTRICT_FILTER");
var appliedFilter = {
entity: "Organisation_entity",
filter: {
type: "group",
operator: "AND",
childs: []
}};
if (parentFilter)
{
appliedFilter.filter.childs.push(JSON.parse(parentFilter).filter);
}
if (districtFilter)
{
//appliedFilter = _getApplicableFilter(appliedFilter, districtFilter);
appliedFilter.filter.childs.push(JSON.parse(districtFilter).filter);
}
result.string(JSON.stringify(appliedFilter));
filterArray = [];
function _getApplicableFilter(pFilter, pAppendFilter){
var applicableFilter = "";
var childFilter = JSON.parse(pFilter).filter;
return applicableFilter;
}
\ No newline at end of file
//Aufbau des kompletten Filters über alle Hierarchie-Ebenen hinweg
var appliedFilter = DistrictUtils.getAppliedFilter(vars.get("$field.DISTRICT_FILTER"), vars.get("$field.PARENTDISTRICT_DISTRICTID"));
result.string(appliedFilter);
import("system.question");
import("system.translate");
import("District_lib");
import("system.vars");
var arrDistrictId = [vars.get("$field.DISTRICTID")];
question.showMessage(translate.text("District assignment will start now!"));
DistrictUtils.assignDistrictOnServer(arrDistrictId);
import("system.logging");
import("system.vars");
import("system.result");
import("system.entities");
......@@ -20,5 +19,4 @@ if (appliedFilter)
rowCount = entities.getRowCount(conf);
}
result.string(rowCount);
\ No newline at end of file
import("system.translate");
import("system.result");
result.object([
["1", translate.text("Yes")]
,["0", translate.text("No")]
]);
\ No newline at end of file
......@@ -2,8 +2,5 @@ import("system.result");
import("system.neon");
import("system.vars");
if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT)
{
result.string(neon.COMPONENTSTATE_INVISIBLE);
}
\ No newline at end of file
if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null)
result.string("0");
\ No newline at end of file
import("system.vars");
import("system.logging");
import("system.result");
import("system.neon");
import("Sql_lib");
var districtNo = vars.get("$field.DISTRICT_NUMBER");
result.string(districtNo.padStart(4, '0'));
result.string(districtNo.padStart(4, '0'));
\ No newline at end of file
import("system.result");
result.string("$$$###ignore_param###$$$");//dummy value, for special treatment in the conditionProcess
\ No newline at end of file
import("system.result");
import("system.vars");
result.string(vars.get("$field.DISTRICTID"));
\ No newline at end of file
import("system.result");
import("system.vars");
result.string(vars.get("$field.DISTRICTID"));
\ No newline at end of file
import("system.vars");
import("system.result");
import("Context_lib");
var res = [];
res.push({id: vars.get("$field.DISTRICTID"), tableNames: ["DISTRICT"]});
res = JSON.stringify(res);//currently only strings can be passed as param
result.object(res);
\ No newline at end of file
import("District_lib");
import("system.result");
import("system.vars");
import("system.neon");
import("Sql_lib");
var res = "";
var parentDistrictId = vars.get("$field.PARENTDISTRICT_DISTRICTID");
if (parentDistrictId)
{
var completeParentFilter = _getParentFilter(parentDistrictId, null);
completeParentFilter.entity = "Organisation_entity";
res = completeParentFilter;
}
else
{
var entity = "Organisation_entity";
var emptyFilter = {
entity: entity,
filter: {
type: "group",
operator: "AND",
childs: []
}
};
res = emptyFilter;
}
result.string(JSON.stringify(res));
function _getParentFilter(pParentDistrictId, pPreviousFilter)
{
var resFilter;
if (pPreviousFilter != null)
{
resFilter = pPreviousFilter;
}
if (pParentDistrictId)
{
var parentDistrictFilter, grandParentDistrict;
[parentDistrictFilter, grandParentDistrict] = newSelect(["DISTRICT.DISTRICT_FILTER", "DISTRICT.PARENTDISTRICT_DISTRICTID"])
.from("DISTRICT")
.where("DISTRICT.DISTRICTID", pParentDistrictId)
.arrayRow();
parentDistrictFilter = JSON.parse(parentDistrictFilter);
if (pPreviousFilter)
parentDistrictFilter.filter.childs.push(resFilter.filter);//todo: kommentar ergänzen was wir heir eigentlcih machen
resFilter = parentDistrictFilter;
if (grandParentDistrict.length > 0)
{
resFilter = _getParentFilter(grandParentDistrict, resFilter);
}
}
return resFilter;
}
\ No newline at end of file
//Aufbau des übergeordneten Filters
var res = DistrictUtils.getParentFilter(vars.get("$field.PARENTDISTRICT_DISTRICTID"));
result.string(res);
......@@ -2,7 +2,6 @@ import("system.text");
import("Sql_lib");
import("system.SQLTYPES");
import("Date_lib");
import("system.logging");
import("system.vars");
import("system.result");
import("system.entities");
......
import("system.result");
result.string("$$$###ignore_param###$$$");//dummy value, for special treatment in the conditionProcess
\ No newline at end of file
import("system.result");
import("Sql_lib");
import("system.vars");
//Don't allow deletion if the district is a superordinate district
var districtId = vars.get("$field.DISTRICTID");
var count = newSelect("COUNT(*)")
.from("DISTRICT")
.where("DISTRICT.PARENTDISTRICT_DISTRICTID", districtId)
.cell();
result.string(count == 0);
import("Employee_lib");
import("system.result");
import("system.vars");
import("Sql_lib");
var onlyResponsibleParam = vars.get("$param.DistrictsByContactId_param");
var responsibleDistrictsOfCurrentUser = vars.get("$param.ResponsibleDistrictsOfCurrentUser_param");
var onlyResponsibleParam;
if(responsibleDistrictsOfCurrentUser == "true")
{
onlyResponsibleParam = EmployeeUtils.getCurrentContactId();
}
else
{
onlyResponsibleParam = vars.get("$param.DistrictsByContactId_param");
}
var cond = newWhere();
if (onlyResponsibleParam)
{
......
import("Sql_lib");
import("system.vars");
import("system.db");
var districtId = vars.get("$field.DISTRICTID");
//delete linked data
db.deletes([
newWhere("DISTRICTCONTACT.DISTRICT_ID", districtId).buildDeleteStatement(),
newWhere("DISTRICTRESPONSIBLE.DISTRICT_ID", districtId).buildDeleteStatement()
]);
\ No newline at end of file
......@@ -285,12 +285,6 @@
<fieldName>Leadimport_Empl</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>e9a775ab-e63d-493d-94dc-6b27dfb77173</name>
<entityName>DistrictResponsible_entity</entityName>
<fieldName>Employees</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>7e6bff46-4047-49da-a5ef-40510a8255a2</name>
<entityName>VisitRecommendation_entity</entityName>
......
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