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

extend Salesproject and improve sql lib

parent b6a80e31
No related branches found
No related tags found
No related merge requests found
Showing
with 1159 additions and 88 deletions
This diff is collapsed.
import("system.db");
import("system.logging");
import("system.text");
import("system.result");
import("system.vars");
import("Sql_lib");
import("Keyword_lib");
var cond, relId, mediumCategories, keywordUtil, condStr;
cond = new SqlCondition();
if(vars.exists("$param.RelId_param")){
relId = vars.get("$param.RelId_param");
if (relId != null && relId != ""){
cond.andPrepare("COMM.RELATION_ID", "# = ?", relId);
}
}
if (vars.exists("$param.MediumCategoriesFilter_param")){
mediumCategories = vars.get("$param.MediumCategoriesFilter_param");
if (mediumCategories != null && mediumCategories != "") {
mediumCategories = text.decodeMS(mediumCategories);
keywordUtil = new KeywordUtils();
var kwd = keywordUtil.createKeyword("COMM.MEDIUM");
kwd.filter(function(id, name, customs){
return mediumCategories.indexOf(customs.category) > -1;
});
mediumIds = kwd.toArray("id");
if (mediumIds.length == 0)
throw new Error();//TODO: add message
cond.and("COMM.MEDIUM_ID in (" + mediumIds.join(", ") + ")");
}
}
condStr = db.translateCondition([cond.toString("1 = 2"), cond.preparedValues]);//TODO: this should not be necessary in the future
result.string(condStr);
\ No newline at end of file
import("system.db");
import("system.result");
import("Sql_lib");
import("Keyword_lib");
var relId, cond;
cond = new SqlCondition();
cond.andPrepareVars("COMM.RELATION_ID", "$param.RelId_param");
if (vars.exists("$param.MediumCategoriesFilter_param")){
mediumCategories = vars.get("$param.MediumCategoriesFilter_param");
if (mediumCategories != null && mediumCategories != "") {
mediumCategories = text.decodeMS(mediumCategories);
keywordUtil = new KeywordUtils();
var kwd = keywordUtil.createKeyword("COMM.MEDIUM");
kwd.filter(function(id, name, customs){
return mediumCategories.indexOf(customs.category) > -1;
});
mediumIds = kwd.toArray("id");
if (mediumIds.length == 0)
throw new Error();//TODO: add message
cond.and("COMM.MEDIUM_ID in (" + mediumIds.join(", ") + ")");
}
}
result.string(db.translateCondition([cond.toString("1 = 2"), cond.preparedValues]));
\ No newline at end of file
import("system.result");
import("system.db");
import("system.logging");
import("system.vars");
import("system.result");
import("Sql_lib");
var relId, country;
if (vars.exists("$param.RelId_param")) {
relId = vars.get("$param.RelId_param");
if (relId != "" && relId != null){
var cond = new SqlCondition();
cond.andPrepare("RELATION.RELATIONID", "# = ?", relId);
//TODO: this should happen by 1:1 links instead of manually requesting the data by a select
country = db.cell(["select ADDRESS.COUNTRY from ADDRESS "
+ "join RELATION on RELATION.ADDRESS_ID = ADDRESS.ADDRESSID "
+ cond.toWhereString(), cond.preparedValues]);
var relId, country, cond;
cond = new SqlCondition();
if (country != "")
result.string(country);
}
}
\ No newline at end of file
cond.andPrepareVars("RELATION.RELATIONID", "$param.RelId_param");
//TODO: this should happen by 1:1 links instead of manually requesting the data by a select
country = db.cell(cond.buildSelect("select ADDRESS.COUNTRY from ADDRESS "
+ "join RELATION on RELATION.ADDRESS_ID = ADDRESS.ADDRESSID "));
if (country != "")
result.string(country);
\ No newline at end of file
......@@ -134,6 +134,18 @@
<contentType>IMAGE</contentType>
<valueProcess>%aditoprj%/entity/History_entity/entityfields/icon/valueProcess.js</valueProcess>
</entityField>
<entityIncomingField>
<name>SalesprojectHistory_dfi</name>
<fieldType>DEPENDENCY_IN</fieldType>
<dependencies>
<entityDependency>
<name>d82c1471-b708-4816-ae86-e92c2cf222b7</name>
<entityName>Salesproject_entity</entityName>
<fieldName>SalesprojectHistory_dfo</fieldName>
<isOutgoing v="false" />
</entityDependency>
</dependencies>
</entityIncomingField>
</entityFields>
<linkInformation>
<linkInformation>
......
import("system.vars");
import("system.db");
import("system.result");
import("system.logging");
import("Sql_lib");
var rowId, cond, preparedValues, sqlHelper;
cond = new SqlCondition();
rowId = vars.getString("$param.RowId_param");
if (rowId){
cond.andPrepare("HISTORYLINK.ROW_ID", "# = ?", rowId);
}
var cond = new SqlCondition();
cond.andPrepareVars("HISTORYLINK.ROW_ID", "$param.RowId_param");
//TODO: use a preparedCondition when available
result.string(db.translateCondition([cond.toString("1 = 1"), cond.preparedValues]));
\ No newline at end of file
result.string(db.translateCondition(cond.build()));
\ No newline at end of file
......@@ -3,12 +3,12 @@
<name>Offer_entity</name>
<title>Offer</title>
<majorModelMode>DISTRIBUTED</majorModelMode>
<alias>Data_alias</alias>
<conditionProcess>%aditoprj%/entity/Offer_entity/conditionProcess.js</conditionProcess>
<grantUpdateProcess>%aditoprj%/entity/Offer_entity/grantUpdateProcess.js</grantUpdateProcess>
<grantDeleteProcess>%aditoprj%/entity/Offer_entity/grantDeleteProcess.js</grantDeleteProcess>
<recordContainerType>DB</recordContainerType>
<caption>Offer</caption>
<alias>Data_alias</alias>
<conditionProcess>%aditoprj%/entity/Offer_entity/conditionProcess.js</conditionProcess>
<entityFields>
<entityIncomingField>
<name>#INCOMING</name>
......@@ -199,6 +199,25 @@
<state>READONLY</state>
<valueProcess>%aditoprj%/entity/Offer_entity/entityfields/totalgross/valueProcess.js</valueProcess>
</entityField>
<entityParameter>
<name>SalesprojectId_param</name>
<expose v="true" />
<triggerRecalculation v="true" />
<mandatory v="false" />
<description>PARAMETER</description>
</entityParameter>
<entityIncomingField>
<name>SalesprojectOffer_dfi</name>
<fieldType>DEPENDENCY_IN</fieldType>
<dependencies>
<entityDependency>
<name>208c1273-d438-4263-a466-a4490b5e319a</name>
<entityName>Salesproject_entity</entityName>
<fieldName>SalesprojectOffer_dfo</fieldName>
<isOutgoing v="false" />
</entityDependency>
</dependencies>
</entityIncomingField>
</entityFields>
<linkInformation>
<linkInformation>
......
import("system.db");
import("system.result");
import("Sql_lib");
var cond = new SqlCondition();
cond.andPrepareVars("OFFER.SALESPROJECT_ID", "$param.SalesprojectId_param");
//TODO: use a preparedCondition when available
result.string(db.translateCondition(cond.build()));
\ No newline at end of file
import("system.db");
import("system.vars");
import("system.result");
import("Sql_lib");
var orgId, cond;
cond = new SqlCondition();
if (vars.exists("$param.OrgId_param")){
orgId = vars.getString("$param.OrgId_param");
if (orgId != "" && orgId != null){
cond.andPrepare("RELATION.ORG_ID", "# = ?", orgId);
}
}
var cond = new SqlCondition();
cond.andPrepareVars("RELATION.ORG_ID", "$param.OrgId_param");
//TODO; add OBJECT_ID (probably another param)
//TODO: use preparedStatements when available
result.string(db.translateCondition([cond.toString("1 = 1"), cond.preparedValues]));
//TODO: use a preparedCondition when available
result.string(db.translateCondition(cond.build()));
\ No newline at end of file
......@@ -3,12 +3,12 @@ import("system.db");
import("system.vars");
import("Sql_lib");
var orgId, orgRelId, sqlHelper, cond;
var orgId, orgRelId, cond;
orgId = vars.get("$field.ORGID");
if (orgId){
cond = new SqlCondition();
cond.and("RELATION.PERS_ID is null").andPrepare("RELATION.ORG_ID", "# = ?", orgId)
orgRelId = db.cell(["select RELATION.RELATIONID from RELATION" + cond.toWhereString(), cond.preparedValues]);
cond.and("RELATION.PERS_ID is null").andPrepare("RELATION.ORG_ID", orgId)
orgRelId = db.cell(cond.buildSelect("select RELATION.RELATIONID from RELATION"));
result.string(orgRelId);
}
\ No newline at end of file
......@@ -3,14 +3,15 @@
<name>Productprice_entity</name>
<title>Price list</title>
<majorModelMode>DISTRIBUTED</majorModelMode>
<alias>Data_alias</alias>
<conditionProcess>%aditoprj%/entity/Productprice_entity/conditionProcess.js</conditionProcess>
<orderClauseProcess>%aditoprj%/entity/Productprice_entity/orderClauseProcess.js</orderClauseProcess>
<onDBInsert>%aditoprj%/entity/Productprice_entity/onDBInsert.js</onDBInsert>
<documentation>%aditoprj%/entity/Productprice_entity/documentation.adoc</documentation>
<grantCreateProcess>%aditoprj%/entity/Productprice_entity/grantCreateProcess.js</grantCreateProcess>
<recordContainerType>DB</recordContainerType>
<caption>Price list</caption>
<onValidation>%aditoprj%/entity/Productprice_entity/onValidation.js</onValidation>
<alias>Data_alias</alias>
<conditionProcess>%aditoprj%/entity/Productprice_entity/conditionProcess.js</conditionProcess>
<orderClauseProcess>%aditoprj%/entity/Productprice_entity/orderClauseProcess.js</orderClauseProcess>
<onDBInsert>%aditoprj%/entity/Productprice_entity/onDBInsert.js</onDBInsert>
<entityFields>
<entityField>
<name>BUYSELL</name>
......
<?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.0.4" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.0.4">
<name>SalesprojectCompetition_entity</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<recordContainerType>DB</recordContainerType>
<alias>Data_alias</alias>
<conditionProcess>%aditoprj%/entity/SalesprojectCompetition_entity/conditionProcess.js</conditionProcess>
<entityFields>
<entityIncomingField>
<name>#INCOMING</name>
</entityIncomingField>
<entityField>
<name>DATE_CANCELLED</name>
<tableName>SALESPROJECT_COMPETITION</tableName>
<columnName>DATE_CANCELLED</columnName>
<caption>Excreted</caption>
<contentType>DATE</contentType>
<resolution>DAY</resolution>
</entityField>
<entityField>
<name>DATE_EDIT</name>
<tableName>SALESPROJECT_COMPETITION</tableName>
<columnName>DATE_EDIT</columnName>
</entityField>
<entityField>
<name>DATE_NEW</name>
<tableName>SALESPROJECT_COMPETITION</tableName>
<columnName>DATE_NEW</columnName>
</entityField>
<entityField>
<name>INFO</name>
<tableName>SALESPROJECT_COMPETITION</tableName>
<columnName>INFO</columnName>
<caption>Info</caption>
</entityField>
<entityField>
<name>ORGNAME</name>
<tableName>SALESPROJECT_COMPETITION</tableName>
<columnName>ORGNAME</columnName>
<caption>Competitor</caption>
</entityField>
<entityField>
<name>REASON</name>
<tableName>SALESPROJECT_COMPETITION</tableName>
<columnName>REASON</columnName>
<caption>Reason</caption>
</entityField>
<entityField>
<name>SALESPROJECT_COMPETITIONID</name>
<tableName>SALESPROJECT_COMPETITION</tableName>
<columnName>SALESPROJECT_COMPETITIONID</columnName>
</entityField>
<entityField>
<name>SALESPROJECT_ID</name>
<tableName>SALESPROJECT_COMPETITION</tableName>
<columnName>SALESPROJECT_ID</columnName>
</entityField>
<entityField>
<name>STATUS</name>
<tableName>SALESPROJECT_COMPETITION</tableName>
<columnName>STATUS</columnName>
<caption>State</caption>
<possibleItemsProcess>%aditoprj%/entity/SalesprojectCompetition_entity/entityfields/status/possibleItemsProcess.js</possibleItemsProcess>
</entityField>
<entityField>
<name>USER_EDIT</name>
<tableName>SALESPROJECT_COMPETITION</tableName>
<columnName>USER_EDIT</columnName>
</entityField>
<entityField>
<name>USER_NEW</name>
<tableName>SALESPROJECT_COMPETITION</tableName>
<columnName>USER_NEW</columnName>
</entityField>
<entityParameter>
<name>SalesprojectId_param</name>
<expose v="true" />
<triggerRecalculation v="true" />
<mandatory v="false" />
<description>PARAMETER</description>
</entityParameter>
<entityIncomingField>
<name>SalesprojectCompetition_dfi</name>
<fieldType>DEPENDENCY_IN</fieldType>
<dependencies>
<entityDependency>
<name>c6884f8d-283b-4338-830f-b20dda9b8aa5</name>
<entityName>Salesproject_entity</entityName>
<fieldName>SalesprojectCompetition_dfo</fieldName>
<isOutgoing v="false" />
</entityDependency>
</dependencies>
</entityIncomingField>
</entityFields>
<linkInformation>
<linkInformation>
<name>474ddf87-d52d-4e4c-b5e3-30499a96d34c</name>
<tableName>SALESPROJECT_COMPETITION</tableName>
<primaryKey>SALESPROJECT_COMPETITIONID</primaryKey>
<isUIDTable v="true" />
</linkInformation>
</linkInformation>
</entity>
import("system.db");
import("system.result");
import("Sql_lib");
var cond = new SqlCondition();
cond.andPrepareVars("SALESPROJECT_COMPETITION.SALESPROJECT_ID", "$param.SalesprojectId_param");
//TODO: use a preparedCondition when available
result.string(db.translateCondition(cond.build()));
\ No newline at end of file
import("system.result");
import("Keyword_lib");
var kwdUtils, items;
kwdUtils = new KeywordUtils();
items = kwdUtils.getStandardArray("SALESPROJECT.STATE");
result.object(items);
\ No newline at end of file
<?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.0.4" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.0.4">
<name>SalesprojectCycle_entity</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<recordContainerType>DB</recordContainerType>
<caption>Milestones</caption>
<alias>Data_alias</alias>
<conditionProcess>%aditoprj%/entity/SalesprojectCycle_entity/conditionProcess.js</conditionProcess>
<entityFields>
<entityIncomingField>
<name>#INCOMING</name>
</entityIncomingField>
<entityField>
<name>DATE_END</name>
<tableName>SALESPROJECT_CYCLE</tableName>
<columnName>DATE_END</columnName>
<contentType>DATE</contentType>
<resolution>DAY</resolution>
</entityField>
<entityField>
<name>DATE_START</name>
<tableName>SALESPROJECT_CYCLE</tableName>
<columnName>DATE_START</columnName>
<caption>Date</caption>
<contentType>DATE</contentType>
<resolution>DAY</resolution>
</entityField>
<entityField>
<name>SALESPROJECT_CYCLEID</name>
<tableName>SALESPROJECT_CYCLE</tableName>
<columnName>SALESPROJECT_CYCLEID</columnName>
</entityField>
<entityField>
<name>SALESPROJECT_ID</name>
<tableName>SALESPROJECT_CYCLE</tableName>
<columnName>SALESPROJECT_ID</columnName>
</entityField>
<entityField>
<name>TYPE</name>
<tableName>SALESPROJECT_CYCLE</tableName>
<columnName>TYPE</columnName>
</entityField>
<entityField>
<name>VALUE</name>
<tableName>SALESPROJECT_CYCLE</tableName>
<columnName>VALUE</columnName>
<caption>Milestone</caption>
<possibleItemsProcess>%aditoprj%/entity/SalesprojectCycle_entity/entityfields/value/possibleItemsProcess.js</possibleItemsProcess>
<valueProcess>%aditoprj%/entity/SalesprojectCycle_entity/entityfields/value/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>DATE_EDIT</name>
<tableName>SALESPROJECT_CYCLE</tableName>
<columnName>DATE_EDIT</columnName>
<valueProcess>%aditoprj%/entity/SalesprojectCycle_entity/entityfields/date_edit/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>DATE_NEW</name>
<tableName>SALESPROJECT_CYCLE</tableName>
<columnName>DATE_NEW</columnName>
<valueProcess>%aditoprj%/entity/SalesprojectCycle_entity/entityfields/date_new/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>USER_EDIT</name>
<tableName>SALESPROJECT_CYCLE</tableName>
<columnName>USER_EDIT</columnName>
<valueProcess>%aditoprj%/entity/SalesprojectCycle_entity/entityfields/user_edit/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>USER_NEW</name>
<tableName>SALESPROJECT_CYCLE</tableName>
<columnName>USER_NEW</columnName>
<valueProcess>%aditoprj%/entity/SalesprojectCycle_entity/entityfields/user_new/valueProcess.js</valueProcess>
</entityField>
<entityParameter>
<name>SalesprojectId_param</name>
<expose v="true" />
<triggerRecalculation v="true" />
<mandatory v="false" />
<description>PARAMETER</description>
</entityParameter>
<entityIncomingField>
<name>SalesprojectCycle_dfi</name>
<fieldType>DEPENDENCY_IN</fieldType>
<dependencies>
<entityDependency>
<name>b05e2bdf-5d8b-4ba2-8dba-a8560c255470</name>
<entityName>Salesproject_entity</entityName>
<fieldName>SalesprojectCycle_dfo</fieldName>
<isOutgoing v="false" />
</entityDependency>
</dependencies>
</entityIncomingField>
</entityFields>
<linkInformation>
<linkInformation>
<name>479f5969-fe03-4b36-8437-d2efc967e7b9</name>
<tableName>SALESPROJECT_CYCLE</tableName>
<primaryKey>SALESPROJECT_CYCLEID</primaryKey>
<isUIDTable v="true" />
</linkInformation>
</linkInformation>
</entity>
import("system.db");
import("system.result");
import("Sql_lib");
var cond = new SqlCondition();
cond.andPrepareVars("SALESPROJECT_CYCLE.SALESPROJECT_ID", "$param.SalesprojectId_param");
//TODO: use a preparedCondition when available
result.string(db.translateCondition(cond.build()));
\ No newline at end of file
import("system.vars");
import("system.result");
import("system.neon");
if(vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT)
result.string(vars.getString("$sys.date"));
\ No newline at end of file
import("system.vars");
import("system.result");
import("system.neon");
if(vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW)
result.string(vars.getString("$sys.date"));
\ No newline at end of file
import("system.vars");
import("system.result");
import("system.neon");
if(vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT)
result.string(vars.getString("$sys.user"));
\ No newline at end of file
import("system.vars");
import("system.result");
import("system.neon");
if(vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW)
result.string(vars.getString("$sys.user"));
\ No newline at end of file
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