Skip to content
Snippets Groups Projects
Commit 9ec62ebe authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

remove old classification and legacy keyword

parent ddd7a306
No related branches found
No related tags found
No related merge requests found
<?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.5" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.5">
<name>SalesprojectClassificationEntry_entity</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<recordContainer>jdito</recordContainer>
<entityFields>
<entityProvider>
<name>#PROVIDER</name>
</entityProvider>
<entityProvider>
<name>SalesprojectClassificatonEntries</name>
<fieldType>DEPENDENCY_IN</fieldType>
<recordContainer>jdito</recordContainer>
<children>
<entityParameter>
<name>ClassId_param</name>
<expose v="true" />
</entityParameter>
<entityParameter>
<name>SalesprojectId_param</name>
<expose v="true" />
</entityParameter>
</children>
</entityProvider>
<entityParameter>
<name>SalesprojectId_param</name>
<expose v="true" />
<triggerRecalculation v="true" />
<mandatory v="true" />
<description>PARAMETER</description>
</entityParameter>
<entityParameter>
<name>ClassId_param</name>
<expose v="true" />
<triggerRecalculation v="true" />
<mandatory v="true" />
<description>PARAMETER</description>
</entityParameter>
<entityField>
<name>UID</name>
<title>Uid</title>
</entityField>
<entityField>
<name>NAME</name>
<title>Name</title>
</entityField>
<entityField>
<name>VALUE</name>
<title>Value</title>
<dropDownProcess>%aditoprj%/entity/SalesprojectClassificationEntry_entity/entityfields/value/dropDownProcess.js</dropDownProcess>
</entityField>
<entityField>
<name>TYPE</name>
<title>Type</title>
<state>INVISIBLE</state>
</entityField>
<entityField>
<name>POINTS</name>
<contentType>NUMBER</contentType>
</entityField>
</entityFields>
<recordContainers>
<jDitoRecordContainer>
<name>jdito</name>
<jDitoRecordAlias>Data_alias</jDitoRecordAlias>
<contentProcess>%aditoprj%/entity/SalesprojectClassificationEntry_entity/recordcontainers/jdito/contentProcess.js</contentProcess>
<onUpdate>%aditoprj%/entity/SalesprojectClassificationEntry_entity/recordcontainers/jdito/onUpdate.js</onUpdate>
<recordFields>
<element>UID.value</element>
<element>TYPE.value</element>
<element>NAME.value</element>
<element>VALUE.value</element>
<element>POINTS.value</element>
</recordFields>
</jDitoRecordContainer>
</recordContainers>
</entity>
import("system.result");
import("system.util");
import("system.db");
import("system.vars");
import("Keyword_lib");
import("Sql_lib");
var allOldTypesCondition, allOldTypes, classificationsCondition, classifications, classId, salesprojectId, entryKeywords, points;
classifications = [];
if (vars.exists("$param.ClassId_param") && vars.exists("$param.SalesprojectId_param")) {
classId = vars.getString("$param.ClassId_param");
salesprojectId = vars.getString("$param.SalesprojectId_param");
if (classId && salesprojectId) {
// keywords which are part of the loaded class [[keyname, visibleName]]
entryKeywords = LegacyKeywordUtils.get("SALESPROJECT.CLASS", classId)[2].keywords;
if (entryKeywords && classId && salesprojectId) {
// correct db if kewords changed
allOldTypesCondition = _getClassificationCondition(false);
allOldTypes = db.array(db.COLUMN, allOldTypesCondition.buildSql("select TYPE from SALESPROJECT_CLASSIFICATION", "1 = 0", "group by TYPE"));
if (allOldTypes.length > 0) {
// TODO maybe ask user????!!!!!
db.deleteData("SALESPROJECT_CLASSIFICATION", allOldTypesCondition.build("1 = 0"));
}
// load classifications for the class
classificationsCondition = _getClassificationCondition(true);
classifications = db.table(classificationsCondition.buildSql("select SALESPROJECT_CLASSIFICATIONID, TYPE, VALUE from SALESPROJECT_CLASSIFICATION", "1 = 0"));
classifications = entryKeywords.map(function(entryKeyword) {
// return saved value
for (i = 0; i < classifications.length; i++) {
if (classifications[i][1] == entryKeyword[0]) {
// get points
if (classifications[i][2]) {
points = LegacyKeywordUtils.get(entryKeyword[0], classifications[i][2])[2].points;
} else {
points = 0;
}
return [classifications[i][0], entryKeyword[0], entryKeyword[1], classifications[i][2], points]
}
}
// if not found create new:
var values = [
util.getNewUUID(),
salesprojectId,
classId,
entryKeyword[0],
"",
];
db.insertData(
"SALESPROJECT_CLASSIFICATION",
[
"SALESPROJECT_CLASSIFICATIONID",
"SALESPROJECT_ID",
"CLASS",
"TYPE",
"VALUE"
],
null,
values
);
return [values[0], values[3], values[3] , values[4], 0]
});
}
}
}
result.object(classifications);
/**
* creates a SqlCondition() to get the classification items
*
* @param include if true the condition includes all types of the class else it excludes them and selects all other types
* @return the condition object
*/
function _getClassificationCondition(include) {
var resultingCondition = new SqlCondition();
resultingCondition.andPrepare("SALESPROJECT_CLASSIFICATION.SALESPROJECT_ID", salesprojectId)
.andPrepare("SALESPROJECT_CLASSIFICATION.CLASS", classId);
var typeCondition = new SqlCondition();
entryKeywords.forEach(function(entry) {
if (include) {
typeCondition.orPrepare("SALESPROJECT_CLASSIFICATION.TYPE", entry[0], "# = ?");
} else {
typeCondition.andPrepare("SALESPROJECT_CLASSIFICATION.TYPE", entry[0], "# <> ?");
}
});
resultingCondition.andSqlCondition(typeCondition, "1 = 0");
return resultingCondition;
}
\ No newline at end of file
import("system.result");
import("system.vars");
import("Keyword_lib");
var type = vars.get("$field.TYPE");
if (type) {
result.object(LegacyKeywordUtils.getStandardArray(type));
}
\ No newline at end of file
import("system.db");
import("system.vars");
import("Sql_lib");
var condition = new SqlCondition();
condition.andPrepare("SALESPROJECT_CLASSIFICATION.SALESPROJECT_CLASSIFICATIONID", vars.getString("$field.UID"));
var values = [
vars.getString("$field.VALUE"),
vars.get("$sys.user"),
vars.get("$sys.date")
];
db.updateData(
"SALESPROJECT_CLASSIFICATION",
[
"VALUE"
],
null,
values,
condition.build("1 = 0")
);
\ No newline at end of file
import("system.result");
import("system.util");
import("system.db");
import("system.vars");
import("Keyword_lib");
import("Sql_lib");
var allOldTypesCondition, allOldTypes, classificationsCondition, classifications, classId, salesprojectId, entryKeywords, points;
classifications = [];
if (vars.exists("$param.ClassId_param") && vars.exists("$param.SalesprojectId_param")) {
classId = vars.getString("$param.ClassId_param");
salesprojectId = vars.getString("$param.SalesprojectId_param");
if (classId && salesprojectId) {
// keywords which are part of the loaded class [[keyname, visibleName]]
entryKeywords = LegacyKeywordUtils.get("SALESPROJECT.CLASS", classId)[2].keywords;
if (entryKeywords && classId && salesprojectId) {
// correct db if kewords changed
allOldTypesCondition = _getClassificationCondition(false);
allOldTypes = db.array(db.COLUMN, allOldTypesCondition.buildSql("select TYPE from SALESPROJECT_CLASSIFICATION", "1 = 0", "group by TYPE"));
if (allOldTypes.length > 0) {
// TODO maybe ask user????!!!!!
db.deleteData("SALESPROJECT_CLASSIFICATION", allOldTypesCondition.build("1 = 0"));
}
// load classifications for the class
classificationsCondition = _getClassificationCondition(true);
classifications = db.table(classificationsCondition.buildSql("select SALESPROJECT_CLASSIFICATIONID, TYPE, VALUE from SALESPROJECT_CLASSIFICATION", "1 = 0"));
classifications = entryKeywords.map(function(entryKeyword) {
// return saved value
for (i = 0; i < classifications.length; i++) {
if (classifications[i][1] == entryKeyword[0]) {
// get points
if (classifications[i][2]) {
points = LegacyKeywordUtils.get(entryKeyword[0], classifications[i][2])[2].points;
} else {
points = 0;
}
return [classifications[i][0], entryKeyword[0], entryKeyword[1], classifications[i][2], points]
}
}
// if not found create new:
var values = [
util.getNewUUID(),
salesprojectId,
classId,
entryKeyword[0],
""
];
db.insertData(
"SALESPROJECT_CLASSIFICATION",
[
"SALESPROJECT_CLASSIFICATIONID",
"SALESPROJECT_ID",
"CLASS",
"TYPE",
"VALUE"
],
null,
values
);
return [values[0], values[3], values[3] , values[4], 0]
});
}
}
}
result.object(classifications);
/**
* creates a SqlCondition() to get the classification items
*
* @param include if true the condition includes all types of the class else it excludes them and selects all other types
* @return the condition object
*/
function _getClassificationCondition(include) {
var resultingCondition = new SqlCondition();
resultingCondition.andPrepare("SALESPROJECT_CLASSIFICATION.SALESPROJECT_ID", salesprojectId)
.andPrepare("SALESPROJECT_CLASSIFICATION.CLASS", classId);
var typeCondition = new SqlCondition();
entryKeywords.forEach(function(entry) {
if (include) {
typeCondition.orPrepare("SALESPROJECT_CLASSIFICATION.TYPE", entry[0], "# = ?");
} else {
typeCondition.andPrepare("SALESPROJECT_CLASSIFICATION.TYPE", entry[0], "# <> ?");
}
});
resultingCondition.andSqlCondition(typeCondition, "1 = 0");
return resultingCondition;
}
\ No newline at end of file
import("system.db");
import("system.vars");
import("Sql_lib");
var condition = new SqlCondition();
condition.andPrepare("SALESPROJECT_CLASSIFICATION.SALESPROJECT_CLASSIFICATIONID", vars.getString("$field.UID"));
var values = [
vars.getString("$field.VALUE")
];
db.updateData(
"SALESPROJECT_CLASSIFICATION",
[
"VALUE"
],
null,
values,
condition.build("1 = 0")
);
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<preferences xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="3.1.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/preferences/3.1.0">
<name>_____PREFERENCES_PROJECT</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<projectName>xRM-Basic2019</projectName>
<jditoMaxContentSize v="57671680" />
<calendarCategoriesEvent>
<entry>
<key>Meeting</key>
<value></value>
</entry>
<entry>
<key>Organisation</key>
<value></value>
</entry>
<entry>
<key>auswärts</key>
<value></value>
</entry>
<entry>
<key>Urlaub</key>
<value></value>
</entry>
</calendarCategoriesEvent>
<clientSearchOptimizedForSpeed v="true" />
<clientSearchExcludeForIgnorecase v="true" />
<blobHandlingMethod>DATABASE</blobHandlingMethod>
<databaseAuditGetOldValueLobs v="false" />
<indexsearchGlobalEnabled v="true" />
<indexsearchFullIndexerEnabled v="true" />
<indexsearchFullIndexerInterval v="0" />
<indexsearchIncrementingIndexerEnabled v="true" />
<indexsearchIncrementingIndexerInterval v="1000" />
<indexsearchIncrementingIndexerBunchSize v="250" />
<indexsearchMaximumHits v="50000" />
<customProperties>
<customBooleanProperty>
<name>addressValidation.enable</name>
<property v="false" />
</customBooleanProperty>
<customStringProperty>
<name>addressValidation.url</name>
<property>https://services.aditosoftware.local/services/rest/ws_checkAddress</property>
</customStringProperty>
<customStringProperty>
<name>addressValidation.user</name>
<property>Admin</property>
</customStringProperty>
<customStringProperty>
<name>addressValidation.pw</name>
<property>a</property>
</customStringProperty>
<customStringProperty>
<name>addressValidation.countryParamName</name>
<property>country</property>
</customStringProperty>
<customBooleanProperty>
<name>zipCityValidation.enable</name>
<property v="false" />
</customBooleanProperty>
<customStringProperty>
<name>zipCityValidation.url</name>
<property>https://services.aditosoftware.local/services/rest/ws_checkZipCity</property>
</customStringProperty>
<customStringProperty>
<name>zipCityValidation.user</name>
<property>Admin</property>
</customStringProperty>
<customStringProperty>
<name>zipCityValidation.pw</name>
<property>a</property>
</customStringProperty>
<customStringProperty>
<name>zipCityValidation.countryParamName</name>
<property>country</property>
</customStringProperty>
<customBooleanProperty>
<name>phoneValidation.enable</name>
<description></description>
<property v="false" />
</customBooleanProperty>
<customStringProperty>
<name>phoneValidation.url</name>
<description></description>
<property>https://services.aditosoftware.local/services/rest/ws_checkPhoneNumber</property>
</customStringProperty>
<customStringProperty>
<name>phoneValidation.user</name>
<property>Admin</property>
</customStringProperty>
<customStringProperty>
<name>phoneValidation.pw</name>
<property>a</property>
</customStringProperty>
<customStringProperty>
<name>phoneValidation.countryParamName</name>
<property>Country</property>
</customStringProperty>
</customProperties>
</preferences>
<?xml version="1.0" encoding="UTF-8"?>
<preferences xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="3.1.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/preferences/3.1.0">
<name>_____PREFERENCES_PROJECT</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<projectName>xRM-Basic5</projectName>
<jditoMaxContentSize v="57671680" />
<calendarCategoriesEvent>
<entry>
<key>Meeting</key>
<value></value>
</entry>
<entry>
<key>Organisation</key>
<value></value>
</entry>
<entry>
<key>auswärts</key>
<value></value>
</entry>
<entry>
<key>Urlaub</key>
<value></value>
</entry>
</calendarCategoriesEvent>
<clientSearchOptimizedForSpeed v="true" />
<clientSearchExcludeForIgnorecase v="true" />
<blobHandlingMethod>DATABASE</blobHandlingMethod>
<databaseAuditGetOldValueLobs v="false" />
<indexsearchGlobalEnabled v="true" />
<indexsearchFullIndexerEnabled v="true" />
<indexsearchFullIndexerInterval v="0" />
<indexsearchIncrementingIndexerEnabled v="true" />
<indexsearchIncrementingIndexerInterval v="1000" />
<indexsearchIncrementingIndexerBunchSize v="250" />
<indexsearchMaximumHits v="50000" />
<customProperties>
<customBooleanProperty>
<name>addressValidation.enable</name>
<property v="false" />
</customBooleanProperty>
<customStringProperty>
<name>addressValidation.url</name>
<property>https://services.aditosoftware.local/services/rest/ws_checkAddress</property>
</customStringProperty>
<customStringProperty>
<name>addressValidation.user</name>
<property>Admin</property>
</customStringProperty>
<customStringProperty>
<name>addressValidation.pw</name>
<property>a</property>
</customStringProperty>
<customStringProperty>
<name>addressValidation.countryParamName</name>
<property>country</property>
</customStringProperty>
<customBooleanProperty>
<name>zipCityValidation.enable</name>
<property v="false" />
</customBooleanProperty>
<customStringProperty>
<name>zipCityValidation.url</name>
<property>https://services.aditosoftware.local/services/rest/ws_checkZipCity</property>
</customStringProperty>
<customStringProperty>
<name>zipCityValidation.user</name>
<property>Admin</property>
</customStringProperty>
<customStringProperty>
<name>zipCityValidation.pw</name>
<property>a</property>
</customStringProperty>
<customStringProperty>
<name>zipCityValidation.countryParamName</name>
<property>country</property>
</customStringProperty>
<customBooleanProperty>
<name>phoneValidation.enable</name>
<description></description>
<property v="false" />
</customBooleanProperty>
<customStringProperty>
<name>phoneValidation.url</name>
<description></description>
<property>https://services.aditosoftware.local/services/rest/ws_checkPhoneNumber</property>
</customStringProperty>
<customStringProperty>
<name>phoneValidation.user</name>
<property>Admin</property>
</customStringProperty>
<customStringProperty>
<name>phoneValidation.pw</name>
<property>a</property>
</customStringProperty>
<customStringProperty>
<name>phoneValidation.countryParamName</name>
<property>Country</property>
</customStringProperty>
</customProperties>
</preferences>
This diff is collapsed.
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