diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod index 7e3443fa75cadefeb27adcc65adceb74ce98213a..04de1d14968f6f2fd142ca5cd7f78448e2e6759e 100644 --- a/aliasDefinition/Data_alias/Data_alias.aod +++ b/aliasDefinition/Data_alias/Data_alias.aod @@ -5164,10 +5164,11 @@ <name>CONTRACT</name> <title>Contract</title> <icon>VAADIN:FILE_TEXT</icon> - <active v="false" /> - <idColumn>CONTRACT</idColumn> + <active v="true" /> + <idColumn>CONTRACTID</idColumn> <titleColumn>TITLECOLUMN</titleColumn> <descriptionColumn>DESCCOLUMN</descriptionColumn> + <query>%aditoprj%/aliasDefinition/Data_alias/indexsearchgroups/contract/query.js</query> <resultContextNeon>Contract</resultContextNeon> <affectedTables> <element>CONTRACT</element> @@ -5178,10 +5179,11 @@ <name>PRODUCT</name> <title>Product</title> <icon>VAADIN:HAMMER</icon> - <active v="false" /> - <idColumn>PRODUCT</idColumn> + <active v="true" /> + <idColumn>PRODUCTID</idColumn> <titleColumn>TITLECOLUMN</titleColumn> <descriptionColumn>DESCCOLUMN</descriptionColumn> + <query>%aditoprj%/aliasDefinition/Data_alias/indexsearchgroups/product/query.js</query> <resultContextNeon>Product</resultContextNeon> <affectedTables> <element>PRODUCT</element> @@ -5192,10 +5194,11 @@ <name>SALESPROJECT</name> <title>Salesproject</title> <icon>VAADIN:BOOK_DOLLAR</icon> - <active v="false" /> - <idColumn>SALESPROJECT</idColumn> + <active v="true" /> + <idColumn>SALESPROJECTID</idColumn> <titleColumn>TITLECOLUMN</titleColumn> <descriptionColumn>DESCCOLUMN</descriptionColumn> + <query>%aditoprj%/aliasDefinition/Data_alias/indexsearchgroups/salesproject/query.js</query> <resultContextNeon>Salesproject</resultContextNeon> <affectedTables> <element>SALESPROJECT</element> diff --git a/aliasDefinition/Data_alias/indexsearchgroups/contract/query.js b/aliasDefinition/Data_alias/indexsearchgroups/contract/query.js new file mode 100644 index 0000000000000000000000000000000000000000..d10d2a6fac72a181df3979be5e857620e0846cc3 --- /dev/null +++ b/aliasDefinition/Data_alias/indexsearchgroups/contract/query.js @@ -0,0 +1,26 @@ +import("system.result"); +import("system.vars"); +import("system.calendars"); +import("system.db"); +import("Keyword_lib"); +import("Sql_lib"); +import("KeywordRegistry_basic"); + +var sqlQuery, sqlHelper, queryCondition, affectedIds; +queryCondition = ""; +if (vars.exists("$local.idvalue")) { + affectedIds = vars.get("$local.idvalue"); + queryCondition = "where CONTRACTID in ('" + affectedIds.map(function (v){return db.quote(v);}).join("', '") + "')"; + //TODO: refactor this for incremental indexer (injections?) +} +sqlHelper = new SqlMaskingUtils(); +sqlQuery = "select CONTRACTID, " + + sqlHelper.concat(["CONTRACTCODE", KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.contractStatus(), "CONTRACTSTATUS")], " | ") + + " as TITLECOLUMN, " + + sqlHelper.concat(["ORGANISATION.NAME", "'| Contract Type: '", KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.contractType(), "CONTRACTTYPE")]) //TODO: translation in index? + + " as DESCCOLUMN, CONTRACTCODE, ORGANISATION.NAME, CUSTOMERCODE " + + " from CONTRACT " + + " join CONTACT on CONTRACT.CONTACT_ID = CONTACTID " + + " join ORGANISATION on ORGANISATIONID = CONTACT.ORGANISATION_ID " + + queryCondition + " order by CONTRACTCODE "; +result.string(sqlQuery); \ No newline at end of file diff --git a/aliasDefinition/Data_alias/indexsearchgroups/organisation/query.js b/aliasDefinition/Data_alias/indexsearchgroups/organisation/query.js index 5778a7f9e4b0d67c432b27c6fd2efc357a794a07..1bb4c5ad46172d14146b49f038b0f4049dfae86a 100644 --- a/aliasDefinition/Data_alias/indexsearchgroups/organisation/query.js +++ b/aliasDefinition/Data_alias/indexsearchgroups/organisation/query.js @@ -12,7 +12,7 @@ if (vars.exists("$local.idvalue")) { } sqlHelper = new SqlMaskingUtils(); sqlQuery = "select CONTACT.CONTACTID " - + "," + sqlHelper.concat(["ORGANISATION.NAME", "ORGANISATION.CUSTOMERCODE"], " | ") + + "," + sqlHelper.concat(["ORGANISATION.NAME", "'|'", "ORGANISATION.CUSTOMERCODE"]) + " as TITLECOLUMN " + "," + sqlHelper.concat([ sqlHelper.concat(["defaultAddress.ADDRESS", "defaultAddress.BUILDINGNO"]) diff --git a/aliasDefinition/Data_alias/indexsearchgroups/product/query.js b/aliasDefinition/Data_alias/indexsearchgroups/product/query.js new file mode 100644 index 0000000000000000000000000000000000000000..9f8b8240c20e0a74ef734bcc01787ba192206ffa --- /dev/null +++ b/aliasDefinition/Data_alias/indexsearchgroups/product/query.js @@ -0,0 +1,24 @@ +import("system.result"); +import("system.vars"); +import("system.calendars"); +import("system.db"); +import("Keyword_lib"); +import("Sql_lib"); +import("KeywordRegistry_basic"); + +var sqlQuery, sqlHelper, queryCondition, affectedIds; +queryCondition = ""; +if (vars.exists("$local.idvalue")) { + affectedIds = vars.get("$local.idvalue"); + queryCondition = "where PRODUCTID in ('" + affectedIds.map(function (v){return db.quote(v);}).join("', '") + "')"; + //TODO: refactor this for incremental indexer (injections?) +} +sqlHelper = new SqlMaskingUtils(); +sqlQuery = "select PRODUCTID, " + + sqlHelper.concat(["PRODUCTCODE", "PRODUCTNAME"], " | ") + + " as TITLECOLUMN, " + + KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.productGroupcode(), "GROUPCODEID") + + " as DESCCOLUMN, PRODUCTCODE " + + " from PRODUCT " + + queryCondition + " order by PRODUCTCODE "; +result.string(sqlQuery); \ No newline at end of file diff --git a/aliasDefinition/Data_alias/indexsearchgroups/salesproject/query.js b/aliasDefinition/Data_alias/indexsearchgroups/salesproject/query.js new file mode 100644 index 0000000000000000000000000000000000000000..e03985eafd0631e8451fb505e7a0ac5e1d5e15fa --- /dev/null +++ b/aliasDefinition/Data_alias/indexsearchgroups/salesproject/query.js @@ -0,0 +1,25 @@ +import("system.result"); +import("system.vars"); +import("system.calendars"); +import("system.db"); +import("Keyword_lib"); +import("Sql_lib"); +import("KeywordRegistry_basic"); + +var sqlQuery, sqlHelper, queryCondition, affectedIds; +queryCondition = ""; +if (vars.exists("$local.idvalue")) { + affectedIds = vars.get("$local.idvalue"); + queryCondition = "where SALESPROJECTID in ('" + affectedIds.map(function (v){return db.quote(v);}).join("', '") + "')"; + //TODO: refactor this for incremental indexer (injections?) +} +sqlHelper = new SqlMaskingUtils(); +sqlQuery = "select SALESPROJECTID, PROJECTTITLE as TITLECOLUMN, " + + sqlHelper.concat([ + "'Status: '", KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectState(), "STATE"), + "'| Phase: '", KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectPhase(), "PHASE") + ]) + + " as DESCCOLUMN, PROJECTCODE " + + " from SALESPROJECT " + + queryCondition + " order by PROJECTCODE "; +result.string(sqlQuery); \ No newline at end of file diff --git a/entity/AttributeRelation_entity/AttributeRelation_entity.aod b/entity/AttributeRelation_entity/AttributeRelation_entity.aod index 73827d2c937d3a4705dcf0efceab4d66b1a493c2..cefbe0b74128d2333c971a22607695baeaf5dfe6 100644 --- a/entity/AttributeRelation_entity/AttributeRelation_entity.aod +++ b/entity/AttributeRelation_entity/AttributeRelation_entity.aod @@ -4,6 +4,7 @@ <title>Attribute Relation</title> <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/AttributeRelation_entity/documentation.adoc</documentation> + <afterOperatingState>%aditoprj%/entity/AttributeRelation_entity/afterOperatingState.js</afterOperatingState> <recordContainer>db</recordContainer> <entityFields> <entityProvider> diff --git a/entity/AttributeRelation_entity/afterOperatingState.js b/entity/AttributeRelation_entity/afterOperatingState.js new file mode 100644 index 0000000000000000000000000000000000000000..d3061e715463d1b8fb004c30a3750ff6b0a2d4a6 --- /dev/null +++ b/entity/AttributeRelation_entity/afterOperatingState.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("system.neon"); + +if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_VIEW) + neon.refresh(); \ No newline at end of file diff --git a/entity/Attribute_entity/Attribute_entity.aod b/entity/Attribute_entity/Attribute_entity.aod index a658dcc50f76b820690dbc2a10ae351816a92225..f244233174a3fa2d942734c2da6a5ae5747a9d05 100644 --- a/entity/Attribute_entity/Attribute_entity.aod +++ b/entity/Attribute_entity/Attribute_entity.aod @@ -42,7 +42,6 @@ <stateProcess>%aditoprj%/entity/Attribute_entity/entityfields/attribute_parent_id/stateProcess.js</stateProcess> <valueProcess>%aditoprj%/entity/Attribute_entity/entityfields/attribute_parent_id/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/Attribute_entity/entityfields/attribute_parent_id/displayValueProcess.js</displayValueProcess> - <onValueChange>%aditoprj%/entity/Attribute_entity/entityfields/attribute_parent_id/onValueChange.js</onValueChange> <onValueChangeTypes> <element>MASK</element> <element>PROCESS</element> @@ -284,6 +283,7 @@ <alias>Data_alias</alias> <conditionProcess>%aditoprj%/entity/Attribute_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <orderClauseProcess>%aditoprj%/entity/Attribute_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> + <onDBUpdate>%aditoprj%/entity/Attribute_entity/recordcontainers/db/onDBUpdate.js</onDBUpdate> <onDBDelete>%aditoprj%/entity/Attribute_entity/recordcontainers/db/onDBDelete.js</onDBDelete> <linkInformation> <linkInformation> diff --git a/entity/Attribute_entity/entityfields/attribute_level/valueProcess.js b/entity/Attribute_entity/entityfields/attribute_level/valueProcess.js index 1977334cca875a56fdbf51b64cd088a46a788ba4..e91a822698ae74d9b594ed31998920eb6f639c74 100644 --- a/entity/Attribute_entity/entityfields/attribute_level/valueProcess.js +++ b/entity/Attribute_entity/entityfields/attribute_level/valueProcess.js @@ -4,7 +4,7 @@ import("system.result"); import("system.vars"); import("Sql_lib"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) if (vars.get("$field.ATTRIBUTE_PARENT_ID") != "") { var level = db.cell(SqlCondition.begin() diff --git a/entity/Attribute_entity/entityfields/attribute_parent_id/onValueChange.js b/entity/Attribute_entity/entityfields/attribute_parent_id/onValueChange.js deleted file mode 100644 index 06db0b11a5c5b5148b3dced909c236bb63f01e9a..0000000000000000000000000000000000000000 --- a/entity/Attribute_entity/entityfields/attribute_parent_id/onValueChange.js +++ /dev/null @@ -1,38 +0,0 @@ -import("system.db"); -import("system.neon"); -import("system.vars"); -import("Attribute_lib"); - -if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT) -{ - var level = 0; - if (vars.get("$field.ATTRIBUTE_PARENT_ID") != "") - { - level = db.cell(SqlCondition.begin() - .andPrepare("AB_ATTRIBUTE.AB_ATTRIBUTEID", vars.get("$field.ATTRIBUTE_PARENT_ID")) - .buildSql("select ATTRIBUTE_LEVEL from AB_ATTRIBUTE")); - level = parseInt(level) + 1; - } - neon.setFieldValue("$field.ATTRIBUTE_LEVEL", level); - - var table = "AB_ATTRIBUTE"; - var columns = ["ATTRIBUTE_LEVEL"]; - var types = db.getColumnTypes(table, columns); - var toUpdate = []; - - var attributes = [vars.get("$field.AB_ATTRIBUTEID")]; - while (attributes.length > 0) - { - var condition = SqlCondition.begin() - .and("AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID in ('" + attributes.join("','") + "')"); - - toUpdate.push([table, columns, types, [String(++level)], condition.build()]); - - attributes = db.array(db.COLUMN, SqlCondition.begin() - .and("AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID in ('" + attributes.join("','") + "')") - .buildSql("select AB_ATTRIBUTEID from AB_ATTRIBUTE") - ); - } - - db.updates(toUpdate); -} \ No newline at end of file diff --git a/entity/Attribute_entity/recordcontainers/db/onDBUpdate.js b/entity/Attribute_entity/recordcontainers/db/onDBUpdate.js new file mode 100644 index 0000000000000000000000000000000000000000..38704929f969ef673a7fafd41ac71a1fa2c05282 --- /dev/null +++ b/entity/Attribute_entity/recordcontainers/db/onDBUpdate.js @@ -0,0 +1,27 @@ +import("system.db"); +import("system.neon"); +import("system.vars"); +import("Attribute_lib"); + +var level = parseInt(vars.get("$field.ATTRIBUTE_LEVEL")); + +var table = "AB_ATTRIBUTE"; +var columns = ["ATTRIBUTE_LEVEL"]; +var types = db.getColumnTypes(table, columns); +var toUpdate = []; + +var attributes = [vars.get("$field.AB_ATTRIBUTEID")]; +while (attributes.length > 0) +{ + var condition = SqlCondition.begin() + .and("AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID in ('" + attributes.join("','") + "')"); + + toUpdate.push([table, columns, types, [String(++level)], condition.build()]); + + attributes = db.array(db.COLUMN, SqlCondition.begin() + .and("AB_ATTRIBUTE.ATTRIBUTE_PARENT_ID in ('" + attributes.join("','") + "')") + .buildSql("select AB_ATTRIBUTEID from AB_ATTRIBUTE") + ); +} + +db.updates(toUpdate);