diff --git a/.liquibase/Data_alias/basic/2021.0.2/Checklists/alter_ChecklistEntry.xml b/.liquibase/Data_alias/basic/2021.0.2/Checklists/alter_ChecklistEntry.xml new file mode 100644 index 0000000000000000000000000000000000000000..924c2b6c716d96449847bc94fe8df2f991ba1749 --- /dev/null +++ b/.liquibase/Data_alias/basic/2021.0.2/Checklists/alter_ChecklistEntry.xml @@ -0,0 +1,35 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + + <!--change datatype of title to nvarchar (derby doesn't have nvarchar)--> + <changeSet dbms="!derby" author="b.ulrich" id="77758b00-afe0-457d-886c-3cfe5bd6dca3"> + <modifyDataType tableName="CHECKLISTENTRY" columnName="TITLE" newDataType="NVARCHAR(100)"/> + </changeSet> + + <!--make automatic work as an boolean--> + <!--change "type" to "auto"--> + <changeSet author="b.ulrich" id="986053d4-8b69-4892-93cd-2f2defbc85d1"> + <addColumn tableName="CHECKLISTENTRY"> + <column name="AUTO" type="TINYINT" defaultValueNumeric="0"/> + </addColumn> + <!--update existing Data--> + <update tableName="CHECKLISTENTRY"> + <column name="AUTO" valueNumeric="1"/> + <where>TYPE = ?</where> + <whereParams> + <param value="AUTO"/> + </whereParams> + </update> + <!--and add not Null constraint--> + <addNotNullConstraint + columnDataType="TINYINT" + columnName="AUTO" + tableName="CHECKLISTENTRY"/> + <!--drop old column--> + <dropColumn tableName="CHECKLISTENTRY"> + <column name="TYPE"/> + </dropColumn> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2021.0.2/Checklists/changelog.xml b/.liquibase/Data_alias/basic/2021.0.2/Checklists/changelog.xml new file mode 100644 index 0000000000000000000000000000000000000000..c4d09368678a9bc321d381aa383ead684bb9f3cf --- /dev/null +++ b/.liquibase/Data_alias/basic/2021.0.2/Checklists/changelog.xml @@ -0,0 +1,6 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <include relativeToChangelogFile="true" file="alter_ChecklistEntry.xml"/> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2021.0.2/alter_CompetitionExpandReasonSize.xml b/.liquibase/Data_alias/basic/2021.0.2/alter_CompetitionExpandReasonSize.xml new file mode 100644 index 0000000000000000000000000000000000000000..cd190defb87046297e90f18ce845fe34221d9934 --- /dev/null +++ b/.liquibase/Data_alias/basic/2021.0.2/alter_CompetitionExpandReasonSize.xml @@ -0,0 +1,21 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <changeSet dbms="derby" author="b.ulrich" id="cdc5aecd-417f-4a7a-bdcd-2fb75bada432"> + <sql> + ALTER TABLE COMPETITION ADD COLUMN REASON_NEW CLOB; + UPDATE COMPETITION SET REASON_NEW = REASON; + ALTER TABLE COMPETITION DROP COLUMN REASON; + RENAME COLUMN COMPETITION.REASON_NEW TO REASON; + </sql> + </changeSet> + <changeSet author="b.ulrich" id="05aabb59-501f-4832-a8cd-c17d38ac78f4"> + <preConditions onFail="CONTINUE"> + <not> + <dbms type="derby" /> + </not> + </preConditions> + <modifyDataType tableName="COMPETITION" columnName="REASON" newDataType="NCLOB"/> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2021.0.2/changelog.xml b/.liquibase/Data_alias/basic/2021.0.2/changelog.xml index d1646df6c526ce5610fb38582780def4296f10ee..2f93b69d2e902b1c2d8192dfa771c4443532f435 100644 --- a/.liquibase/Data_alias/basic/2021.0.2/changelog.xml +++ b/.liquibase/Data_alias/basic/2021.0.2/changelog.xml @@ -1,6 +1,8 @@ <?xml version="1.1" encoding="UTF-8" standalone="no"?> <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> -<include relativeToChangelogFile="true" file="Event/changelog.xml"/> -<include relativeToChangelogFile="true" file="LinkManagement/changelog.xml"/> + <include relativeToChangelogFile="true" file="Event/changelog.xml"/> + <include relativeToChangelogFile="true" file="alter_CompetitionExpandReasonSize.xml"/> + <include relativeToChangelogFile="true" file="Checklists/changelog.xml"/> + <include relativeToChangelogFile="true" file="LinkManagement/changelog.xml"/> </databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/_demoData/generatedData/productprice.xml b/.liquibase/Data_alias/basic/_demoData/generatedData/productprice.xml index a8dcad563fd4d0fa49e9d4023ef8d479e8525a71..d9b32b2bf4c768ca13a8c4dfed0d631f54a9f0e6 100644 --- a/.liquibase/Data_alias/basic/_demoData/generatedData/productprice.xml +++ b/.liquibase/Data_alias/basic/_demoData/generatedData/productprice.xml @@ -90,7 +90,7 @@ <column name="PRODUCTPRICEID" value="75365b30-fd09-4255-b1d7-f4c91e9d255e"/> <column name="PRICE" valueNumeric="2500.00"/> <column name="FROMQUANTITY" valueNumeric="1.00"/> - <column name="VALID_TO" valueDate="2022-05-18T02:00:00"/> + <column name="VALID_TO" valueDate="2022-05-17T02:00:00"/> <column name="PRODUCT_ID" value="805cd37f-d6c7-424b-99b0-b3de9ec89f7b"/> <column name="VAT" valueNumeric="19.00"/> <column name="VALID_FROM" valueDate="2019-05-17T02:00:00"/> @@ -169,7 +169,7 @@ <column name="PRODUCTPRICEID" value="bf8ef6ac-9f34-40fd-aa2e-9792fee9a970"/> <column name="PRICE" valueNumeric="15000.00"/> <column name="FROMQUANTITY" valueNumeric="1.00"/> - <column name="VALID_TO" valueDate="2022-05-22T02:00:00"/> + <column name="VALID_TO" valueDate="2022-05-21T02:00:00"/> <column name="PRODUCT_ID" value="e073ddc7-e3b8-4430-9e4f-12065106a624"/> <column name="VAT" valueNumeric="19.00"/> <column name="VALID_FROM" valueDate="2019-05-17T02:00:00"/> @@ -216,7 +216,7 @@ <column name="PRODUCTPRICEID" value="ead04c9b-955e-4595-bb31-31685b3ceaec"/> <column name="PRICE" valueNumeric="10000.00"/> <column name="FROMQUANTITY" valueNumeric="1.00"/> - <column name="VALID_TO" valueDate="2022-05-21T02:00:00"/> + <column name="VALID_TO" valueDate="2022-05-20T02:00:00"/> <column name="PRODUCT_ID" value="535cec1a-e81c-4833-aad6-1d2348dbc0fb"/> <column name="VAT" valueNumeric="19.00"/> <column name="VALID_FROM" valueDate="2019-05-23T02:00:00"/> @@ -229,7 +229,7 @@ <column name="PRODUCTPRICEID" value="f90ff3d2-3e62-4b6f-bcfb-db4d4ecd8de8"/> <column name="PRICE" valueNumeric="5000.00"/> <column name="FROMQUANTITY" valueNumeric="1.00"/> - <column name="VALID_TO" valueDate="2019-05-23T02:00:00"/> + <column name="VALID_TO" valueDate="2019-05-22T02:00:00"/> <column name="PRODUCT_ID" value="535cec1a-e81c-4833-aad6-1d2348dbc0fb"/> <column name="VAT" valueNumeric="19.00"/> <column name="VALID_FROM" valueDate="2019-05-17T02:00:00"/> diff --git a/.liquibase/Data_alias/changelog.xml b/.liquibase/Data_alias/changelog.xml index 55e9b42b3435df4543d14257793db42b89307bc4..c46a164da2f3cc26f2336d2aba78a1d54067672e 100644 --- a/.liquibase/Data_alias/changelog.xml +++ b/.liquibase/Data_alias/changelog.xml @@ -22,6 +22,7 @@ <include relativeToChangelogFile="true" file="basic/2021.0.0/changelog.xml"/> <include relativeToChangelogFile="true" file="basic/2021.0.1/changelog.xml"/> <include relativeToChangelogFile="true" file="basic/2021.0.2/changelog.xml"/> + <!--enable this only when you definetly want to overwrite the existing data with demo records:--> <!--<include relativeToChangelogFile="true" file="basic/_demoData/changelog.xml" context="example"/>--> </databaseChangeLog> \ No newline at end of file diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod index 314e098c9cda6d35e49c06770ad996c48ef38373..0a9369d96dff4431f4e5decb22e859a884cf93e7 100644 --- a/aliasDefinition/Data_alias/Data_alias.aod +++ b/aliasDefinition/Data_alias/Data_alias.aod @@ -18106,11 +18106,11 @@ <description></description> </entityFieldDb> <entityFieldDb> - <name>TYPE</name> + <name>USER_EDIT</name> <dbName></dbName> <primaryKey v="false" /> <columnType v="12" /> - <size v="10" /> + <size v="50" /> <scale v="0" /> <notNull v="false" /> <isUnique v="false" /> @@ -18119,16 +18119,17 @@ <description></description> </entityFieldDb> <entityFieldDb> - <name>USER_EDIT</name> + <name>AUTO</name> <dbName></dbName> <primaryKey v="false" /> - <columnType v="12" /> - <size v="50" /> + <columnType v="5" /> + <size v="5" /> <scale v="0" /> - <notNull v="false" /> + <notNull v="true" /> <isUnique v="false" /> <index v="false" /> <documentation></documentation> + <title></title> <description></description> </entityFieldDb> </entityFields> diff --git a/entity/CampaignAddParticipants_entity/entityfields/addparticipants/stateProcess.js b/entity/CampaignAddParticipants_entity/entityfields/addparticipants/stateProcess.js index 8271cfcda5c3966074453a2c2c22d86b086388ce..c85f7e47be1516470164487978aaa2ccf7169e10 100644 --- a/entity/CampaignAddParticipants_entity/entityfields/addparticipants/stateProcess.js +++ b/entity/CampaignAddParticipants_entity/entityfields/addparticipants/stateProcess.js @@ -3,13 +3,20 @@ import("system.result"); import("system.vars"); if (vars.get("$sys.validationerrors")) +{ result.string(neon.COMPONENTSTATE_DISABLED); -else +} +else if(vars.get("$field.campaignparticipantContactIds") != null && vars.get("$field.campaignparticipantContactIds") != "") { var contactCount = JSON.parse(vars.get("$field.campaignparticipantContactIds")).length; + if (contactCount == 0) + { result.string(neon.COMPONENTSTATE_DISABLED); + } else + { result.string(neon.COMPONENTSTATE_EDITABLE); + } } \ No newline at end of file diff --git a/entity/CampaignAddParticipants_entity/entityfields/campaign_id/onValidation.js b/entity/CampaignAddParticipants_entity/entityfields/campaign_id/onValidation.js index c84027b8fee4b1faaeaa73067205a136f7ce68ba..c596003e424ef1b3ec890598ce9a8ecadedc4ec4 100644 --- a/entity/CampaignAddParticipants_entity/entityfields/campaign_id/onValidation.js +++ b/entity/CampaignAddParticipants_entity/entityfields/campaign_id/onValidation.js @@ -3,17 +3,22 @@ import("system.result"); import("Sql_lib"); import("system.translate"); -let participants = JSON.parse(vars.get("$param.campaignParticipantsRowIds_param")); -if(participants.length > 0) + +if (vars.get("$param.campaignParticipantsRowIds_param") != null && vars.get("$param.campaignParticipantsRowIds_param") != "") { - let thisParticipantCount = newSelect("count('')").from("CAMPAIGNPARTICIPANT") - .where("CAMPAIGNPARTICIPANT.CAMPAIGN_ID", vars.get("$field.CAMPAIGN_ID")) - .and( - "CAMPAIGNPARTICIPANT.CONTACT_ID", - participants, - SqlBuilder.IN() - ).cell(); + let participants = JSON.parse(vars.get("$param.campaignParticipantsRowIds_param")); + + if(participants.length > 0) + { + let thisParticipantCount = newSelect("COUNT(*)") + .from("CAMPAIGNPARTICIPANT") + .where("CAMPAIGNPARTICIPANT.CAMPAIGN_ID", vars.get("$field.CAMPAIGN_ID")) + .and("CAMPAIGNPARTICIPANT.CONTACT_ID", participants, SqlBuilder.IN()) + .cell(); - if(parseInt(thisParticipantCount) > 0) - result.string(translate.text("Participant is already participating")); + if(parseInt(thisParticipantCount) > 0) + { + result.string(translate.text("Participant is already participating")); + } + } } diff --git a/entity/ChecklistEntryValue_entity/ChecklistEntryValue_entity.aod b/entity/ChecklistEntryValue_entity/ChecklistEntryValue_entity.aod index a2e7566be13d80bdeb1b4a29dc61ecfaec1fb4ff..307cc1e87027b5757a020bf21e3965c812548a4d 100644 --- a/entity/ChecklistEntryValue_entity/ChecklistEntryValue_entity.aod +++ b/entity/ChecklistEntryValue_entity/ChecklistEntryValue_entity.aod @@ -21,7 +21,6 @@ <name>CHECKLISTENTRY_ID</name> <title>Checklist entry</title> <state>READONLY</state> - <displayValueProcess>%aditoprj%/entity/ChecklistEntryValue_entity/entityfields/checklistentry_id/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>OBJECT_ROWID</name> @@ -103,11 +102,13 @@ </children> </entityActionGroup> <entityField> - <name>type</name> - <title>Type</title> - <valueProcess>%aditoprj%/entity/ChecklistEntryValue_entity/entityfields/type/valueProcess.js</valueProcess> - <displayValueProcess>%aditoprj%/entity/ChecklistEntryValue_entity/entityfields/type/displayValueProcess.js</displayValueProcess> + <name>AUTO</name> + <title>Automatically</title> </entityField> + <entityParameter> + <name>ChecklistEntryValueId_param</name> + <expose v="true" /> + </entityParameter> </entityFields> <recordContainers> <jDitoRecordContainer> @@ -146,6 +147,15 @@ <jDitoRecordFieldMapping> <name>USER_NEW.value</name> </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>CHECKLISTENTRY_ID.displayValue</name> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>AUTO.value</name> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>AUTO.displayValue</name> + </jDitoRecordFieldMapping> </recordFieldMappings> </jDitoRecordContainer> </recordContainers> diff --git a/entity/ChecklistEntryValue_entity/entityfields/checklistentry_id/displayValueProcess.js b/entity/ChecklistEntryValue_entity/entityfields/checklistentry_id/displayValueProcess.js deleted file mode 100644 index 3a0b46b8b1fe9519eeec33585163ca74d1a2ebab..0000000000000000000000000000000000000000 --- a/entity/ChecklistEntryValue_entity/entityfields/checklistentry_id/displayValueProcess.js +++ /dev/null @@ -1,25 +0,0 @@ -import("system.result"); -import("system.vars"); -import("system.translate"); -import("ChecklistEntryRegistry_basic"); -import("Util_lib"); -import("Sql_lib"); - - -var checklistEntryId = vars.get("$field.CHECKLISTENTRY_ID"); -var verfierFnName = newSelect("TITLE", "Data_alias") - .from("CHECKLISTENTRY") - .where("CHECKLISTENTRY.CHECKLISTENTRYID", checklistEntryId) - .cell(); -var verifierFn = $ChecklistEntryRegistry[verfierFnName]; -var displayValue; - -if (Utils.isFunction(verifierFn)) - displayValue = verifierFn().title; -else{ - displayValue = translate.text(verfierFnName); -} - -result.string(displayValue); - - diff --git a/entity/ChecklistEntryValue_entity/entityfields/setchecklistentrycompleted/children/setcompleted/onActionProcess.js b/entity/ChecklistEntryValue_entity/entityfields/setchecklistentrycompleted/children/setcompleted/onActionProcess.js index 4684843918c7813b0de9c2057d3b93650301dacf..e1f74869bb3695fad698f4dd4a1180674700ffa3 100644 --- a/entity/ChecklistEntryValue_entity/entityfields/setchecklistentrycompleted/children/setcompleted/onActionProcess.js +++ b/entity/ChecklistEntryValue_entity/entityfields/setchecklistentrycompleted/children/setcompleted/onActionProcess.js @@ -1,9 +1,26 @@ +import("system.entities"); import("system.vars"); import("system.neon"); import("Sql_lib"); +var loadConfig = entities.createConfigForLoadingRows() + .entity("ChecklistEntryValue_entity") + .fields(["CHECKLISTENTRYVALUEID"]) + .addParameter("ObjectRowId_param", vars.get("$param.ObjectRowId_param")) + .addParameter("ChecklistEntryValueId_param", vars.get("$field.CHECKLISTENTRYVALUEID")) + .addParameter("ChecklistId_param", vars.get("$param.ChecklistId_param")); -newWhere("CHECKLISTENTRYVALUE.CHECKLISTENTRYVALUEID", "$field.CHECKLISTENTRYVALUEID") - .updateFields({"IS_FULFILLED":1}); - -neon.refreshAll(); \ No newline at end of file +var checklistEntryValueIds = entities.getRows(loadConfig); + +var updateConfig = entities.createConfigForUpdatingRows() + .entity("ChecklistEntryValue_entity") + .fieldValues({"IS_FULFILLED": 1}) + .uid(checklistEntryValueIds[0]["CHECKLISTENTRYVALUEID"]) + .addParameter("ObjectRowId_param", vars.get("$param.ObjectRowId_param")) + .addParameter("ChecklistEntryValueId_param", vars.get("$field.CHECKLISTENTRYVALUEID")) + .addParameter("ChecklistId_param", vars.get("$param.ChecklistId_param")) + .ignorePermissions(true); + +entities.updateRow(updateConfig); + +neon.refresh(); \ No newline at end of file diff --git a/entity/ChecklistEntryValue_entity/entityfields/setchecklistentrycompleted/stateProcess.js b/entity/ChecklistEntryValue_entity/entityfields/setchecklistentrycompleted/stateProcess.js index 9e756de19ae758e0f6d61a377c1f25181a31d598..e2abbdb1d69ecefdef3b011cd18efa3a6775384b 100644 --- a/entity/ChecklistEntryValue_entity/entityfields/setchecklistentrycompleted/stateProcess.js +++ b/entity/ChecklistEntryValue_entity/entityfields/setchecklistentrycompleted/stateProcess.js @@ -4,12 +4,11 @@ import("system.neon"); import("KeywordRegistry_basic"); -if (vars.get("$field.type") == $KeywordRegistry.checklistEntryType$auto()) +if (vars.get("$field.AUTO") == 1) { result.string(neon.COMPONENTSTATE_DISABLED); } - -if (vars.get("$field.type") == $KeywordRegistry.checklistEntryType$manual()) +else { result.string(neon.COMPONENTSTATE_EDITABLE); } \ No newline at end of file diff --git a/entity/ChecklistEntryValue_entity/entityfields/type/displayValueProcess.js b/entity/ChecklistEntryValue_entity/entityfields/type/displayValueProcess.js deleted file mode 100644 index 574355fa5aa6c81739dff0c6bc2884eed8ac0829..0000000000000000000000000000000000000000 --- a/entity/ChecklistEntryValue_entity/entityfields/type/displayValueProcess.js +++ /dev/null @@ -1,7 +0,0 @@ -import("Keyword_lib"); -import("system.vars"); -import("system.result"); -import("KeywordRegistry_basic"); - - -result.string(KeywordUtils.getViewValue($KeywordRegistry.checklistEntryType(), vars.get("$field.type"))); \ No newline at end of file diff --git a/entity/ChecklistEntryValue_entity/entityfields/type/valueProcess.js b/entity/ChecklistEntryValue_entity/entityfields/type/valueProcess.js deleted file mode 100644 index 08c466c3be65f8e64bb5f7d594ce20fca8db8891..0000000000000000000000000000000000000000 --- a/entity/ChecklistEntryValue_entity/entityfields/type/valueProcess.js +++ /dev/null @@ -1,16 +0,0 @@ -import("system.result"); -import("system.vars"); -import("Sql_lib"); - - -var checklistEntryId = vars.get("$field.CHECKLISTENTRY_ID"); - -if (checklistEntryId) -{ - var type = newSelect("TYPE") - .from("CHECKLISTENTRY") - .where("CHECKLISTENTRY.CHECKLISTENTRYID", checklistEntryId) - .cell(); - - result.string(type); -} \ No newline at end of file diff --git a/entity/ChecklistEntryValue_entity/recordcontainers/jdito/contentProcess.js b/entity/ChecklistEntryValue_entity/recordcontainers/jdito/contentProcess.js index 4727ac92281bcd2d31273ffa81fe95efe7a12786..a17f5785d37a462f4d534cf5770264812e1d2cfe 100644 --- a/entity/ChecklistEntryValue_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/ChecklistEntryValue_entity/recordcontainers/jdito/contentProcess.js @@ -1,3 +1,4 @@ +import("system.translate"); import("system.result"); import("system.vars"); import("system.util"); @@ -5,10 +6,10 @@ import("system.db"); import("KeywordRegistry_basic"); import("Util_lib"); import("Sql_lib"); - +import("ChecklistEntryRegistry_basic"); var newUid; -var isExistent; +var doesExist; var checklistEntryIds = []; var preparedStatements = []; var checklistEntryValues = []; @@ -19,11 +20,45 @@ var cols = ["CHECKLISTENTRYVALUEID", "CHECKLISTENTRY_ID", "OBJECT_ROWID", "OBJEC var checklistId = vars.get("$param.ChecklistId_param"); var objectRowId = vars.get("$param.ObjectRowId_param"); -//var objectType = vars.get("$param.ObjectType_param"); - necessary? var checklistEntries = []; -if (checklistId) +var checklistEntryValueId = vars.get("$param.ChecklistEntryValueId_param"); +if (checklistEntryValueId) +{ + //get all entries of the current checklist + checklistEntries = newSelect([ + "CHECKLISTENTRY.CHECKLISTENTRYID", + "CHECKLISTENTRY.CHECKLIST_ID", + "CHECKLISTENTRY.TITLE", + "CHECKLISTENTRY.AUTO", + "CHECKLISTENTRY.USER_NEW", + "CHECKLISTENTRY.USER_EDIT", + "CHECKLISTENTRY.DATE_NEW", + "CHECKLISTENTRY.DATE_EDIT"]) + .from("CHECKLISTENTRY") + .join("CHECKLISTENTRYVALUE", "CHECKLISTENTRYVALUE.CHECKLISTENTRY_ID = CHECKLISTENTRY.CHECKLISTENTRYID") + .where("CHECKLISTENTRY.CHECKLIST_ID", checklistId) + .and("CHECKLISTENTRYVALUE.CHECKLISTENTRYVALUEID", checklistEntryValueId) + .table(); + + checklistEntries.forEach(function(pRow){ + if (pRow[0]) + { + checklistEntryIds.push(pRow[0]); + } + }); +} +else if (checklistId) { - checklistEntries = newSelect("CHECKLISTENTRYID, CHECKLIST_ID, TITLE, TYPE, USER_NEW, USER_EDIT, DATE_NEW, DATE_EDIT") + //get all entries of the current checklist + checklistEntries = newSelect([ + "CHECKLISTENTRY.CHECKLISTENTRYID", + "CHECKLISTENTRY.CHECKLIST_ID", + "CHECKLISTENTRY.TITLE", + "CHECKLISTENTRY.AUTO", + "CHECKLISTENTRY.USER_NEW", + "CHECKLISTENTRY.USER_EDIT", + "CHECKLISTENTRY.DATE_NEW", + "CHECKLISTENTRY.DATE_EDIT"]) .from("CHECKLISTENTRY") .where("CHECKLISTENTRY.CHECKLIST_ID", checklistId) .table(); @@ -36,13 +71,14 @@ if (checklistId) }); } -for (i = 0; i < checklistEntries.length; i++) +//loop trough the checklistEntries and handle them according to their type +for (let i = 0; i < checklistEntries.length; i++) { - for (j = 0; j < checklistEntries[i].length; j++) + for (let ii = 0; ii < checklistEntries[i].length; ii++) { - checklistEntryValues[i] = new Array(10); + checklistEntryValues[i] = new Array(13); - if (checklistEntries[i][3] == $KeywordRegistry.checklistEntryType$auto()) + if (checklistEntries[i][3] == 1)//if auto == true { newUid = util.getNewUUID(); vars.set("$param.VerifierFnName_param", checklistEntries[i][2]); @@ -50,28 +86,37 @@ for (i = 0; i < checklistEntries.length; i++) Utils.toBoolean(vars.get("$param.Verifier_param")) ? 1 : 0, objectRowId, "", "null", vars.get("$sys.user")]; } - else + else//else manual { - isExistent = newSelect("CHECKLISTENTRYVALUEID, CHECKLISTENTRY_ID, CHECKLISTENTRYVALUEID,\n\ - DATE_EDIT, DATE_NEW, IS_FULFILLED, OBJECT_ROWID, OBJECT_TYPE, USER_EDIT, USER_NEW") + doesExist = newSelect([ + "CHECKLISTENTRYVALUE.CHECKLISTENTRYVALUEID", + "CHECKLISTENTRYVALUE.CHECKLISTENTRY_ID", + "CHECKLISTENTRYVALUE.CHECKLISTENTRYVALUEID", + "CHECKLISTENTRYVALUE.DATE_EDIT", + "CHECKLISTENTRYVALUE.DATE_NEW", + "CHECKLISTENTRYVALUE.IS_FULFILLED", + "CHECKLISTENTRYVALUE.OBJECT_ROWID", + "CHECKLISTENTRYVALUE.OBJECT_TYPE", + "CHECKLISTENTRYVALUE.USER_EDIT", + "CHECKLISTENTRYVALUE.USER_NEW"]) .from("CHECKLISTENTRYVALUE") .where("CHECKLISTENTRYVALUE.CHECKLISTENTRY_ID", checklistEntries[i][0]) .and("CHECKLISTENTRYVALUE.OBJECT_ROWID", objectRowId) .arrayRow(); - if (isExistent.length > 0) + if (doesExist.length > 0) { - checklistEntryValues[i] = isExistent; + checklistEntryValues[i] = doesExist; } else { newUid = util.getNewUUID(); checklistEntryValues[i] = [newUid, checklistEntries[i][0], newUid, "", vars.get("$sys.date"), "0", objectRowId, "", - "null", vars.get("$sys.user")]; - isExistent = preparedStatements.some(function(pPreparedStatement){ + "null", vars.get("$sys.user"), ""]; + doesExist = preparedStatements.some(function(pPreparedStatement){ return pPreparedStatement[3].includes(checklistEntries[i][0]) && pPreparedStatement[3].includes(objectRowId); }); - if (!isExistent) + if (!doesExist) { preparedStatements.push(["CHECKLISTENTRYVALUE", cols, @@ -89,7 +134,39 @@ for (i = 0; i < checklistEntries.length; i++) } } } + checklistEntryValues[i][10] = _checklistEntryDisplayValue(checklistEntries[i][2]); + checklistEntryValues[i][11] = checklistEntries[i][3]; + checklistEntryValues[i][12] = _autoDisplayValue(checklistEntries[i][3]); } -db.inserts(preparedStatements, "Data_alias"); -result.object(checklistEntryValues); \ No newline at end of file +db.inserts(preparedStatements);//insert the ones that don't already exist +result.object(checklistEntryValues); + + +function _checklistEntryDisplayValue(pChecklistEntryTitle) +{ + var displayValue; + var verfierFnName = pChecklistEntryTitle; + + var verifierFn = $ChecklistEntryRegistry[verfierFnName]; + + + if (Utils.isFunction(verifierFn)) + displayValue = verifierFn().title; + else{ + displayValue = translate.text(verfierFnName); + } + return displayValue; +} + +function _autoDisplayValue(pAutoValue) +{ + if(pAutoValue == 1) + { + return translate.text("Automatically"); + } + else + { + return translate.text("Manually"); + } +} \ No newline at end of file diff --git a/entity/ChecklistEntry_entity/ChecklistEntry_entity.aod b/entity/ChecklistEntry_entity/ChecklistEntry_entity.aod index 200dfd83079a685ddc6cc91e1f5cae555ce0333c..3385604c588240288d04438c5f6946dc6b7b6d22 100644 --- a/entity/ChecklistEntry_entity/ChecklistEntry_entity.aod +++ b/entity/ChecklistEntry_entity/ChecklistEntry_entity.aod @@ -19,13 +19,17 @@ <entityField> <name>TITLE</name> <title>Title</title> + <mandatory v="true" /> <dropDownProcess>%aditoprj%/entity/ChecklistEntry_entity/entityfields/title/dropDownProcess.js</dropDownProcess> <displayValueProcess>%aditoprj%/entity/ChecklistEntry_entity/entityfields/title/displayValueProcess.js</displayValueProcess> </entityField> <entityField> - <name>TYPE</name> - <title>Type</title> - <dropDownProcess>%aditoprj%/entity/ChecklistEntry_entity/entityfields/type/dropDownProcess.js</dropDownProcess> + <name>AUTO</name> + <title>Automatically</title> + <contentType>BOOLEAN</contentType> + <placeholderProcess>%aditoprj%/entity/ChecklistEntry_entity/entityfields/auto/placeholderProcess.js</placeholderProcess> + <displayValueProcess>%aditoprj%/entity/ChecklistEntry_entity/entityfields/auto/displayValueProcess.js</displayValueProcess> + <onValueChange>%aditoprj%/entity/ChecklistEntry_entity/entityfields/auto/onValueChange.js</onValueChange> </entityField> <entityField> <name>USER_EDIT</name> @@ -99,10 +103,6 @@ <name>TITLE.value</name> <recordfield>CHECKLISTENTRY.TITLE</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>TYPE.value</name> - <recordfield>CHECKLISTENTRY.TYPE</recordfield> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>USER_EDIT.value</name> <recordfield>CHECKLISTENTRY.USER_EDIT</recordfield> @@ -115,6 +115,10 @@ <name>CHECKLIST_ID.value</name> <recordfield>CHECKLISTENTRY.CHECKLIST_ID</recordfield> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>AUTO.value</name> + <recordfield>CHECKLISTENTRY.AUTO</recordfield> + </dbRecordFieldMapping> </recordFieldMappings> <linkInformation> <linkInformation> diff --git a/entity/ChecklistEntry_entity/entityfields/auto/displayValueProcess.js b/entity/ChecklistEntry_entity/entityfields/auto/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..94bb5f7e4d05d71c1b725767f2c128ea325687dd --- /dev/null +++ b/entity/ChecklistEntry_entity/entityfields/auto/displayValueProcess.js @@ -0,0 +1,14 @@ +import("system.translate"); +import("system.result"); +import("system.vars"); + +var auto = vars.get("$field.AUTO"); + +if(auto == 1) +{ + result.string(translate.text("Automatically")); +} +else +{ + result.string(translate.text("Manually")); +} \ No newline at end of file diff --git a/entity/ChecklistEntry_entity/entityfields/auto/onValueChange.js b/entity/ChecklistEntry_entity/entityfields/auto/onValueChange.js new file mode 100644 index 0000000000000000000000000000000000000000..e44082d115bf9429cced900ee2f038ee81cd0ecd --- /dev/null +++ b/entity/ChecklistEntry_entity/entityfields/auto/onValueChange.js @@ -0,0 +1,3 @@ +import("system.neon"); + +neon.setFieldValue("$field.TITLE", null); \ No newline at end of file diff --git a/entity/ChecklistEntry_entity/entityfields/auto/placeholderProcess.js b/entity/ChecklistEntry_entity/entityfields/auto/placeholderProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7f69ea4c65ec2ada3f93fd7aba429864811db308 --- /dev/null +++ b/entity/ChecklistEntry_entity/entityfields/auto/placeholderProcess.js @@ -0,0 +1,4 @@ +import("system.translate"); +import("system.result"); + +result.string(translate.text("Automatically")); \ No newline at end of file diff --git a/entity/ChecklistEntry_entity/entityfields/date_edit/valueProcess.js b/entity/ChecklistEntry_entity/entityfields/date_edit/valueProcess.js index b1325e54818a2ef8aef43c452e840cf0e00a340b..7aa6fc91c97f0cd2a7a37fc09ada9e4845f65291 100644 --- a/entity/ChecklistEntry_entity/entityfields/date_edit/valueProcess.js +++ b/entity/ChecklistEntry_entity/entityfields/date_edit/valueProcess.js @@ -2,7 +2,7 @@ import("system.vars"); import("system.result"); import("system.neon"); -if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) { result.string(vars.get("$sys.date")); } \ No newline at end of file diff --git a/entity/ChecklistEntry_entity/entityfields/date_new/valueProcess.js b/entity/ChecklistEntry_entity/entityfields/date_new/valueProcess.js index 557358ecb61b3de637a1a916a37929ca88fc9563..e5780ea88894297e27937096e4583ee4ad0803ec 100644 --- a/entity/ChecklistEntry_entity/entityfields/date_new/valueProcess.js +++ b/entity/ChecklistEntry_entity/entityfields/date_new/valueProcess.js @@ -2,7 +2,7 @@ import("system.vars"); import("system.result"); import("system.neon"); -if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { result.string(vars.get("$sys.date")); } \ No newline at end of file diff --git a/entity/ChecklistEntry_entity/entityfields/title/displayValueProcess.js b/entity/ChecklistEntry_entity/entityfields/title/displayValueProcess.js index b9d9117ecefc66d14394164cab6b1ca390a67c50..8a1672dcd95f28d745482af6021264e667c9abe7 100644 --- a/entity/ChecklistEntry_entity/entityfields/title/displayValueProcess.js +++ b/entity/ChecklistEntry_entity/entityfields/title/displayValueProcess.js @@ -5,7 +5,7 @@ import("KeywordRegistry_basic"); var title = vars.get("$field.TITLE"); -if (vars.get("$field.TYPE") == $KeywordRegistry.checklistEntryType$manual()) +if (vars.get("$field.AUTO") != 1) { result.string(translate.text(title)); } \ No newline at end of file diff --git a/entity/ChecklistEntry_entity/entityfields/title/dropDownProcess.js b/entity/ChecklistEntry_entity/entityfields/title/dropDownProcess.js index 3a7f1a267bc366a0da3a7c3a5a68cc21f418479a..b8fce1068b75efc84d99d5df068d56cef1dad792 100644 --- a/entity/ChecklistEntry_entity/entityfields/title/dropDownProcess.js +++ b/entity/ChecklistEntry_entity/entityfields/title/dropDownProcess.js @@ -4,7 +4,7 @@ import("KeywordRegistry_basic"); import("ChecklistEntryRegistry_basic"); -if (vars.get("$field.TYPE") == $KeywordRegistry.checklistEntryType$auto()) +if (vars.get("$field.AUTO") == 1) { result.object($ChecklistEntryRegistry.getEntryList()); } \ No newline at end of file diff --git a/entity/ChecklistEntry_entity/entityfields/type/dropDownProcess.js b/entity/ChecklistEntry_entity/entityfields/type/dropDownProcess.js deleted file mode 100644 index f3b2df2523349e9e5fe6e9ac8d8b8f712aed3bec..0000000000000000000000000000000000000000 --- a/entity/ChecklistEntry_entity/entityfields/type/dropDownProcess.js +++ /dev/null @@ -1,5 +0,0 @@ -import("system.result"); -import("system.vars"); -import("system.translate"); - -result.object({"MANUAL":translate.text("Manually"), "AUTO":translate.text("Automatically")}); \ No newline at end of file diff --git a/entity/ChecklistEntry_entity/entityfields/user_edit/valueProcess.js b/entity/ChecklistEntry_entity/entityfields/user_edit/valueProcess.js index de5a4ba34e5e6a1abd7ba5be9d69d59f7f05330f..023108b48d60642b3a1c3f3c2f90eafbf2cea818 100644 --- a/entity/ChecklistEntry_entity/entityfields/user_edit/valueProcess.js +++ b/entity/ChecklistEntry_entity/entityfields/user_edit/valueProcess.js @@ -2,7 +2,7 @@ import("system.vars"); import("system.result"); import("system.neon"); -if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) { result.string(vars.get("$sys.user")); } \ No newline at end of file diff --git a/entity/ChecklistEntry_entity/entityfields/user_new/valueProcess.js b/entity/ChecklistEntry_entity/entityfields/user_new/valueProcess.js index c2c237153fee057be773b3a43d34c443734039e5..97e43c18a2880ace4a19c61c63a2378b8377b462 100644 --- a/entity/ChecklistEntry_entity/entityfields/user_new/valueProcess.js +++ b/entity/ChecklistEntry_entity/entityfields/user_new/valueProcess.js @@ -2,7 +2,7 @@ import("system.vars"); import("system.result"); import("system.neon"); -if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { result.string(vars.get("$sys.user")); } \ No newline at end of file diff --git a/entity/Checklist_entity/entityfields/date_edit/valueProcess.js b/entity/Checklist_entity/entityfields/date_edit/valueProcess.js index b1325e54818a2ef8aef43c452e840cf0e00a340b..7aa6fc91c97f0cd2a7a37fc09ada9e4845f65291 100644 --- a/entity/Checklist_entity/entityfields/date_edit/valueProcess.js +++ b/entity/Checklist_entity/entityfields/date_edit/valueProcess.js @@ -2,7 +2,7 @@ import("system.vars"); import("system.result"); import("system.neon"); -if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) { result.string(vars.get("$sys.date")); } \ No newline at end of file diff --git a/entity/Checklist_entity/entityfields/date_new/valueProcess.js b/entity/Checklist_entity/entityfields/date_new/valueProcess.js index 557358ecb61b3de637a1a916a37929ca88fc9563..779344e19687837497817925a51143d01876fa4b 100644 --- a/entity/Checklist_entity/entityfields/date_new/valueProcess.js +++ b/entity/Checklist_entity/entityfields/date_new/valueProcess.js @@ -2,7 +2,7 @@ import("system.vars"); import("system.result"); import("system.neon"); -if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) { result.string(vars.get("$sys.date")); } \ No newline at end of file diff --git a/entity/Checklist_entity/entityfields/user_edit/valueProcess.js b/entity/Checklist_entity/entityfields/user_edit/valueProcess.js index de5a4ba34e5e6a1abd7ba5be9d69d59f7f05330f..023108b48d60642b3a1c3f3c2f90eafbf2cea818 100644 --- a/entity/Checklist_entity/entityfields/user_edit/valueProcess.js +++ b/entity/Checklist_entity/entityfields/user_edit/valueProcess.js @@ -2,7 +2,7 @@ import("system.vars"); import("system.result"); import("system.neon"); -if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) { result.string(vars.get("$sys.user")); } \ No newline at end of file diff --git a/entity/Checklist_entity/entityfields/user_new/valueProcess.js b/entity/Checklist_entity/entityfields/user_new/valueProcess.js index c2c237153fee057be773b3a43d34c443734039e5..97e43c18a2880ace4a19c61c63a2378b8377b462 100644 --- a/entity/Checklist_entity/entityfields/user_new/valueProcess.js +++ b/entity/Checklist_entity/entityfields/user_new/valueProcess.js @@ -2,7 +2,7 @@ import("system.vars"); import("system.result"); import("system.neon"); -if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { result.string(vars.get("$sys.user")); } \ No newline at end of file diff --git a/entity/Competition_entity/Competition_entity.aod b/entity/Competition_entity/Competition_entity.aod index 8e08714b5b06f1bad56c3ccc46180c98b2834bb9..7c7f311b945078d8803fe0682ce7979c6a7c3eae 100644 --- a/entity/Competition_entity/Competition_entity.aod +++ b/entity/Competition_entity/Competition_entity.aod @@ -27,9 +27,8 @@ <entityField> <name>REASON</name> <title>Reason</title> - <consumer>KeywordWonLost</consumer> - <selectionMode>SINGLE</selectionMode> - <displayValueProcess>%aditoprj%/entity/Competition_entity/entityfields/reason/displayValueProcess.js</displayValueProcess> + <dropDownProcess>%aditoprj%/entity/Competition_entity/entityfields/reason/dropDownProcess.js</dropDownProcess> + <selectionMode>MULTI</selectionMode> </entityField> <entityField> <name>COMPETITIONID</name> @@ -334,10 +333,6 @@ <name>CONTACT_ID.displayValue</name> <recordfield>ORGANISATION.NAME</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>REASON.displayValue</name> - <expression>%aditoprj%/entity/Competition_entity/recordcontainers/db/recordfieldmappings/reason.displayvalue/expression.js</expression> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>PHASE.displayValue</name> <expression>%aditoprj%/entity/Competition_entity/recordcontainers/db/recordfieldmappings/phase.displayvalue/expression.js</expression> diff --git a/entity/Competition_entity/entityfields/reason/displayValueProcess.js b/entity/Competition_entity/entityfields/reason/displayValueProcess.js deleted file mode 100644 index 4058d229ee949c4c9b93c9f8bc05dda8ea3d60bc..0000000000000000000000000000000000000000 --- a/entity/Competition_entity/entityfields/reason/displayValueProcess.js +++ /dev/null @@ -1,6 +0,0 @@ -import("system.result"); -import("system.vars"); -import("Keyword_lib"); -import("KeywordRegistry_basic"); - -result.string(KeywordUtils.getViewValue($KeywordRegistry.salesprojectWonLost(), vars.get("$field.REASON"))); diff --git a/entity/Competition_entity/entityfields/reason/dropDownProcess.js b/entity/Competition_entity/entityfields/reason/dropDownProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..8e12cae7f3fa1cc744096ce53b70005aebe91ef0 --- /dev/null +++ b/entity/Competition_entity/entityfields/reason/dropDownProcess.js @@ -0,0 +1,14 @@ +import("KeywordRegistry_basic"); +import("Keyword_lib"); +import("Sql_lib"); +import("system.result"); + +var keyIds = newSelect("AB_KEYWORD_ENTRY.KEYID") + .from("AB_KEYWORD_ENTRY") + .where("AB_KEYWORD_ENTRY.CONTAINER", "SalesprojectWonLost") + .arrayColumn(); + +var res = keyIds.map(function (keyId) { + return [keyId, KeywordUtils.getViewValue($KeywordRegistry.salesprojectWonLost(), keyId)] +}); +result.object(res); \ No newline at end of file diff --git a/entity/Competition_entity/recordcontainers/db/recordfieldmappings/reason.displayvalue/expression.js b/entity/Competition_entity/recordcontainers/db/recordfieldmappings/reason.displayvalue/expression.js deleted file mode 100644 index bcd63431cb33c5f998e787ae57b30663efc9a37f..0000000000000000000000000000000000000000 --- a/entity/Competition_entity/recordcontainers/db/recordfieldmappings/reason.displayvalue/expression.js +++ /dev/null @@ -1,6 +0,0 @@ -import("system.result"); -import("Keyword_lib"); -import("KeywordRegistry_basic"); - -var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectWonLost(), "COMPETITION.REASON"); -result.string(sql); diff --git a/entity/Member_entity/Member_entity.aod b/entity/Member_entity/Member_entity.aod index 2d994f801429a8dec7bf03121c124c7ec958f996..2352659698a9a46d1b461716f2e1ec4289f38284 100644 --- a/entity/Member_entity/Member_entity.aod +++ b/entity/Member_entity/Member_entity.aod @@ -456,7 +456,6 @@ <name>jdito</name> <jDitoRecordAlias>Data_alias</jDitoRecordAlias> <isFilterable v="true" /> - <isSortable v="true" /> <contentProcess>%aditoprj%/entity/Member_entity/recordcontainers/jdito/contentProcess.js</contentProcess> <onInsert>%aditoprj%/entity/Member_entity/recordcontainers/jdito/onInsert.js</onInsert> <onUpdate>%aditoprj%/entity/Member_entity/recordcontainers/jdito/onUpdate.js</onUpdate> diff --git a/entity/Member_entity/recordcontainers/jdito/contentProcess.js b/entity/Member_entity/recordcontainers/jdito/contentProcess.js index 48b27281c4ebadf918be03ac5c907c41683d133a..85d651ee76c4f9f5d1898f4a39d2c48644226946 100644 --- a/entity/Member_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Member_entity/recordcontainers/jdito/contentProcess.js @@ -128,7 +128,7 @@ if (Utils.isNullOrEmpty(idValues) || memberRows.length === 0) row[7], "VAADIN:GLOBE", "TEXT:" + row[4].substring(row[4].indexOf(" ", 0)+1, row[4].length), - "MEMBERROLEDISTRICTRESPONSIBLE", + "70cbad1b-eac6-4369-ba50-4946e0fbcb3a", translate.text("District Responsible"), vars.get("$param.ObjectRowId_param"), vars.get("$param.ObjectType_param"), diff --git a/entity/ObservationMultiple_entity/ObservationMultiple_entity.aod b/entity/ObservationMultiple_entity/ObservationMultiple_entity.aod new file mode 100644 index 0000000000000000000000000000000000000000..2f9186f4f69144ae457fa6dcadbc871057f6643f --- /dev/null +++ b/entity/ObservationMultiple_entity/ObservationMultiple_entity.aod @@ -0,0 +1,153 @@ +<?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.18" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.18"> + <name>ObservationMultiple_entity</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <documentation>%aditoprj%/entity/ObservationMultiple_entity/documentation.adoc</documentation> + <siblings> + <element>Observation_entity</element> + </siblings> + <recordContainer>dataless</recordContainer> + <entityFields> + <entityProvider> + <name>#PROVIDER</name> + </entityProvider> + <entityProvider> + <name>#PROVIDER_AGGREGATES</name> + <useAggregates v="true" /> + </entityProvider> + <entityField> + <name>TRIGGEREVENTUPDATE</name> + <title>Update</title> + <contentType>BOOLEAN</contentType> + <groupable v="false" /> + <state>EDITABLE</state> + <valueProcess>%aditoprj%/entity/ObservationMultiple_entity/entityfields/triggereventupdate/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>TRIGGEREVENTINSERT</name> + <title>Insert</title> + <contentType>BOOLEAN</contentType> + <groupable v="false" /> + <state>EDITABLE</state> + <valueProcess>%aditoprj%/entity/ObservationMultiple_entity/entityfields/triggereventinsert/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>TRIGGEREVENTDELETE</name> + <title>Delete</title> + <contentType>BOOLEAN</contentType> + <groupable v="false" /> + <state>EDITABLE</state> + <valueProcess>%aditoprj%/entity/ObservationMultiple_entity/entityfields/triggereventdelete/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>OBJECT_FIELD</name> + <title>Fields</title> + <contentType>TEXT</contentType> + <dropDownProcess>%aditoprj%/entity/ObservationMultiple_entity/entityfields/object_field/dropDownProcess.js</dropDownProcess> + <selectionMode>MULTI</selectionMode> + <state>EDITABLE</state> + <stateProcess>%aditoprj%/entity/ObservationMultiple_entity/entityfields/object_field/stateProcess.js</stateProcess> + <valueProcess>%aditoprj%/entity/ObservationMultiple_entity/entityfields/object_field/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>NOTIFICATION_PRIO</name> + <title>Priority</title> + <consumer>PrioKeywords</consumer> + <state>EDITABLE</state> + <valueProcess>%aditoprj%/entity/ObservationMultiple_entity/entityfields/notification_prio/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/ObservationMultiple_entity/entityfields/notification_prio/displayValueProcess.js</displayValueProcess> + </entityField> + <entityField> + <name>includeDependencies</name> + <title>incl. Dependencies</title> + <contentType>BOOLEAN</contentType> + <state>EDITABLE</state> + <valueProcess>%aditoprj%/entity/ObservationMultiple_entity/entityfields/includedependencies/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>OBSERVER</name> + <title>Observer</title> + <consumer>Users</consumer> + <groupable v="true" /> + <mandatory v="true" /> + <state>READONLY</state> + <valueProcess>%aditoprj%/entity/ObservationMultiple_entity/entityfields/observer/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/ObservationMultiple_entity/entityfields/observer/displayValueProcess.js</displayValueProcess> + </entityField> + <entityField> + <name>OBJECT_TYPE</name> + <title>Object Type</title> + <consumer>Contexts</consumer> + <groupable v="false" /> + <mandatory v="true" /> + <state>READONLY</state> + <valueProcess>%aditoprj%/entity/ObservationMultiple_entity/entityfields/object_type/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/ObservationMultiple_entity/entityfields/object_type/displayValueProcess.js</displayValueProcess> + </entityField> + <entityActionField> + <name>addObservations</name> + <onActionProcess>%aditoprj%/entity/ObservationMultiple_entity/entityfields/addobservations/onActionProcess.js</onActionProcess> + <titleProcess>%aditoprj%/entity/ObservationMultiple_entity/entityfields/addobservations/titleProcess.js</titleProcess> + </entityActionField> + <entityParameter> + <name>Observer_param</name> + <valueProcess>%aditoprj%/entity/ObservationMultiple_entity/entityfields/observer_param/valueProcess.js</valueProcess> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>ObjectType_param</name> + <expose v="true" /> + <mandatory v="false" /> + </entityParameter> + <entityConsumer> + <name>Contexts</name> + <dependency> + <name>dependency</name> + <entityName>Context_entity</entityName> + <fieldName>Exclusive</fieldName> + </dependency> + <children> + <entityParameter> + <name>Blacklist_param</name> + <valueProcess>%aditoprj%/entity/ObservationMultiple_entity/entityfields/contexts/children/blacklist_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>InvertBlacklist_param</name> + <valueProcess>%aditoprj%/entity/ObservationMultiple_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityConsumer> + <name>PrioKeywords</name> + <dependency> + <name>dependency</name> + <entityName>KeywordEntry_entity</entityName> + <fieldName>#PROVIDER</fieldName> + </dependency> + <children> + <entityParameter> + <name>ContainerName_param</name> + <valueProcess>%aditoprj%/entity/ObservationMultiple_entity/entityfields/priokeywords/children/containername_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityConsumer> + <name>Users</name> + <dependency> + <name>dependency</name> + <entityName>Employee_entity</entityName> + <fieldName>EmployeesByUserId</fieldName> + </dependency> + </entityConsumer> + <entityParameter> + <name>ObjectIds_param</name> + <expose v="true" /> + </entityParameter> + </entityFields> + <recordContainers> + <datalessRecordContainer> + <name>dataless</name> + <alias>Data_alias</alias> + </datalessRecordContainer> + </recordContainers> +</entity> diff --git a/entity/ObservationMultiple_entity/documentation.adoc b/entity/ObservationMultiple_entity/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..cf6bba8ba432275e48b53876bff4401b3f58659b --- /dev/null +++ b/entity/ObservationMultiple_entity/documentation.adoc @@ -0,0 +1,4 @@ += ObservationMultible_entity + +This entity handling the seriel action to add more than one observation. +This action can´t be done with the Observation_entity, because a entity displays always one dataset. \ No newline at end of file diff --git a/entity/ObservationMultiple_entity/entityfields/addobservations/onActionProcess.js b/entity/ObservationMultiple_entity/entityfields/addobservations/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..186340d602bd55708ca6435b69786b4ad0727cd7 --- /dev/null +++ b/entity/ObservationMultiple_entity/entityfields/addobservations/onActionProcess.js @@ -0,0 +1,41 @@ +import("Sql_lib"); +import("system.entities"); +import("system.neon"); +import("system.vars"); + +var objectIds = JSON.parse(vars.getString("$param.ObjectIds_param")); + +var currentExitsObservations = newSelect("OBSERVATION.OBJECT_ID") + .from("OBSERVATION") + .where("OBSERVATION.OBJECT_TYPE", vars.get("$field.OBJECT_TYPE")) + .and("OBSERVATION.OBSERVER", vars.get("$field.OBSERVER")) + .and("OBSERVATION.TRIGGEREVENTDELETE", vars.get("$field.TRIGGEREVENTDELETE")) + .and("OBSERVATION.TRIGGEREVENTINSERT", vars.get("$field.TRIGGEREVENTINSERT")) + .and("OBSERVATION.TRIGGEREVENTUPDATE", vars.get("$field.TRIGGEREVENTUPDATE")) + .and("OBSERVATION.NOTIFICATION_PRIO", vars.get("$field.NOTIFICATION_PRIO")) + .and("OBSERVATION.OBJECT_ID", objectIds, SqlBuilder.IN()).arrayColumn(); + +// filter the allredy observed ids +objectIds = objectIds.filter(function (id) { + return !currentExitsObservations.includes(id); +}); + +var fields = { + "OBJECT_TYPE" : vars.get("$field.OBJECT_TYPE"), + "OBSERVER" : vars.get("$field.OBSERVER"), + "OBJECT_FIELD" : vars.get("$field.OBJECT_FIELD"), + "includeDependencies" : vars.get("$field.includeDependencies") == "1", + "TRIGGEREVENTDELETE" : vars.get("$field.TRIGGEREVENTDELETE") == "1", + "TRIGGEREVENTINSERT" : vars.get("$field.TRIGGEREVENTINSERT") == "1", + "TRIGGEREVENTUPDATE" : vars.get("$field.TRIGGEREVENTUPDATE") == "1", + "NOTIFICATION_PRIO" : vars.get("$field.NOTIFICATION_PRIO") + } + +let createRowConfig = entities.createConfigForAddingRows() + .entity("Observation_entity"); + + +objectIds.forEach(function (pObservationId) { + fields.OBJECT_ID = pObservationId; + entities.createRow(createRowConfig.fieldValues(fields)); +}); \ No newline at end of file diff --git a/entity/ObservationMultiple_entity/entityfields/addobservations/titleProcess.js b/entity/ObservationMultiple_entity/entityfields/addobservations/titleProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..f0bb020357d333ed7d2712953cb239ad2feb3782 --- /dev/null +++ b/entity/ObservationMultiple_entity/entityfields/addobservations/titleProcess.js @@ -0,0 +1,8 @@ +import("system.result"); +import("Sql_lib"); +import("system.vars"); +import("system.translate"); + +var objectIds = JSON.parse(vars.getString("$param.ObjectIds_param")); + +result.string(translate.withArguments("Add %0 Observations", [objectIds.length])); \ No newline at end of file diff --git a/entity/ObservationMultiple_entity/entityfields/contexts/children/blacklist_param/valueProcess.js b/entity/ObservationMultiple_entity/entityfields/contexts/children/blacklist_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..c40747f7e7256dd47edf175310a55a6b7293c3a3 --- /dev/null +++ b/entity/ObservationMultiple_entity/entityfields/contexts/children/blacklist_param/valueProcess.js @@ -0,0 +1,5 @@ +import("Observation_lib"); +import("system.vars"); +import("system.result"); + +result.object(Observation.getContextFields(vars.get("$field.OBSERVATION_ID"))); \ No newline at end of file diff --git a/entity/ObservationMultiple_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js b/entity/ObservationMultiple_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..40effa0178464da0c7850912345f19c7fa95975a --- /dev/null +++ b/entity/ObservationMultiple_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string(true); \ No newline at end of file diff --git a/entity/ObservationMultiple_entity/entityfields/includedependencies/valueProcess.js b/entity/ObservationMultiple_entity/entityfields/includedependencies/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..35371aba2179658a5d577832af3e554dd072c340 --- /dev/null +++ b/entity/ObservationMultiple_entity/entityfields/includedependencies/valueProcess.js @@ -0,0 +1,8 @@ +import("system.vars"); +import("system.result"); + +if (vars.get("$this.value") == null) +{ + result.string("1"); +} + \ No newline at end of file diff --git a/entity/ObservationMultiple_entity/entityfields/notification_prio/displayValueProcess.js b/entity/ObservationMultiple_entity/entityfields/notification_prio/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..0f475486d679f56d4a977f7e00a5cdb544331bbf --- /dev/null +++ b/entity/ObservationMultiple_entity/entityfields/notification_prio/displayValueProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("system.vars"); +import("KeywordRegistry_basic"); +import("Keyword_lib"); + +result.string(KeywordUtils.getViewValue($KeywordRegistry.notificationPriority(), vars.get("$this.value"))); \ No newline at end of file diff --git a/entity/ObservationMultiple_entity/entityfields/notification_prio/valueProcess.js b/entity/ObservationMultiple_entity/entityfields/notification_prio/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..3a1600efc791c121ec23f293d72ad1a6de66f289 --- /dev/null +++ b/entity/ObservationMultiple_entity/entityfields/notification_prio/valueProcess.js @@ -0,0 +1,9 @@ +import("KeywordRegistry_basic"); +import("system.result"); +import("system.vars"); + +if (!vars.get("$this.value")) +{ + result.string($KeywordRegistry.notificationPriority$normal()); +} + \ No newline at end of file diff --git a/entity/ObservationMultiple_entity/entityfields/object_field/dropDownProcess.js b/entity/ObservationMultiple_entity/entityfields/object_field/dropDownProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..b0d5277bc58c7f968310c549db58fa67fa61e917 --- /dev/null +++ b/entity/ObservationMultiple_entity/entityfields/object_field/dropDownProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("Observation_lib"); +import("system.vars"); + + +result.object(Observation.getAllPosibleFields(vars.get("$field.OBJECT_TYPE"))); diff --git a/entity/ObservationMultiple_entity/entityfields/object_field/stateProcess.js b/entity/ObservationMultiple_entity/entityfields/object_field/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..9c287ee5a33089d7ec613102f8e2d30350e87f6c --- /dev/null +++ b/entity/ObservationMultiple_entity/entityfields/object_field/stateProcess.js @@ -0,0 +1,12 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); + +if (vars.get("$field.OBJECT_TYPE")) +{ + result.string(neon.COMPONENTSTATE_EDITABLE); +} +else +{ + result.string(neon.COMPONENTSTATE_INVISIBLE); +} diff --git a/entity/ObservationMultiple_entity/entityfields/object_field/valueProcess.js b/entity/ObservationMultiple_entity/entityfields/object_field/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..6f113be8802678fc4c8dae77865af8f1c5fae8e7 --- /dev/null +++ b/entity/ObservationMultiple_entity/entityfields/object_field/valueProcess.js @@ -0,0 +1,10 @@ +import("system.vars"); +import("Observation_lib"); +import("system.result"); +import("system.neon"); + +if (!vars.get("$this.value") && vars.get("$field.OBJECT_TYPE") && (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT)) +{ + result.string(Observation.getAllFieldValue(vars.get("$field.OBJECT_TYPE"))); +} + \ No newline at end of file diff --git a/entity/ObservationMultiple_entity/entityfields/object_type/displayValueProcess.js b/entity/ObservationMultiple_entity/entityfields/object_type/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..76e020b3aadd1b62511b0efabc1179d3ec962140 --- /dev/null +++ b/entity/ObservationMultiple_entity/entityfields/object_type/displayValueProcess.js @@ -0,0 +1,12 @@ +import("system.translate"); +import("system.result"); +import("system.vars"); +import("Context_lib"); + +let type = vars.get("$field.OBJECT_TYPE"); + +if (type) +{ + result.string(translate.text(ContextUtils.getContextName(type))); +} + \ No newline at end of file diff --git a/entity/ObservationMultiple_entity/entityfields/object_type/valueProcess.js b/entity/ObservationMultiple_entity/entityfields/object_type/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..f55eb81a7a63ace42ea29a12606eee16090ce678 --- /dev/null +++ b/entity/ObservationMultiple_entity/entityfields/object_type/valueProcess.js @@ -0,0 +1,8 @@ +import("system.result"); +import("system.neon"); +import("system.vars"); + +if (!vars.get("$this.value") && vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param")) +{ + result.string(vars.get("$param.ObjectType_param")); +} \ No newline at end of file diff --git a/entity/ObservationMultiple_entity/entityfields/observer/displayValueProcess.js b/entity/ObservationMultiple_entity/entityfields/observer/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..19d424b79d975bd806ed0caf351c834dcac80174 --- /dev/null +++ b/entity/ObservationMultiple_entity/entityfields/observer/displayValueProcess.js @@ -0,0 +1,9 @@ +import("system.result"); +import("system.vars"); +import("system.tools"); + +var user = tools.getUserByAttribute(tools.NAME, vars.get("$field.OBSERVER"), tools.PROFILE_DEFAULT); +if (user) +{ + result.string((user.params.firstname + " " + user.params.lastname).trim()); +} \ No newline at end of file diff --git a/entity/ObservationMultiple_entity/entityfields/observer/valueProcess.js b/entity/ObservationMultiple_entity/entityfields/observer/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..be2b76bc769be6a403542e67c452d5f14ac643c3 --- /dev/null +++ b/entity/ObservationMultiple_entity/entityfields/observer/valueProcess.js @@ -0,0 +1,8 @@ +import("system.result"); +import("system.vars") + +if (!vars.get("$this.value") && vars.get("$param.Observer_param")) +{ + result.string(vars.get("$param.Observer_param")); +} + \ No newline at end of file diff --git a/entity/ObservationMultiple_entity/entityfields/observer_param/valueProcess.js b/entity/ObservationMultiple_entity/entityfields/observer_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..3bc7f5cd1797ce903128a6d074df6ee4cc34dd18 --- /dev/null +++ b/entity/ObservationMultiple_entity/entityfields/observer_param/valueProcess.js @@ -0,0 +1,5 @@ +import("Employee_lib"); +import("system.result"); + + +result.string( EmployeeUtils.getCurrentUserId()); \ No newline at end of file diff --git a/entity/ObservationMultiple_entity/entityfields/priokeywords/children/containername_param/valueProcess.js b/entity/ObservationMultiple_entity/entityfields/priokeywords/children/containername_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..2a473f8de51c830b161872dd3f102670e683296b --- /dev/null +++ b/entity/ObservationMultiple_entity/entityfields/priokeywords/children/containername_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string("NotificationPriority"); \ No newline at end of file diff --git a/entity/ObservationMultiple_entity/entityfields/triggereventdelete/valueProcess.js b/entity/ObservationMultiple_entity/entityfields/triggereventdelete/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..35371aba2179658a5d577832af3e554dd072c340 --- /dev/null +++ b/entity/ObservationMultiple_entity/entityfields/triggereventdelete/valueProcess.js @@ -0,0 +1,8 @@ +import("system.vars"); +import("system.result"); + +if (vars.get("$this.value") == null) +{ + result.string("1"); +} + \ No newline at end of file diff --git a/entity/ObservationMultiple_entity/entityfields/triggereventinsert/valueProcess.js b/entity/ObservationMultiple_entity/entityfields/triggereventinsert/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..63fa115623e45cb8e72ca6ba77f201a233027f36 --- /dev/null +++ b/entity/ObservationMultiple_entity/entityfields/triggereventinsert/valueProcess.js @@ -0,0 +1,8 @@ +import("system.vars"); +import("system.result"); + +if (vars.get("$this.value") == null) +{ + result.string("1"); +} + \ No newline at end of file diff --git a/entity/ObservationMultiple_entity/entityfields/triggereventupdate/valueProcess.js b/entity/ObservationMultiple_entity/entityfields/triggereventupdate/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..35371aba2179658a5d577832af3e554dd072c340 --- /dev/null +++ b/entity/ObservationMultiple_entity/entityfields/triggereventupdate/valueProcess.js @@ -0,0 +1,8 @@ +import("system.vars"); +import("system.result"); + +if (vars.get("$this.value") == null) +{ + result.string("1"); +} + \ No newline at end of file diff --git a/entity/Observation_entity/Observation_entity.aod b/entity/Observation_entity/Observation_entity.aod index bccdb0c9b868f6137c54681abf0cb4a05a4220d1..56b10c9389cc18e4ed0b4746638d4101a50874d1 100644 --- a/entity/Observation_entity/Observation_entity.aod +++ b/entity/Observation_entity/Observation_entity.aod @@ -43,7 +43,6 @@ <consumer>Users</consumer> <groupable v="true" /> <mandatory v="true" /> - <stateProcess>%aditoprj%/entity/Observation_entity/entityfields/observer/stateProcess.js</stateProcess> <valueProcess>%aditoprj%/entity/Observation_entity/entityfields/observer/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/Observation_entity/entityfields/observer/displayValueProcess.js</displayValueProcess> </entityField> @@ -58,6 +57,7 @@ <groupable v="false" /> <mandatory v="true" /> <stateProcess>%aditoprj%/entity/Observation_entity/entityfields/object_type/stateProcess.js</stateProcess> + <valueProcess>%aditoprj%/entity/Observation_entity/entityfields/object_type/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/Observation_entity/entityfields/object_type/displayValueProcess.js</displayValueProcess> <onValueChange>%aditoprj%/entity/Observation_entity/entityfields/object_type/onValueChange.js</onValueChange> </entityField> @@ -221,6 +221,25 @@ <valueProcess>%aditoprj%/entity/Observation_entity/entityfields/notification_prio/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/Observation_entity/entityfields/notification_prio/displayValueProcess.js</displayValueProcess> </entityField> + <entityField> + <name>includeDependencies</name> + <title>incl. Dependencies</title> + <contentType>BOOLEAN</contentType> + <stateProcess>%aditoprj%/entity/Observation_entity/entityfields/includedependencies/stateProcess.js</stateProcess> + <valueProcess>%aditoprj%/entity/Observation_entity/entityfields/includedependencies/valueProcess.js</valueProcess> + </entityField> + <entityParameter> + <name>ObjectType_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>ObjectId_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>ObjectFilter_param</name> + <expose v="true" /> + </entityParameter> </entityFields> <recordContainers> <dbRecordContainer> @@ -229,6 +248,7 @@ <hasDependentRecords v="true" /> <conditionProcess>%aditoprj%/entity/Observation_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <orderClauseProcess>%aditoprj%/entity/Observation_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> + <onDBInsert>%aditoprj%/entity/Observation_entity/recordcontainers/db/onDBInsert.js</onDBInsert> <onDBDelete>%aditoprj%/entity/Observation_entity/recordcontainers/db/onDBDelete.js</onDBDelete> <alias>Data_alias</alias> <cacheType>GLOBAL</cacheType> diff --git a/entity/Observation_entity/entityfields/contexts/children/blacklist_param/valueProcess.js b/entity/Observation_entity/entityfields/contexts/children/blacklist_param/valueProcess.js index 8d6aa9e96bc961bf55a4e420addb8013057565af..ce4ed3a334253f41bc34a9e5751e2e316485f481 100644 --- a/entity/Observation_entity/entityfields/contexts/children/blacklist_param/valueProcess.js +++ b/entity/Observation_entity/entityfields/contexts/children/blacklist_param/valueProcess.js @@ -13,4 +13,4 @@ if (vars.get("$field.OBSERVATION_ID")) .cell(); } -result.object(Observation.getAllContextValue(type)); +result.object(Observation.getAllContextValue(type)); \ No newline at end of file diff --git a/entity/Observation_entity/entityfields/includedependencies/stateProcess.js b/entity/Observation_entity/entityfields/includedependencies/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..2cc7df11aa6f726c65bcf5d39adc7690346b597f --- /dev/null +++ b/entity/Observation_entity/entityfields/includedependencies/stateProcess.js @@ -0,0 +1,8 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); + +if (vars.get("$sys.recordstate") != neon.OPERATINGSTATE_NEW) +{ + result.string(neon.COMPONENTSTATE_INVISIBLE); +} diff --git a/entity/Observation_entity/entityfields/includedependencies/valueProcess.js b/entity/Observation_entity/entityfields/includedependencies/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..17d96815f787ef6b77dd7e341456d3c52a69f46a --- /dev/null +++ b/entity/Observation_entity/entityfields/includedependencies/valueProcess.js @@ -0,0 +1,23 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); + +let isIncluded; + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) +{ + if (vars.get("$field.OBSERVATION_ID")) + { + isIncluded = "0"; + } + else + { + isIncluded = "1"; + } +} + +if (isIncluded) +{ + result.string(isIncluded); +} + diff --git a/entity/Observation_entity/entityfields/object_filter/valueProcess.js b/entity/Observation_entity/entityfields/object_filter/valueProcess.js index e1eab777e321453398af0f07b195fe48287fe6ff..4d4ffd9519726affce4f0ec8e8ffe1d9eb12576a 100644 --- a/entity/Observation_entity/entityfields/object_filter/valueProcess.js +++ b/entity/Observation_entity/entityfields/object_filter/valueProcess.js @@ -3,6 +3,19 @@ import("Context_lib"); import("system.vars"); import("system.result"); -if ((vars.get("$this.value") == null || vars.get("$this.value") == "") && vars.get("$field.OBJECT_TYPE") && !vars.get("$field.OBJECT_ID")) { - result.string(Observation.getContextFilter(vars.get("$field.OBJECT_TYPE"), null)); -} \ No newline at end of file +let isFilterParamExists = vars.exists("$param.ObjectFilter_param") && vars.get("$param.ObjectFilter_param"); +let resFilter; + +if ((vars.get("$this.value") == null || vars.get("$this.value") == "") && vars.get("$field.OBJECT_TYPE") && !vars.get("$field.OBJECT_ID") && !isFilterParamExists) +{ + resFilter = Observation.getContextFilter(vars.get("$field.OBJECT_TYPE"), null); +} +else if (!vars.get("$this.value") && isFilterParamExists) +{ + resFilter = vars.get("$param.ObjectFilter_param"); +} + +if (resFilter) +{ + result.string(resFilter); +} diff --git a/entity/Observation_entity/entityfields/object_id/valueProcess.js b/entity/Observation_entity/entityfields/object_id/valueProcess.js index 0d548d4da42d78867153de937258b1388ee775ec..3b52ba6e005efd0b253ccb4a2565b7167b8258f0 100644 --- a/entity/Observation_entity/entityfields/object_id/valueProcess.js +++ b/entity/Observation_entity/entityfields/object_id/valueProcess.js @@ -3,6 +3,19 @@ import("system.vars"); import("system.result"); let value = vars.get("$this.value"); +let resId; + +if (value) +{ + resId = vars.get("$field.OBJECT_TYPE") == "Employee" && value.length == 36 ? EmployeeUtils.prefixUserId(value) : value; +} +else if (!value && vars.exists("$param.ObjectId_param") && vars.get("$param.ObjectId_param")) +{ + resId = vars.get("$param.ObjectId_param"); +} + +if (resId) +{ + result.string(resId); +} -if (vars.get("$this.value")) - result.string(vars.get("$field.OBJECT_TYPE") == "Employee" && value.length == 36 ? EmployeeUtils.prefixUserId(value) : value); \ No newline at end of file diff --git a/entity/Observation_entity/entityfields/object_type/valueProcess.js b/entity/Observation_entity/entityfields/object_type/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e153d160e1a743b72e278e9cb2b2283ea8d6d573 --- /dev/null +++ b/entity/Observation_entity/entityfields/object_type/valueProcess.js @@ -0,0 +1,7 @@ +import("system.result"); +import("system.vars"); + + if (!vars.get("$this.value") && vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param")) +{ + result.string(vars.get("$param.ObjectType_param")); +} diff --git a/entity/Observation_entity/entityfields/observer/stateProcess.js b/entity/Observation_entity/entityfields/observer/stateProcess.js deleted file mode 100644 index e930c613bf00b043822b8deda3fb50fffc555121..0000000000000000000000000000000000000000 --- a/entity/Observation_entity/entityfields/observer/stateProcess.js +++ /dev/null @@ -1,8 +0,0 @@ -import("system.neon"); -import("system.vars"); -import("system.result"); - -if (vars.get("$sys.recordstate") != neon.OPERATINGSTATE_EDIT && vars.get("$param.OnlyMyObservations_param") != "true") - result.string(neon.COMPONENTSTATE_EDITABLE); -else - result.string(neon.COMPONENTSTATE_READONLY); \ No newline at end of file diff --git a/entity/Observation_entity/recordcontainers/db/onDBInsert.js b/entity/Observation_entity/recordcontainers/db/onDBInsert.js new file mode 100644 index 0000000000000000000000000000000000000000..aa3b524a0b205afb4d6793903fc229447669fc89 --- /dev/null +++ b/entity/Observation_entity/recordcontainers/db/onDBInsert.js @@ -0,0 +1,24 @@ +import("system.vars"); +import("Observation_lib"); +import("system.entities"); + +if (vars.get("$field.includeDependencies") == "1") +{ + let observer = vars.get("$field.OBSERVER"); + let observation_id = vars.get("$field.OBSERVATIONID"); + + Observation.getAllContextValue(vars.get("$field.OBJECT_TYPE")).forEach(function (contextID) { + var fields = { + "OBJECT_TYPE" : contextID, + "OBSERVER" : observer, + "OBJECT_FIELD" : Observation.getAllFieldValue(contextID).toString(), + "includeDependencies" : false, + "OBSERVATION_ID" : observation_id, + "OBJECT_FILTER" : Observation.getContextFilter(contextID, null) + } + + let createRowConfig = entities.createConfigForAddingRows() + .entity("Observation_entity"); + entities.createRow(createRowConfig.fieldValues(fields)); + }); +} \ No newline at end of file diff --git a/entity/Offeritem_entity/Offeritem_entity.aod b/entity/Offeritem_entity/Offeritem_entity.aod index 19d6a1685231db35bc8c28195c24c218b8578d68..88ce3773d3d8b38b93a43c8f7f78de581fd4a16d 100644 --- a/entity/Offeritem_entity/Offeritem_entity.aod +++ b/entity/Offeritem_entity/Offeritem_entity.aod @@ -271,6 +271,25 @@ <expose v="true" /> <documentation>%aditoprj%/entity/Offeritem_entity/entityfields/ignoreonupdateprocess_param/documentation.adoc</documentation> </entityParameter> + <entityActionGroup> + <name>group</name> + <children> + <entityActionField> + <name>moveUp</name> + <onActionProcess>%aditoprj%/entity/Offeritem_entity/entityfields/group/children/moveup/onActionProcess.js</onActionProcess> + <iconId>VAADIN:ARROW_UP</iconId> + <state>DISABLED</state> + <stateProcess>%aditoprj%/entity/Offeritem_entity/entityfields/group/children/moveup/stateProcess.js</stateProcess> + </entityActionField> + <entityActionField> + <name>moveDown</name> + <onActionProcess>%aditoprj%/entity/Offeritem_entity/entityfields/group/children/movedown/onActionProcess.js</onActionProcess> + <iconId>VAADIN:ARROW_DOWN</iconId> + <state>DISABLED</state> + <stateProcess>%aditoprj%/entity/Offeritem_entity/entityfields/group/children/movedown/stateProcess.js</stateProcess> + </entityActionField> + </children> + </entityActionGroup> </entityFields> <recordContainers> <dbRecordContainer> diff --git a/entity/Offeritem_entity/entityfields/group/children/movedown/onActionProcess.js b/entity/Offeritem_entity/entityfields/group/children/movedown/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..b23a6e09886473b682563c3ab7a20d7b94a00a5c --- /dev/null +++ b/entity/Offeritem_entity/entityfields/group/children/movedown/onActionProcess.js @@ -0,0 +1,15 @@ +import("system.vars"); +import("Item_lib"); +import("system.result"); + +var itemUtils = new MoveableItemUtils( + "OFFERITEM", + + "OFFERITEMID", + "ITEMSORT", + "ITEMPOSITION", + + "OFFER_ID", + vars.get("$field.OFFER_ID") +); +itemUtils.moveDown(vars.get("$field.OFFERITEMID")); diff --git a/entity/Offeritem_entity/entityfields/group/children/movedown/stateProcess.js b/entity/Offeritem_entity/entityfields/group/children/movedown/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..ff1138fe8c07709fd2b79f0303c514234ad6736d --- /dev/null +++ b/entity/Offeritem_entity/entityfields/group/children/movedown/stateProcess.js @@ -0,0 +1,32 @@ +import("system.vars"); +import("Item_lib"); +import("system.neon"); +import("system.result"); + +var selection = vars.get("$sys.selection"); +if(selection.length == 1 && typeof selection[0] == "string") +{ + var itemUtils = new MoveableItemUtils( + "OFFERITEM", + + "OFFERITEMID", + "ITEMSORT", + "ITEMPOSITION", + + "OFFER_ID", + vars.get("$field.OFFER_ID") + ); + + if(itemUtils.canMoveDown(selection[0])) + { + result.string(neon.COMPONENTSTATE_EDITABLE); + } + else + { + result.string(neon.COMPONENTSTATE_DISABLED); + } +} +else +{ + result.string(neon.COMPONENTSTATE_DISABLED); +} diff --git a/entity/Offeritem_entity/entityfields/group/children/moveup/onActionProcess.js b/entity/Offeritem_entity/entityfields/group/children/moveup/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..77f1d9126671716372617f0e54c99c0d0062bb9d --- /dev/null +++ b/entity/Offeritem_entity/entityfields/group/children/moveup/onActionProcess.js @@ -0,0 +1,15 @@ +import("system.vars"); +import("Item_lib"); +import("system.result"); + +var itemUtils = new MoveableItemUtils( + "OFFERITEM", + + "OFFERITEMID", + "ITEMSORT", + "ITEMPOSITION", + + "OFFER_ID", + vars.get("$field.OFFER_ID") +); +itemUtils.moveUp(vars.get("$field.OFFERITEMID")); diff --git a/entity/Offeritem_entity/entityfields/group/children/moveup/stateProcess.js b/entity/Offeritem_entity/entityfields/group/children/moveup/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..96992cac02dd7d7b48d86e83736ba50b898b66a3 --- /dev/null +++ b/entity/Offeritem_entity/entityfields/group/children/moveup/stateProcess.js @@ -0,0 +1,32 @@ +import("system.vars"); +import("Item_lib"); +import("system.neon"); +import("system.result"); + +var selection = vars.get("$sys.selection"); +if(selection.length == 1 && typeof selection[0] == "string") +{ + var itemUtils = new MoveableItemUtils( + "OFFERITEM", + + "OFFERITEMID", + "ITEMSORT", + "ITEMPOSITION", + + "OFFER_ID", + vars.get("$field.OFFER_ID") + ); + + if(itemUtils.canMoveUp(selection[0])) + { + result.string(neon.COMPONENTSTATE_EDITABLE); + } + else + { + result.string(neon.COMPONENTSTATE_DISABLED); + } +} +else +{ + result.string(neon.COMPONENTSTATE_DISABLED); +} diff --git a/entity/Offeritem_entity/entityfields/product_id/onValueChange.js b/entity/Offeritem_entity/entityfields/product_id/onValueChange.js index 1996256d8084708c434b34ce31be70a28bb63879..0d52517c981eb2f8832ea8149f8206dae6067d8b 100644 --- a/entity/Offeritem_entity/entityfields/product_id/onValueChange.js +++ b/entity/Offeritem_entity/entityfields/product_id/onValueChange.js @@ -2,7 +2,10 @@ import("system.vars"); import("OfferOrder_lib"); var pId = vars.get("$local.value"); +var uid = vars.get("$field.OFFERITEMID"); +var entity = vars.get("$sys.currententityname"); + if(pId != "") { - ItemUtils.product_IdOnValueChange(pId); + ItemUtils.product_IdOnValueChange(pId, uid, entity); } \ No newline at end of file diff --git a/entity/Offeritem_entity/entityfields/totalprice/valueProcess.js b/entity/Offeritem_entity/entityfields/totalprice/valueProcess.js index 60704bc72e12f666589462ef55d7b84b26e5ea63..ff5074afaa498e940f7e9a557dbc9dda218d012e 100644 --- a/entity/Offeritem_entity/entityfields/totalprice/valueProcess.js +++ b/entity/Offeritem_entity/entityfields/totalprice/valueProcess.js @@ -5,4 +5,4 @@ import("Offer_lib"); var oiUtils = new OfferItemUtils(vars.get("$field.OFFER_ID")); result.string(oiUtils.roundPrice(oiUtils.getItemSum(vars.get("$field.QUANTITY"), vars.get("$field.PRICE") - , vars.get("$field.DISCOUNT"), vars.get("$field.OPTIONAL")))); + , vars.get("$field.DISCOUNT"), vars.get("$field.OPTIONAL")))); \ No newline at end of file diff --git a/entity/Offeritem_entity/recordcontainers/db/onDBInsert.js b/entity/Offeritem_entity/recordcontainers/db/onDBInsert.js index b8dacf51771648b7bee18c502b6c4271ed73493a..ccbec217a9ab2911b54beeaef6e915c64863b14c 100644 --- a/entity/Offeritem_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Offeritem_entity/recordcontainers/db/onDBInsert.js @@ -1,3 +1,4 @@ +import("system.eMath"); import("system.entities"); import("system.datetime"); import("system.neon"); @@ -18,8 +19,38 @@ if(oid != "") var discount = vars.exists("$param.Discount_param") ? vars.get("$param.Discount_param"): ""; var quantity = vars.get("$field.QUANTITY"); var oiUtils = new OfferItemUtils(rowdata["OFFERITEM.OFFER_ID"]); - oiUtils.insertPartsList(rowdata["OFFERITEM.PRODUCT_ID"], vars.get("$local.uid"), curr, contactid, vars.get("$param.Language_param"), quantity); + var insertParts = oiUtils.insertPartsList(rowdata["OFFERITEM.PRODUCT_ID"], vars.get("$local.uid"), curr, contactid, vars.get("$param.Language_param"), quantity, true); oiUtils.reOrgItems(); + var calculatedPrices = {}; + var priceObj = insertParts["priceObject"]; + var treeStructure = insertParts["treeStructure"][rowdata["OFFERITEM.OFFERITEMID"]]; + var productsWithSumUpPrices = insertParts["productsWithSumUpPrices"] + var correctOrder = insertParts["insertedItemIds"]; + _handleSumUpPricesOfItems(correctOrder, treeStructure, productsWithSumUpPrices, priceObj); + var price = rowdata["OFFERITEM.PRICE"]; + if(price === "" || price === undefined || price === null) + { + var calcPrice = 0; + var vat = 0; + for(var id in treeStructure) + { + calcPrice = eMath.addDec(priceObj[id]["price"], calcPrice); + if(priceObj[id]["vat"] !== null && priceObj[id]["vat"] !== undefined && priceObj[id]["vat"] > 0) + { + vat = priceObj[id]["vat"]; + } + } + var config = entities.createConfigForUpdatingRows() + .entity("Offeritem_entity") + .addParameter("OfferId_param", oid) + .addParameter("IgnoreOnUpdateProcess_param", true) + .uid(rowdata["OFFERITEM.OFFERITEMID"]) + .fieldValues({ + "PRICE": calcPrice, + "VAT": vat + }); + entities.updateRow(config); + } //update offer price var vals = oiUtils.getNetAndVat(); @@ -28,7 +59,8 @@ if(oid != "") let config = entities.createConfigForUpdatingRows() config.entity("Offer_entity"); - if(discountedVals){ + if(discountedVals) + { config.fieldValues({ "NET": vals[0], "VAT": vals[1], @@ -36,7 +68,8 @@ if(oid != "") "DISCOUNTED_VAT": discountedVals[1] }); } - else{ + else + { config.fieldValues({ "NET": vals[0], "VAT": vals[1] @@ -45,5 +78,95 @@ if(oid != "") } config.uid(oid); entities.updateRow(config); +} + +//We want to sum up the prices directly under the current item to calculate the price if we don't have an valid price for them +function _handleSumUpPricesOfItems(pOrder, pTreestruct, pSumUpPrices, pPriceObj) +{ + + var currentStruc = pTreestruct; + var sumUpPrices = pSumUpPrices; + var order = pOrder; + var summandObject = {}; + for (var i = order.length; i > -1; i--)//we do this backwards because otherwiese we would run into problems when trying to build the sum (we could have items without an price yet) + { + if(sumUpPrices.hasOwnProperty(order[i])) + { + summandObject[order[i]] = _getNode(pTreestruct, order[i], Object.keys(pTreestruct)[0]); + } + } + + for(var offerItem in summandObject) + { + var calcPrice = 0; + var vat = null; + for (var child in summandObject[offerItem]) + { + var childPrice; + if(priceObj[child] != undefined) + { + childPrice = priceObj[child]["price"] + } + else if(summandObject[child][child] != undefined) + { + childPrice = priceObj[Object.keys(summandObject[child][child])[0]]["price"] + vat = priceObj[Object.keys(summandObject[child][child])[0]]["vat"] + } + else + { + childPrice = 0; + vat = 0; + } + calcPrice = eMath.addDec(childPrice, calcPrice); + if(!vat) + { + vat = priceObj[child]["vat"]; + } + } + calculatedPrices[offerItem] = {}; + calculatedPrices[offerItem]["price"] = calcPrice; + calculatedPrices[offerItem]["vat"] = vat; + priceObj[offerItem] = {}; + priceObj[offerItem]["price"] = calcPrice; + priceObj[offerItem]["vat"] = vat; + } + //ToDo: Document + function _getNode(pObject, pName, pCurrName){ + if(pCurrName == pName) + { + return pObject; + } + else if (pObject != undefined) + { + let x; + let res = null; + for(var obj in pObject) + { + if(res == null) + { + res = _getNode(pObject[obj], pName, obj); + } + else + { + break; + } + } + return res; + } + return null; + } + + var config = entities.createConfigForUpdatingRows().entity("Offeritem_entity").addParameter("OfferId_param", oid).addParameter("IgnoreOnUpdateProcess_param", true); + + for(var oiId in productsWithSumUpPrices) + { + config.uid(oiId) + .fieldValues({ + "PRICE": priceObj[oiId]["price"], + "VAT": priceObj[oiId]["vat"] + }); + + entities.updateRow(config); + } } \ No newline at end of file diff --git a/entity/Offeritem_entity/recordcontainers/db/onDBUpdate.js b/entity/Offeritem_entity/recordcontainers/db/onDBUpdate.js index 35cf52474fb057b7d4639eebb8b046616609b0ae..a3e8e2fb33ac86ffe5baad4675c7dba8ab206316 100644 --- a/entity/Offeritem_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/Offeritem_entity/recordcontainers/db/onDBUpdate.js @@ -34,7 +34,6 @@ if(oid != "") } config.uid(oid); entities.updateRow(config); - //this process get's executed for every child of this offerItem since we use writeEntiy, so we use the param to make sure we don't execute it for the children if(vars.getString("$param.IgnoreOnUpdateProcess_param") != "true") { diff --git a/entity/Orderitem_entity/Orderitem_entity.aod b/entity/Orderitem_entity/Orderitem_entity.aod index 1b2727fd611e9b0f00ca34d964bbe9e73b5d8b3e..11dd85372cf2c28d72012ade4ff7def203fa3874 100644 --- a/entity/Orderitem_entity/Orderitem_entity.aod +++ b/entity/Orderitem_entity/Orderitem_entity.aod @@ -247,6 +247,25 @@ <name>Discount_param</name> <expose v="true" /> </entityParameter> + <entityActionGroup> + <name>group</name> + <children> + <entityActionField> + <name>moveUp</name> + <onActionProcess>%aditoprj%/entity/Orderitem_entity/entityfields/group/children/moveup/onActionProcess.js</onActionProcess> + <iconId>VAADIN:ARROW_UP</iconId> + <state>DISABLED</state> + <stateProcess>%aditoprj%/entity/Orderitem_entity/entityfields/group/children/moveup/stateProcess.js</stateProcess> + </entityActionField> + <entityActionField> + <name>moveDown</name> + <onActionProcess>%aditoprj%/entity/Orderitem_entity/entityfields/group/children/movedown/onActionProcess.js</onActionProcess> + <iconId>VAADIN:ARROW_DOWN</iconId> + <state>DISABLED</state> + <stateProcess>%aditoprj%/entity/Orderitem_entity/entityfields/group/children/movedown/stateProcess.js</stateProcess> + </entityActionField> + </children> + </entityActionGroup> </entityFields> <recordContainers> <dbRecordContainer> diff --git a/entity/Orderitem_entity/entityfields/group/children/movedown/onActionProcess.js b/entity/Orderitem_entity/entityfields/group/children/movedown/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..3b21c5e7110f0ee82a0a9204268c4bb30a587f46 --- /dev/null +++ b/entity/Orderitem_entity/entityfields/group/children/movedown/onActionProcess.js @@ -0,0 +1,15 @@ +import("system.vars"); +import("Item_lib"); +import("system.result"); + +var itemUtils = new MoveableItemUtils( + "SALESORDERITEM", + + "SALESORDERITEMID", + "ITEMSORT", + "ITEMPOSITION", + + "SALESORDER_ID", + vars.get("$field.SALESORDER_ID") +); +itemUtils.moveDown(vars.get("$field.SALESORDERITEMID")); diff --git a/entity/Orderitem_entity/entityfields/group/children/movedown/stateProcess.js b/entity/Orderitem_entity/entityfields/group/children/movedown/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..dc260307eb5f517b250f69af7be1f8793334ffe3 --- /dev/null +++ b/entity/Orderitem_entity/entityfields/group/children/movedown/stateProcess.js @@ -0,0 +1,32 @@ +import("system.vars"); +import("Item_lib"); +import("system.neon"); +import("system.result"); + +var selection = vars.get("$sys.selection"); +if(selection.length == 1 && typeof selection[0] == "string") +{ + var itemUtils = new MoveableItemUtils( + "SALESORDERITEM", + + "SALESORDERITEMID", + "ITEMSORT", + "ITEMPOSITION", + + "SALESORDER_ID", + vars.get("$field.SALESORDER_ID") + ); + + if(itemUtils.canMoveDown(selection[0])) + { + result.string(neon.COMPONENTSTATE_EDITABLE); + } + else + { + result.string(neon.COMPONENTSTATE_DISABLED); + } +} +else +{ + result.string(neon.COMPONENTSTATE_DISABLED); +} diff --git a/entity/Orderitem_entity/entityfields/group/children/moveup/onActionProcess.js b/entity/Orderitem_entity/entityfields/group/children/moveup/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..4389d85a0252ce830db27a1fb18ff269ca3be8d8 --- /dev/null +++ b/entity/Orderitem_entity/entityfields/group/children/moveup/onActionProcess.js @@ -0,0 +1,15 @@ +import("system.vars"); +import("Item_lib"); +import("system.result"); + +var itemUtils = new MoveableItemUtils( + "SALESORDERITEM", + + "SALESORDERITEMID", + "ITEMSORT", + "ITEMPOSITION", + + "SALESORDER_ID", + vars.get("$field.SALESORDER_ID") +); +itemUtils.moveUp(vars.get("$field.SALESORDERITEMID")); diff --git a/entity/Orderitem_entity/entityfields/group/children/moveup/stateProcess.js b/entity/Orderitem_entity/entityfields/group/children/moveup/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..129eaae15595b774d1ab4ea36050a7695e5dacc4 --- /dev/null +++ b/entity/Orderitem_entity/entityfields/group/children/moveup/stateProcess.js @@ -0,0 +1,32 @@ +import("system.vars"); +import("Item_lib"); +import("system.neon"); +import("system.result"); + +var selection = vars.get("$sys.selection"); +if(selection.length == 1 && typeof selection[0] == "string") +{ + var itemUtils = new MoveableItemUtils( + "SALESORDERITEM", + + "SALESORDERITEMID", + "ITEMSORT", + "ITEMPOSITION", + + "SALESORDER_ID", + vars.get("$field.SALESORDER_ID") + ); + + if(itemUtils.canMoveUp(selection[0])) + { + result.string(neon.COMPONENTSTATE_EDITABLE); + } + else + { + result.string(neon.COMPONENTSTATE_DISABLED); + } +} +else +{ + result.string(neon.COMPONENTSTATE_DISABLED); +} diff --git a/entity/Organisation_entity/Organisation_entity.aod b/entity/Organisation_entity/Organisation_entity.aod index 3a13ba89f60d6699ecc536ae743e06833d91c333..a1c9dc5748145d7807a8927740c9383fa46d735c 100644 --- a/entity/Organisation_entity/Organisation_entity.aod +++ b/entity/Organisation_entity/Organisation_entity.aod @@ -14,7 +14,6 @@ <useFavorites v="true" /> <iconId>VAADIN:BUILDING</iconId> <imageProcess>%aditoprj%/entity/Organisation_entity/imageProcess.js</imageProcess> - <usePermissions v="false" /> <titlePlural>Companies</titlePlural> <recordContainer>db</recordContainer> <entityFields> @@ -1725,12 +1724,12 @@ </dbRecordFieldMapping> <dbRecordFieldMapping> <name>STANDARD_EMAIL_COMMUNICATION.value</name> - <isFilterable v="true" /> + <isFilterable v="false" /> <isLookupFilter v="false" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>STANDARD_PHONE_COMMUNICATION.value</name> - <isFilterable v="true" /> + <isFilterable v="false" /> <isLookupFilter v="false" /> </dbRecordFieldMapping> <consumerMapping> @@ -1881,6 +1880,27 @@ <filterConditionProcess>%aditoprj%/entity/Organisation_entity/recordcontainers/db/filterextensions/responsibleassignment/filterConditionProcess.js</filterConditionProcess> <filtertype>EXTENDED</filtertype> </filterExtension> + <filterExtension> + <name>Communication_Mail_filter</name> + <title>Communication: Mail</title> + <contentType>TEXT</contentType> + <filterConditionProcess>%aditoprj%/entity/Organisation_entity/recordcontainers/db/filterextensions/communication_mail_filter/filterConditionProcess.js</filterConditionProcess> + <filtertype>BASIC</filtertype> + </filterExtension> + <filterExtension> + <name>Communication_Phone_filter</name> + <title>Communication: Phone</title> + <contentType>TEXT</contentType> + <filterConditionProcess>%aditoprj%/entity/Organisation_entity/recordcontainers/db/filterextensions/communication_phone_filter/filterConditionProcess.js</filterConditionProcess> + <filtertype>BASIC</filtertype> + </filterExtension> + <filterExtension> + <name>Commincation_Link_filter</name> + <title>Communication: Link</title> + <contentType>TEXT</contentType> + <filterConditionProcess>%aditoprj%/entity/Organisation_entity/recordcontainers/db/filterextensions/commincation_link_filter/filterConditionProcess.js</filterConditionProcess> + <filtertype>BASIC</filtertype> + </filterExtension> </filterExtensions> </dbRecordContainer> <indexRecordContainer> diff --git a/entity/Organisation_entity/recordcontainers/db/filterextensions/commincation_link_filter/filterConditionProcess.js b/entity/Organisation_entity/recordcontainers/db/filterextensions/commincation_link_filter/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..d09b906577809b1aef5ce5ececa962849e83bed4 --- /dev/null +++ b/entity/Organisation_entity/recordcontainers/db/filterextensions/commincation_link_filter/filterConditionProcess.js @@ -0,0 +1,8 @@ +import("system.result"); +import("system.vars"); +import("Contact_lib"); + +var resultSqlCond = ContactUtils.getCommFilter(vars.get("$local.operator"), (vars.get("$local.rawvalue") ? vars.get("$local.rawvalue") : ""), + vars.get("$local.operator2").trim(), vars.get("$local.comparison"), "LINK"); + +result.string(resultSqlCond); \ No newline at end of file diff --git a/entity/Organisation_entity/recordcontainers/db/filterextensions/communication_mail_filter/filterConditionProcess.js b/entity/Organisation_entity/recordcontainers/db/filterextensions/communication_mail_filter/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..36ecbba8f78b1d6a3cc44b791aa188a7b1c028df --- /dev/null +++ b/entity/Organisation_entity/recordcontainers/db/filterextensions/communication_mail_filter/filterConditionProcess.js @@ -0,0 +1,8 @@ +import("system.result"); +import("system.vars"); +import("Contact_lib"); + +var resultSqlCond = ContactUtils.getCommFilter(vars.get("$local.operator"), (vars.get("$local.rawvalue") ? vars.get("$local.rawvalue") : ""), + vars.get("$local.operator2").trim(), vars.get("$local.comparison"), "EMAIL"); + +result.string(resultSqlCond); \ No newline at end of file diff --git a/entity/Organisation_entity/recordcontainers/db/filterextensions/communication_phone_filter/filterConditionProcess.js b/entity/Organisation_entity/recordcontainers/db/filterextensions/communication_phone_filter/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..a48f7cdf37ab4438d79ae1ddb9349f4cfd91272b --- /dev/null +++ b/entity/Organisation_entity/recordcontainers/db/filterextensions/communication_phone_filter/filterConditionProcess.js @@ -0,0 +1,8 @@ +import("system.result"); +import("system.vars"); +import("Contact_lib"); + +var resultSqlCond = ContactUtils.getCommFilter(vars.get("$local.operator"), (vars.get("$local.rawvalue") ? vars.get("$local.rawvalue") : ""), + vars.get("$local.operator2").trim(), vars.get("$local.comparison"), "TELEPHONE"); + +result.string(resultSqlCond); \ No newline at end of file diff --git a/entity/Person_entity/Person_entity.aod b/entity/Person_entity/Person_entity.aod index 64bb15fc5641035b58595c7c69834e4ac7c989e3..f294673d397ad7e5b12ab7f16821daa5d3c0d75b 100644 --- a/entity/Person_entity/Person_entity.aod +++ b/entity/Person_entity/Person_entity.aod @@ -1671,12 +1671,12 @@ </dbRecordFieldMapping> <dbRecordFieldMapping> <name>STANDARD_EMAIL_COMMUNICATION.value</name> - <isFilterable v="true" /> + <isFilterable v="false" /> <isLookupFilter v="false" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>STANDARD_PHONE_COMMUNICATION.value</name> - <isFilterable v="true" /> + <isFilterable v="false" /> <isLookupFilter v="false" /> </dbRecordFieldMapping> <consumerMapping> @@ -1825,6 +1825,28 @@ <filterConditionProcess>%aditoprj%/entity/Person_entity/recordcontainers/db/filterextensions/supervisorassignment/filterConditionProcess.js</filterConditionProcess> <filtertype>BASIC</filtertype> </filterExtension> + <filterExtension> + <name>Communication_Mail_filter</name> + <title>Communication: Mail</title> + <contentType>TEXT</contentType> + <filterConditionProcess>%aditoprj%/entity/Person_entity/recordcontainers/db/filterextensions/communication_mail_filter/filterConditionProcess.js</filterConditionProcess> + <filtertype>BASIC</filtertype> + </filterExtension> + <filterExtension> + <name>Communication_Phone_filter</name> + <title>Communication: Phone</title> + <contentType>TEXT</contentType> + <filterConditionProcess>%aditoprj%/entity/Person_entity/recordcontainers/db/filterextensions/communication_phone_filter/filterConditionProcess.js</filterConditionProcess> + <filtertype>BASIC</filtertype> + </filterExtension> + <filterExtension> + <name>Communication_Link_filter</name> + <title>Communication: Link</title> + <contentType>TEXT</contentType> + <filterConditionProcess>%aditoprj%/entity/Person_entity/recordcontainers/db/filterextensions/communication_link_filter/filterConditionProcess.js</filterConditionProcess> + <isLookupFilter v="false" /> + <filtertype>BASIC</filtertype> + </filterExtension> </filterExtensions> </dbRecordContainer> <indexRecordContainer> diff --git a/entity/Person_entity/recordcontainers/db/filterextensions/communication_link_filter/filterConditionProcess.js b/entity/Person_entity/recordcontainers/db/filterextensions/communication_link_filter/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..d09b906577809b1aef5ce5ececa962849e83bed4 --- /dev/null +++ b/entity/Person_entity/recordcontainers/db/filterextensions/communication_link_filter/filterConditionProcess.js @@ -0,0 +1,8 @@ +import("system.result"); +import("system.vars"); +import("Contact_lib"); + +var resultSqlCond = ContactUtils.getCommFilter(vars.get("$local.operator"), (vars.get("$local.rawvalue") ? vars.get("$local.rawvalue") : ""), + vars.get("$local.operator2").trim(), vars.get("$local.comparison"), "LINK"); + +result.string(resultSqlCond); \ No newline at end of file diff --git a/entity/Person_entity/recordcontainers/db/filterextensions/communication_mail_filter/filterConditionProcess.js b/entity/Person_entity/recordcontainers/db/filterextensions/communication_mail_filter/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..36ecbba8f78b1d6a3cc44b791aa188a7b1c028df --- /dev/null +++ b/entity/Person_entity/recordcontainers/db/filterextensions/communication_mail_filter/filterConditionProcess.js @@ -0,0 +1,8 @@ +import("system.result"); +import("system.vars"); +import("Contact_lib"); + +var resultSqlCond = ContactUtils.getCommFilter(vars.get("$local.operator"), (vars.get("$local.rawvalue") ? vars.get("$local.rawvalue") : ""), + vars.get("$local.operator2").trim(), vars.get("$local.comparison"), "EMAIL"); + +result.string(resultSqlCond); \ No newline at end of file diff --git a/entity/Person_entity/recordcontainers/db/filterextensions/communication_phone_filter/filterConditionProcess.js b/entity/Person_entity/recordcontainers/db/filterextensions/communication_phone_filter/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..a48f7cdf37ab4438d79ae1ddb9349f4cfd91272b --- /dev/null +++ b/entity/Person_entity/recordcontainers/db/filterextensions/communication_phone_filter/filterConditionProcess.js @@ -0,0 +1,8 @@ +import("system.result"); +import("system.vars"); +import("Contact_lib"); + +var resultSqlCond = ContactUtils.getCommFilter(vars.get("$local.operator"), (vars.get("$local.rawvalue") ? vars.get("$local.rawvalue") : ""), + vars.get("$local.operator2").trim(), vars.get("$local.comparison"), "TELEPHONE"); + +result.string(resultSqlCond); \ No newline at end of file diff --git a/entity/Prod2prod_entity/Prod2prod_entity.aod b/entity/Prod2prod_entity/Prod2prod_entity.aod index 5d2197e08cec6e8fc8c9f80ee8f100a4b331b8e9..0acf3ef262439b9abf72d47cb858eac6817b1f60 100644 --- a/entity/Prod2prod_entity/Prod2prod_entity.aod +++ b/entity/Prod2prod_entity/Prod2prod_entity.aod @@ -21,6 +21,7 @@ <title>Optional</title> <contentType>BOOLEAN</contentType> <valueProcess>%aditoprj%/entity/Prod2prod_entity/entityfields/optional/valueProcess.js</valueProcess> + <onValueChange>%aditoprj%/entity/Prod2prod_entity/entityfields/optional/onValueChange.js</onValueChange> </entityField> <entityField> <name>UID</name> @@ -41,6 +42,7 @@ <title>Product</title> <consumer>Products</consumer> <mandatory v="true" /> + <valueProcess>%aditoprj%/entity/Prod2prod_entity/entityfields/source_id/valueProcess.js</valueProcess> <onValueChange>%aditoprj%/entity/Prod2prod_entity/entityfields/source_id/onValueChange.js</onValueChange> </entityField> <entityField> @@ -48,6 +50,7 @@ <documentation>%aditoprj%/entity/Prod2prod_entity/entityfields/takeprice/documentation.adoc</documentation> <title>Take price</title> <contentType>BOOLEAN</contentType> + <stateProcess>%aditoprj%/entity/Prod2prod_entity/entityfields/takeprice/stateProcess.js</stateProcess> <valueProcess>%aditoprj%/entity/Prod2prod_entity/entityfields/takeprice/valueProcess.js</valueProcess> </entityField> <entityParameter> @@ -186,7 +189,7 @@ <name>OPTIONAL.value</name> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> - <name>TAKEPRICE.displayValue</name> + <name>TAKEPRICE.value</name> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>SOURCE_ID.displayValue</name> diff --git a/entity/Prod2prod_entity/entityfields/optional/onValueChange.js b/entity/Prod2prod_entity/entityfields/optional/onValueChange.js new file mode 100644 index 0000000000000000000000000000000000000000..5f1e2b639b51cf3ec51ab12287d14c3f8d407687 --- /dev/null +++ b/entity/Prod2prod_entity/entityfields/optional/onValueChange.js @@ -0,0 +1,9 @@ +import("system.neon"); +import("system.vars"); + +var optional = vars.get("$local.value"); + +if(optional == 1) +{ + neon.setFieldValue("$field.TAKEPRICE", 0); +} \ No newline at end of file diff --git a/entity/Prod2prod_entity/entityfields/source_id/valueProcess.js b/entity/Prod2prod_entity/entityfields/source_id/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/entity/Prod2prod_entity/entityfields/takeprice/stateProcess.js b/entity/Prod2prod_entity/entityfields/takeprice/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..37dfe505d2a9e3a8bf20837acb450747d4d6ead2 --- /dev/null +++ b/entity/Prod2prod_entity/entityfields/takeprice/stateProcess.js @@ -0,0 +1,23 @@ +import("system.result"); +import("system.vars"); +import("system.neon"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) +{ + var takePrice = vars.get("$field.TAKEPRICE"); + var optional = vars.get("$field.OPTIONAL"); + + + if(optional == 1 && takePrice == 0) + { + result.string(neon.COMPONENTSTATE_READONLY); + } + else + { + result.string(neon.COMPONENTSTATE_EDITABLE); + } +} +else +{ + result.string(neon.COMPONENTSTATE_READONLY); +} \ No newline at end of file diff --git a/entity/Productprice_entity/recordcontainers/db/onDBInsert.js b/entity/Productprice_entity/recordcontainers/db/onDBInsert.js index 3bd6ad5c6cd885240b6c77505ce01472f4f4ecfe..5d9ed76f358f35176af7e052e4630a14b9774255 100644 --- a/entity/Productprice_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Productprice_entity/recordcontainers/db/onDBInsert.js @@ -1,3 +1,4 @@ +import("system.eMath"); import("Date_lib"); import("system.datetime"); import("system.entities"); @@ -9,7 +10,7 @@ var priceList = vars.get("$field.PRICELIST"); var productId = vars.get("$field.PRODUCT_ID"); var buySell = vars.get("$field.BUYSELL"); var validFrom = vars.get("$field.VALID_FROM"); -var today = DateUtils.getTodayUTC(); +var oneDayPrior = eMath.subInt(validFrom, datetime.ONE_DAY); var productPriceListId = vars.get("$field.PRODUCTPRICEID"); var validPriceLists = newSelect("PRODUCTPRICE.PRODUCTPRICEID") @@ -22,7 +23,7 @@ var validPriceLists = newSelect("PRODUCTPRICE.PRODUCTPRICEID") .and(newWhere("PRODUCTPRICE.VALID_TO", validFrom, SqlBuilder.GREATER_OR_EQUAL()).or("PRODUCTPRICE.VALID_TO is null")) .arrayColumn(); -var config = entities.createConfigForUpdatingRows().entity("Productprice_entity").fieldValues({"VALID_TO": today}).addParameter("IgnoreOnValidation_param", true); +var config = entities.createConfigForUpdatingRows().entity("Productprice_entity").fieldValues({"VALID_TO": oneDayPrior}).addParameter("IgnoreOnValidation_param", true); for (i = 0; i < validPriceLists.length; i++) { diff --git a/entity/SalesprojectPhaseDefinition_entity/entityfields/date_edit/valueProcess.js b/entity/SalesprojectPhaseDefinition_entity/entityfields/date_edit/valueProcess.js index 4b3fffc0c63f47083ae49e08b9b746227c628443..e22054c04fb16601530ec2cb75af55dc24732889 100644 --- a/entity/SalesprojectPhaseDefinition_entity/entityfields/date_edit/valueProcess.js +++ b/entity/SalesprojectPhaseDefinition_entity/entityfields/date_edit/valueProcess.js @@ -5,7 +5,7 @@ import("system.result"); var currentDate = null; -if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) { currentUser = vars.get("$sys.date"); } diff --git a/entity/SalesprojectPhaseDefinition_entity/entityfields/date_new/valueProcess.js b/entity/SalesprojectPhaseDefinition_entity/entityfields/date_new/valueProcess.js index b4e0581883113b47c4aa2ecf96fcb2258bf87768..e1f0aceaa6c3a35ca0626bb855c090612748b7a0 100644 --- a/entity/SalesprojectPhaseDefinition_entity/entityfields/date_new/valueProcess.js +++ b/entity/SalesprojectPhaseDefinition_entity/entityfields/date_new/valueProcess.js @@ -5,7 +5,7 @@ import("system.result"); var currentDate = null; -if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { currentUser = vars.get("$sys.date"); } diff --git a/entity/SalesprojectPhaseDefinition_entity/entityfields/phase/dropDownProcess.js b/entity/SalesprojectPhaseDefinition_entity/entityfields/phase/dropDownProcess.js index 268d3b2dc5db832a404d50b25a958a9e216b8d27..ec6a82d81cac931a83fd9543f634b92bafdcfa48 100644 --- a/entity/SalesprojectPhaseDefinition_entity/entityfields/phase/dropDownProcess.js +++ b/entity/SalesprojectPhaseDefinition_entity/entityfields/phase/dropDownProcess.js @@ -4,7 +4,6 @@ import("KeywordRegistry_basic"); import("Keyword_lib"); import("Sql_lib"); - var salesprojectPhases = KeywordUtils.getEntryNamesAndIdsByContainer($KeywordRegistry.salesprojectPhase()); var dropDownEntries = []; var counter = 0; @@ -13,11 +12,12 @@ var exisitingPhases = newSelect("PHASE") .from("SALESPROJECTPHASEDEFINITION") .arrayColumn(); -salesprojectPhases.forEach(function(pSalesprojectPhase){ - - var isExistent = exisitingPhases.includes(pSalesprojectPhase[0]); +salesprojectPhases.forEach(function(pSalesprojectPhase) +{ + var doesExist = exisitingPhases.includes(pSalesprojectPhase[0]); - if (!isExistent || (vars.get("$field.PHASE") == pSalesprojectPhase[0])) { + if (!doesExist) + { dropDownEntries[counter] = [pSalesprojectPhase[0], pSalesprojectPhase[1]]; } diff --git a/entity/SalesprojectPhaseDefinition_entity/entityfields/phase/onValidation.js b/entity/SalesprojectPhaseDefinition_entity/entityfields/phase/onValidation.js index 61a58a68724cade1ca65ed289ed9a56594c2ab5c..447fe3e410ed852c9276460e2e30a394d526ca4a 100644 --- a/entity/SalesprojectPhaseDefinition_entity/entityfields/phase/onValidation.js +++ b/entity/SalesprojectPhaseDefinition_entity/entityfields/phase/onValidation.js @@ -11,14 +11,14 @@ if(thisValue != null && thisValue != "" && vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW && thisValue != vars.get("$field.PHASE")) { - var isExistent = newSelect("COUNT(*)") + var doesExist = newSelect("COUNT(*)") .from("SALESPROJECTPHASEDEFINITION") .where("SALESPROJECTPHASEDEFINITION.SALESPROJECTPHASE", localValue) .cell(); - if (isExistent > 0) + if (doesExist > 0) { - result.string(translate.text("For this salesproject phase are already traits defined.")); + result.string(translate.text("Traits have already been defined for this salesproject phase.")); } } diff --git a/entity/SalesprojectPhaseDefinition_entity/entityfields/user_edit/valueProcess.js b/entity/SalesprojectPhaseDefinition_entity/entityfields/user_edit/valueProcess.js index a55cb327464d6def9b94735913c25ffb5e4328ef..4ce39f0d7bbd26f93005bef325050028972e5d91 100644 --- a/entity/SalesprojectPhaseDefinition_entity/entityfields/user_edit/valueProcess.js +++ b/entity/SalesprojectPhaseDefinition_entity/entityfields/user_edit/valueProcess.js @@ -5,7 +5,7 @@ import("system.result"); var currentUser = null; -if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) { currentUser = vars.get("$sys.user"); } diff --git a/entity/SalesprojectPhaseDefinition_entity/entityfields/user_new/valueProcess.js b/entity/SalesprojectPhaseDefinition_entity/entityfields/user_new/valueProcess.js index 1411b9ac93e217a76a876371a2609ff9464f4997..9257fbfc206646ed188497bdcc2392fa740955a8 100644 --- a/entity/SalesprojectPhaseDefinition_entity/entityfields/user_new/valueProcess.js +++ b/entity/SalesprojectPhaseDefinition_entity/entityfields/user_new/valueProcess.js @@ -5,7 +5,7 @@ import("system.result"); var currentUser = null; -if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) { currentUser = vars.get("$sys.user"); } diff --git a/entity/SalesprojectPhaseDefinition_entity/iconIdProcess.js b/entity/SalesprojectPhaseDefinition_entity/iconIdProcess.js index b647759848390c03032e49219e04c68b5f8cf93f..87857762669d119f86eb6578f89c3d6b84251a4b 100644 --- a/entity/SalesprojectPhaseDefinition_entity/iconIdProcess.js +++ b/entity/SalesprojectPhaseDefinition_entity/iconIdProcess.js @@ -1,4 +1,4 @@ import("system.vars"); import("system.result"); -result.string("TEXT:" + vars.getString("$field.PHASE").substr(vars.getString("$field.PHASE").indexOf("PHASE",0)+5, vars.getString("$field.PHASE").length).trim()); \ No newline at end of file +result.string("TEXT:" + vars.getString("$field.PHASE.displayValue")); \ No newline at end of file diff --git a/entity/SalesprojectPhaseDefinition_entity/recordcontainers/db/recordfieldmappings/phase.displayvalue/expression.js b/entity/SalesprojectPhaseDefinition_entity/recordcontainers/db/recordfieldmappings/phase.displayvalue/expression.js index c566f14a5d945b383ff38cbe41f3b3dc01cb1c9f..d86536b1bdaa18fa89d6ab0959ad001b73a83efa 100644 --- a/entity/SalesprojectPhaseDefinition_entity/recordcontainers/db/recordfieldmappings/phase.displayvalue/expression.js +++ b/entity/SalesprojectPhaseDefinition_entity/recordcontainers/db/recordfieldmappings/phase.displayvalue/expression.js @@ -4,6 +4,5 @@ import("KeywordRegistry_basic"); import("Sql_lib"); var resolvingSql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.salesprojectPhase(), "SALESPROJECTPHASEDEFINITION.SALESPROJECTPHASE"); -//var sql = "case when SALESPROJECT_PHASE = '" + $KeywordRegistry.salesprojectPhase$offer() + "' THEN 'Offer' ELSE (" + resolvingSql.toString() + ") end"; result.string(resolvingSql); diff --git a/entity/Salesproject_entity/Salesproject_entity.aod b/entity/Salesproject_entity/Salesproject_entity.aod index 8d7dae6c6ef2e2f0fe923829348216f29c566a23..dd4447968ef70d90258931a4e7b5fc09fe711832 100644 --- a/entity/Salesproject_entity/Salesproject_entity.aod +++ b/entity/Salesproject_entity/Salesproject_entity.aod @@ -127,7 +127,6 @@ <outputFormat>#,##0.00</outputFormat> <inputFormat>#,##0.00</inputFormat> <groupable v="true" /> - <displayValueProcess>%aditoprj%/entity/Salesproject_entity/entityfields/volume/displayValueProcess.js</displayValueProcess> </entityField> <entityConsumer> <name>Organisations</name> diff --git a/entity/Salesproject_entity/entityfields/checklistentryvalues/children/checklistid_param/valueProcess.js b/entity/Salesproject_entity/entityfields/checklistentryvalues/children/checklistid_param/valueProcess.js index 7d139bbd2167e2965f317440302f3484f608b65e..2a921546e3472fda60a57aaf2f6a5a5fdcc718d4 100644 --- a/entity/Salesproject_entity/entityfields/checklistentryvalues/children/checklistid_param/valueProcess.js +++ b/entity/Salesproject_entity/entityfields/checklistentryvalues/children/checklistid_param/valueProcess.js @@ -4,7 +4,7 @@ import("KeywordRegistry_basic"); import("Sql_lib"); -var checklistId = newSelect("CHECKLIST_ID") +var checklistId = newSelect("SALESPROJECTPHASEDEFINITION.CHECKLIST_ID") .from("SALESPROJECTPHASEDEFINITION") .where("SALESPROJECTPHASEDEFINITION.PHASE", vars.get("$field.PHASE")) .cell(); diff --git a/entity/Salesproject_entity/entityfields/volume/displayValueProcess.js b/entity/Salesproject_entity/entityfields/volume/displayValueProcess.js deleted file mode 100644 index 376c72c136a831f2fb6215c6474c1918fbc798de..0000000000000000000000000000000000000000 --- a/entity/Salesproject_entity/entityfields/volume/displayValueProcess.js +++ /dev/null @@ -1,6 +0,0 @@ -import("Util_lib"); -import("system.vars"); -import("system.translate"); -import("system.result"); - -result.string(NumberUtils.formatWithCurrency(vars.get("$field.VOLUME"), translate.text("#0"), translate.text("${EURO_SIGN}"))); \ No newline at end of file diff --git a/entity/UniversalFileProcessor_entity/entityfields/drop_action/onActionProcess.js b/entity/UniversalFileProcessor_entity/entityfields/drop_action/onActionProcess.js index 07c84afdbee221f02ce2bddf07d7daa980774214..08cfe20b63ade03abbf75c5a8817b0f96059437e 100644 --- a/entity/UniversalFileProcessor_entity/entityfields/drop_action/onActionProcess.js +++ b/entity/UniversalFileProcessor_entity/entityfields/drop_action/onActionProcess.js @@ -9,7 +9,7 @@ import("system.process"); import("system.project"); import("system.plugin"); -var dbAlias = "Data_alias"; +var dbAlias = "Data_alias"; //hardcoded because of a lack of a recordcontainer var files = vars.get("$local.value"); var status = { activitiesCreated: 0, diff --git a/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/openroute/onActionProcess.js b/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/openroute/onActionProcess.js index dc5b0f07067f9de2b8ea08deebdb04d1940ce157..5d3c935ea964eefa7f20fdaf93925f7f02b57e5b 100644 --- a/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/openroute/onActionProcess.js +++ b/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/openroute/onActionProcess.js @@ -5,7 +5,6 @@ import("system.db"); import("system.text"); import("system.neon"); import("system.vars"); -import("Address_lib"); var visitAddresses = []; var addressIdStart; @@ -49,7 +48,9 @@ if(addressIdStart) var selectionRowData = vars.get("$sys.selectionRows"); var UID = selectionRowData[0].UID; var isGroup = selectionRowData[0].ISGROUP; //not Bool -var entrydateDB = datetime.toLong(UID.split("#")[1], "dd.MM.yyyy"); + +var entrydateDB = datetime.toLong(UID.split("#")[1], "dd.MM.yyyy", "UTC"); // UTC, otherwise client-timezone e.g.: "Europe/Berlin" is used. + // (result: time difference of 1 hour) if(vars.exists("$param.Entries_param") && vars.get("$param.Entries_param")) { diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index 8c4aa272cf416ead6fc2dbe2e75bb838e98d65d1..553c663568b837f780f938c8d79c797667171b8c 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -8091,6 +8091,15 @@ <entry> <key>Participant is already participating</key> </entry> + <entry> + <key>incl. Dependencies</key> + </entry> + <entry> + <key>Add %0 Observations</key> + </entry> + <entry> + <key>Traits have already been defined for this salesproject phase.</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> <sqlModels> diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index 92402864cf86208fb0cdd62e1a83dc21f2eb1200..23e6d296ea90fd1c311faa6dafe33178bbdb0377 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -78,6 +78,10 @@ <key>Restore Team</key> <value>Team wiederherstellen</value> </entry> + <entry> + <key>Communication: Mail</key> + <value>Kommunikation: E-Mail</value> + </entry> <entry> <key>The given Keyword Category Name is already used but needs to be unique</key> <value>Der angegebene Schlüsselwort Kategoriename existiert bereits, muss aber eindeutig sein</value> @@ -102,6 +106,14 @@ <key>Edit Team</key> <value>Team bearbeiten</value> </entry> + <entry> + <key>Communication: Phone</key> + <value>Kommunikation: Telefon</value> + </entry> + <entry> + <key>Communication: Link</key> + <value>Kommunikation: Webseite</value> + </entry> <entry> <key>The start date has to be before the end date.</key> <value>Das Startdatum muss vor dem Enddatum sein.</value> @@ -10680,6 +10692,22 @@ Bitte Datumseingabe prüfen</value> <key>Participant is already participating</key> <value>Teilnehmer nimmt bereits teil.</value> </entry> + <entry> + <key>incl. Dependencies</key> + <value>incl. Abhänigkeiten</value> + </entry> + <entry> + <key>Add %0 Observations</key> + <value>%0 Beobachtungen hinzufügen</value> + </entry> + <entry> + <key>Traits have already been defined for this salesproject phase.</key> + <value>Für diese Vertriebsprojektphase wurden schon Merkmale festgelegt.</value> + </entry> + <entry> + <key>Automatically</key> + <value>Automatisch</value> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index 1f52888b2bb78f99fbfb61e7bfbec898054ecf2d..9aa216250971ccfd30c03fa21ce6d2fe94f52a90 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -8193,6 +8193,15 @@ <entry> <key>Participant is already participating</key> </entry> + <entry> + <key>incl. Dependencies</key> + </entry> + <entry> + <key>Add %0 Observations</key> + </entry> + <entry> + <key>Traits have already been defined for this salesproject phase.</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/neonContext/ObservationMultiple/ObservationMultiple.aod b/neonContext/ObservationMultiple/ObservationMultiple.aod new file mode 100644 index 0000000000000000000000000000000000000000..049e52936cc40e8a4c78f426bc4078247f29a679 --- /dev/null +++ b/neonContext/ObservationMultiple/ObservationMultiple.aod @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.1"> + <name>ObservationMultiple</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <editView>ObservationMultipleEdit_view</editView> + <entity>ObservationMultiple_entity</entity> + <references> + <neonViewReference> + <name>4601f612-0fce-4195-97dc-82e05c046484</name> + <view>ObservationMultipleEdit_view</view> + </neonViewReference> + </references> +</neonContext> diff --git a/neonView/ChecklistEntryList_view/ChecklistEntryList_view.aod b/neonView/ChecklistEntryList_view/ChecklistEntryList_view.aod index 9928f472cbbf54d997ab646bf4987464c0517791..73632c6d2d8b4ad54a29ac6c390e24538aafd6a2 100644 --- a/neonView/ChecklistEntryList_view/ChecklistEntryList_view.aod +++ b/neonView/ChecklistEntryList_view/ChecklistEntryList_view.aod @@ -10,7 +10,7 @@ <children> <titledListViewTemplate> <name>titledListViewTemplate</name> - <titleField>TYPE</titleField> + <titleField>AUTO</titleField> <columns> <neonTitledListTableColumn> <name>49ad66e3-645d-489a-8bf8-d56645cf5465</name> diff --git a/neonView/ChecklistEntryMultiEdit_view/ChecklistEntryMultiEdit_view.aod b/neonView/ChecklistEntryMultiEdit_view/ChecklistEntryMultiEdit_view.aod index 5aa3bfcacebf9b5f8e7732eafb144f629d594d17..97fdc36b6fc77c2338f16f0c1efe397dd42947f3 100644 --- a/neonView/ChecklistEntryMultiEdit_view/ChecklistEntryMultiEdit_view.aod +++ b/neonView/ChecklistEntryMultiEdit_view/ChecklistEntryMultiEdit_view.aod @@ -14,7 +14,7 @@ <columns> <neonGenericMultipleTableColumn> <name>f139b472-471b-45ef-8406-f11fe052e246</name> - <entityField>TYPE</entityField> + <entityField>AUTO</entityField> </neonGenericMultipleTableColumn> <neonGenericMultipleTableColumn> <name>ed1eb021-aad1-4228-bcdf-eef2d44f53f8</name> diff --git a/neonView/ChecklistEntryValueList_view/ChecklistEntryValueList_view.aod b/neonView/ChecklistEntryValueList_view/ChecklistEntryValueList_view.aod index 1f86e623f5d6595e1b58d4abd826ef2e87dd29b3..05829b4051870bcd2759ca41cbd9c0ccd1f1178d 100644 --- a/neonView/ChecklistEntryValueList_view/ChecklistEntryValueList_view.aod +++ b/neonView/ChecklistEntryValueList_view/ChecklistEntryValueList_view.aod @@ -24,7 +24,7 @@ </neonTableColumn> <neonTableColumn> <name>35a60394-91ad-4e39-85b4-683564604e97</name> - <entityField>type</entityField> + <entityField>AUTO</entityField> </neonTableColumn> <neonTableColumn> <name>56a78ef9-dcef-4d1c-b30d-5c89f38611ec</name> diff --git a/neonView/ObservationEdit_view/ObservationEdit_view.aod b/neonView/ObservationEdit_view/ObservationEdit_view.aod index 6de89791e0f557e7b7c4c2a0e1448200c5618906..4540877e882f98774d37d42d786452ae592fe8d9 100644 --- a/neonView/ObservationEdit_view/ObservationEdit_view.aod +++ b/neonView/ObservationEdit_view/ObservationEdit_view.aod @@ -45,6 +45,10 @@ <name>c545362b-42d8-4cd5-83c8-9e4f2426c4ca</name> <entityField>TRIGGEREVENTDELETE</entityField> </entityFieldLink> + <entityFieldLink> + <name>aa93c341-578b-4da9-8ee8-2b3d9ea9e1ca</name> + <entityField>includeDependencies</entityField> + </entityFieldLink> <entityFieldLink> <name>c6fa82e2-5830-46c5-9127-e273ddf5a194</name> <entityField>NOTIFICATION_PRIO</entityField> diff --git a/neonView/ObservationMultipleEdit_view/ObservationMultipleEdit_view.aod b/neonView/ObservationMultipleEdit_view/ObservationMultipleEdit_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..a44ccaaa0822d9c91ef6d7818c09929a7ba2d39f --- /dev/null +++ b/neonView/ObservationMultipleEdit_view/ObservationMultipleEdit_view.aod @@ -0,0 +1,57 @@ +<?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.8" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.8"> + <name>ObservationMultipleEdit_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <size>SMALL</size> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <genericViewTemplate> + <name>ObserverationEditMultibleGeneric</name> + <editMode v="true" /> + <fields> + <entityFieldLink> + <name>f519c0bd-8c1c-4a8e-aba2-9bd94d70ccb0</name> + <entityField>OBSERVER</entityField> + </entityFieldLink> + <entityFieldLink> + <name>ac1990a8-fe10-4feb-93b2-7def0792c00f</name> + <entityField>OBJECT_TYPE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>86222081-5406-4a85-8c43-189166566ed1</name> + <entityField>OBJECT_FIELD</entityField> + </entityFieldLink> + <entityFieldLink> + <name>d5f4cb5d-c70d-46fd-ab78-bef71a205f37</name> + <entityField>TRIGGEREVENTINSERT</entityField> + </entityFieldLink> + <entityFieldLink> + <name>ba0cde17-7efb-481f-ae6c-6a75c2d41451</name> + <entityField>TRIGGEREVENTUPDATE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>c545362b-42d8-4cd5-83c8-9e4f2426c4ca</name> + <entityField>TRIGGEREVENTDELETE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>aa93c341-578b-4da9-8ee8-2b3d9ea9e1ca</name> + <entityField>includeDependencies</entityField> + </entityFieldLink> + <entityFieldLink> + <name>c6fa82e2-5830-46c5-9127-e273ddf5a194</name> + <entityField>NOTIFICATION_PRIO</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + <actionsViewTemplate> + <name>ObservationEditMultibleActions</name> + <actions> + <element>addObservations</element> + </actions> + </actionsViewTemplate> + </children> +</neonView> diff --git a/neonView/OfferitemFilter_view/OfferitemFilter_view.aod b/neonView/OfferitemFilter_view/OfferitemFilter_view.aod index 5986ce5aa6e394d55b2bb6249d6b72a983262e41..ce595dd9657cac28869bab3578789379dc34bb2e 100644 --- a/neonView/OfferitemFilter_view/OfferitemFilter_view.aod +++ b/neonView/OfferitemFilter_view/OfferitemFilter_view.aod @@ -16,6 +16,7 @@ <element>QUANTITY</element> <element>DISCOUNT</element> </editableColumns> + <favoriteActionGroup1>group</favoriteActionGroup1> <columns> <neonTreeTableColumn> <name>91e85f61-5e5d-48f8-aeb1-a5740ec07e25</name> @@ -79,6 +80,7 @@ <treeTableViewTemplate> <name>OfferitemsTreeTable</name> <entityField>#ENTITY</entityField> + <favoriteActionGroup1>group</favoriteActionGroup1> <columns> <neonTreeTableColumn> <name>91e85f61-5e5d-48f8-aeb1-a5740ec07e25</name> diff --git a/neonView/OrderitemFilter_view/OrderitemFilter_view.aod b/neonView/OrderitemFilter_view/OrderitemFilter_view.aod index 640f32e655c7f0719447a6a224cd4aad70b21187..5696e2e72d229266950afcc651c31daef7abcb0a 100644 --- a/neonView/OrderitemFilter_view/OrderitemFilter_view.aod +++ b/neonView/OrderitemFilter_view/OrderitemFilter_view.aod @@ -14,6 +14,7 @@ <inlineEdit v="false" /> <autoNewRow v="true" /> <entityField>#ENTITY</entityField> + <favoriteActionGroup1>group</favoriteActionGroup1> <columns> <neonTableColumn> <name>8c74810d-d127-4e64-8fbf-1b3db1835232</name> @@ -56,6 +57,7 @@ <treeTableViewTemplate> <name>Treetable</name> <entityField>#ENTITY</entityField> + <favoriteActionGroup1>group</favoriteActionGroup1> <columns> <neonTreeTableColumn> <name>d07130dd-7727-45cc-8f8c-ae5d2972d21d</name> diff --git a/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod b/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod index f48aa4fd1691d2091d0b8e3a25243074e083743e..ea1112320a62bb4d9bca624009ec4e671d5adfbd 100644 --- a/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod +++ b/preferences/_____PREFERENCES_PROJECT/_____PREFERENCES_PROJECT.aod @@ -164,6 +164,11 @@ <description>Whether the observations are enabled or not</description> <property v="false" /> </customBooleanProperty> + <customBooleanProperty> + <name>observation.isMultiselectionEnabled</name> + <description>Whether the multiselectionaction for observations are enabled or not.</description> + <property v="false" /> + </customBooleanProperty> <customStringProperty> <name>sales.vat</name> <description>Default VAT in percent</description> diff --git a/process/ChecklistEntryRegistry_basic/process.js b/process/ChecklistEntryRegistry_basic/process.js index 496eda6a2e822c72af1122829932e0e468d28d38..c274a6670e35d40a7761fe7089997a845a1997fd 100644 --- a/process/ChecklistEntryRegistry_basic/process.js +++ b/process/ChecklistEntryRegistry_basic/process.js @@ -9,8 +9,24 @@ import("KeywordRegistry_basic"); import("Sql_lib"); + /** - * Returns the matching rows, to the defined parameters. + * Provides a central place where all checklist entries with type 'AUTO' are defined. + * All defined entries has to return a object of type "ChecklistEntry". + * <p> + * This object has an attribute named: <u><b><i>verifierFn</i></u></b>. This attribute is a function, which + * expects the uid/object-rowid as param and is, how the name implies, responsible for + * verifying, whether the checklist entry is fulfilled or not. + * + * @class + * + * @example + * $ChecklistEntryRegistry.salesprojectRoleProjManager() + */ +function $ChecklistEntryRegistry(){} + +/** + * Returns the matching rows, to the defined parameters, ignoring Permissions. * * @param {String} pUid <p> * The uid of the corresponding data set. @@ -23,7 +39,8 @@ import("Sql_lib"); * @param {String} pProvider <p> * An provider for loading the rows. */ -function _getRows(pUid, pEntity, pFields, pParameters, pProvider){ +$ChecklistEntryRegistry._getRows = function(pUid, pEntity, pFields, pParameters, pProvider) +{ var config = entities.createConfigForLoadingRows() .entity(pEntity) @@ -52,22 +69,6 @@ function _getRows(pUid, pEntity, pFields, pParameters, pProvider){ return entities.getRows(config); } - -/** - * Provides a central place where all checklist entries with type 'AUTO' are defined. - * All defined entries has to return a object of type "ChecklistEntry". - * <p> - * This object has an attribute named: <u><b><i>verifierFn</i></u></b>. This attribute is a function, which - * expects the uid/object-rowid as param and is, how the name implies, responsible for - * verifying, whether the checklist entry is fulfilled or not. - * - * @class - * - * @example - * $ChecklistEntryRegistry.salesprojectRoleProjManager() - */ -function $ChecklistEntryRegistry(){} - /* * Returns you a list of all existing entries as object <br> * <i><u>(key: functionname & value: title)</u></i><br> @@ -81,7 +82,7 @@ $ChecklistEntryRegistry.getEntryList = function(){ var returnableList = {}; rawList.forEach(function(pEntry){ - if (!(pEntry == 'getEntryList')) + if (pEntry != 'getEntryList' && pEntry != '_getRows')//ignore the functions (main reason being performance) { returnableList[pEntry] = $ChecklistEntryRegistry[pEntry]().title; } @@ -100,8 +101,10 @@ $ChecklistEntryRegistry.salesprojectRoleProjManager = function(){ title: translate.text("Project team: \"Project manager\""), verifierFn: function(pSalesprojectId){ - var spRows = _getRows(pSalesprojectId, "Salesproject_entity", ["SALESPROJECTID", "MST_TEAM_ID", "PROJECTCODE"], null, "NoPhaseRequirementLoading"); - var memberRows = _getRows(null, "Member_entity", ["MEMBERROLE"], [["EnableMSTeams_param", spRows[0]["MST_TEAM_ID"]], ["ObjectRowId_param", spRows[0]["SALESPROJECTID"]]], "WithDistrictResponsibles"); + var spRows = $ChecklistEntryRegistry._getRows(pSalesprojectId, "Salesproject_entity", ["SALESPROJECTID", "MST_TEAM_ID", "PROJECTCODE"], null, "NoPhaseRequirementLoading"); + var memberRows = $ChecklistEntryRegistry._getRows(null, "Member_entity", ["MEMBERROLE"], [["EnableMSTeams_param", spRows[0]["MST_TEAM_ID"]], + ["ObjectRowId_param", spRows[0]["SALESPROJECTID"]]], "WithDistrictResponsibles"); + for (let i = 0; i < memberRows.length; i++) { if(memberRows[i]["MEMBERROLE"] == $KeywordRegistry.memberRoleProjManag()) @@ -124,8 +127,8 @@ $ChecklistEntryRegistry.salesprojectTouchpoint = function(){ title: translate.text("Touchpoint"), verifierFn: function(pSalesprojectId){ - var spRows = _getRows(pSalesprojectId, "Salesproject_entity", ["SALESPROJECTID", "MST_TEAM_ID", "PROJECTCODE"], null, "NoPhaseRequirementLoading"); - var touchpintRows = _getRows(null, "SalesprojectSource_entity", ["SALESPROJECT_TOUCHPOINTID"], [["SalesprojectId_param", pSalesprojectId]], "SalesprojectSouces"); + var spRows = $ChecklistEntryRegistry._getRows(pSalesprojectId, "Salesproject_entity", ["SALESPROJECTID", "MST_TEAM_ID", "PROJECTCODE"], null, "NoPhaseRequirementLoading"); + var touchpintRows = $ChecklistEntryRegistry._getRows(null, "SalesprojectSource_entity", ["SALESPROJECT_TOUCHPOINTID"], [["SalesprojectId_param", pSalesprojectId]], "SalesprojectSouces"); if(touchpintRows.length > 0) { return true; @@ -145,7 +148,7 @@ $ChecklistEntryRegistry.salesprojectVolume = function(){ title: translate.text("Volume"), verifierFn: function(pSalesprojectId){ - var spRows = _getRows(pSalesprojectId, "Salesproject_entity", ["VOLUME"], null, "NoPhaseRequirementLoading"); + var spRows = $ChecklistEntryRegistry._getRows(pSalesprojectId, "Salesproject_entity", ["VOLUME"], null, "NoPhaseRequirementLoading"); if(spRows[0]["VOLUME"] && spRows[0]["VOLUME"] != "") { return true; @@ -165,7 +168,7 @@ $ChecklistEntryRegistry.salesprojectProjStart = function(){ title: translate.text("Project start"), verifierFn: function(pSalesprojectId){ - var spRows = _getRows(pSalesprojectId, "Salesproject_entity", ["STARTDATE"], null, "NoPhaseRequirementLoading"); + var spRows = $ChecklistEntryRegistry._getRows(pSalesprojectId, "Salesproject_entity", ["STARTDATE"], null, "NoPhaseRequirementLoading"); if(spRows[0]["STARTDATE"] && spRows[0]["STARTDATE"] != "") { return true; @@ -185,7 +188,7 @@ $ChecklistEntryRegistry.salesprojectClassificationFields = function(){ title: translate.text("Classification fields"), verifierFn: function(pSalesprojectId){ var res = false; - var classificationRows = _getRows(null, "Classification_entity", ["VALUE"], [["ObjectType_param", "Salesproject"], ["ObjectRowid_param", pSalesprojectId]], "Classifications"); + var classificationRows = $ChecklistEntryRegistry._getRows(null, "Classification_entity", ["VALUE"], [["ObjectType_param", "Salesproject"], ["ObjectRowid_param", pSalesprojectId]], "Classifications"); if(classificationRows.length > 0) { res = true @@ -212,8 +215,8 @@ $ChecklistEntryRegistry.salesprojectRoleIntDist = function(){ title: translate.text("Project team: \"Internal distribution\""), verifierFn: function(pSalesprojectId){ - var spRows = _getRows(pSalesprojectId, "Salesproject_entity", ["SALESPROJECTID", "MST_TEAM_ID", "PROJECTCODE"], null, "NoPhaseRequirementLoading"); - var memberRows = _getRows(null, "Member_entity", ["MEMBERROLE"], [["EnableMSTeams_param", spRows[0]["MST_TEAM_ID"]], ["ObjectRowId_param", spRows[0]["SALESPROJECTID"]]], "WithDistrictResponsibles"); + var spRows = $ChecklistEntryRegistry._getRows(pSalesprojectId, "Salesproject_entity", ["SALESPROJECTID", "MST_TEAM_ID", "PROJECTCODE"], null, "NoPhaseRequirementLoading"); + var memberRows = $ChecklistEntryRegistry._getRows(null, "Member_entity", ["MEMBERROLE"], [["EnableMSTeams_param", spRows[0]["MST_TEAM_ID"]], ["ObjectRowId_param", spRows[0]["SALESPROJECTID"]]], "WithDistrictResponsibles"); for (let i = 0; i < memberRows.length; i++) { if(memberRows[i]["MEMBERROLE"] == $KeywordRegistry.memberRoleIntenDistrib()) @@ -236,9 +239,9 @@ $ChecklistEntryRegistry.salesprojectTeamRoles = function(){ title: translate.text("Project team roles"), verifierFn: function(pSalesprojectId){ - var spRows = _getRows(pSalesprojectId, "Salesproject_entity", ["SALESPROJECTID", "MST_TEAM_ID", "PROJECTCODE"], null, "NoPhaseRequirementLoading"); - var memberRows = _getRows(null, "Member_entity", ["MEMBERROLE"], [["EnableMSTeams_param", spRows[0]["MST_TEAM_ID"]], ["ObjectRowId_param", spRows[0]["SALESPROJECTID"]]], "WithDistrictResponsibles"); - var allMemberRoles = newSelect(SqlBuilder.caseWhen(newWhere("AB_KEYWORD_ENTRY.KEYID", "MEMROLEDISTRICTRESPONSIBLE")).thenString("70cbad1b-eac6-4369-ba50-4946e0fbcb3a").elseValue("AB_KEYWORD_ENTRY.KEYID")) + var spRows = $ChecklistEntryRegistry._getRows(pSalesprojectId, "Salesproject_entity", ["SALESPROJECTID", "MST_TEAM_ID", "PROJECTCODE"], null, "NoPhaseRequirementLoading"); + var memberRows = $ChecklistEntryRegistry._getRows(null, "Member_entity", ["MEMBERROLE"], [["EnableMSTeams_param", spRows[0]["MST_TEAM_ID"]], ["ObjectRowId_param", spRows[0]["SALESPROJECTID"]]], "WithDistrictResponsibles"); + var allMemberRoles = newSelect("AB_KEYWORD_ENTRY.KEYID") .from("AB_KEYWORD_ENTRY") .where("AB_KEYWORD_ENTRY.AB_KEYWORD_CATEGORY_ID", KeywordUtils.getCategoryIdByName($KeywordRegistry.MemberRole())) .arrayColumn(); @@ -273,7 +276,7 @@ $ChecklistEntryRegistry.salesprojectOfferExists = function(){ title: translate.text("Offer exists"), verifierFn: function(pSalesprojectId){ - var offerRows = _getRows(null, "Offer_entity", ["OFFERID"], [["ObjectRowId_param", pSalesprojectId], ["ObjectType_param", "Salesproject"]], "Links"); + var offerRows = $ChecklistEntryRegistry._getRows(null, "Offer_entity", ["OFFERID"], [["ObjectRowId_param", pSalesprojectId], ["ObjectType_param", "Salesproject"]], "Links"); if(offerRows.length > 0) { return true; @@ -293,7 +296,7 @@ $ChecklistEntryRegistry.salesprojectProjStart12 = function(){ title: translate.text("Project start within next 12 months"), verifierFn: function(pSalesprojectId){ - var spRows = _getRows(pSalesprojectId, "Salesproject_entity", ["STARTDATE"], null, "NoPhaseRequirementLoading"); + var spRows = $ChecklistEntryRegistry._getRows(pSalesprojectId, "Salesproject_entity", ["STARTDATE"], null, "NoPhaseRequirementLoading"); for (let i = 0; i < spRows.length; i++) { @@ -324,7 +327,7 @@ $ChecklistEntryRegistry.salesprojectOfferSent = function(){ title: translate.text("Offer sent"), verifierFn: function(pSalesprojectId){ - var offerRows = _getRows(null, "Offer_entity", ["STATUS"], [["ObjectRowId_param", pSalesprojectId], ["ObjectType_param", "Salesproject"]], "Links"); + var offerRows = $ChecklistEntryRegistry._getRows(null, "Offer_entity", ["STATUS"], [["ObjectRowId_param", pSalesprojectId], ["ObjectType_param", "Salesproject"]], "Links"); var res = false; for (let i = 0; i < offerRows.length; i++) @@ -350,7 +353,7 @@ $ChecklistEntryRegistry.salesprojectProb100 = function(){ title: translate.text("Probablity: 100%"), verifierFn: function(pSalesprojectId){ - var spRows = _getRows(pSalesprojectId, "Salesproject_entity", ["PROBABILITY"], null, "NoPhaseRequirementLoading"); + var spRows = $ChecklistEntryRegistry._getRows(pSalesprojectId, "Salesproject_entity", ["PROBABILITY"], null, "NoPhaseRequirementLoading"); if(spRows[0]["PROBABILITY"] && parseInt(spRows[0]["PROBABILITY"]) == 100) { return true; @@ -370,7 +373,7 @@ $ChecklistEntryRegistry.salesprojectStatusWon = function(){ title: translate.text("Status: \"won\""), verifierFn: function(pSalesprojectId){ - var spRows = _getRows(pSalesprojectId, "Salesproject_entity", ["STATUS"], null, "NoPhaseRequirementLoading"); + var spRows = $ChecklistEntryRegistry._getRows(pSalesprojectId, "Salesproject_entity", ["STATUS"], null, "NoPhaseRequirementLoading"); if(spRows[0]["STATUS"] && (spRows[0]["STATUS"] == $KeywordRegistry.salesprojectState$partialOrder() || spRows[0]["STATUS"] == $KeywordRegistry.salesprojectState$order())) { @@ -391,10 +394,10 @@ $ChecklistEntryRegistry.salesprojectContractExists = function(){ title: translate.text("Contract"), verifierFn: function(pSalesprojectId){ - var offerRows = _getRows(null, "Offer_entity", ["OFFERID"], [["ObjectRowId_param", pSalesprojectId], ["ObjectType_param", "Salesproject"]], "Links"); + var offerRows = $ChecklistEntryRegistry._getRows(null, "Offer_entity", ["OFFERID"], [["ObjectRowId_param", pSalesprojectId], ["ObjectType_param", "Salesproject"]], "Links"); for (let i = 0; i < offerRows.length; i++) { - var documentRows = _getRows(null, "Document_entity", ["BINDATA_UPLOAD"], [["AssignmentRowId_param", offerRows[i]["OFFERID"]], ["AssignmentTable_param", "OFFER"]], "Documents"); + var documentRows = $ChecklistEntryRegistry._getRows(null, "Document_entity", ["BINDATA_UPLOAD"], [["AssignmentRowId_param", offerRows[i]["OFFERID"]], ["AssignmentTable_param", "OFFER"]], "Documents"); if(documentRows.length>0) { return true; diff --git a/process/Contact_lib/process.js b/process/Contact_lib/process.js index 4a59839543915bbe0c16edfb2c56985efe935f15..9c3d0a46d788de699d66888adde8897756016087 100644 --- a/process/Contact_lib/process.js +++ b/process/Contact_lib/process.js @@ -582,6 +582,61 @@ ContactUtils.getCommRestrictionCount = function(pMedium, pStartDate) return firstLevel.toString() +") + ("+secondLevel.toString(); } +/** + * returns sql for filtering links, mail addresses or telephone numbers + * + * @param {String} pOperator filter operator + * @param {String} pRawvalue value that is filtered for + * @param {String} pFilterOperatorName name of the filter operator + * @param {String} pComparison comparison operator + * @param {String} pType type of communication + * + * @return {String} the resulting select + */ +ContactUtils.getCommFilter = function(pOperator, pRawvalue, pFilterOperatorName, pComparison, pType) +{ + let resultSqlCond; + let addSqlcond = " in "; + //SqlBuilder not implemented as the statement needs to be finished in the switch case + let commpart = "(select COMMUNICATION.CONTACT_ID from COMMUNICATION " + + " join AB_KEYWORD_ENTRY on AB_KEYWORD_ENTRY.KEYID = COMMUNICATION.MEDIUM_ID " + + " join AB_KEYWORD_ATTRIBUTERELATION on AB_KEYWORD_ENTRY.AB_KEYWORD_ENTRYID = AB_KEYWORD_ATTRIBUTERELATION.AB_KEYWORD_ENTRY_ID" + + " where AB_KEYWORD_ATTRIBUTERELATION.CHAR_VALUE = '" + pType + "'"; + + if (pOperator == 2) + { + addSqlcond = " not in "; + } + + resultSqlCond = "CONTACTID " + addSqlcond + commpart + " and COMMUNICATION.ADDR " + pFilterOperatorName; + + switch (pComparison) + { + case "EQUAL": + case "NOT_EQUAL": + resultSqlCond = resultSqlCond + " '" + pRawvalue + "')"; + break; + case "CONTAINS": + case "CONTAINS_NOT": + resultSqlCond = resultSqlCond + " '%" + pRawvalue + "%')"; + break; + case "STARTSWITH": + resultSqlCond = resultSqlCond + " '" + pRawvalue + "%')"; + break; + case "ENDSWITH": + resultSqlCond = resultSqlCond + " '%" + pRawvalue + "')"; + break; + case "ISNULL": + resultSqlCond = "CONTACTID not in " + commpart + ")"; + break; + case "ISNOTNULL": + resultSqlCond = resultSqlCond + ")"; + break; + } + + return resultSqlCond; +} + /** * object for handling of a single contact * provides static- and instance-functions diff --git a/process/Dependency_lib/process.js b/process/Dependency_lib/process.js index 79bfcf0f79776ec91166c5a6d075e05695b23d53..76b94543fc436be99897773a884b33279c618644 100644 --- a/process/Dependency_lib/process.js +++ b/process/Dependency_lib/process.js @@ -75,9 +75,9 @@ Dependency.defaultFunctionForRelation = function (pRelationTable, pRelationField return newSelect(pRelationTable + "." + (pSourceField || "OBJECT_ROWID")) .from(pRelationTable) - .groupBy(pRelationTable + ".OBJECT_ROWID") + .groupBy(pRelationTable + "." + pSourceField || "OBJECT_ROWID") .whereIfSet(pRelationTable + "." + pRelationField, relationFieldValue) - .and(pRelationTable + ".OBJECT_TYPE", pContext) + .andIfSet(pRelationTable + ".OBJECT_TYPE", pContext) .arrayColumn(); } } diff --git a/process/EwsClientSync_lib/process.js b/process/EwsClientSync_lib/process.js index 2366e6b5af77b5ba73399379f2f2d2c14fe88c1b..10a51f29306e076043cbfeb6122bf8df6ed99a06 100644 --- a/process/EwsClientSync_lib/process.js +++ b/process/EwsClientSync_lib/process.js @@ -107,8 +107,9 @@ EwsClientSyncUtils.prepareContactSyncTable = function(){ } try{ - let count = db.inserts(statements, "Data_alias"); - let updCount = db.updates(updStatements, "Data_alias"); + let alias = db.getCurrentAlias(); + let count = db.inserts(statements, alias); + let updCount = db.updates(updStatements, alias); } catch(exc){ logging.log(exc) diff --git a/process/Item_lib/Item_lib.aod b/process/Item_lib/Item_lib.aod new file mode 100644 index 0000000000000000000000000000000000000000..37e2a7dcc5b4a52f1634812a5b291706a93c4941 --- /dev/null +++ b/process/Item_lib/Item_lib.aod @@ -0,0 +1,9 @@ +<?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.2"> + <name>Item_lib</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <process>%aditoprj%/process/Item_lib/process.js</process> + <variants> + <element>LIBRARY</element> + </variants> +</process> diff --git a/process/Item_lib/process.js b/process/Item_lib/process.js new file mode 100644 index 0000000000000000000000000000000000000000..2fc3948ff51c2adbe65651f5ecbeef5f833af4cc --- /dev/null +++ b/process/Item_lib/process.js @@ -0,0 +1,183 @@ +import("system.logging"); +import("Sql_lib"); +import("system.db"); +import("system.neon"); + +/** + * A Utility class for the items like OfferItem and OrderItem. + * Loads all items and stores them as trees + * + * @class + */ +function MoveableItemUtils(pTargetTable, pItemIdField, pItemSortField, pItemPosField, pParentRowName, pParentRowId) { + this.targetTable = pTargetTable; + + this.itemIdField = pItemIdField; + this.itemSortField = pItemSortField; + this.itemPosField = pItemPosField; + + this.parentRowName = pParentRowName; + this.parentRowId = pParentRowId; + + var data = this.getData(); + + this.posMap = new Map(); + this.uidToPos = new Map(); + for(let i = 0; i < data.length; i++) + { + var uid = data[i][0]; + var pos = data[i][2]; + var trimmedPos = pos.replace(/(^|\.)\d*$/, ""); + + if(!this.posMap.has(pos)) + { + this.posMap.set(pos, {childs: []}); + } + + var curr = this.posMap.get(pos); + curr.uid = uid; + curr.pos = pos; + curr.parent = trimmedPos; + + if(!this.posMap.has(trimmedPos)) + { + this.posMap.set(trimmedPos, {childs: []}); + } + this.posMap.get(trimmedPos).childs.push(pos); + + this.uidToPos.set(uid, pos); + } +} + +/** + * Checks weather the item can move up + */ +MoveableItemUtils.prototype.canMoveUp = function(pItemId) +{ + var pos = this.uidToPos.get(pItemId); + var item = this.posMap.get(pos); + var parentChilds = this.posMap.get(item.parent).childs.sort(); + return parentChilds.indexOf(pos) >= 1; +} + +/** + * Checks weather the item can move down + */ +MoveableItemUtils.prototype.canMoveDown = function(pItemId) +{ + var pos = this.uidToPos.get(pItemId); + var item = this.posMap.get(pos); + var parentChilds = this.posMap.get(item.parent).childs.sort(); + return parentChilds.indexOf(pos) < parentChilds.length - 1; +} + +/** + * Moves the item up + */ +MoveableItemUtils.prototype.moveUp = function(pItemId) +{ + if(!this.canMoveUp(pItemId)) + { + throw new Error("Item can't be moved up"); + } + + var pos = this.uidToPos.get(pItemId); + var item = this.posMap.get(pos); + var parentChilds = this.posMap.get(item.parent).childs.sort(); + var idx = parentChilds.indexOf(pos); + + var upperItemPos = parentChilds[idx - 1]; + var upperItem = this.posMap.get(upperItemPos); + + var stmts = []; + this.moveItem(stmts, upperItem.uid, pos); + this.moveItem(stmts, pItemId, upperItemPos); + db.updates(stmts); + + this.updateSorting(); + neon.refreshAll(); +} + +/** + * Moves the item down + */ +MoveableItemUtils.prototype.moveDown = function(pItemId) +{ + if(!this.canMoveDown(pItemId)) + { + throw new Error("Item can't be moved down"); + } + + var pos = this.uidToPos.get(pItemId); + var item = this.posMap.get(pos); + var parentChilds = this.posMap.get(item.parent).childs.sort(); + var idx = parentChilds.indexOf(pos); + + var lowerItemPos = parentChilds[idx + 1]; + var lowerItem = this.posMap.get(lowerItemPos); + + var stmts = []; + this.moveItem(stmts, lowerItem.uid, pos); + this.moveItem(stmts, pItemId, lowerItemPos); + db.updates(stmts); + + this.updateSorting(); + neon.refreshAll(); +} + +/** + * Swaps item positions + */ +MoveableItemUtils.prototype.moveItem = function(pTargetStmts, pId, pPos) +{ + var pos = this.uidToPos.get(pId); + var item = this.posMap.get(pos); + var childs = item.childs; + + var COLUMN_NAMES = [this.itemPosField]; + var COLUMN_TYPES = db.getColumnTypes(this.targetTable, COLUMN_NAMES); + var columnValues = [pPos + pos.slice(pPos.length)]; + pTargetStmts.push([this.targetTable, COLUMN_NAMES, COLUMN_TYPES, columnValues, this.targetTable + "." + this.itemIdField + " = '" + pId + "'"]); + + for(let i = 0; i < childs.length; i++) + { + var childItem = this.posMap.get(childs[i]); + this.moveItem(pTargetStmts, childItem.uid, pPos); + } +} + +/** + * Updates the sorting + */ +MoveableItemUtils.prototype.updateSorting = function() +{ + var stmts = []; + var data = this.getData(); + var posList = data.map(function(curr) { + return curr[2]; + }).sort(); + for(let i = 0; i < data.length; i++) + { + var row = data[i]; + var expectedSort = posList.indexOf(row[2]); + if(parseInt(row[1]) != expectedSort) + { + var COLUMN_NAMES = [this.itemSortField]; + var COLUMN_TYPES = db.getColumnTypes(this.targetTable, COLUMN_NAMES); + var columnValues = [expectedSort.toFixed(0)]; + stmts.push([this.targetTable, COLUMN_NAMES, COLUMN_TYPES, columnValues, this.targetTable + "." + this.itemIdField + " = '" + row[0] + "'"]); + } + } + db.updates(stmts); +} + +/** + * Returns the item data via sql + */ +MoveableItemUtils.prototype.getData = function() +{ + return newSelect([this.itemIdField, this.itemSortField, this.itemPosField]) + .from(this.targetTable) + .where(this.targetTable + "." + this.parentRowName, this.parentRowId) + .table(); +} diff --git a/process/KeywordData_lib/process.js b/process/KeywordData_lib/process.js index a367023d23685e3bd9590be36b5e0e793de93298..f9ed4ba049025f57f20ed0bfb26fe15c0f2690c3 100644 --- a/process/KeywordData_lib/process.js +++ b/process/KeywordData_lib/process.js @@ -22,7 +22,7 @@ KeywordData.getSimpleData = function(pKeywordContainer, pLocale, pOnlyActives) var cache = new CachedData(identifier, true, pLocale); return cache.load(function(pTranslationNecessary, pLocale) { - var keywordEntrySelect = newSelect("AB_KEYWORD_ENTRY.KEYID, AB_KEYWORD_ENTRY.TITLE", "Data_alias") + var keywordEntrySelect = newSelect("AB_KEYWORD_ENTRY.KEYID, AB_KEYWORD_ENTRY.TITLE", "Data_alias") //Data_alias necessary due to calles from both system- and data-alias .from("AB_KEYWORD_ENTRY") .orderBy("AB_KEYWORD_ENTRY.SORTING asc, AB_KEYWORD_ENTRY.TITLE asc") .where("AB_KEYWORD_ENTRY.AB_KEYWORD_CATEGORY_ID", KeywordUtils.getCategoryIdByName(pKeywordContainer)); @@ -48,7 +48,7 @@ KeywordData.getSimpleData2 = function(pKeywordContainer, pLocale, pOnlyActives) var cache = new CachedData(identifier, true, pLocale); return cache.load(function(pTranslationNecessary, pLocale) { - var keywordEntrySelect = newSelect("AB_KEYWORD_ENTRY.KEYID, AB_KEYWORD_ENTRY.TITLE", "Data_alias") + var keywordEntrySelect = newSelect("AB_KEYWORD_ENTRY.KEYID, AB_KEYWORD_ENTRY.TITLE", "Data_alias") //Data_alias necessary due to calles from both system- and data-alias .from("AB_KEYWORD_ENTRY") .join("AB_KEYWORD_CATEGORY", "AB_KEYWORD_ENTRY.AB_KEYWORD_CATEGORY_ID = AB_KEYWORD_CATEGORY.AB_KEYWORD_CATEGORYID") .orderBy("AB_KEYWORD_ENTRY.SORTING asc, AB_KEYWORD_ENTRY.TITLE asc") diff --git a/process/KeywordRegistry_basic/process.js b/process/KeywordRegistry_basic/process.js index ed67820926e4e62df33ab2962a473caa1064c0bb..6a21f8cc5cb43534a0b56ab98cc8fd27245ff627 100644 --- a/process/KeywordRegistry_basic/process.js +++ b/process/KeywordRegistry_basic/process.js @@ -341,6 +341,7 @@ $KeywordRegistry.knowledgePublishLevel$public = function(){return "PUBLIC";} $KeywordRegistry.visitPlanEntryStatusAppointment = function(){return "VisitPlanEntryStatusAppointment";}; $KeywordRegistry.visitPlanEntryStatusAppointment$requested = function(){return "VISITSTATUSAPPOINTMENTREQUESTED";}; $KeywordRegistry.visitPlanEntryStatusAppointment$confirmed = function(){return "VISITSTATUSAPPOINTMENTCONFIRMED";}; +$KeywordRegistry.knowledgePublishLevel$public = function(){return "PUBLIC";} $KeywordRegistry.notificationPriority = function(){ return "NotificationPriority";}; $KeywordRegistry.notificationPriority$none = function(){ return "NONE";}; diff --git a/process/Loghistory_lib/process.js b/process/Loghistory_lib/process.js index 23b84d6651ee79d7a04a4b8670b5caddd1733bc4..ccfcde13ce112db94776dfcb587206bb0aea5dc6 100644 --- a/process/Loghistory_lib/process.js +++ b/process/Loghistory_lib/process.js @@ -36,7 +36,7 @@ import("system.entities"); */ function LogHistoryExecutor(pTable, pUser, pColumns, pNewValues, pOldValues, pTimeStamp, pAction, pIdValue) { - this.structureDefinitionAlias = "Data_alias";//alias where the definition of what shall be logged is stored + this.structureDefinitionAlias = db.getCurrentAlias();//alias where the definition of what shall be logged is stored this.oldValues = pOldValues || []; this.newValues = pNewValues || []; this.affectedTable = pTable.toUpperCase(); @@ -137,7 +137,7 @@ LogHistoryExecutor.prototype.generateLogHistory = function (pIdvalue, pExtra) } if (!somethingTolog) - return null; + return [null, null, null]; var description = []; var oldvalues = {}; diff --git a/process/MSTeams_lib/process.js b/process/MSTeams_lib/process.js index 98728cf49abc577ec16ae328b5fe1aec3c980ef2..892ed53b3e815ba9bc00dd562b43f1c06fe7781b 100644 --- a/process/MSTeams_lib/process.js +++ b/process/MSTeams_lib/process.js @@ -1,3 +1,4 @@ +import("system.db"); import("system.logging"); import("system.neon"); import("Util_lib"); @@ -308,7 +309,7 @@ MSTeamsUtils.isUserTeamOwner = function (pTeamId, pUserId) */ MSTeamsUtils.getTeamInfo = function (pTeamId) { - var teamInfo = new SqlBuilder("Data_alias") + var teamInfo = new SqlBuilder(db.getCurrentAlias()) .select(["TEAMNAME", "WEB_URL", "SERVICE_URL", "IS_ARCHIVED", "GENERAL_CHANNELID"]) .from("MST_TEAM") .whereIfSet("MST_TEAM.MST_TEAMID", pTeamId) diff --git a/process/Neon_lib/process.js b/process/Neon_lib/process.js index fd8efc5e55400e54d155278eabb1daf14db7e5bb..c9400e2255c4ec752d4be18e2d0d0ddfe10992ad 100644 --- a/process/Neon_lib/process.js +++ b/process/Neon_lib/process.js @@ -86,7 +86,7 @@ CopyModuleUtils.openNewModules = function(pNeonContext, pModulesMapping) */ CopyModuleUtils.copyModule = function(pInputMapping) { - var AliasDefinitionStructure = project.getAliasDefinitionStructure("Data_alias", null); + var AliasDefinitionStructure = project.getAliasDefinitionStructure(db.getCurrentAlias(), null); var ModulesMapping = {}; var statements = []; diff --git a/process/Observation_lib/process.js b/process/Observation_lib/process.js index 33d05fbff61766bbc813d8b56f26e96b6652bd5d..b2e80061c7b805fc9bcbfa405a8790c1bc257f5a 100644 --- a/process/Observation_lib/process.js +++ b/process/Observation_lib/process.js @@ -18,6 +18,7 @@ import("system.tools"); import("system.datetime"); import("system.db"); import("system.favorite"); +import("system.neon"); function Observation(){} @@ -257,15 +258,14 @@ Observation._notifiyUsers = function (pVariables, pObservers) if (pObservers && observers.length != 0 && pVariables) { var user = tools.getUserByAttribute(tools.NAME, pVariables[WorkflowVariables.EVENT_USER()], tools.PROFILE_DEFAULT); - var notificationCaption; + var beginNotificationDescription = (user.params.firstname + " " + user.params.lastname).trim() + " " + translate.text("has") + " "; var filteredVariables = { - notificationCaption : translate.text(notificationCaption), notificationUser : JSON.stringify(observers), notificationType : "ObservationNotification" } observers.forEach(function (pObserver) { - filteredVariables.notificationDescription = (user.params.firstname + " " + user.params.lastname).trim() + " " + translate.text("has") + " "; + filteredVariables.notificationDescription = beginNotificationDescription; // If there is a OBJECT_TYPE, this is a dependency observation if (pObservers[pObserver][Observation.OBJECT_TYPE()]) { @@ -362,8 +362,10 @@ Observation._notification = function (pVariables, pFilteredVariables, pObservers if (pFilteredVariables.notificationDescription.length > 980) { - pFilteredVariables.notificationDescription.slice(0, 980) + pFilteredVariables.notificationDescription = pFilteredVariables.notificationDescription.slice(0, 980) pFilteredVariables.notificationDescription += "....there is more data available"; + isNewDescription = true; + isfirstField = false; return; } @@ -470,47 +472,32 @@ Observation.formatFieldValue = function (pRowData, pTypes, pField) */ Observation.insertAction = function () { - let contextID = ContextUtils.getCurrentContextId(); - let observer = EmployeeUtils.getCurrentUserId(); - let rowCount = newSelect("COUNT(*)") - .from("OBSERVATION") - .where("OBSERVATION.OBJECT_TYPE", contextID) - .and("OBSERVATION.OBSERVER", observer); + let contextId = ContextUtils.getCurrentContextId(); - var fields = { - "OBJECT_TYPE" : contextID, - "OBSERVER" : observer, - "OBJECT_FIELD" : Observation.getAllFieldValue(contextID).toString() + var params = { + "ObjectType_param" : contextId } - let createRowConfig = entities.createConfigForAddingRows() - .entity("Observation_entity"); - let selectedUIDs = vars.get("$sys.selection"); - if (selectedUIDs.length){ - selectedUIDs.forEach(function (uid) - { - let tempRowCount = rowCount.copy() - .and("OBSERVATION.OBJECT_ID", uid); - - if (tempRowCount.cell() == 0) - { - fields.OBJECT_ID = uid; - entities.createRow(createRowConfig.fieldValues(fields)); - } + if (selectedUIDs.length > 1) + { + params["ObjectIds_param"] = JSON.stringify(selectedUIDs); + neon.openContext("ObservationMultiple", "ObservationMultipleEdit_view", null, neon.OPERATINGSTATE_VIEW, params); + return; - }); - } else { - let filter = Observation.getContextFilter(contextID,vars.get("$sys.filter").filter); + } + else if (selectedUIDs.length) + { + params["ObjectId_param"] = selectedUIDs[0]; + } + else + { + let filter = Observation.getContextFilter(contextId,vars.get("$sys.filter").filter); - rowCount.and("OBSERVATION.OBJECT_FILTER", filter, SqlBuilder.LIKE()); - if (rowCount.cell() == 0) - { - fields.OBJECT_FILTER = filter; - entities.createRow(createRowConfig.fieldValues(fields)); - } + params["ObjectFilter_param"] = filter; } + neon.openContext("Observation", "ObservationEdit_view", null, neon.OPERATINGSTATE_NEW, params); } /** @@ -597,16 +584,15 @@ Observation.countObservations = function (pSelectedUIDs) { let contextID = ContextUtils.getCurrentContextId(); let observer = EmployeeUtils.getCurrentUserId(); - let selectedUIDs = pSelectedUIDs.filter(function (el) { - return el; - }); + let rowCount = newSelect("COUNT(*)") .from("OBSERVATION") .where("OBSERVATION.OBJECT_TYPE", contextID) - .and("OBSERVATION.OBSERVER", observer); + .and("OBSERVATION.OBSERVER", observer) + .and("OBSERVATION.OBSERVATION_ID is null"); - if (selectedUIDs && selectedUIDs.length){ - rowCount.and("OBSERVATION.OBJECT_ID", selectedUIDs, SqlBuilder.IN()); + if (pSelectedUIDs && pSelectedUIDs.length){ + rowCount.and("OBSERVATION.OBJECT_ID", pSelectedUIDs, SqlBuilder.IN()); } else { rowCount.and("OBSERVATION.OBJECT_FILTER", Observation.getContextFilter(contextID,vars.get("$sys.filter").filter), SqlBuilder.LIKE()); } @@ -622,13 +608,19 @@ Observation.countObservations = function (pSelectedUIDs) */ Observation.actionState = function (pSelectedUIDs, pIsCancelAction) { + + let selectedUIDs = pSelectedUIDs.filter(function (el) { + return el; + }); let isEnabled = project.getPreferenceValue("custom.observation.isEnabled", "false"); - if (isEnabled == "false") + let isMultiselectionAction = project.getPreferenceValue("custom.observation.isMultiselectionEnabled", "false"); + if (isEnabled == "false" || + (isMultiselectionAction == "false" && (pSelectedUIDs && pSelectedUIDs.length) && vars.get("$sys.presentationmode") == neon.CONTEXT_PRESENTATIONMODE_FILTER)) { return neon.COMPONENTSTATE_INVISIBLE; } - let cond = pIsCancelAction ? Observation.countObservations(pSelectedUIDs) : !Observation.countObservations(pSelectedUIDs); + let cond = pIsCancelAction ? Observation.countObservations(selectedUIDs) : !Observation.countObservations(selectedUIDs); if (cond) { diff --git a/process/OfferOrder_lib/process.js b/process/OfferOrder_lib/process.js index 7d864ce3f13169c2d9a24ddbaaf93311a1b5d5bd..edecfffa185bb9a53bfa1339ff401b086bfe6c73 100644 --- a/process/OfferOrder_lib/process.js +++ b/process/OfferOrder_lib/process.js @@ -1,3 +1,6 @@ +import("Util_lib"); +import("system.entities"); +import("system.logging"); import("Contact_lib"); import("AttributeRegistry_basic"); import("system.neon"); @@ -201,12 +204,12 @@ ItemUtils.prototype.roundPrice = function(pPrice) { * @param {String[][]} additionalProductInfo additional product info, which has to be copied from the product. (e.g. INFO field is only used by offer) * has to be in the form: [[["identifier1", "DESTINATION-DB-FIELD"], ["identifier2", "PRODUCT-DB-SUBSELECT-OR-FIELD"]], ...] * @param {String} pQuantity opt quantity - * + * @param {Boolean} pSumUpPrices If true: Prices of items get summed up if no valid price exists * @return {String[]} Array of inserted ItemIDs * * @abstract */ -ItemUtils.prototype.insertPartsList = function(columns, productId, assignedTo, currency, contactId, additionalProductInfo, pQuantity) { +ItemUtils.prototype.insertPartsList = function(columns, productId, assignedTo, currency, contactId, additionalProductInfo, pQuantity, pSumUpPrices) { if (additionalProductInfo == undefined) { additionalProductInfo = [] @@ -231,7 +234,8 @@ ItemUtils.prototype.insertPartsList = function(columns, productId, assignedTo, c } var rootProdId = productId; - if (rootProdId != "") { + if (rootProdId != "") + { var p2pUtils = new Prod2ProdUtils(rootProdId); var partsList = p2pUtils.getPartsListObject(); @@ -249,7 +253,9 @@ ItemUtils.prototype.insertPartsList = function(columns, productId, assignedTo, c } columns = columns.concat(additionalProductInfo.map(function(item) {return item[0][1]})); - + var treeStructure = {}; + var productsWithSumUpPrices = {}; + var priceObject = {}; if (partsList.root != undefined) // if product has a parts list { __itemInsertStatement(partsList.root, assignedTo, currency, contactId); @@ -258,8 +264,17 @@ ItemUtils.prototype.insertPartsList = function(columns, productId, assignedTo, c if (statements.length > 0) db.inserts(statements); } - - return insertedItemIds; + if(pSumUpPrices == true) + { + return{"insertedItemIds": insertedItemIds, + "treeStructure": treeStructure, + "productsWithSumUpPrices": productsWithSumUpPrices, + "priceObject": priceObject} + } + else + { + return insertedItemIds; + } //recursive function for building item insert statements function __itemInsertStatement(partsListObj, assignedTo, currency, contactId) { @@ -279,11 +294,35 @@ ItemUtils.prototype.insertPartsList = function(columns, productId, assignedTo, c var price = ""; var vat = ""; - if (P2pObject.takeprice && ProductDetails.productId && ProductDetails.PriceListToUse) { - price = ProductDetails.PriceListToUse.price; - vat = ProductDetails.PriceListToUse.vat; + if(P2pObject.takeprice == 1 && ProductDetails.productId) + { + if (ProductDetails.PriceListToUse) + { + price = ProductDetails.PriceListToUse.price; + vat = ProductDetails.PriceListToUse.vat; + if(pSumUpPrices) + { + priceObject[newid] = {}; + priceObject[newid]["price"] = price; + priceObject[newid]["vat"] = vat; + } + + } + else if(pSumUpPrices) + { + productsWithSumUpPrices[newid] = ""; + } } + var stop = false; + var checkedElements; + var amuntOfKeys; + var itemAdded; + if(pSumUpPrices) + { + treeStructure = _buildTreeStructure(treeStructure, assignedTo, newid); + } + var vals = [newid , self.offerOrderId , prodid @@ -303,7 +342,35 @@ ItemUtils.prototype.insertPartsList = function(columns, productId, assignedTo, c statements.push([table, columns, null, vals]); insertedItemIds.push(newid); - __itemInsertStatement(partsList[p2pid], newid); + __itemInsertStatement(partsList[p2pid], newid, currency, contactId); + } + // helper function to build the tree structure so we can later sum up the prices accordingly + function _buildTreeStructure(treeObj, assignedTo, newid) + { + for (var id in treeObj) + { + if (typeof treeObj[id] == "object" && treeObj[id] !== null && id != assignedTo) + _buildTreeStructure(treeObj[id], assignedTo, newid); + else + { + if(id == assignedTo) + { + if(!treeObj.hasOwnProperty(assignedTo)) + { + treeObj[assignedTo] = {}; + } + treeObj[assignedTo][newid] = {}; + + return treeObj; + } + } + } + if(Utils.isEmpty(treeObj)) + { + treeObj[assignedTo] = {}; + treeObj[assignedTo][newid] = {}; + } + return treeObj; } } } @@ -465,11 +532,12 @@ ItemUtils.prototype.reOrgItems = function() { * * * @param {String} pProductId <p/> product Id - * + * @param {String} pUid <p/> product Id + * @param {String} pEntity <p/> product Id * @return {void} * @static */ -ItemUtils.product_IdOnValueChange = function (pProductId) +ItemUtils.product_IdOnValueChange = function (pProductId, pUid, pEntity) { var curr = vars.exists("$param.Currency_param") ? vars.get("$param.Currency_param") : ""; var contactid = vars.exists("$param.ContactId_param") ? vars.get("$param.ContactId_param") : ""; @@ -513,5 +581,5 @@ ItemUtils.product_IdOnValueChange = function (pProductId) neon.setFieldValue("$field.PRICE", ProductDetails.PriceListToUse.price); neon.setFieldValue("$field.VAT", ProductDetails.PriceListToUse.vat); } - } + } }; \ No newline at end of file diff --git a/process/Offer_lib/process.js b/process/Offer_lib/process.js index b7ba4d8bdd588b647272ad865576b5f3bd1892a9..45b1ae52d6d5ef4cd6385ef4f76aece0aed45c49 100644 --- a/process/Offer_lib/process.js +++ b/process/Offer_lib/process.js @@ -222,17 +222,18 @@ OfferUtils.buildOfferReport = function (pOfferID, pExclDiscountGroupcodes) itemData = itemData.map(function (item) { - //quantity * price - fullPrice = eMath.mulDec(parseFloat(item[9]), parseFloat(item[10])); //price without discount - - if (item[4] != "1") //optional + if (!item[5].includes(".") && item[4] != "1") //only if it's no child and its not optional { + //quantity * price + fullPrice = eMath.mulDec(parseFloat(item[9]), parseFloat(item[10])); //price without discount + //itemSum = (fullPrice * (100 - discount)) / 100 itemSum = eMath.roundDec(eMath.divDec(eMath.mulDec(fullPrice, eMath.subDec(100, item[11])), 100), 2, eMath.ROUND_HALF_EVEN); //sum of the item (with discount) sumItemSum += itemSum; //total sum (without vat) let excluded = -1 - if(pExclDiscountGroupcodes){ + if(pExclDiscountGroupcodes) + { excluded = pExclDiscountGroupcodes.indexOf(item[15]) } //vatsum = itemSum * vat / 100 @@ -242,7 +243,9 @@ OfferUtils.buildOfferReport = function (pOfferID, pExclDiscountGroupcodes) vatsum = eMath.subDec(vatsum, eMath.divDec(eMath.mulDec(vatsum, offerData[16]), "100")); } else + { vatsum = ItemUtils.prototype.getItemVAT(item[9], item[10], item[11], item[12], item[4]) + } if (item[12] > 0) sums.push([item[12], vatsum]); //MWSteuerwerte für Map vorbereiten @@ -251,7 +254,7 @@ OfferUtils.buildOfferReport = function (pOfferID, pExclDiscountGroupcodes) // sumItemSum + vat if(!printHeadDiscount) - total = eMath.addDec(sumItemSum, offerData[9]); //total sum with vat + total = eMath.addDec(sumItemSum, vatsum); //total sum with vat if (!printDiscount && item[11] > 0) printDiscount = true; @@ -554,7 +557,7 @@ OfferItemUtils.prototype.roundPrice = function(pPrice) { /** * For documentation, see class ItemUtils. */ -OfferItemUtils.prototype.insertPartsList = function(pProductId, pAssignedTo, pCurrency, pContactId, pLanguage, pQuantity) { +OfferItemUtils.prototype.insertPartsList = function(pProductId, pAssignedTo, pCurrency, pContactId, pLanguage, pQuantity, pSumUpPrices) { this.initItemTree(); var cols = ["OFFERITEMID" @@ -577,7 +580,7 @@ OfferItemUtils.prototype.insertPartsList = function(pProductId, pAssignedTo, pCu .where("DESCRIPTIONTRANSLATION.OBJECT_ROWID = PRODUCT.PRODUCTID") .and("DESCRIPTIONTRANSLATION.OBJECT_TYPE", "Product") .and("DESCRIPTIONTRANSLATION.LANG", pLanguage) - .toString() + ")"]]], pQuantity]); + .toString() + ")"]]], pQuantity, pSumUpPrices]); } diff --git a/process/PermissionCalendar_lib/process.js b/process/PermissionCalendar_lib/process.js index 5fdc9fb6c34ca9533b4bbf052e586d6f6226c608..372f85e353234519d6dd386b16772edb0b5d6c95 100644 --- a/process/PermissionCalendar_lib/process.js +++ b/process/PermissionCalendar_lib/process.js @@ -30,7 +30,7 @@ function PermissionCalendar(){} PermissionCalendar.getAlias = function() { - return "Data_alias"; + return db.getCurrentAlias(); }; /** diff --git a/process/Product_lib/process.js b/process/Product_lib/process.js index d4814f043368b48643607d1867995c2391972544..224894eabb7e4c483c02445acb3e2cee9d4a3413 100644 --- a/process/Product_lib/process.js +++ b/process/Product_lib/process.js @@ -287,7 +287,7 @@ ProductUtils.getProductDetails = function(pid, pPriceListFilter, pAdditionalProd //infividual pricelists always have the highest priority, so we loop trough and use the first one we find regardles of the rest for (var indivList in priceLists) { - if(priceLists[indivList]["relationId"] != "") + if(priceLists[indivList]["priceList"] == $KeywordRegistry.productPricelist$specialList()) { return priceLists[indivList]; } diff --git a/process/Workflow_lib/process.js b/process/Workflow_lib/process.js index 31639afe38fc1c35b729b59fd89c7c96b2b68738..e645f7a4aa67bdb71c03361840943f8e9ebfff2a 100644 --- a/process/Workflow_lib/process.js +++ b/process/Workflow_lib/process.js @@ -1,3 +1,4 @@ +import("system.db"); import("Employee_lib"); import("system.process"); import("Util_lib"); @@ -235,7 +236,7 @@ WorkflowSignalSender.eventHappened = function (pEvent, pTargetId, pTargetContext */ WorkflowSignalSender.getSignalConfig = function (pContext, pEvent) { - var signals = newSelect("SIGNAL_NAME, TRIGGER_EVENT, OBJECT_CONDITION, OBJECT_TYPE, VARIABLES", "Data_alias") + var signals = newSelect("SIGNAL_NAME, TRIGGER_EVENT, OBJECT_CONDITION, OBJECT_TYPE, VARIABLES", db.getCurrentAlias()) .from("WORKFLOWSIGNAL") .whereIfSet("WORKFLOWSIGNAL.OBJECT_TYPE", pContext) .andIfSet("WORKFLOWSIGNAL.TRIGGER_EVENT", pEvent) diff --git a/process/ewsSyncContacts_serverProcess/process.js b/process/ewsSyncContacts_serverProcess/process.js index fd420916d9172146ce5f60943ae629bf8578cd82..aed60d38cbdb1ccf856de1f22d558ece50c1a88c 100644 --- a/process/ewsSyncContacts_serverProcess/process.js +++ b/process/ewsSyncContacts_serverProcess/process.js @@ -291,7 +291,7 @@ function EWSupdateContactsForUser(pUserID, pMailBox, pAlias, pRunDate, pUser, do if(deletes.length > 0) { //delete out of sync table - db.deleteData("AB_SYNCCONTACT", " CONTACT_ID in ('" + deletes.join("', '") + "') and USER_ID = '" + pUserID + "'", "Data_alias", 300000); + db.deleteData("AB_SYNCCONTACT", " CONTACT_ID in ('" + deletes.join("', '") + "') and USER_ID = '" + pUserID + "'", db.getCurrentAlias(), 300000); //remove set favorite for those which are delted - otherwise they would appear in the next run as 'new' Contacts EwsClientSyncUtils.removeFromFavorite(deletes, pUserID); @@ -584,5 +584,5 @@ function updateADITOContactsAfterAction(pUpdateValues, pUserID) cond = "CONTACT_ID = '" + pUpdateValues[i][0] + "' and USER_ID = '" + pUserID + "'"; updArr.push(["AB_SYNCCONTACT", cols, types, vals, cond]); } - db.updates(updArr, "Data_alias", 300000); + db.updates(updArr, db.getCurrentAlias(), 300000); } diff --git a/report/Offer_report/reportData.jrxml b/report/Offer_report/reportData.jrxml index 76b33d239d03b4c903aed440ea6f8c4b5c30df50..909a49ae0c633c8db4975aad71b03479e196b122 100644 --- a/report/Offer_report/reportData.jrxml +++ b/report/Offer_report/reportData.jrxml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report1" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="e7a916c8-3f9a-497d-84bb-3909b15271ea"> - <property name="ireport.zoom" value="1.7715610000000064"/> + <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> - <property name="ireport.y" value="279"/> + <property name="ireport.y" value="0"/> <parameter name="myAddr" class="java.lang.String"/> <parameter name="Pos" class="java.lang.String"/> <parameter name="Articledescription" class="java.lang.String"/> @@ -24,7 +24,7 @@ <parameter name="OfferDeliveryTerm" class="java.lang.String"/> <parameter name="responsible" class="java.lang.String"/> <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false"> - <defaultValueExpression><![CDATA["C:\\Users\\s.neumaier\\Documents\\AditoProjects\\basic_2020.2\\report\\Offer_report\\"]]></defaultValueExpression> + <defaultValueExpression><![CDATA["C:\\Entwicklung\\0.0\\project\\basic2\\report\\Offer_report\\"]]></defaultValueExpression> </parameter> <parameter name="adito.datasource.subdata" class="java.lang.Object"/> <parameter name="SUMITEMSUM" class="java.lang.Double"/>