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

District model upgrade and refactoring

parent 5c8c428a
No related branches found
No related tags found
No related merge requests found
Showing
with 75 additions and 256 deletions
<?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.17" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.17">
<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.18" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.18">
<name>DistrictContact_entity</name>
<title>District Contact</title>
<majorModelMode>DISTRIBUTED</majorModelMode>
<icon>VAADIN:GLOBE</icon>
<title>District Contact</title>
<iconIdProcess>%aditoprj%/entity/DistrictContact_entity/iconIdProcess.js</iconIdProcess>
<image>VAADIN:GLOBE</image>
<titlePlural>Supervisors</titlePlural>
......@@ -99,8 +99,8 @@
<valueProcess>%aditoprj%/entity/DistrictContact_entity/entityfields/keywordcontactstates/children/containername_param/valueProcess.js</valueProcess>
</entityParameter>
<entityParameter>
<name>ExcludedKeyIdsSubquery_param</name>
<valueProcess>%aditoprj%/entity/DistrictContact_entity/entityfields/keywordcontactstates/children/excludedkeyidssubquery_param/valueProcess.js</valueProcess>
<name>BlacklistIds_param</name>
<valueProcess>%aditoprj%/entity/DistrictContact_entity/entityfields/keywordcontactstates/children/blacklistids_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
......@@ -224,28 +224,12 @@
<recordContainers>
<dbRecordContainer>
<name>db</name>
<alias>Data_alias</alias>
<isPageable v="true" />
<isRequireContainerFiltering v="false" />
<hasDependentRecords v="true" />
<fromClauseProcess>%aditoprj%/entity/DistrictContact_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess>
<conditionProcess>%aditoprj%/entity/DistrictContact_entity/recordcontainers/db/conditionProcess.js</conditionProcess>
<linkInformation>
<linkInformation>
<name>dc5cbebc-a947-4196-937a-f665ee80cc31</name>
<tableName>DISTRICTCONTACT</tableName>
<primaryKey>DISTRICTCONTACTID</primaryKey>
<isUIDTable v="true" />
<readonly v="false" />
</linkInformation>
<linkInformation>
<name>058abbb3-d92f-4fe1-b326-1320cfee90df</name>
<tableName>CONTACT</tableName>
<primaryKey>CONTACTID</primaryKey>
<isUIDTable v="false" />
<readonly v="true" />
</linkInformation>
</linkInformation>
<alias>Data_alias</alias>
<recordFieldMappings>
<dbRecordFieldMapping>
<name>ADVISER_CONTACT_ID.value</name>
......@@ -304,6 +288,22 @@
<expression>%aditoprj%/entity/DistrictContact_entity/recordcontainers/db/recordfieldmappings/status.displayvalue/expression.js</expression>
</dbRecordFieldMapping>
</recordFieldMappings>
<linkInformation>
<linkInformation>
<name>dc5cbebc-a947-4196-937a-f665ee80cc31</name>
<tableName>DISTRICTCONTACT</tableName>
<primaryKey>DISTRICTCONTACTID</primaryKey>
<isUIDTable v="true" />
<readonly v="false" />
</linkInformation>
<linkInformation>
<name>058abbb3-d92f-4fe1-b326-1320cfee90df</name>
<tableName>CONTACT</tableName>
<primaryKey>CONTACTID</primaryKey>
<isUIDTable v="false" />
<readonly v="true" />
</linkInformation>
</linkInformation>
</dbRecordContainer>
</recordContainers>
</entity>
import("system.vars");
import("system.result");
import("system.neon");
import("KeywordRegistry_basic");
import("Sql_lib");
if (vars.get("$sys.presentationmode") != neon.CONTEXT_PRESENTATIONMODE_FILTER)
{
var excludedIds = $KeywordRegistry.contactStatus$inReview();
result.string(JSON.stringify(excludedIds));
}
\ No newline at end of file
import("system.vars");
import("system.result");
import("system.neon");
import("KeywordRegistry_basic");
import("Sql_lib");
if(vars.get("$sys.presentationmode") != neon.CONTEXT_PRESENTATIONMODE_FILTER){
var cond = newSelect("AB_KEYWORD_ENTRY.KEYID")
.from("AB_KEYWORD_ENTRY")
.where("AB_KEYWORD_ENTRY.CONTAINER", $KeywordRegistry.contactStatus())
.and("AB_KEYWORD_ENTRY.KEYID", $KeywordRegistry.contactStatus$inReview(), SqlBuilder.LIKE());
result.string(cond.toString());
}
\ No newline at end of file
......@@ -7,6 +7,5 @@ import("District_lib");
var arrIds = vars.get("$sys.selection");
DistrictUtils.setDistrictContactStatus(arrIds, $KeywordRegistry.contactStatus$active());
//refresh only if the function is called twice
neon.refreshAll();
neon.refreshAll();
\ No newline at end of file
......@@ -5,6 +5,5 @@ import("District_lib");
var arrIds = vars.get("$sys.selection");
DistrictUtils.setDistrictContactStatus(arrIds, $KeywordRegistry.contactStatus$inactive());
//refresh only if the function is called twice
neon.refreshAll();
neon.refreshAll();
\ No newline at end of file
......@@ -215,6 +215,10 @@
<name>ExcludedKeyIdsSubquery_param</name>
<valueProcess>%aditoprj%/entity/DistrictResponsible_entity/entityfields/adviserstates/children/excludedkeyidssubquery_param/valueProcess.js</valueProcess>
</entityParameter>
<entityParameter>
<name>BlacklistIds_param</name>
<valueProcess>%aditoprj%/entity/DistrictResponsible_entity/entityfields/adviserstates/children/blacklistids_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityField>
......@@ -265,22 +269,6 @@
<alias>Data_alias</alias>
<cacheType>GLOBAL</cacheType>
<cacheKeyProcess>%aditoprj%/entity/DistrictResponsible_entity/recordcontainers/db/cacheKeyProcess.js</cacheKeyProcess>
<linkInformation>
<linkInformation>
<name>d0fee359-92fb-4d5e-b50c-3e74251440d8</name>
<tableName>DISTRICTRESPONSIBLE</tableName>
<primaryKey>DISTRICTRESPONSIBLEID</primaryKey>
<isUIDTable v="true" />
<readonly v="false" />
</linkInformation>
<linkInformation>
<name>33f6c941-5245-4847-a8a3-3cbddc30a104</name>
<tableName>CONTACT</tableName>
<primaryKey>CONTACTID</primaryKey>
<isUIDTable v="false" />
<readonly v="true" />
</linkInformation>
</linkInformation>
<recordFieldMappings>
<dbRecordFieldMapping>
<name>DISTRICT_ID.value</name>
......@@ -358,14 +346,14 @@
</recordFieldMappings>
<linkInformation>
<linkInformation>
<name>d24296ec-5040-4b40-ad5b-668d3e02b4aa</name>
<name>d0fee359-92fb-4d5e-b50c-3e74251440d8</name>
<tableName>DISTRICTRESPONSIBLE</tableName>
<primaryKey>DISTRICTRESPONSIBLEID</primaryKey>
<isUIDTable v="true" />
<readonly v="false" />
</linkInformation>
<linkInformation>
<name>86f9ab94-0d69-4a3a-9a04-615f61be2c23</name>
<name>33f6c941-5245-4847-a8a3-3cbddc30a104</name>
<tableName>CONTACT</tableName>
<primaryKey>CONTACTID</primaryKey>
<isUIDTable v="false" />
......
import("system.result");
import("KeywordRegistry_basic");
var excludedIds = [$KeywordRegistry.contactStatus$inReview()];
result.string(JSON.stringify(excludedIds));
\ No newline at end of file
......@@ -4,17 +4,13 @@ import("system.result");
import("Sql_lib");
import("system.db");
var cond = newWhere();
var count = newSelect("COUNT(*)")
.from("DISTRICTCONTACT")
.join("DISTRICTRESPONSIBLE", "DISTRICTCONTACT.ADVISER_CONTACT_ID = DISTRICTRESPONSIBLE.EMPLOYEE_CONTACT_ID")
.where("DISTRICTRESPONSIBLE.EMPLOYEE_CONTACT_ID", vars.get("$field.EMPLOYEE_CONTACT_ID"))
.cell();
var test = newSelect("COUNT(*)")
.from("DISTRICTCONTACT")
.join("DISTRICTRESPONSIBLE", "DISTRICTCONTACT.ADVISER_CONTACT_ID = DISTRICTRESPONSIBLE.EMPLOYEE_CONTACT_ID")
.where("DISTRICTRESPONSIBLE.EMPLOYEE_CONTACT_ID", vars.get("$field.EMPLOYEE_CONTACT_ID"))
.arrayColumn()[0];
if(test.toString() == 0){
if(count == 0)
result.string(neon.COMPONENTSTATE_EDITABLE);
}
else{
result.string(neon.COMPONENTSTATE_READONLY);
}
\ No newline at end of file
else
result.string(neon.COMPONENTSTATE_READONLY);
\ No newline at end of file
......@@ -2,7 +2,8 @@ import("system.result");
import("system.db");
import("Sql_lib");
result.object(newSelect("EMPLOYEE_CONTACT_ID")
.from("DISTRICTRESPONSIBLE")
.where("DISTRICTRESPONSIBLE.DISTRICT_ID", "$param.DistrictId_param")
.arrayColumn(true));
\ No newline at end of file
result.string(JSON.stringify(newSelect("EMPLOYEE_CONTACT_ID")
.from("DISTRICTRESPONSIBLE")
.where("DISTRICTRESPONSIBLE.DISTRICT_ID", "$param.DistrictId_param")
.arrayColumn())
);
\ No newline at end of file
......@@ -2,15 +2,11 @@ import("system.result");
import("Sql_lib");
import("system.vars");
//Ist das zu löschende Gebiet ein übergeordnetes Gebiet, dann ist das Löschen nicht erlaubt.
//Don't allow deletion if the district is a superordinate district
var districtId = vars.get("$field.DISTRICTID");
var anzahl = newSelect("COUNT(*)")
var count = newSelect("COUNT(*)")
.from("DISTRICT")
.where("DISTRICT.PARENTDISTRICT_DISTRICTID", districtId)
.cell(true);
.cell();
if (anzahl > 0)
result.string(false);
else
result.string(true);
result.string(count == 0);
......@@ -2,15 +2,10 @@ import("Sql_lib");
import("system.vars");
import("system.db");
var condition;
var deleteArray = [];
var districtId = vars.get("$field.DISTRICTID");
//Gebiet wird gelöscht -> auch die Referenzen in den folgenden Tabellen löschen
condition = newWhere("DISTRICTCONTACT.DISTRICT_ID", districtId);
deleteArray.push(["DISTRICTCONTACT", condition.build()]);
condition = newWhere("DISTRICTRESPONSIBLE.DISTRICT_ID", districtId);
deleteArray.push(["DISTRICTRESPONSIBLE", condition.build()]);
db.deletes(deleteArray);
\ No newline at end of file
//delete linked data
db.deletes([
newWhere("DISTRICTCONTACT.DISTRICT_ID", districtId).buildDeleteStatement(),
newWhere("DISTRICTRESPONSIBLE.DISTRICT_ID", districtId).buildDeleteStatement()
]);
\ No newline at end of file
<?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.6" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.6">
<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.7" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.7">
<name>DistrictContactEdit_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<size>SMALL</size>
......
<?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.6" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.6">
<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.7" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.7">
<name>DistrictContactFilter_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<filterable v="true" />
......@@ -32,8 +32,8 @@
<children>
<tableViewTemplate>
<name>districtContacts</name>
<favoriteActionGroup1>setStatus</favoriteActionGroup1>
<entityField>#ENTITY</entityField>
<favoriteActionGroup1>setStatus</favoriteActionGroup1>
<linkedColumns />
<fixedFilterFields />
<columns>
......
<?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.6" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.6">
<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.7" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.7">
<name>DistrictResponsibleEdit_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<size>SMALL</size>
......
<?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.6" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.6">
<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.7" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.7">
<name>DistrictResponsibleFilter_view</name>
<title>Responsibles</title>
<majorModelMode>DISTRIBUTED</majorModelMode>
......
<?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.6" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.6">
<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.7" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.7">
<name>DistrictResponsibleLookup_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<layout>
......
<entry>
<key>Auto assignment</key>
<value>Auto-Zuordnung</value>
</entry>
<entry>
<key>District Contact</key>
<value>Gebietsverantwortlicher</value>
</entry>
<entry>
<key>District Contacts</key>
<value>Gebietsverantwortlichen</value>
</entry>
<entry>
<key>Adviser Role</key>
<value>Rolle des Verantwortlichen</value>
</entry>
<entry>
<key>Adviser Contact</key>
<value>Verantwortlicher</value>
</entry>
<entry>
<key>Office Duty</key>
<value>Innendienst</value>
</entry>
<entry>
<key>Region Manager</key>
<value>Regionsleiter</value>
</entry>
<entry>
<key>Area Manager</key>
<value>Gebietsleiter</value>
</entry>
<entry>
<key>Field Service</key>
<value>Außendienst</value>
</entry>
<entry>
<key>Assign district</key>
<value>Gebiet zuordnen</value>
</entry>
<entry>
<key>District assignment will start now!</key>
<value>Die Gebietszuordnung wird jetzt gestartet!</value>
</entry>
<entry>
<key>Assignment of district \"%0\" is completed!</key>
<value>Zuordnung des Gebietes \"%0\" ist abgeschlossen!</value>
</entry>
<entry>
<key>%0 companies were newley assigned. \n%1 companies are no longer assigned (these assignments got the status 'review'). \n%2 valid assignments were unchanged.\nThe Process took %3 seconds.</key>
<value>%0 Firmen wurden neu hinzugefügt. \n %1 Firmen sind nicht länger zugeordnet (diese Zuordnungen wurden auf den Status 'zur Prüfung' gesetzt). \n %2 gültige Zuordnungen blieben unverändert. \n Der Prozess dauert %3 Sekunden. </value>
</entry>
<entry>
<key>District assignment status</key>
<value>Gebietzuordnungstatus</value>
</entry>
<entry>
<key>Assign all selected districts</key>
<value>Zuordnung für alle selektierten Gebiete</value>
</entry>
<entry>
<key>Assignment for all selected districts will start now!</key>
<value>Zuordnung für alle selektierten Gebiete wird jetzt gestartet</value>
</entry>
<entry>
<key>Assignment of all selected districts is completed!</key>
<value>Zuordnung für alle selektierten Gebiete abgeschlossen</value>
</entry>
<entry>
<key>Set active</key>
<value>Aktiv setzen</value>
</entry>
<entry>
<key>Set inactive</key>
<value>Inaktiv setzen</value>
</entry>
<entry>
<key>Set status to active</key
<value>Status auf aktiv setzen</value>
</entry>
<entry>
<key>Set status to inactive</key>
<value>Status auf inaktiv setzen</value>
</entry>
<entry>
<key>My district assignments to check</key>
<value>Meine zu prüfenden Gebietszuweisungen</value>
</entry>
\ No newline at end of file
<entry>
<key>Auto assignment</key>
</entry>
<entry>
<key>District Contact</key>
</entry>
<entry>
<key>District Contacts</key>
</entry>
<entry>
<key>Adviser Role</key>
</entry>
<entry>
<key>Adviser Contact</key>
</entry>
<entry>
<key>Sales Manager</key>
</entry>
<entry>
<key>Office Duty</key>
</entry>
<entry>
<key>Region Manager</key>
</entry>
<entry>
<key>Area Manager</key>
</entry>
<entry>
<key>Field Service</key>
</entry>
<entry>
<key>Assign district</key>
</entry>
<entry>
<key>District assignment will start now!</key>
</entry>
<entry>
<key>Assignment of district \"%0\" is completed!</key>
</entry>
<entry>
<key>%0 companies were newley assigned. \n%1 companies are no longer assigned (these assignments got the status 'review'). \n%2 valid assignments were unchanged.\nThe Process took %3 seconds.</key>
</entry>
<entry>
<key>District assignment status</key>
</entry>
<entry>
<key>Assign all selected districts</key>
</entry>
<entry>
<key>Assignment for all selected districts will start now!</key>
</entry>
<entry>
<key>Assignment of all selected districts is completed!</key>
</entry>
<entry>
<key>Set active</key>
</entry>
<entry>
<key>Set inactive</key>
</entry>
<entry>
<key>Set status to active</key>
</entry>
<entry>
<key>Set status to inactive</key>
</entry>
<entry>
<key>My district assignments to check</key>
</entry>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.1">
<process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.2">
<name>District_lib</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<process>%aditoprj%/process/District_lib/process.js</process>
......
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.1">
<process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.2">
<name>assignDistrict_serverProcess</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<process>%aditoprj%/process/assignDistrict_serverProcess/process.js</process>
......
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