diff --git a/.liquibase/Data_alias/basic/2021.0.0/Visit/add_VisitPlanEntry.xml b/.liquibase/Data_alias/basic/2021.0.0/Visit/add_VisitPlanEntry.xml new file mode 100644 index 0000000000000000000000000000000000000000..d43b906d7fd2e768d5178348fc5cc29d09b5d0ec --- /dev/null +++ b/.liquibase/Data_alias/basic/2021.0.0/Visit/add_VisitPlanEntry.xml @@ -0,0 +1,10 @@ +<?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 author="c.wimmer" id="d49486a1-a935-49dd-886c-04c5be4d529e"> + <addColumn tableName="VISITPLANENTRY"> + <column name="STATUS_APPOINTMENT" type="VARCHAR(36)"/> + </addColumn> + </changeSet> +</databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/2021.0.0/Visit/add_VisitrecommendationStatus.xml b/.liquibase/Data_alias/basic/2021.0.0/Visit/add_VisitrecommendationStatus.xml new file mode 100644 index 0000000000000000000000000000000000000000..a2bd036c1d4146eca31052f506caf7d3474ea35e --- /dev/null +++ b/.liquibase/Data_alias/basic/2021.0.0/Visit/add_VisitrecommendationStatus.xml @@ -0,0 +1,10 @@ +<?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 author="c.wimmer" id="e4ab868a-6072-483c-abb3-db83ce162575"> + <addColumn tableName="VISITRECOMMENDATION"> + <column name="STATUS" type="CHAR(36)"/> + </addColumn> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2021.0.0/Visit/alter_VisitrecommendationpriorityUserNewResp.xml b/.liquibase/Data_alias/basic/2021.0.0/Visit/alter_VisitrecommendationpriorityUserNewResp.xml new file mode 100644 index 0000000000000000000000000000000000000000..c57e89387fb5f69f801d86e9110b7de0eca76700 --- /dev/null +++ b/.liquibase/Data_alias/basic/2021.0.0/Visit/alter_VisitrecommendationpriorityUserNewResp.xml @@ -0,0 +1,11 @@ +<?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 author="c.wimmer" id="c994f27c-c773-41f3-b467-aa11e27f1142"> + <addColumn tableName="VISITRECOMMENDATION"> + <column name="USER_NEW" type="NVARCHAR(50)"/> + <column name="CONTACT_PERSON_ID" type="CHAR(36)"/> + <column name="RESPONSIBLE" type="CHAR(36)"/> + </addColumn> + </changeSet> +</databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/2021.0.0/Visit/changelog.xml b/.liquibase/Data_alias/basic/2021.0.0/Visit/changelog.xml new file mode 100644 index 0000000000000000000000000000000000000000..d6346a774dad2b61c9236231ed90636d636123c6 --- /dev/null +++ b/.liquibase/Data_alias/basic/2021.0.0/Visit/changelog.xml @@ -0,0 +1,11 @@ +<?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_VisitrecommendationpriorityUserNewResp.xml"/> + <include relativeToChangelogFile="true" file="insert_VisitFrequencyAttributeUsagePers.xml"/> + <include relativeToChangelogFile="true" file="insert_VisitPlanningAttribute.xml"/> + <include relativeToChangelogFile="true" file="insert_VisitPlanEntryStatusAppointment.xml"/> + <include relativeToChangelogFile="true" file="add_VisitPlanEntry.xml"/> + <include relativeToChangelogFile="true" file="add_VisitrecommendationStatus.xml"/> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2021.0.0/Visit/insert_VisitFrequencyAttributeUsagePers.xml b/.liquibase/Data_alias/basic/2021.0.0/Visit/insert_VisitFrequencyAttributeUsagePers.xml new file mode 100644 index 0000000000000000000000000000000000000000..ac24208cb27c163c81216f8002a6766eeed109a3 --- /dev/null +++ b/.liquibase/Data_alias/basic/2021.0.0/Visit/insert_VisitFrequencyAttributeUsagePers.xml @@ -0,0 +1,12 @@ +<?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 author="c.wimmer" id="077aed97-bd93-4062-be37-78d306c4b4c6"> + <insert tableName="AB_ATTRIBUTEUSAGE"> + <column name="AB_ATTRIBUTEUSAGEID" value="23897e8d-00d5-45ff-86c7-391db0bd5cf4"/> + <column name="AB_ATTRIBUTE_ID" value="547b8b9d-88ba-4590-9e01-34d2a58116cc"/> + <column name="MAX_COUNT" valueNumeric="1"/> + <column name="OBJECT_TYPE" value="Person"/> + </insert> + </changeSet> +</databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/2021.0.0/Visit/insert_VisitPlanEntryStatusAppointment.xml b/.liquibase/Data_alias/basic/2021.0.0/Visit/insert_VisitPlanEntryStatusAppointment.xml new file mode 100644 index 0000000000000000000000000000000000000000..1319607baf5a5a22557f3482af094dba289f93bc --- /dev/null +++ b/.liquibase/Data_alias/basic/2021.0.0/Visit/insert_VisitPlanEntryStatusAppointment.xml @@ -0,0 +1,25 @@ +<?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 author="c.wimmer" id="b1bd94b5-5cef-450d-a1a3-c510984373e0"> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="70f352e7-81dc-4d44-9f12-30bfc2cc39f1"/> + <column name="KEYID" value="VISITSTATUSAPPOINTMENTREQUESTED"/> + <column name="TITLE" value="requested"/> + <column name="CONTAINER" value="VisitPlanEntryStatusAppointment"/> + <column name="SORTING" valueNumeric="0"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="1b6b5070-8028-42f9-abfd-ee64142801d1"/> + <column name="KEYID" value="VISITSTATUSAPPOINTMENTCONFIRMED"/> + <column name="TITLE" value="confirmed"/> + <column name="CONTAINER" value="VisitPlanEntryStatusAppointment"/> + <column name="SORTING" valueNumeric="1"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2021.0.0/Visit/insert_VisitPlanningAttribute.xml b/.liquibase/Data_alias/basic/2021.0.0/Visit/insert_VisitPlanningAttribute.xml new file mode 100644 index 0000000000000000000000000000000000000000..2fe3d6a38c8943ff591145dda9f1e34a99760de7 --- /dev/null +++ b/.liquibase/Data_alias/basic/2021.0.0/Visit/insert_VisitPlanningAttribute.xml @@ -0,0 +1,63 @@ +<?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 author="c.wimmer" id="f03c2c38-bf5d-411a-9b77-3050771d91f9"> + <delete tableName="AB_ATTRIBUTE"> + <where>AB_ATTRIBUTEID = ?</where> + <whereParams> + <param value="59377864-0745-4a18-8d7b-57a0491a8116" /> + </whereParams> + </delete> + <insert tableName="AB_ATTRIBUTE"> + <column name="AB_ATTRIBUTEID" value="59377864-0745-4a18-8d7b-57a0491a8116"/> + <column name="ATTRIBUTE_ACTIVE" valueNumeric="1"/> + <column name="ATTRIBUTE_NAME" value="Visit Planning"/> + <column name="ATTRIBUTE_TYPE" value="GROUP"/> + </insert> + <insert tableName="AB_ATTRIBUTE"> + <column name="AB_ATTRIBUTEID" value="e8770b60-160c-466e-af57-4f90bd6e02d7"/> + <column name="ATTRIBUTE_ACTIVE" valueNumeric="1"/> + <column name="ATTRIBUTE_NAME" value="Maturity"/> + <column name="ATTRIBUTE_PARENT_ID" value="59377864-0745-4a18-8d7b-57a0491a8116"/> + <column name="ATTRIBUTE_TYPE" value="COMBO "/> + </insert> + <insert tableName="AB_ATTRIBUTE"> + <column name="AB_ATTRIBUTEID" value="5dd9a89d-2357-4ca7-910c-4365fd338603"/> + <column name="ATTRIBUTE_ACTIVE" valueNumeric="1"/> + <column name="ATTRIBUTE_NAME" value="2 Weeks"/> + <column name="ATTRIBUTE_PARENT_ID" value="e8770b60-160c-466e-af57-4f90bd6e02d7"/> + <column name="ATTRIBUTE_TYPE" value="COMBOVALUE "/> + <column name="SORTING" valueNumeric="1"/> + </insert> + <insert tableName="AB_ATTRIBUTE"> + <column name="AB_ATTRIBUTEID" value="b0eeed9b-38a5-44b9-8fdf-dd03493380b8"/> + <column name="ATTRIBUTE_ACTIVE" valueNumeric="1"/> + <column name="ATTRIBUTE_NAME" value="1 Month"/> + <column name="ATTRIBUTE_PARENT_ID" value="e8770b60-160c-466e-af57-4f90bd6e02d7"/> + <column name="ATTRIBUTE_TYPE" value="COMBOVALUE "/> + <column name="SORTING" valueNumeric="2"/> + </insert> + <insert tableName="AB_ATTRIBUTE"> + <column name="AB_ATTRIBUTEID" value="e7ece5ea-f1f3-47de-b11a-479183e5e95a"/> + <column name="ATTRIBUTE_ACTIVE" valueNumeric="1"/> + <column name="ATTRIBUTE_NAME" value="6 Months"/> + <column name="ATTRIBUTE_PARENT_ID" value="e8770b60-160c-466e-af57-4f90bd6e02d7"/> + <column name="ATTRIBUTE_TYPE" value="COMBOVALUE "/> + <column name="SORTING" valueNumeric="3"/> + </insert> + <insert tableName="AB_ATTRIBUTE"> + <column name="AB_ATTRIBUTEID" value="49dc2a73-a58a-45b7-95d3-ce2ff21326fd"/> + <column name="ATTRIBUTE_ACTIVE" valueNumeric="1"/> + <column name="ATTRIBUTE_NAME" value="12 Months"/> + <column name="ATTRIBUTE_PARENT_ID" value="e8770b60-160c-466e-af57-4f90bd6e02d7"/> + <column name="ATTRIBUTE_TYPE" value="COMBOVALUE "/> + <column name="SORTING" valueNumeric="4"/> + </insert> + <insert tableName="AB_ATTRIBUTEUSAGE"> + <column name="AB_ATTRIBUTEUSAGEID" value="ace9e8ea-b586-4299-92ea-b12fce72e4d9"/> + <column name="AB_ATTRIBUTE_ID" value="e8770b60-160c-466e-af57-4f90bd6e02d7"/> + <column name="MAX_COUNT" valueNumeric="1"/> + <column name="OBJECT_TYPE" value="Person"/> + </insert> + </changeSet> +</databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/2021.0.0/changelog.xml b/.liquibase/Data_alias/basic/2021.0.0/changelog.xml index 68a89e3e7fe42e0da1999d5357912e1ac4e3c583..596d2498a8f91b84c17aa4fe61d6cdf1fb260235 100644 --- a/.liquibase/Data_alias/basic/2021.0.0/changelog.xml +++ b/.liquibase/Data_alias/basic/2021.0.0/changelog.xml @@ -2,4 +2,5 @@ <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="Classification/changelog.xml"/> + <include relativeToChangelogFile="true" file="Visit/changelog.xml"/> </databaseChangeLog> diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod index b876bcf50b17a9d2c7c4de1bd099860f752d5c91..a81a739efc0c54a5b8c3151861c62ae10a8f6313 100644 --- a/aliasDefinition/Data_alias/Data_alias.aod +++ b/aliasDefinition/Data_alias/Data_alias.aod @@ -14938,6 +14938,62 @@ <title></title> <description></description> </entityFieldDb> + <entityFieldDb> + <name>USER_NEW</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="50" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>CONTACT_PERSON_ID</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>RESPONSIBLE</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>STATUS</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> </entityFields> </entityDb> <entityDb> @@ -15188,6 +15244,20 @@ <title></title> <description></description> </entityFieldDb> + <entityFieldDb> + <name>STATUS_APPOINTMENT</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> </entityFields> </entityDb> <entityDb> diff --git a/entity/Activity_entity/recordcontainers/db/onDBInsert.js b/entity/Activity_entity/recordcontainers/db/onDBInsert.js index c50343f5ee151ae93ea0838053e69c138540a21b..03ba2693c5c83c04813081360c6380aa0d248181 100644 --- a/entity/Activity_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Activity_entity/recordcontainers/db/onDBInsert.js @@ -28,8 +28,12 @@ if(vars.exists("$param.VisitPlanEntryId_param") && vars.get("$param.VisitPlanEnt { var values = [$KeywordRegistry.visitPlanEntryStatus$Visitreportcreated()]; var columns = ["STATUS"]; - var update = newWhere("VISITPLANENTRY.VISITPLANENTRYID", vars.get("$param.VisitPlanEntryId_param")) + var updateEntry = newWhere("VISITPLANENTRY.VISITPLANENTRYID", vars.get("$param.VisitPlanEntryId_param")) .updateData(true, "VISITPLANENTRY", columns, null, values); + + var recommendationId = newSelect("VISITPLANENTRY.VISITRECOMMENDATION_ID").from("VISITPLANENTRY").where("VISITPLANENTRY.VISITPLANENTRYID", vars.get("$param.VisitPlanEntryId_param")) + + newWhere("VISITRECOMMENDATION.VISITRECOMMENDATIONID", recommendationId).deleteData(true, "VISITRECOMMENDATION"); } if (vars.exists("$param.InsertLinks_param") && vars.get("$param.InsertLinks_param")) diff --git a/entity/Appointment_entity/Appointment_entity.aod b/entity/Appointment_entity/Appointment_entity.aod index 2b98d6bd2c33292ef54ca82d1d5c8f624b353cbf..cb201e6b12fd623c83ca7b8eaafb29288e5b8e18 100644 --- a/entity/Appointment_entity/Appointment_entity.aod +++ b/entity/Appointment_entity/Appointment_entity.aod @@ -254,6 +254,10 @@ <name>#PROVIDER_AGGREGATES</name> <useAggregates v="true" /> </entityProvider> + <entityParameter> + <name>PresetLinks_param</name> + <expose v="true" /> + </entityParameter> <entityParameter> <name>ErrorOnPermissionDenied</name> <valueProcess>%aditoprj%/entity/Appointment_entity/entityfields/erroronpermissiondenied/valueProcess.js</valueProcess> diff --git a/entity/Appointment_entity/afterUiInit.js b/entity/Appointment_entity/afterUiInit.js index 12e19779bd85ea257cf9f67b8eba2cae0d388fa2..b018dcc372580a44982d6c1fbfccf554474ca192 100644 --- a/entity/Appointment_entity/afterUiInit.js +++ b/entity/Appointment_entity/afterUiInit.js @@ -14,4 +14,15 @@ if(vars.exists("$param.Entry_param") && vars.get("$param.Entry_param")) "OBJECTTYPE" : entry["AppLinkContext"] }); } +} + +if(vars.exists("$param.PresetLinks_param") && vars.get("$param.PresetLinks_param")) +{ + var presetLink = JSON.parse(vars.get("$param.PresetLinks_param")); + presetLink.forEach(function(link) { + neon.addRecord("AppointmentLinks", { + "OBJECTTYPE" : link[0], + "OBJECTID" : link[1] + }); + }); } \ No newline at end of file diff --git a/entity/Employee_entity/Employee_entity.aod b/entity/Employee_entity/Employee_entity.aod index c17ea53f45bca4ddb64fbf866dad9505601bb5b8..1a1e23ee1f1ae219859ec7c852cfb9d68271b8aa 100644 --- a/entity/Employee_entity/Employee_entity.aod +++ b/entity/Employee_entity/Employee_entity.aod @@ -276,6 +276,18 @@ <fieldName>Employees</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>7e6bff46-4047-49da-a5ef-40510a8255a2</name> + <entityName>VisitRecommendation_entity</entityName> + <fieldName>Employees</fieldName> + <isConsumer v="false" /> + </entityDependency> + <entityDependency> + <name>14d61385-28fb-40b2-a31a-a5764a8da2f0</name> + <entityName>VisitPlanEmployeeWeek_entity</entityName> + <fieldName>Employees</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> </entityProvider> <entityConsumer> diff --git a/entity/Employee_entity/recordcontainers/jdito/onInsert.js b/entity/Employee_entity/recordcontainers/jdito/onInsert.js index 4ad2125ac50b2285f7a4b9e73c205c510004b7e1..fef358b7702ec286242ecb653dcbf02309db38b3 100644 --- a/entity/Employee_entity/recordcontainers/jdito/onInsert.js +++ b/entity/Employee_entity/recordcontainers/jdito/onInsert.js @@ -1,30 +1,30 @@ -import("Workflow_lib"); -import("system.neon"); -import("system.vars"); -import("system.tools"); -import("Employee_lib"); - -var rowdata = vars.get("$local.rowdata"); - -var user = {}; -var params = []; //this has to be an array -params[tools.EMAIL] = rowdata["EMAIL_ADDRESS.value"]; -params[tools.CALENDARID] = rowdata["EMAIL_ADDRESS.value"]; -params[tools.DESCRIPTION] = rowdata["DESCRIPTION.value"]; -params[tools.CONTACTID] = rowdata["CONTACT_ID.value"]; -params[tools.FIRSTNAME] = rowdata["FIRSTNAME.value"]; -params[tools.LASTNAME] = rowdata["LASTNAME.value"]; -params[tools.ISACTIVE] = rowdata["ISACTIVE.value"]; -params.department = rowdata["DEPARTMENT.value"]; -params[tools.PHONE_ADDRESS] = rowdata["PHONE_ADDRESS.value"]; - -user[tools.TITLE] = rowdata["TITLE.value"]; -user[tools.PARAMS] = params; - -if (rowdata["PASSWORD.value"] && rowdata["PASSWORD.value"] == rowdata["CONFIRM_PASSWORD.value"]) -{ - user[tools.PASSWORD] = rowdata["PASSWORD.value"]; -} -tools.insertUser(user, rowdata["UID.value"]); - +import("Workflow_lib"); +import("system.neon"); +import("system.vars"); +import("system.tools"); +import("Employee_lib"); + +var rowdata = vars.get("$local.rowdata"); + +var user = {}; +var params = []; //this has to be an array +params[tools.EMAIL] = rowdata["EMAIL_ADDRESS.value"]; +params[tools.CALENDARID] = rowdata["EMAIL_ADDRESS.value"]; +params[tools.DESCRIPTION] = rowdata["DESCRIPTION.value"]; +params[tools.CONTACTID] = rowdata["CONTACT_ID.value"]; +params[tools.FIRSTNAME] = rowdata["FIRSTNAME.value"]; +params[tools.LASTNAME] = rowdata["LASTNAME.value"]; +params[tools.ISACTIVE] = rowdata["ISACTIVE.value"]; +params.department = rowdata["DEPARTMENT.value"]; +params[tools.PHONE_ADDRESS] = rowdata["PHONE_ADDRESS.value"]; + +user[tools.TITLE] = rowdata["TITLE.value"]; +user[tools.PARAMS] = params; + +if (rowdata["PASSWORD.value"] && rowdata["PASSWORD.value"] == rowdata["CONFIRM_PASSWORD.value"]) +{ + user[tools.PASSWORD] = rowdata["PASSWORD.value"]; +} +tools.insertUser(user, rowdata["UID.value"]); + WorkflowSignalSender.inserted(); \ No newline at end of file diff --git a/entity/KeywordEntry_entity/KeywordEntry_entity.aod b/entity/KeywordEntry_entity/KeywordEntry_entity.aod index d897ddd5ff1732ea13f318d6834412bf0993cd20..d4054b78086a57ff19b59201546b0f0483bebb0c 100644 --- a/entity/KeywordEntry_entity/KeywordEntry_entity.aod +++ b/entity/KeywordEntry_entity/KeywordEntry_entity.aod @@ -607,6 +607,12 @@ <fieldName>KeywordStepMedium</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>f2719502-19e8-4a24-8f3f-e4aa4dd77e70</name> + <entityName>VisitPlanEntry_entity</entityName> + <fieldName>KeywordVisitPlanEntryStatusAppointment</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> </entityProvider> <entityField> diff --git a/entity/Organisation_entity/Organisation_entity.aod b/entity/Organisation_entity/Organisation_entity.aod index 2729b04a7e15481b999f46c3765bbaf7fa86d91c..1b0fc5e0a6f097b1be2e4a280b6ce2023712a06a 100644 --- a/entity/Organisation_entity/Organisation_entity.aod +++ b/entity/Organisation_entity/Organisation_entity.aod @@ -1441,6 +1441,10 @@ <fieldName>FilterProvider</fieldName> </dependency> </entityConsumer> + <entityParameter> + <name>OnlyActive_param</name> + <expose v="true" /> + </entityParameter> </entityFields> <recordContainers> <dbRecordContainer> diff --git a/entity/Organisation_entity/entityfields/newvisitplanentry/onActionProcess.js b/entity/Organisation_entity/entityfields/newvisitplanentry/onActionProcess.js index a4b75c65374cd0c2b158597b4afc565669916962..3c74f21974a25e4f2437b5721c8cc56fe1a93548 100644 --- a/entity/Organisation_entity/entityfields/newvisitplanentry/onActionProcess.js +++ b/entity/Organisation_entity/entityfields/newvisitplanentry/onActionProcess.js @@ -4,6 +4,7 @@ import("system.vars"); var params = {}; params["NoVisitPlanEmployeeWeek_param"] = true; +params["ContactId_param"] = vars.get("$field.CONTACTID"); params["OrganisationId_param"] = vars.get("$field.CONTACTID"); neon.openContext("VisitPlanEntry", "VisitPlanEntryEdit_view", null, neon.OPERATINGSTATE_NEW, params); \ No newline at end of file diff --git a/entity/Organisation_entity/recordcontainers/db/conditionProcess.js b/entity/Organisation_entity/recordcontainers/db/conditionProcess.js index a38a50972c05d3a71887d352e767a4413d5398bb..284a5df816a268ac7887194caf4624a6579541ec 100644 --- a/entity/Organisation_entity/recordcontainers/db/conditionProcess.js +++ b/entity/Organisation_entity/recordcontainers/db/conditionProcess.js @@ -1,3 +1,4 @@ +import("KeywordRegistry_basic"); import("Employee_lib"); import("AttributeRegistry_basic"); import("Attribute_lib"); @@ -40,7 +41,9 @@ if (vars.exists("$param.ExcludedContactIds_param") && vars.get("$param.ExcludedC var excludedContacts = JSON.parse(vars.getString("$param.ExcludedContactIds_param")); cond.andIfSet("CONTACT.CONTACTID", excludedContacts, SqlBuilder.NOT_IN()) } - +if (vars.exists("$param.OnlyActive_param") && vars.get("$param.OnlyActive_param")) + cond.and("CONTACT.STATUS", $KeywordRegistry.contactStatus$active()) + cond.andIfSet("ORGANISATION.KIND", "$param.OrganisationType_param"); cond.andIfSet("CONTACT.CONTACTID", onlyShowContactIds, SqlBuilder.IN()) diff --git a/entity/Person_entity/Person_entity.aod b/entity/Person_entity/Person_entity.aod index c75998fdf577e9a4540d7860f1afb9d59fd3e9aa..ec5c4ba86dfbc45651ad2f2904b1ef484958f796 100644 --- a/entity/Person_entity/Person_entity.aod +++ b/entity/Person_entity/Person_entity.aod @@ -719,7 +719,7 @@ </entityParameter> <entityParameter> <name>OrgId_param</name> - <expose v="false" /> + <expose v="true" /> </entityParameter> <entityParameter> <name>OnlyShowContactIds_param</name> @@ -1011,189 +1011,6 @@ </entityDependency> </dependencies> </entityProvider> - <entityActionField> - <name>openEditDefaultsView</name> - <title>Edit defaults</title> - <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/openeditdefaultsview/onActionProcess.js</onActionProcess> - <iconId>VAADIN:WRENCH</iconId> - <stateProcess>%aditoprj%/entity/Person_entity/entityfields/openeditdefaultsview/stateProcess.js</stateProcess> - </entityActionField> - <entityActionField> - <name>newOffer</name> - <title>New offer</title> - <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/newoffer/onActionProcess.js</onActionProcess> - <iconId>VAADIN:CART</iconId> - <stateProcess>%aditoprj%/entity/Person_entity/entityfields/newoffer/stateProcess.js</stateProcess> - </entityActionField> - <entityActionField> - <name>newActivity</name> - <title>New activity</title> - <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/newactivity/onActionProcess.js</onActionProcess> - <iconId>VAADIN:HOURGLASS_END</iconId> - <tooltip>New activity</tooltip> - <tooltipProcess>%aditoprj%/entity/Person_entity/entityfields/newactivity/tooltipProcess.js</tooltipProcess> - </entityActionField> - <entityActionField> - <name>newTask</name> - <title>New task</title> - <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/newtask/onActionProcess.js</onActionProcess> - <iconId>VAADIN:TASKS</iconId> - </entityActionField> - <entityActionField> - <name>addToCampaign</name> - <title>Add to Campaign</title> - <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/addtocampaign/onActionProcess.js</onActionProcess> - <actionOrder v="1" /> - <iconId>NEON:GROUP_APPOINTMENT</iconId> - <stateProcess>%aditoprj%/entity/Person_entity/entityfields/addtocampaign/stateProcess.js</stateProcess> - <tooltip>Choose a campaign and a step to add the contact to a campaign</tooltip> - </entityActionField> - <entityActionGroup> - <name>filterViewActionGroup</name> - <documentation>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/documentation.adoc</documentation> - <title>Serial Actions</title> - <iconId>NEON:GROUP_APPOINTMENT</iconId> - <children> - <entityActionField> - <name>addToCampaignFromTable</name> - <title>Add to Campaign</title> - <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/addtocampaignfromtable/onActionProcess.js</onActionProcess> - <isMenuAction v="true" /> - <isObjectAction v="false" /> - <isSelectionAction v="false" /> - <iconId>NEON:GROUP_APPOINTMENT</iconId> - <stateProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/addtocampaignfromtable/stateProcess.js</stateProcess> - <tooltip>Add the selection to a campaign</tooltip> - <tooltipProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/addtocampaignfromtable/tooltipProcess.js</tooltipProcess> - </entityActionField> - <entityActionField> - <name>addToBulkMailFromTable</name> - <title>Add to Bulkmail</title> - <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/addtobulkmailfromtable/onActionProcess.js</onActionProcess> - <isObjectAction v="false" /> - <iconId>VAADIN:AT</iconId> - <stateProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/addtobulkmailfromtable/stateProcess.js</stateProcess> - <tooltipProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/addtobulkmailfromtable/tooltipProcess.js</tooltipProcess> - </entityActionField> - <entityActionField> - <name>addToSerialLetter</name> - <title>Add to serial letter</title> - <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/addtoserialletter/onActionProcess.js</onActionProcess> - <isMenuAction v="true" /> - <isObjectAction v="false" /> - <iconId>VAADIN:ENVELOPES</iconId> - <stateProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/addtoserialletter/stateProcess.js</stateProcess> - <tooltipProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/addtoserialletter/tooltipProcess.js</tooltipProcess> - </entityActionField> - <entityActionField> - <name>export</name> - <title>Export</title> - <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/export/onActionProcess.js</onActionProcess> - <isObjectAction v="false" /> - <iconId>NEON:EXPORT</iconId> - <stateProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/export/stateProcess.js</stateProcess> - <tooltip>Export fields of this table</tooltip> - <tooltipProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/export/tooltipProcess.js</tooltipProcess> - </entityActionField> - <entityActionField> - <name>startMultipleWorkflows</name> - <title>Start workflow</title> - <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/startmultipleworkflows/onActionProcess.js</onActionProcess> - <isObjectAction v="false" /> - <iconId>VAADIN:PLAY</iconId> - <stateProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/startmultipleworkflows/stateProcess.js</stateProcess> - </entityActionField> - <entityActionField> - <name>startMarketingWorkflows</name> - <title>Start marketing mailing</title> - <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/startmarketingworkflows/onActionProcess.js</onActionProcess> - <isObjectAction v="false" /> - <iconId>VAADIN:ENVELOPES</iconId> - </entityActionField> - </children> - </entityActionGroup> - <entityActionGroup> - <name>DuplicateActions</name> - <title>Duplicate actions</title> - <state>AUTO</state> - <stateProcess>%aditoprj%/entity/Person_entity/entityfields/duplicateactions/stateProcess.js</stateProcess> - <children> - <entityActionField> - <name>IntegrateSelectedIntoCurrentAction</name> - <title>Integrate selected into current contact</title> - <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/duplicateactions/children/integrateselectedintocurrentaction/onActionProcess.js</onActionProcess> - <isMenuAction v="true" /> - <isObjectAction v="false" /> - <isSelectionAction v="true" /> - <iconId>NEON:IMPORT</iconId> - <stateProcess>%aditoprj%/entity/Person_entity/entityfields/duplicateactions/children/integrateselectedintocurrentaction/stateProcess.js</stateProcess> - </entityActionField> - <entityActionField> - <name>IntegrateCurrentIntoSelectedAction</name> - <title>Integrate current into selected contact</title> - <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/duplicateactions/children/integratecurrentintoselectedaction/onActionProcess.js</onActionProcess> - <isMenuAction v="true" /> - <isObjectAction v="false" /> - <isSelectionAction v="true" /> - <iconId>NEON:EXPORT</iconId> - <stateProcess>%aditoprj%/entity/Person_entity/entityfields/duplicateactions/children/integratecurrentintoselectedaction/stateProcess.js</stateProcess> - </entityActionField> - <entityActionField> - <name>IgnoreDuplicate</name> - <title>Ignore Duplicate</title> - <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/duplicateactions/children/ignoreduplicate/onActionProcess.js</onActionProcess> - <isMenuAction v="true" /> - <isObjectAction v="false" /> - <isSelectionAction v="true" /> - <iconId>VAADIN:CLOSE</iconId> - <stateProcess>%aditoprj%/entity/Person_entity/entityfields/duplicateactions/children/ignoreduplicate/stateProcess.js</stateProcess> - </entityActionField> - <entityActionField> - <name>IgnoreWholeCluster</name> - <title>Ignore whole cluster</title> - <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/duplicateactions/children/ignorewholecluster/onActionProcess.js</onActionProcess> - <isObjectAction v="false" /> - <iconId>VAADIN:CLOSE</iconId> - <stateProcess>%aditoprj%/entity/Person_entity/entityfields/duplicateactions/children/ignorewholecluster/stateProcess.js</stateProcess> - </entityActionField> - </children> - </entityActionGroup> - <entityActionField> - <name>newEmail</name> - <title>Write email</title> - <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/newemail/onActionProcess.js</onActionProcess> - <iconId>VAADIN:AT</iconId> - <stateProcess>%aditoprj%/entity/Person_entity/entityfields/newemail/stateProcess.js</stateProcess> - </entityActionField> - <entityActionField> - <name>newAppointment</name> - <title>New appointment</title> - <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/newappointment/onActionProcess.js</onActionProcess> - <iconId>VAADIN:CALENDAR</iconId> - <stateProcess>%aditoprj%/entity/Person_entity/entityfields/newappointment/stateProcess.js</stateProcess> - <tooltip>New Appointment</tooltip> - </entityActionField> - <entityActionField> - <name>newLetter</name> - <title>New letter</title> - <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/newletter/onActionProcess.js</onActionProcess> - <iconId>VAADIN:ENVELOPE</iconId> - <stateProcess>%aditoprj%/entity/Person_entity/entityfields/newletter/stateProcess.js</stateProcess> - </entityActionField> - <entityActionField> - <name>startWorkflow</name> - <title>Start workflow</title> - <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/startworkflow/onActionProcess.js</onActionProcess> - <iconId>VAADIN:PLAY</iconId> - <stateProcess>%aditoprj%/entity/Person_entity/entityfields/startworkflow/stateProcess.js</stateProcess> - </entityActionField> - <entityActionField> - <name>openAdminView</name> - <title>Open admin view</title> - <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/openadminview/onActionProcess.js</onActionProcess> - <iconId>VAADIN:CURLY_BRACKETS</iconId> - <stateProcess>%aditoprj%/entity/Person_entity/entityfields/openadminview/stateProcess.js</stateProcess> - </entityActionField> <entityParameter> <name>OnlyShowContactIds_param</name> <expose v="true" /> @@ -1253,13 +1070,6 @@ <entityField> <name>IndexPhoneticFirstname</name> </entityField> - <entityActionField> - <name>newVisitPlanEntry</name> - <title>New Weekplanentry</title> - <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/newvisitplanentry/onActionProcess.js</onActionProcess> - <iconId>VAADIN:CAR</iconId> - <stateProcess>%aditoprj%/entity/Person_entity/entityfields/newvisitplanentry/stateProcess.js</stateProcess> - </entityActionField> <entityProvider> <name>IdFilteredActiveContacts</name> <documentation>%aditoprj%/entity/Person_entity/entityfields/idfilteredactivecontacts/documentation.adoc</documentation> @@ -1401,6 +1211,214 @@ <fieldName>OrganisationResponsibles</fieldName> </dependency> </entityConsumer> + <entityActionField> + <name>openEditDefaultsView</name> + <title>Edit defaults</title> + <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/openeditdefaultsview/onActionProcess.js</onActionProcess> + <iconId>VAADIN:WRENCH</iconId> + <stateProcess>%aditoprj%/entity/Person_entity/entityfields/openeditdefaultsview/stateProcess.js</stateProcess> + </entityActionField> + <entityActionField> + <name>newOffer</name> + <title>New offer</title> + <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/newoffer/onActionProcess.js</onActionProcess> + <iconId>VAADIN:CART</iconId> + <stateProcess>%aditoprj%/entity/Person_entity/entityfields/newoffer/stateProcess.js</stateProcess> + </entityActionField> + <entityActionField> + <name>newActivity</name> + <title>New activity</title> + <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/newactivity/onActionProcess.js</onActionProcess> + <iconId>VAADIN:HOURGLASS_END</iconId> + <tooltip>New activity</tooltip> + <tooltipProcess>%aditoprj%/entity/Person_entity/entityfields/newactivity/tooltipProcess.js</tooltipProcess> + </entityActionField> + <entityActionField> + <name>newTask</name> + <title>New task</title> + <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/newtask/onActionProcess.js</onActionProcess> + <iconId>VAADIN:TASKS</iconId> + </entityActionField> + <entityActionField> + <name>addToCampaign</name> + <title>Add to Campaign</title> + <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/addtocampaign/onActionProcess.js</onActionProcess> + <actionOrder v="1" /> + <iconId>NEON:GROUP_APPOINTMENT</iconId> + <stateProcess>%aditoprj%/entity/Person_entity/entityfields/addtocampaign/stateProcess.js</stateProcess> + <tooltip>Choose a campaign and a step to add the contact to a campaign</tooltip> + </entityActionField> + <entityActionGroup> + <name>filterViewActionGroup</name> + <documentation>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/documentation.adoc</documentation> + <title>Serial Actions</title> + <iconId>NEON:GROUP_APPOINTMENT</iconId> + <children> + <entityActionField> + <name>addToCampaignFromTable</name> + <title>Add to Campaign</title> + <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/addtocampaignfromtable/onActionProcess.js</onActionProcess> + <isMenuAction v="true" /> + <isObjectAction v="false" /> + <isSelectionAction v="false" /> + <iconId>NEON:GROUP_APPOINTMENT</iconId> + <stateProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/addtocampaignfromtable/stateProcess.js</stateProcess> + <tooltip>Add the selection to a campaign</tooltip> + <tooltipProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/addtocampaignfromtable/tooltipProcess.js</tooltipProcess> + </entityActionField> + <entityActionField> + <name>addToBulkMailFromTable</name> + <title>Add to Bulkmail</title> + <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/addtobulkmailfromtable/onActionProcess.js</onActionProcess> + <isObjectAction v="false" /> + <iconId>VAADIN:AT</iconId> + <stateProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/addtobulkmailfromtable/stateProcess.js</stateProcess> + <tooltipProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/addtobulkmailfromtable/tooltipProcess.js</tooltipProcess> + </entityActionField> + <entityActionField> + <name>addToSerialLetter</name> + <title>Add to serial letter</title> + <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/addtoserialletter/onActionProcess.js</onActionProcess> + <isMenuAction v="true" /> + <isObjectAction v="false" /> + <iconId>VAADIN:ENVELOPES</iconId> + <stateProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/addtoserialletter/stateProcess.js</stateProcess> + <tooltipProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/addtoserialletter/tooltipProcess.js</tooltipProcess> + </entityActionField> + <entityActionField> + <name>export</name> + <title>Export</title> + <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/export/onActionProcess.js</onActionProcess> + <isObjectAction v="false" /> + <iconId>NEON:EXPORT</iconId> + <stateProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/export/stateProcess.js</stateProcess> + <tooltip>Export fields of this table</tooltip> + <tooltipProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/export/tooltipProcess.js</tooltipProcess> + </entityActionField> + <entityActionField> + <name>startMultipleWorkflows</name> + <title>Start workflow</title> + <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/startmultipleworkflows/onActionProcess.js</onActionProcess> + <isObjectAction v="false" /> + <iconId>VAADIN:PLAY</iconId> + <stateProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/startmultipleworkflows/stateProcess.js</stateProcess> + </entityActionField> + <entityActionField> + <name>startMarketingWorkflows</name> + <title>Start marketing mailing</title> + <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/startmarketingworkflows/onActionProcess.js</onActionProcess> + <isObjectAction v="false" /> + <iconId>VAADIN:ENVELOPES</iconId> + </entityActionField> + </children> + </entityActionGroup> + <entityActionGroup> + <name>DuplicateActions</name> + <title>Duplicate actions</title> + <state>AUTO</state> + <stateProcess>%aditoprj%/entity/Person_entity/entityfields/duplicateactions/stateProcess.js</stateProcess> + <children> + <entityActionField> + <name>IntegrateSelectedIntoCurrentAction</name> + <title>Integrate selected into current contact</title> + <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/duplicateactions/children/integrateselectedintocurrentaction/onActionProcess.js</onActionProcess> + <isMenuAction v="true" /> + <isObjectAction v="false" /> + <isSelectionAction v="true" /> + <iconId>NEON:IMPORT</iconId> + <stateProcess>%aditoprj%/entity/Person_entity/entityfields/duplicateactions/children/integrateselectedintocurrentaction/stateProcess.js</stateProcess> + </entityActionField> + <entityActionField> + <name>IntegrateCurrentIntoSelectedAction</name> + <title>Integrate current into selected contact</title> + <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/duplicateactions/children/integratecurrentintoselectedaction/onActionProcess.js</onActionProcess> + <isMenuAction v="true" /> + <isObjectAction v="false" /> + <isSelectionAction v="true" /> + <iconId>NEON:EXPORT</iconId> + <stateProcess>%aditoprj%/entity/Person_entity/entityfields/duplicateactions/children/integratecurrentintoselectedaction/stateProcess.js</stateProcess> + </entityActionField> + <entityActionField> + <name>IgnoreDuplicate</name> + <title>Ignore Duplicate</title> + <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/duplicateactions/children/ignoreduplicate/onActionProcess.js</onActionProcess> + <isMenuAction v="true" /> + <isObjectAction v="false" /> + <isSelectionAction v="true" /> + <iconId>VAADIN:CLOSE</iconId> + <stateProcess>%aditoprj%/entity/Person_entity/entityfields/duplicateactions/children/ignoreduplicate/stateProcess.js</stateProcess> + </entityActionField> + <entityActionField> + <name>IgnoreWholeCluster</name> + <title>Ignore whole cluster</title> + <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/duplicateactions/children/ignorewholecluster/onActionProcess.js</onActionProcess> + <isObjectAction v="false" /> + <iconId>VAADIN:CLOSE</iconId> + <stateProcess>%aditoprj%/entity/Person_entity/entityfields/duplicateactions/children/ignorewholecluster/stateProcess.js</stateProcess> + </entityActionField> + </children> + </entityActionGroup> + <entityActionField> + <name>newEmail</name> + <title>Write email</title> + <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/newemail/onActionProcess.js</onActionProcess> + <iconId>VAADIN:AT</iconId> + <stateProcess>%aditoprj%/entity/Person_entity/entityfields/newemail/stateProcess.js</stateProcess> + </entityActionField> + <entityActionField> + <name>newAppointment</name> + <title>New appointment</title> + <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/newappointment/onActionProcess.js</onActionProcess> + <iconId>VAADIN:CALENDAR</iconId> + <stateProcess>%aditoprj%/entity/Person_entity/entityfields/newappointment/stateProcess.js</stateProcess> + <tooltip>New Appointment</tooltip> + </entityActionField> + <entityActionField> + <name>newLetter</name> + <title>New letter</title> + <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/newletter/onActionProcess.js</onActionProcess> + <iconId>VAADIN:ENVELOPE</iconId> + <stateProcess>%aditoprj%/entity/Person_entity/entityfields/newletter/stateProcess.js</stateProcess> + </entityActionField> + <entityActionField> + <name>startWorkflow</name> + <title>Start workflow</title> + <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/startworkflow/onActionProcess.js</onActionProcess> + <iconId>VAADIN:PLAY</iconId> + <stateProcess>%aditoprj%/entity/Person_entity/entityfields/startworkflow/stateProcess.js</stateProcess> + </entityActionField> + <entityActionField> + <name>openAdminView</name> + <title>Open admin view</title> + <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/openadminview/onActionProcess.js</onActionProcess> + <iconId>VAADIN:CURLY_BRACKETS</iconId> + <stateProcess>%aditoprj%/entity/Person_entity/entityfields/openadminview/stateProcess.js</stateProcess> + </entityActionField> + <entityActionField> + <name>newVisitrecommendation</name> + <title>New Visit Recommendation</title> + <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/newvisitrecommendation/onActionProcess.js</onActionProcess> + <iconId>VAADIN:CALENDAR</iconId> + <stateProcess>%aditoprj%/entity/Person_entity/entityfields/newvisitrecommendation/stateProcess.js</stateProcess> + </entityActionField> + <entityActionField> + <name>newVisitPlanEntry</name> + <title>New Weekplanentry</title> + <onActionProcess>%aditoprj%/entity/Person_entity/entityfields/newvisitplanentry/onActionProcess.js</onActionProcess> + <iconId>VAADIN:CAR</iconId> + <stateProcess>%aditoprj%/entity/Person_entity/entityfields/newvisitplanentry/stateProcess.js</stateProcess> + </entityActionField> + <entityProvider> + <name>ebdb88f5-f030-426c-b261-9f3828d19356</name> + <dependencies> + <entityDependency> + <name>511f3e4c-7493-4a31-a136-0ba80ba2ec85</name> + <entityName>Member_entity</entityName> + <fieldName>Contacts</fieldName> + <isConsumer v="false" /> + </entityDependency> + </dependencies> + </entityProvider> <entityConsumer> <name>Orders</name> <documentation>%aditoprj%/entity/Person_entity/entityfields/orders/documentation.adoc</documentation> diff --git a/entity/Person_entity/entityfields/newvisitplanentry/onActionProcess.js b/entity/Person_entity/entityfields/newvisitplanentry/onActionProcess.js index f32b45bbbf4dcad4715cdee536fa1326f7bb3ae3..3c74f21974a25e4f2437b5721c8cc56fe1a93548 100644 --- a/entity/Person_entity/entityfields/newvisitplanentry/onActionProcess.js +++ b/entity/Person_entity/entityfields/newvisitplanentry/onActionProcess.js @@ -5,5 +5,6 @@ var params = {}; params["NoVisitPlanEmployeeWeek_param"] = true; params["ContactId_param"] = vars.get("$field.CONTACTID"); +params["OrganisationId_param"] = vars.get("$field.CONTACTID"); neon.openContext("VisitPlanEntry", "VisitPlanEntryEdit_view", null, neon.OPERATINGSTATE_NEW, params); \ No newline at end of file diff --git a/entity/Person_entity/entityfields/newvisitrecommendation/onActionProcess.js b/entity/Person_entity/entityfields/newvisitrecommendation/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..20eba0e1aca21c0349ba3eb04313ac6985330162 --- /dev/null +++ b/entity/Person_entity/entityfields/newvisitrecommendation/onActionProcess.js @@ -0,0 +1,15 @@ +import("system.logging"); +import("Sql_lib"); +import("system.neon"); +import("system.vars"); + +var personContactId = vars.getString("$field.CONTACTID"); +var params = {}; + +var orgId = newSelect("CONTACT.ORGANISATION_ID").from("CONTACT").where("CONTACT.CONTACTID", personContactId).cell(); +var orgContactId = newSelect("CONTACT.CONTACTID").from("CONTACT").where("CONTACT.ORGANISATION_ID", orgId).and("CONTACT.PERSON_ID is null").cell(); + +params["ContactIdPerson_param"] = personContactId; +params["ContactId_param"] = orgContactId; + +neon.openContext("VisitRecommendation", null, null, neon.OPERATINGSTATE_NEW, params); \ No newline at end of file diff --git a/entity/Person_entity/entityfields/newvisitrecommendation/stateProcess.js b/entity/Person_entity/entityfields/newvisitrecommendation/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..aefbc6e8f76f99c4281890f3461553c49562d5b9 --- /dev/null +++ b/entity/Person_entity/entityfields/newvisitrecommendation/stateProcess.js @@ -0,0 +1,7 @@ +import("system.result"); +import("system.neon"); +import("system.vars"); +import("KeywordRegistry_basic"); + +if (vars.get("$field.STATUS") == $KeywordRegistry.contactStatus$inactive()) + result.string(neon.COMPONENTSTATE_DISABLED); \ No newline at end of file diff --git a/entity/Person_entity/recordcontainers/db/recordfieldmappings/visitplan_prio.displayvalue/expression.js b/entity/Person_entity/recordcontainers/db/recordfieldmappings/visitplan_prio.displayvalue/expression.js new file mode 100644 index 0000000000000000000000000000000000000000..ad8d13c1e089db8b279c05cd15f15dd77263dfbf --- /dev/null +++ b/entity/Person_entity/recordcontainers/db/recordfieldmappings/visitplan_prio.displayvalue/expression.js @@ -0,0 +1,6 @@ +import("system.result"); +import("system.vars"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +result.string(KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.visitRecommendationPriority(), "PERSON.VISITPLAN_PRIO")); diff --git a/entity/VisitPlanEmployeeWeek_entity/VisitPlanEmployeeWeek_entity.aod b/entity/VisitPlanEmployeeWeek_entity/VisitPlanEmployeeWeek_entity.aod index d7e664a23695770a983a66ae5599360454629498..6b93b13e76777649aa073891128d32196d4db339 100644 --- a/entity/VisitPlanEmployeeWeek_entity/VisitPlanEmployeeWeek_entity.aod +++ b/entity/VisitPlanEmployeeWeek_entity/VisitPlanEmployeeWeek_entity.aod @@ -18,15 +18,22 @@ <entityField> <name>YEAR</name> <title>Year</title> - <resolution>YEAR</resolution> + <contentType>NUMBER</contentType> + <outputFormat>##00</outputFormat> + <inputFormat>##00</inputFormat> + <groupable v="true" /> + <mandatory v="true" /> <valueProcess>%aditoprj%/entity/VisitPlanEmployeeWeek_entity/entityfields/year/valueProcess.js</valueProcess> <onValidation>%aditoprj%/entity/VisitPlanEmployeeWeek_entity/entityfields/year/onValidation.js</onValidation> </entityField> <entityField> <name>WEEK</name> <title>Week</title> + <groupable v="true" /> + <mandatory v="true" /> <dropDownProcess>%aditoprj%/entity/VisitPlanEmployeeWeek_entity/entityfields/week/dropDownProcess.js</dropDownProcess> <valueProcess>%aditoprj%/entity/VisitPlanEmployeeWeek_entity/entityfields/week/valueProcess.js</valueProcess> + <onValidation>%aditoprj%/entity/VisitPlanEmployeeWeek_entity/entityfields/week/onValidation.js</onValidation> </entityField> <entityField> <name>INFO</name> @@ -35,8 +42,12 @@ <entityField> <name>CONTACT_ID</name> <title>Employee</title> - <state>INVISIBLE</state> + <consumer>Employees</consumer> + <groupable v="true" /> + <linkedContext>Person</linkedContext> + <state>AUTO</state> <valueProcess>%aditoprj%/entity/VisitPlanEmployeeWeek_entity/entityfields/contact_id/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/VisitPlanEmployeeWeek_entity/entityfields/contact_id/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>icon</name> @@ -99,12 +110,25 @@ <name>#PROVIDER_AGGREGATES</name> <useAggregates v="true" /> </entityProvider> + <entityConsumer> + <name>Employees</name> + <children> + <entityParameter> + <name>OnlyActives_param</name> + <valueProcess>%aditoprj%/entity/VisitPlanEmployeeWeek_entity/entityfields/employees/children/onlyactives_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + <dependency> + <name>dependency</name> + <entityName>Employee_entity</entityName> + <fieldName>Employees</fieldName> + </dependency> + </entityConsumer> </entityFields> <recordContainers> <dbRecordContainer> <name>db</name> <alias>Data_alias</alias> - <conditionProcess>%aditoprj%/entity/VisitPlanEmployeeWeek_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <orderClauseProcess>%aditoprj%/entity/VisitPlanEmployeeWeek_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> <linkInformation> <linkInformation> @@ -123,10 +147,12 @@ <dbRecordFieldMapping> <name>YEAR.value</name> <recordfield>VISITPLANEMPLOYEEWEEK.VISITPLAN_YEAR</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>WEEK.value</name> <recordfield>VISITPLANEMPLOYEEWEEK.VISITPLAN_WEEK</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>INFO.value</name> @@ -135,7 +161,12 @@ <dbRecordFieldMapping> <name>CONTACT_ID.value</name> <recordfield>VISITPLANEMPLOYEEWEEK.CONTACT_ID</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> + <consumerMapping> + <name>Employees</name> + <isFilterable v="false" /> + </consumerMapping> </recordFieldMappings> </dbRecordContainer> </recordContainers> diff --git a/entity/VisitPlanEmployeeWeek_entity/entityfields/contact_id/displayValueProcess.js b/entity/VisitPlanEmployeeWeek_entity/entityfields/contact_id/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..edca7faf0b2b011d95ec2f010108b663eaf20d33 --- /dev/null +++ b/entity/VisitPlanEmployeeWeek_entity/entityfields/contact_id/displayValueProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("Contact_lib"); +import("system.result"); + +result.string(ContactUtils.getFullTitleByContactId(vars.get("$field.CONTACT_ID"), false)); \ No newline at end of file diff --git a/entity/VisitPlanEmployeeWeek_entity/entityfields/employees/children/onlyactives_param/valueProcess.js b/entity/VisitPlanEmployeeWeek_entity/entityfields/employees/children/onlyactives_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..599bfc35195077f2fb171156ddaf1faddd9b3254 --- /dev/null +++ b/entity/VisitPlanEmployeeWeek_entity/entityfields/employees/children/onlyactives_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string(true) \ No newline at end of file diff --git a/entity/VisitPlanEmployeeWeek_entity/entityfields/week/onValidation.js b/entity/VisitPlanEmployeeWeek_entity/entityfields/week/onValidation.js new file mode 100644 index 0000000000000000000000000000000000000000..b16c0d7eda66954a018dfe07f5d95dfb32a83577 --- /dev/null +++ b/entity/VisitPlanEmployeeWeek_entity/entityfields/week/onValidation.js @@ -0,0 +1,22 @@ +import("system.result"); +import("Sql_lib"); +import("system.neon"); +import("system.eMath"); +import("system.vars"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +{ + var year = eMath.absInt(vars.get("$field.YEAR")); + var week = vars.get("$local.value"); + var user = vars.get("$field.CONTACT_ID"); + + var weekEntry = newSelect("VISITPLANEMPLOYEEWEEKID") + .from("VISITPLANEMPLOYEEWEEK") + .where("VISITPLANEMPLOYEEWEEK.VISITPLAN_YEAR", year) + .and("VISITPLANEMPLOYEEWEEK.VISITPLAN_WEEK", week) + .and("VISITPLANEMPLOYEEWEEK.CONTACT_ID", user) + .cell(); + + if(weekEntry) + result.string("Weekplan already exists!"); +} \ No newline at end of file diff --git a/entity/VisitPlanEmployeeWeek_entity/entityfields/year/onValidation.js b/entity/VisitPlanEmployeeWeek_entity/entityfields/year/onValidation.js index efe1ad7a3f2a0e8f24c0d5243d9e5cf21e13163b..36df8e4197e4e63aededc90180b62d6ec83db7f0 100644 --- a/entity/VisitPlanEmployeeWeek_entity/entityfields/year/onValidation.js +++ b/entity/VisitPlanEmployeeWeek_entity/entityfields/year/onValidation.js @@ -4,7 +4,7 @@ import("system.translate"); import("system.vars"); import("system.result"); -var year = eMath.absInt(vars.get("$local.value")); //input -var currentYear = eMath.absInt(datetime.toDate(vars.get("$sys.date"), "yyyy"));//2019 +var year = eMath.absInt(vars.get("$local.value")); +var currentYear = eMath.absInt(datetime.toDate(vars.get("$sys.date"), "yyyy")); if(year < currentYear || year >= 10000 ) result.string(translate.text("Invalid year!")); diff --git a/entity/VisitPlanEmployeeWeek_entity/entityfields/year/valueProcess.js b/entity/VisitPlanEmployeeWeek_entity/entityfields/year/valueProcess.js index c79b83acb5a542cb7b197d5e7eae812502f4a67f..f58c37080a73ef9fe822bc9bd0f75c1a32bf7f69 100644 --- a/entity/VisitPlanEmployeeWeek_entity/entityfields/year/valueProcess.js +++ b/entity/VisitPlanEmployeeWeek_entity/entityfields/year/valueProcess.js @@ -4,6 +4,5 @@ import("system.result"); import("system.neon"); import("system.vars"); -//use current year if recordstate = new and this field empty if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) result.string(datetime.toDate(vars.get("$sys.date"), "yyyy")); \ No newline at end of file diff --git a/entity/VisitPlanEmployeeWeek_entity/recordcontainers/db/conditionProcess.js b/entity/VisitPlanEmployeeWeek_entity/recordcontainers/db/conditionProcess.js deleted file mode 100644 index dfed3430a9ea724ab52316ad51e4bbf11129d2ae..0000000000000000000000000000000000000000 --- a/entity/VisitPlanEmployeeWeek_entity/recordcontainers/db/conditionProcess.js +++ /dev/null @@ -1,10 +0,0 @@ -import("system.logging"); -import("Sql_lib"); -import("Employee_lib"); -import("system.result"); - -var cond = newWhere(); - -cond.and("VISITPLANEMPLOYEEWEEK.CONTACT_ID", EmployeeUtils.getCurrentContactId()); - -result.string(cond); \ No newline at end of file diff --git a/entity/VisitPlanEntry_entity/VisitPlanEntry_entity.aod b/entity/VisitPlanEntry_entity/VisitPlanEntry_entity.aod index bdb4144e03c7d3d3c6c658e28403f3bc6eb03818..3efac8736808923f7b6f7f71f618f59517fbf5c9 100644 --- a/entity/VisitPlanEntry_entity/VisitPlanEntry_entity.aod +++ b/entity/VisitPlanEntry_entity/VisitPlanEntry_entity.aod @@ -8,6 +8,7 @@ <grantUpdateProcess>%aditoprj%/entity/VisitPlanEntry_entity/grantUpdateProcess.js</grantUpdateProcess> <grantDeleteProcess>%aditoprj%/entity/VisitPlanEntry_entity/grantDeleteProcess.js</grantDeleteProcess> <onValidation>%aditoprj%/entity/VisitPlanEntry_entity/onValidation.js</onValidation> + <afterSave>%aditoprj%/entity/VisitPlanEntry_entity/afterSave.js</afterSave> <titlePlural></titlePlural> <recordContainer>jDito</recordContainer> <entityFields> @@ -26,6 +27,7 @@ <name>STATUS</name> <title>Status</title> <consumer>KeywordVisitPlanEntryStatus</consumer> + <state>INVISIBLE</state> <valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/status/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/status/displayValueProcess.js</displayValueProcess> </entityField> @@ -47,6 +49,15 @@ <outputFormat>dd.MM.yyyy</outputFormat> <inputFormat>dd.MM.yyyy</inputFormat> <mandatory v="true" /> + <valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/entrydate/valueProcess.js</valueProcess> + <onValueChange>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/entrydate/onValueChange.js</onValueChange> + <onValueChangeTypes> + <element>MASK</element> + <element>PROCESS</element> + <element>PROCESS_SETVALUE</element> + <element>RECORD</element> + </onValueChangeTypes> + <onValidation>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/entrydate/onValidation.js</onValidation> </entityField> <entityField> <name>END_TIME</name> @@ -58,6 +69,11 @@ <mandatory v="true" /> <dropDownProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/end_time/dropDownProcess.js</dropDownProcess> <valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/end_time/valueProcess.js</valueProcess> + <onValueChangeTypes> + <element>MASK</element> + <element>PROCESS</element> + <element>PROCESS_SETVALUE</element> + </onValueChangeTypes> </entityField> <entityField> <name>BEGIN_TIME</name> @@ -69,6 +85,10 @@ <mandatory v="true" /> <dropDownProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/begin_time/dropDownProcess.js</dropDownProcess> <valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/begin_time/valueProcess.js</valueProcess> + <onValueChange>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/begin_time/onValueChange.js</onValueChange> + <onValueChangeTypes> + <element>MASK</element> + </onValueChangeTypes> </entityField> <entityActionGroup> <name>entityActionGroup</name> @@ -91,7 +111,7 @@ <title>New Appointment</title> <onActionProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newappointment/onActionProcess.js</onActionProcess> <iconId>VAADIN:CALENDAR</iconId> - <state>AUTO</state> + <state>EDITABLE</state> <stateProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newappointment/stateProcess.js</stateProcess> <tooltip>Create new Appointment</tooltip> <tooltipProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newappointment/tooltipProcess.js</tooltipProcess> @@ -110,6 +130,12 @@ </entityActionGroup> <entityConsumer> <name>Organisations</name> + <children> + <entityParameter> + <name>OnlyActive_param</name> + <valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/organisations/children/onlyactive_param/valueProcess.js</valueProcess> + </entityParameter> + </children> <dependency> <name>dependency</name> <entityName>Organisation_entity</entityName> @@ -162,6 +188,7 @@ </entityField> <entityField> <name>VISITRECOMMENDATION_ID</name> + <valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/visitrecommendation_id/valueProcess.js</valueProcess> </entityField> <entityField> <name>APPOINTMENT_ID</name> @@ -188,19 +215,26 @@ <name>Persons</name> <children> <entityParameter> - <name>ExcludedContactIds_param</name> + <name>OrgId_param</name> + <valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/persons/children/orgid_param/valueProcess.js</valueProcess> <expose v="true" /> </entityParameter> - <entityParameter> - <name>OnlyShowContactIds_param</name> - <valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/persons/children/onlyshowcontactids_param/valueProcess.js</valueProcess> - </entityParameter> </children> <dependency> <name>dependency</name> <entityName>Person_entity</entityName> <fieldName>Contacts</fieldName> </dependency> + <children> + <entityParameter> + <name>ExcludedContactIds_param</name> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>OnlyShowContactIds_param</name> + <valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/persons/children/onlyshowcontactids_param/valueProcess.js</valueProcess> + </entityParameter> + </children> </entityConsumer> <entityParameter> <name>ContactId_param</name> @@ -222,6 +256,48 @@ <name>#PROVIDER_AGGREGATES</name> <useAggregates v="true" /> </entityProvider> + <entityParameter> + <name>Entrydate_param</name> + <expose v="true" /> + </entityParameter> + <entityField> + <name>VISITPLANEMPLOYEEWEEK_INFO</name> + <title>Weekplan Info</title> + <color>priority-high-color</color> + <state>INVISIBLE</state> + <stateProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/visitplanemployeeweek_info/stateProcess.js</stateProcess> + <valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/visitplanemployeeweek_info/valueProcess.js</valueProcess> + <onValueChangeTypes> + <element>MASK</element> + <element>PROCESS</element> + <element>PROCESS_SETVALUE</element> + </onValueChangeTypes> + </entityField> + <entityField> + <name>STATUS_APPOINTMENT</name> + <title>Status Appointment</title> + <consumer>KeywordVisitPlanEntryStatusAppointment</consumer> + <valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/status_appointment/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/status_appointment/displayValueProcess.js</displayValueProcess> + </entityField> + <entityConsumer> + <name>KeywordVisitPlanEntryStatusAppointment</name> + <children> + <entityParameter> + <name>ContainerName_param</name> + <valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/keywordvisitplanentrystatusappointment/children/containername_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + <dependency> + <name>dependency</name> + <entityName>KeywordEntry_entity</entityName> + <fieldName>SpecificContainerKeywords</fieldName> + </dependency> + </entityConsumer> + <entityParameter> + <name>VisitrecommendationId_param</name> + <expose v="true" /> + </entityParameter> </entityFields> <recordContainers> <jDitoRecordContainer> @@ -278,6 +354,15 @@ <jDitoRecordFieldMapping> <name>STATUS.displayValue</name> </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>STATUS_APPOINTMENT.value</name> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>STATUS_APPOINTMENT.displayValue</name> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>VISITRECOMMENDATION_ID.value</name> + </jDitoRecordFieldMapping> </recordFieldMappings> </jDitoRecordContainer> </recordContainers> diff --git a/entity/VisitPlanEntry_entity/afterSave.js b/entity/VisitPlanEntry_entity/afterSave.js new file mode 100644 index 0000000000000000000000000000000000000000..0474f7803292e84fd36388734a67e8a568cefc41 --- /dev/null +++ b/entity/VisitPlanEntry_entity/afterSave.js @@ -0,0 +1,46 @@ +import("Sql_lib"); +import("system.translate"); +import("system.eMath"); +import("system.datetime"); +import("Date_lib"); +import("system.logging"); +import("system.result"); +import("system.neon"); +import("system.calendars"); +import("system.util"); +import("system.vars"); +import("system.db"); +import("Calendar_lib"); +import("Communication_lib"); + +var savedData = vars.get("$local.entitydata"); + +if(savedData["VISITRECOMMENDATION_ID"]) +{ + newWhere("VISITRECOMMENDATION.VISITRECOMMENDATIONID", savedData["VISITRECOMMENDATION_ID"]) + .updateData(true, "VISITRECOMMENDATION", ["STATUS"], null, ["PLANNED"]); +} +if(savedData["STATUS_APPOINTMENT"] == "VISITSTATUSAPPOINTMENTCONFIRMED") +{ + var summary = translate.text("Site visit") + " | " + savedData["CONTACT_ID.displayValue"]; + var description = savedData["CONTACT_ID.displayValue"]; + var standardMail = CommUtil.getStandardMail(savedData["CONTACT_ID"]); + + var entryDate = datetime.toDate(savedData["ENTRYDATE"], "dd-MM-yyyy"); + var startTime = entryDate + " " + datetime.toDate(savedData["BEGIN_TIME"], "HH:mm:ss.S"); + startTime = datetime.toLong(startTime, "dd-MM-yyyy HH:mm:ss.S"); + var endTime = savedData["END_TIME"]; + var duration = eMath.subInt(endTime, startTime); + + var params = {}; + params["Entry_param"] = JSON.stringify(CalendarUtil.createEntry(util.getNewUUID(), calendars.VEVENT, summary, description, false, null, null + , null, null, startTime, duration, null, null, null, null, [standardMail])); + + params["PresetLinks_param"] = JSON.stringify([ + ["Organisation", savedData["ORGANISATION_CONTACT_ID"]], + ["Person", savedData["CONTACT_ID"]] + ]); + + neon.openContext("Appointment", "AppointmentEdit_view", [vars.get("$field.UID")], neon.OPERATINGSTATE_NEW, params, null); + result.string(true); +} diff --git a/entity/VisitPlanEntry_entity/entityfields/begin_time/dropDownProcess.js b/entity/VisitPlanEntry_entity/entityfields/begin_time/dropDownProcess.js index f5ef197dc6d959c10471831543b60f96634e9f9c..12411ad70b3b6d08ee98e1c841e860d8a53256a4 100644 --- a/entity/VisitPlanEntry_entity/entityfields/begin_time/dropDownProcess.js +++ b/entity/VisitPlanEntry_entity/entityfields/begin_time/dropDownProcess.js @@ -12,13 +12,14 @@ for(var i = 0; i < 24; i++) i = i.toString(); if(i.length == 1) { - values.push([datetime.toLong("0" + i + ":00", "HH:mm"), "0" + i + ":00"]); - values.push([datetime.toLong("0" + i + ":30", "HH:mm"), "0" + i + ":30"]); + values.push([datetime.toLong("0" + i + ":00", "HH:mm", "UTC"), "0" + i + ":00"]); + values.push([datetime.toLong("0" + i + ":30", "HH:mm", "UTC"), "0" + i + ":30"]); } else { - values.push([datetime.toLong(i + ":00", "HH:mm"), i + ":00"]); - values.push([datetime.toLong(i + ":30", "HH:mm"), i + ":30"]); + values.push([datetime.toLong(i + ":00", "HH:mm", "UTC"), i + ":00"]); + if(i != "23") + values.push([datetime.toLong(i + ":30", "HH:mm", "UTC"), i + ":30"]); } } diff --git a/entity/VisitPlanEntry_entity/entityfields/begin_time/onValueChange.js b/entity/VisitPlanEntry_entity/entityfields/begin_time/onValueChange.js new file mode 100644 index 0000000000000000000000000000000000000000..7250691eb897d766a2c439be45dd7e9a05553581 --- /dev/null +++ b/entity/VisitPlanEntry_entity/entityfields/begin_time/onValueChange.js @@ -0,0 +1,9 @@ +import("system.datetime"); +import("system.vars"); +import("system.eMath"); +import("system.neon"); + +if(datetime.toDate(vars.get("$this.value"), "HH:mm") == "23:00") + neon.setFieldValue("$field.END_TIME", eMath.absInt(vars.get("$this.value")) + datetime.ONE_MINUTE * 30); +else + neon.setFieldValue("$field.END_TIME", eMath.absInt(vars.get("$this.value")) + datetime.ONE_HOUR); \ No newline at end of file diff --git a/entity/VisitPlanEntry_entity/entityfields/begin_time/valueProcess.js b/entity/VisitPlanEntry_entity/entityfields/begin_time/valueProcess.js index f320a45527c475f10db0d36dea1edc224a2ed3f9..052b11da3b9bbea6a4ab378f728c67806ea67b71 100644 --- a/entity/VisitPlanEntry_entity/entityfields/begin_time/valueProcess.js +++ b/entity/VisitPlanEntry_entity/entityfields/begin_time/valueProcess.js @@ -4,7 +4,6 @@ import("system.neon"); import("system.result"); import("system.vars"); -// 7am as default value if field is empty and recordstate = new if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.getString("$this.value") == null) { result.string(datetime.toLong("07:00", "HH:mm")); diff --git a/entity/VisitPlanEntry_entity/entityfields/contact_id/valueProcess.js b/entity/VisitPlanEntry_entity/entityfields/contact_id/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..52193180296057318c5efc834cf1e666c44f6359 --- /dev/null +++ b/entity/VisitPlanEntry_entity/entityfields/contact_id/valueProcess.js @@ -0,0 +1,19 @@ +import("Sql_lib"); +import("system.logging"); +import("system.neon"); +import("system.result"); +import("system.vars"); + + + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && (vars.get("$this.value") == null || vars.get("$this.value") == undefined)) +{ + var isPersonContact = newSelect("PERSON.PERSONID").from("PERSON") + .join("CONTACT", "PERSON.PERSONID = CONTACT.PERSON_ID") + .whereIfSet("CONTACT.CONTACTID", vars.get("$param.ContactId_param")).cell() + + if(isPersonContact) + result.string(vars.get("$param.ContactId_param")); +} + + diff --git a/entity/VisitPlanEntry_entity/entityfields/end_time/dropDownProcess.js b/entity/VisitPlanEntry_entity/entityfields/end_time/dropDownProcess.js index fad1ff9a83ebe192458c199e819f2a8a4186a6aa..fc6e5d4034f088b335e35322609771d3594ce05a 100644 --- a/entity/VisitPlanEntry_entity/entityfields/end_time/dropDownProcess.js +++ b/entity/VisitPlanEntry_entity/entityfields/end_time/dropDownProcess.js @@ -12,13 +12,14 @@ for(var i = 0; i < 24; i++) i = i.toString(); if(i.length == 1) { - values.push([datetime.toLong("0" + i + ":00", "HH:mm"), "0" + i + ":00"]); - values.push([datetime.toLong("0" + i + ":30", "HH:mm"), "0" + i + ":30"]); + if(i != "0") + values.push([datetime.toLong("0" + i + ":00", "HH:mm", "UTC"), "0" + i + ":00"]); + values.push([datetime.toLong("0" + i + ":30", "HH:mm", "UTC"), "0" + i + ":30"]); } else { - values.push([datetime.toLong(i + ":00", "HH:mm"), i + ":00"]); - values.push([datetime.toLong(i + ":30", "HH:mm"), i + ":30"]); + values.push([datetime.toLong(i + ":00", "HH:mm", "UTC"), i + ":00"]); + values.push([datetime.toLong(i + ":30", "HH:mm", "UTC"), i + ":30"]); } } diff --git a/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newactivity/onActionProcess.js b/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newactivity/onActionProcess.js index 5fdb3779fc2b8699a502c17353bbf34ff9a59bb1..9c215fd3ee4f53ee55b7558fa704565a87ecffc3 100644 --- a/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newactivity/onActionProcess.js +++ b/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newactivity/onActionProcess.js @@ -19,27 +19,14 @@ var pointOfContact = newSelect("CONTACT.CONTACTID", db.getCurrentAlias()) .where("AB_ATTRIBUTE.AB_ATTRIBUTEID", $AttributeRegistry.visitPlanPointOfContact()) .and("CONTACT.CONTACTID", vars.get("$field.ORGANISATION_CONTACT_ID")) .cell(); -var context; if(pointOfContact) links.push([ContactUtils.getContextByContactId(pointOfContact), pointOfContact]); else { - var contactId = vars.get("$field.ORGANISATION_CONTACT_ID"); - context = ContactUtils.getContextByContactId(contactId); - if(context == 'Person') - { - var orgContactId = newSelect("CONTACTID") - .from("CONTACT") - .where("PERSON_ID is null") - .and("CONTACT.ORGANISATION_ID", newSelect("ORGANISATION_ID") - .from("CONTACT") - .where("CONTACT.CONTACTID", contactId) - .cell()).cell(); - if(orgContactId) - links.push(["Organisation", orgContactId]); - } - links.push([context, contactId]); + links.push(["Organisation", vars.get("$field.ORGANISATION_CONTACT_ID")]); + links.push(["Person", vars.get("$field.CONTACT_ID")]); } ActivityUtils.createNewActivity(null, links, null, null, null, null, $KeywordRegistry.activityDirection$outgoing(), null, $KeywordRegistry.activityCategory$visit(), vars.get("$field.ENTRYDATE"), vars.get("$field.UID")); + diff --git a/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newappointment/onActionProcess.js b/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newappointment/onActionProcess.js index d5d0373503802bd20c6e17d52696af9a2ae87961..83d2148d4e05ea1d5c71a3b04cedc476baee492b 100644 --- a/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newappointment/onActionProcess.js +++ b/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newappointment/onActionProcess.js @@ -1,113 +1,46 @@ -import("Keyword_lib"); -import("Address_lib"); -import("Person_lib"); -import("Contact_lib"); -import("KeywordRegistry_basic"); -import("system.translate"); import("Sql_lib"); -import("AttributeRegistry_basic"); -import("system.datetime"); -import("system.logging"); -import("Communication_lib"); +import("system.translate"); import("system.db"); -import("system.vars"); -import("system.neon"); +import("Communication_lib"); +import("system.datetime"); +import("system.eMath"); import("system.calendars"); -import("Calendar_lib"); -import("system.date"); -import("Context_lib"); import("system.util"); -import("system.eMath"); -import("system.text"); - -var params = {}; -var mailAffectedUser = []; +import("Calendar_lib"); +import("system.vars"); +import("system.neon"); +import("system.result"); +import("Contact_lib") var selectionRowData = vars.get("$sys.selectionRows"); -var uid = selectionRowData[0].UID; -var isGroup = selectionRowData[0].ISGROUP; //not Bool -var entryDateAsLong = selectionRowData[0].ENTRYDATE; -var entryDate = datetime.toDate(entryDateAsLong, "dd-MM-yyyy"); -var startTime = selectionRowData[0].BEGIN_TIME; -var endTime = selectionRowData[0].END_TIME; -var organisationContact_id = selectionRowData[0].ORGANISATION_CONTACT_ID; -var organisationName = OrganisationUtils.getNameByContactId(organisationContact_id); -var contact_id = selectionRowData[0].CONTACT_ID; -var contactName = ContactUtils.getFullTitleByContactId(contact_id); -var contactMail = CommUtil.getStandardSubSqlMail(contact_id) -var contactData = newSelect("CONTACT.DEPARTMENT, CONTACT.CONTACTROLE") - .from("CONTACT") - .where("CONTACT.CONTACTID", contact_id) - .arrayRow() -var department = contactData[0]; -var contactRole = contactData[1]; -var addressId = newSelect("CONTACT.ADDRESS_ID") - .from("CONTACT") - .where("CONTACT.CONTACTID", organisationContact_id) - .cell(); -var organisationAddress = new AddrObject(organisationContact_id); -var organisationAddressFormatted = organisationAddress.getFormattedAddress(false, "{salutation_name}\n {street} {buildingno}\n {country_short} - {zip} {city}"); -var contactCommunication = newSelect("COMMUNICATION.MEDIUM_ID, COMMUNICATION.ADDR") - .from("COMMUNICATION") - .where("COMMUNICATION.CONTACT_ID", contact_id) - .table(); -if(contactCommunication.length > 0) +if(selectionRowData[0].VISITRECOMMENDATION_ID) { - var communicationString; - for (let i = 0; i < contactCommunication.length; i++) - { - communicationString += KeywordUtils.getViewValue($KeywordRegistry.communicationMedium(), contactCommunication[i][0]) + ": " - + contactCommunication[i][1] + "</br>" - } - communicationString = communicationString.substring(9); + newWhere("VISITRECOMMENDATION.VISITRECOMMENDATIONID", selectionRowData[0].VISITRECOMMENDATION_ID) + .updateData(true, "VISITRECOMMENDATION", ["STATUS"], null, ["PLANNED"]); } -var summary = translate.text("Visit") + " " + contactName + " | "+ organisationName; -var description = contactName + "</br>" - + department + "</br>" - + contactRole + "</br>" - + communicationString + "</br>" + "</br>" - + organisationName + "</br>" - + organisationAddressFormatted; -userMailto = []; -userMailto.push("mailto:" + contactMail, "CN:" + contactMail); -mailAffectedUser.push(text.encodeMS(userMailto)); +var fullName = ContactUtils.getFullTitleByContactId(selectionRowData[0].CONTACT_ID, true) +var summary = translate.text("Site visit") + " || " + fullName; +var description = fullName; +var standardMail = CommUtil.getStandardMail(selectionRowData[0].CONTACT_ID); +var startTime = selectionRowData[0].BEGIN_TIME; +var endTime = selectionRowData[0].END_TIME; +var duration = eMath.subInt(endTime, startTime); +var entryDate = datetime.toDate(selectionRowData[0].ENTRYDATE, "dd-MM-yyyy"); +startTime = entryDate + " " + datetime.toDate(selectionRowData[0].BEGIN_TIME, "HH:mm:ss.S"); +startTime = datetime.toLong(startTime, "dd-MM-yyyy HH:mm:ss.S"); -var startdate = entryDate + " " + datetime.toDate(startTime, "HH:mm:ss.S"); -startdate = datetime.toLong(startdate, "dd-MM-yyyy HH:mm:ss.S"); +var params = {}; +params["Entry_param"] = JSON.stringify(CalendarUtil.createEntry(util.getNewUUID(), calendars.VEVENT, summary, description, false, null, null + , null, null, startTime, duration, null, null, null, null, [standardMail])); -var duration = eMath.subInt(endTime, startTime); - -var entry = CalendarUtil.createEntry("", calendars.VEVENT, summary, description, false, false, false, - vars.get("$sys.user"), [vars.get("$sys.user")], startdate, duration, null, calendars.STATUS_TENTATIVE, null, null); - -params["Entry_param"] = JSON.stringify(entry); -var uidAppointment = calendars.insert([entry]); - -var columns = ["AB_APPOINTMENTLINK_ID", - "APPOINTMENT_ID", - "OBJECT_TYPE", - "OBJECT_ROWID"] - -var values = [util.getNewUUID(), - uidAppointment[0], - "Organisation", - organisationContact_id] -db.insertData("AB_APPOINTMENTLINK", columns, null, values) - -values = [util.getNewUUID(), - uidAppointment[0], - "Person", - contact_id] -db.insertData("AB_APPOINTMENTLINK", columns, null, values) - -values = [$KeywordRegistry.visitPlanEntryStatus$Appointmentarranged(), uidAppointment[0]]; -columns = ["STATUS", "APPOINTMENT_ID"]; - -newWhere("VISITPLANENTRY.VISITPLANENTRYID", uid) - .updateData(true, "VISITPLANENTRY", columns, null, values); +params["PresetLinks_param"] = JSON.stringify([ + ["Organisation", selectionRowData[0].ORGANISATION_CONTACT_ID], + ["Person", selectionRowData[0].CONTACT_ID] + ]); + +neon.openContext("Appointment", "AppointmentEdit_view", [vars.get("$field.UID")], neon.OPERATINGSTATE_NEW, params, null); +result.string(true); -neon.setFieldValue("$field.STATUS", $KeywordRegistry.visitPlanEntryStatus$Appointmentarranged()); -neon.refreshAll(); \ No newline at end of file diff --git a/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newappointment/stateProcess.js b/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newappointment/stateProcess.js index 00cae70329680cdd31c029965dc471e53f65d642..3f986eb99cdd8c56ea85788bc2ab0f547f172b25 100644 --- a/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newappointment/stateProcess.js +++ b/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newappointment/stateProcess.js @@ -1,8 +1,10 @@ +import("system.logging"); import("system.result"); import("system.vars"); import("system.neon"); -var state = neon.COMPONENTSTATE_DISABLED; -if (vars.get("$field.ISGROUP") == "false" && vars.get("$sys.selectionRows") != "") - state = neon.COMPONENTSTATE_EDITABLE; -result.string(state); +if (vars.get("$field.ISGROUP") == "false" && vars.get("$sys.selectionRows") != "" + && (vars.get("$field.STATUS") == "VISITSTATUSAPPPLANED" + || vars.get("$field.STATUS_APPOINTMENT") == "VISITSTATUSAPPOINTMENTCONFIRMED ")) + result.string(neon.COMPONENTSTATE_DISABLED); + diff --git a/entity/VisitPlanEntry_entity/entityfields/entrydate/onValueChange.js b/entity/VisitPlanEntry_entity/entityfields/entrydate/onValueChange.js new file mode 100644 index 0000000000000000000000000000000000000000..2e2ab9e1659616926f5721ca8640068c0b6bdf75 --- /dev/null +++ b/entity/VisitPlanEntry_entity/entityfields/entrydate/onValueChange.js @@ -0,0 +1,25 @@ +import("system.neon"); +import("system.logging"); +import("system.translate"); +import("system.result"); +import("Sql_lib"); +import("system.vars"); +import("system.datetime"); +import("Employee_lib"); + +var user = EmployeeUtils.getCurrentContactId(); +var calendarWeek = datetime.toDate(vars.get("$field.ENTRYDATE"), "w"); +var calendarYear = datetime.toDate(vars.get("$field.ENTRYDATE"), "yyyy"); +var info = newSelect("INFO") + .from("VISITPLANEMPLOYEEWEEK") + .where("VISITPLANEMPLOYEEWEEK.VISITPLAN_WEEK", calendarWeek) + .and("VISITPLANEMPLOYEEWEEK.VISITPLAN_YEAR", calendarYear) + .and("VISITPLANEMPLOYEEWEEK.CONTACT_ID", user) + .cell(); + +if(info) + neon.setFieldValue("$field.VISITPLANEMPLOYEEWEEK_INFO", "Calendar week: " + calendarWeek + " Info: " + info); +else + neon.setFieldValue("$field.VISITPLANEMPLOYEEWEEK_INFO", ""); + + diff --git a/entity/VisitPlanEntry_entity/entityfields/entrydate/valueProcess.js b/entity/VisitPlanEntry_entity/entityfields/entrydate/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..459c622245d9f40641c694f9e11c1f157081cc87 --- /dev/null +++ b/entity/VisitPlanEntry_entity/entityfields/entrydate/valueProcess.js @@ -0,0 +1,7 @@ +import("system.logging"); +import("system.neon"); +import("system.result"); +import("system.vars"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && (vars.get("$this.value") == null || vars.get("$this.value") == undefined)) + result.string(vars.get("$param.Entrydate_param")); \ No newline at end of file diff --git a/entity/VisitPlanEntry_entity/entityfields/keywordvisitplanentrystatusappointment/children/containername_param/valueProcess.js b/entity/VisitPlanEntry_entity/entityfields/keywordvisitplanentrystatusappointment/children/containername_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..a796e1af63d2e67f15030524f185dd73b26c11cf --- /dev/null +++ b/entity/VisitPlanEntry_entity/entityfields/keywordvisitplanentrystatusappointment/children/containername_param/valueProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +result.string($KeywordRegistry.visitPlanEntryStatusAppointment()); \ No newline at end of file diff --git a/entity/VisitPlanEntry_entity/entityfields/organisation_contact_id/stateProcess.js b/entity/VisitPlanEntry_entity/entityfields/organisation_contact_id/stateProcess.js index 832f94c08cd6b525fa8a549e6332eea384362f65..b8cad0c73fa5d1649c5a09e20f4e48fe27645ba8 100644 --- a/entity/VisitPlanEntry_entity/entityfields/organisation_contact_id/stateProcess.js +++ b/entity/VisitPlanEntry_entity/entityfields/organisation_contact_id/stateProcess.js @@ -1,10 +1,6 @@ -import("system.logging"); import("system.neon"); -import("system.result"); import("system.vars"); +import("system.result"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null - && vars.exists("$param.ContactId_param") && vars.get("$param.ContactId_param")) -{ - result.string(neon.COMPONENTSTATE_INVISIBLE); -} \ No newline at end of file +if(vars.get("$param.VisitrecommendationId_param")) + result.string(neon.COMPONENTSTATE_READONLY) \ No newline at end of file diff --git a/entity/VisitPlanEntry_entity/entityfields/organisation_contact_id/valueProcess.js b/entity/VisitPlanEntry_entity/entityfields/organisation_contact_id/valueProcess.js index 8e22e5c11f08455e5f445c1fbd3d05e4a222cd75..2b90b668563cd3c022b2e3a32c9bab71c44f1783 100644 --- a/entity/VisitPlanEntry_entity/entityfields/organisation_contact_id/valueProcess.js +++ b/entity/VisitPlanEntry_entity/entityfields/organisation_contact_id/valueProcess.js @@ -1,3 +1,4 @@ +import("Sql_lib"); import("system.neon"); import("system.result"); import("system.vars"); @@ -5,5 +6,15 @@ import("system.vars"); if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null && vars.exists("$param.OrganisationId_param") && vars.get("$param.OrganisationId_param")) { - result.string(vars.get("$param.OrganisationId_param")); + + var OrgId = newSelect("CONTACT.ORGANISATION_ID").from("CONTACT") + .where("CONTACT.CONTACTID", vars.get("$param.OrganisationId_param")) + .cell() + + var contactIdWithoutPerson = newSelect("CONTACT.CONTACTID").from("CONTACT") + .where("CONTACT.ORGANISATION_ID", OrgId) + .and("CONTACT.PERSON_ID is null") + .cell() + + result.string(contactIdWithoutPerson); } \ No newline at end of file diff --git a/entity/VisitPlanEntry_entity/entityfields/organisations/children/onlyactive_param/valueProcess.js b/entity/VisitPlanEntry_entity/entityfields/organisations/children/onlyactive_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..40effa0178464da0c7850912345f19c7fa95975a --- /dev/null +++ b/entity/VisitPlanEntry_entity/entityfields/organisations/children/onlyactive_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string(true); \ No newline at end of file diff --git a/entity/VisitPlanEntry_entity/entityfields/persons/children/orgid_param/valueProcess.js b/entity/VisitPlanEntry_entity/entityfields/persons/children/orgid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..c6e583e8bd66c32b6b8243af36cc6c2264c8ac18 --- /dev/null +++ b/entity/VisitPlanEntry_entity/entityfields/persons/children/orgid_param/valueProcess.js @@ -0,0 +1,9 @@ +import("system.logging"); +import("Sql_lib"); +import("system.vars"); +import("system.result"); + +var orgContactId = vars.get("$field.ORGANISATION_CONTACT_ID") +var orgId = newSelect("CONTACT.ORGANISATION_ID").from("CONTACT").where("CONTACT.CONTACTID", orgContactId).cell(); + +result.string(orgId); \ No newline at end of file diff --git a/entity/VisitPlanEntry_entity/entityfields/status_appointment/displayValueProcess.js b/entity/VisitPlanEntry_entity/entityfields/status_appointment/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..6da13f3303b3eb4dd4da2a507f9ea6ba6bdc71a9 --- /dev/null +++ b/entity/VisitPlanEntry_entity/entityfields/status_appointment/displayValueProcess.js @@ -0,0 +1,8 @@ +import("system.translate"); +import("system.logging"); +import("system.result"); +import("system.vars"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +result.string(KeywordUtils.getViewValue($KeywordRegistry.visitPlanEntryStatusAppointment(), vars.get("$field.STATUS_APPOINTMENT"))); \ No newline at end of file diff --git a/entity/VisitPlanEntry_entity/entityfields/status_appointment/valueProcess.js b/entity/VisitPlanEntry_entity/entityfields/status_appointment/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..32f48a2b8d5ccab1d3ec284c2958e4ef14713430 --- /dev/null +++ b/entity/VisitPlanEntry_entity/entityfields/status_appointment/valueProcess.js @@ -0,0 +1,9 @@ +import("KeywordRegistry_basic"); +import("system.vars"); +import("system.result"); +import("system.neon"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.getString("$this.value") == null) +{ + result.string($KeywordRegistry.visitPlanEntryStatusAppointment$requested()); +} \ No newline at end of file diff --git a/entity/VisitPlanEntry_entity/entityfields/visitplanemployeeweek_info/stateProcess.js b/entity/VisitPlanEntry_entity/entityfields/visitplanemployeeweek_info/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..c1b91b310592bd609d821e730603d5097a3d8439 --- /dev/null +++ b/entity/VisitPlanEntry_entity/entityfields/visitplanemployeeweek_info/stateProcess.js @@ -0,0 +1,6 @@ +import("system.vars"); +import("system.result"); +import("system.neon"); + +if(vars.get("$field.ENTRYDATE")) + result.string(neon.COMPONENTSTATE_READONLY); \ No newline at end of file diff --git a/entity/VisitPlanEntry_entity/entityfields/visitplanemployeeweek_info/valueProcess.js b/entity/VisitPlanEntry_entity/entityfields/visitplanemployeeweek_info/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..8848cb05cb421139c05f93526854cbf0ca8fac01 --- /dev/null +++ b/entity/VisitPlanEntry_entity/entityfields/visitplanemployeeweek_info/valueProcess.js @@ -0,0 +1,20 @@ +import("system.logging"); +import("system.translate"); +import("system.result"); +import("Sql_lib"); +import("system.vars"); +import("system.datetime"); +import("Employee_lib"); + +var user = EmployeeUtils.getCurrentContactId(); +var calendarWeek = datetime.toDate(vars.get("$field.ENTRYDATE"), "w"); +var calendarYear = datetime.toDate(vars.get("$field.ENTRYDATE"), "yyyy"); +var info = newSelect("INFO") + .from("VISITPLANEMPLOYEEWEEK") + .where("VISITPLANEMPLOYEEWEEK.VISITPLAN_WEEK", calendarWeek) + .and("VISITPLANEMPLOYEEWEEK.VISITPLAN_YEAR", calendarYear) + .and("VISITPLANEMPLOYEEWEEK.CONTACT_ID", user) + .cell(); + +if(info) + result.string(info); \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/contact_id/stateProcess.js b/entity/VisitPlanEntry_entity/entityfields/visitrecommendation_id/valueProcess.js similarity index 57% rename from entity/VisitRecommendation_entity/entityfields/contact_id/stateProcess.js rename to entity/VisitPlanEntry_entity/entityfields/visitrecommendation_id/valueProcess.js index 5cc1152733bc77ebadb70d7da6bec021692745a0..dbfee2528ec4bfc6ac624c6e0751f4b2f983bb2a 100644 --- a/entity/VisitRecommendation_entity/entityfields/contact_id/stateProcess.js +++ b/entity/VisitPlanEntry_entity/entityfields/visitrecommendation_id/valueProcess.js @@ -3,5 +3,5 @@ import("system.neon"); import("system.result"); import("system.vars"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$param.ContactId_param") && vars.exists("$param.ContactId_param")) -result.string(neon.COMPONENTSTATE_INVISIBLE) \ No newline at end of file +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value")== null) + result.string(vars.get("$param.VisitrecommendationId_param")); \ No newline at end of file diff --git a/entity/VisitPlanEntry_entity/onValidation.js b/entity/VisitPlanEntry_entity/onValidation.js index 15c1007b0a9286bb7512a4c9dc0d510e59350624..2b341575427fda464e3356d01061e405b7b75e30 100644 --- a/entity/VisitPlanEntry_entity/onValidation.js +++ b/entity/VisitPlanEntry_entity/onValidation.js @@ -1,3 +1,4 @@ +import("system.neon"); import("system.eMath"); import("Sql_lib"); import("system.logging"); @@ -13,9 +14,10 @@ var begin_time = eMath.absInt(vars.get("$field.BEGIN_TIME")); if (endTime != "" && begin_time != "" && endTime < begin_time) result.string(translate.text("The endtime can't be before begintime!")); -if(vars.get("$param.NoVisitPlanEmployeeWeek_param") != "true") +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$param.NoVisitPlanEmployeeWeek_param")) { - var week = newSelect("VISITPLAN_WEEK") + + var week = newSelect("VISITPLAN_WEEK") .from("VISITPLANEMPLOYEEWEEK") .where("VISITPLANEMPLOYEEWEEK.VISITPLANEMPLOYEEWEEKID", vars.get("$field.VISITPLANEMPLOYEEWEEK_ID")) .cell(); @@ -23,4 +25,5 @@ if(vars.get("$param.NoVisitPlanEmployeeWeek_param") != "true") if(week != weekEntrydate) result.string(translate.text("Entrydate has to be in the selected calendar week!")); + } diff --git a/entity/VisitPlanEntry_entity/recordcontainers/jdito/contentProcess.js b/entity/VisitPlanEntry_entity/recordcontainers/jdito/contentProcess.js index ae8d3918edde1c772c1f09bb3623506cce40cdc1..c2156fee4955f99b1bf8781a2d18a0aadadd8e07 100644 --- a/entity/VisitPlanEntry_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/VisitPlanEntry_entity/recordcontainers/jdito/contentProcess.js @@ -16,7 +16,8 @@ var items = []; var group = []; var entryData = ""; -var entrySQL = newSelect("ENTRYDATE, VISITPLANENTRYID, BEGIN_TIME, END_TIME, ORGANISATION_CONTACT_ID, CONTACT_ID,STATUS, VISITPLANEMPLOYEEWEEK_ID, APPOINTMENT_ID") +var entrySQL = newSelect("ENTRYDATE, VISITPLANENTRYID, BEGIN_TIME, END_TIME, ORGANISATION_CONTACT_ID, CONTACT_ID,STATUS, VISITPLANEMPLOYEEWEEK_ID" + +", APPOINTMENT_ID, STATUS_APPOINTMENT, VISITRECOMMENDATION_ID") .from("VISITPLANENTRY"); if (vars.exists("$local.idvalues") && vars.get("$local.idvalues")) @@ -46,8 +47,8 @@ if(entryData.length > 0) { for(var i = 0; i < entryData.length; i++) { - var entryDateRaw, visitPlanEntryId, beginTime, endTime, organisationContactId, contactId, status, visitplanEmployeeWeekId, appointmentid; - [entryDateRaw, visitPlanEntryId, beginTime, endTime, organisationContactId, contactId, status, visitplanEmployeeWeekId, appointmentid] = entryData[i] + var entryDateRaw, visitPlanEntryId, beginTime, endTime, organisationContactId, contactId, status, visitplanEmployeeWeekId, appointmentid, statusAppointment, visitrecommendation_id; + [entryDateRaw, visitPlanEntryId, beginTime, endTime, organisationContactId, contactId, status, visitplanEmployeeWeekId, appointmentid, statusAppointment, visitrecommendation_id] = entryData[i] var contactname = ContactUtils.getTitleByContactId(contactId); var orgname = OrganisationUtils.getNameByContactId(organisationContactId); @@ -55,16 +56,18 @@ if(entryData.length > 0) entryDate = datetime.toDate(entryDateRaw, "dd.MM.yyyy"); var statusDisplay = KeywordUtils.getViewValue($KeywordRegistry.visitPlanEntryStatus(), status) + var statusAppointmentDisplay = KeywordUtils.getViewValue($KeywordRegistry.visitPlanEntryStatusAppointment(), statusAppointment) var alias = SqlUtils.getSystemAlias(); items.push([visitPlanEntryId, false, parentName + "#" + entryDate, "", beginTime - , endTime, organisationContactId, orgname, contactId, contactname, entryDateRaw, status, visitplanEmployeeWeekId, appointmentid, statusDisplay]); + , endTime, organisationContactId, orgname, contactId, contactname, entryDateRaw, status, visitplanEmployeeWeekId, appointmentid + , statusDisplay, statusAppointment, statusAppointmentDisplay, visitrecommendation_id]); if(!vars.get("$local.idvalues")) { if(group.indexOf(parentName + "#" + entryDate) == -1) { - items.push([parentName + "#" + entryDate, true, "", parentName + " " + entryDate, "", "", "", "", "", "", "", "", "", "", ""]); + items.push([parentName + "#" + entryDate, true, "", parentName + " " + entryDate, "", "", "", "", "", "", "", "", "", "", "", "", "", ""]); group.push(parentName + "#" + entryDate); } } diff --git a/entity/VisitPlanEntry_entity/recordcontainers/jdito/onDelete.js b/entity/VisitPlanEntry_entity/recordcontainers/jdito/onDelete.js index a507271c6792ee838fad76db423cae2fb2209c8b..77424135ff0acd196f784311bbc6b6497a9f743e 100644 --- a/entity/VisitPlanEntry_entity/recordcontainers/jdito/onDelete.js +++ b/entity/VisitPlanEntry_entity/recordcontainers/jdito/onDelete.js @@ -5,6 +5,10 @@ import("Sql_lib"); import("system.db"); var id = vars.get("$field.APPOINTMENT_ID") //deletes appointmententries (+ the linked Objects) if an appointment has been made +var recommendationId = vars.get("$field.VISITRECOMMENDATION_ID"); + +newWhere("VISITRECOMMENDATION.VISITRECOMMENDATIONID", recommendationId) + .updateData(true, "VISITRECOMMENDATION", ["STATUS"], null, [""]); new SqlBuilder(SqlUtils.getSystemAlias()).whereIfSet("ASYS_CALENDARBACKEND.ELEMENTUID", id) .deleteData(); @@ -13,4 +17,5 @@ newWhereIfSet("AB_APPOINTMENTLINK.APPOINTMENT_ID", id) .deleteData(); newWhereIfSet("VISITPLANENTRY.VISITPLANENTRYID", "$field.UID") - .deleteData(); \ No newline at end of file + .deleteData(); + diff --git a/entity/VisitPlanEntry_entity/recordcontainers/jdito/onInsert.js b/entity/VisitPlanEntry_entity/recordcontainers/jdito/onInsert.js index 513409e05735c092c8170ae3dc7184dc1c7e0933..c9f89a1065270df5b8602b0a086d052662774858 100644 --- a/entity/VisitPlanEntry_entity/recordcontainers/jdito/onInsert.js +++ b/entity/VisitPlanEntry_entity/recordcontainers/jdito/onInsert.js @@ -50,7 +50,8 @@ else } var rowData = vars.get("$local.rowdata"); - +//logging.log("rowData: " + rowData["VISITRECOMMENDATION_ID.value"]); +//logging.log("field: " +vars.get("$field.VISITRECOMMENDATION_ID")); var valuesEntry = [ rowData["UID.value"], rowData["ENTRYDATE.value"], @@ -59,7 +60,9 @@ var valuesEntry = [ rowData["ORGANISATION_CONTACT_ID.value"], rowData["CONTACT_ID.value"], visitPlanEmployeeWeekID, - rowData["STATUS.value"] + rowData["STATUS.value"], + rowData["STATUS_APPOINTMENT.value"], + rowData["VISITRECOMMENDATION_ID.value"] || "" ]; var columnsEntry = [ @@ -70,7 +73,9 @@ var columnsEntry = [ "ORGANISATION_CONTACT_ID", "CONTACT_ID", "VISITPLANEMPLOYEEWEEK_ID", - "STATUS" + "STATUS", + "STATUS_APPOINTMENT", + "VISITRECOMMENDATION_ID" ]; insertData.push(["VISITPLANENTRY", columnsEntry, null, valuesEntry]) diff --git a/entity/VisitPlanEntry_entity/recordcontainers/jdito/onUpdate.js b/entity/VisitPlanEntry_entity/recordcontainers/jdito/onUpdate.js index c22eeca42034c0676686e931650daeb0b22b5bb1..d5c991243c8c5ab3fd254ea668979b2d147de171 100644 --- a/entity/VisitPlanEntry_entity/recordcontainers/jdito/onUpdate.js +++ b/entity/VisitPlanEntry_entity/recordcontainers/jdito/onUpdate.js @@ -1,3 +1,6 @@ +import("Employee_lib"); +import("system.util"); +import("system.datetime"); import("Sql_lib"); import("system.logging"); import("system.neon"); @@ -5,13 +8,49 @@ import("system.db"); import("system.vars"); var rowData = vars.get("$local.rowdata"); +var user = EmployeeUtils.getCurrentContactId() +var calendarWeek = datetime.toDate(rowData["ENTRYDATE.value"], "w"); +var calendarYear = datetime.toDate(rowData["ENTRYDATE.value"], "yyyy"); +var weekId = newSelect("VISITPLANEMPLOYEEWEEKID") + .from("VISITPLANEMPLOYEEWEEK") + .where("VISITPLANEMPLOYEEWEEK.VISITPLAN_WEEK", calendarWeek) + .and("VISITPLANEMPLOYEEWEEK.VISITPLAN_YEAR", calendarYear) + .and("VISITPLANEMPLOYEEWEEK.CONTACT_ID", user) + .cell(); + +if(weekId) + visitPlanEmployeeWeekID = weekId; +else +{ + var newWeekId = util.getNewUUID(); + + var valuesWeek = [ + newWeekId, + calendarWeek, + calendarYear, + user + ]; + + var columnsWeek = [ + "VISITPLANEMPLOYEEWEEKID", + "VISITPLAN_WEEK", + "VISITPLAN_YEAR", + "CONTACT_ID", + ]; + + db.insertData("VISITPLANEMPLOYEEWEEK", columnsWeek, null, valuesWeek); + + visitPlanEmployeeWeekID = newWeekId; +} var values = [ rowData["ENTRYDATE.value"], rowData["BEGIN_TIME.value"], rowData["END_TIME.value"], rowData["ORGANISATION_CONTACT_ID.value"], - rowData["STATUS"] + rowData["STATUS.value"], + rowData["STATUS_APPOINTMENT.value"], + visitPlanEmployeeWeekID ]; var columns = [ @@ -19,7 +58,9 @@ var columns = [ "BEGIN_TIME", "END_TIME", "ORGANISATION_CONTACT_ID", - "STATUS" + "STATUS", + "STATUS_APPOINTMENT", + "VISITPLANEMPLOYEEWEEK_ID" ]; var cond = newWhere("VISITPLANENTRY.VISITPLANENTRYID", vars.get("$field.UID")).toString(); diff --git a/entity/VisitRecommendation_entity/VisitRecommendation_entity.aod b/entity/VisitRecommendation_entity/VisitRecommendation_entity.aod index bccac7cc31663c0452590bb08c4720db354a761b..0aa7cf7d9db38387de9bf17ad34c185af1e15ae6 100644 --- a/entity/VisitRecommendation_entity/VisitRecommendation_entity.aod +++ b/entity/VisitRecommendation_entity/VisitRecommendation_entity.aod @@ -3,10 +3,10 @@ <name>VisitRecommendation_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/entity/VisitRecommendation_entity/documentation.adoc</documentation> + <iconProcess>%aditoprj%/entity/VisitRecommendation_entity/iconProcess.js</iconProcess> <title>Visit Recommendation</title> <grantCreate v="true" /> - <grantUpdateProcess>%aditoprj%/entity/VisitRecommendation_entity/grantUpdateProcess.js</grantUpdateProcess> - <grantDeleteProcess>%aditoprj%/entity/VisitRecommendation_entity/grantDeleteProcess.js</grantDeleteProcess> + <initFilterProcess>%aditoprj%/entity/VisitRecommendation_entity/initFilterProcess.js</initFilterProcess> <iconId>VAADIN:BRIEFCASE</iconId> <image>VAADIN:BRIEFCASE</image> <titlePlural>Visit Recommendations</titlePlural> @@ -15,7 +15,7 @@ <entityProvider> <name>#PROVIDER</name> <targetContextField>TARGET_CONTEXT</targetContextField> - <targetIdField>CONTACT_ID</targetIdField> + <targetIdField>TARGET_ID</targetIdField> <documentation>%aditoprj%/entity/VisitRecommendation_entity/entityfields/#provider/documentation.adoc</documentation> <dependencies> <entityDependency> @@ -29,10 +29,13 @@ <entityField> <name>CONTACT_ID</name> <documentation>%aditoprj%/entity/VisitRecommendation_entity/entityfields/contact_id/documentation.adoc</documentation> - <title>Customer</title> + <title>Organisation</title> <consumer>OrganisationConsumer</consumer> - <stateProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/contact_id/stateProcess.js</stateProcess> + <groupable v="false" /> + <linkedContext>Organisation</linkedContext> + <mandatory v="true" /> <valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/contact_id/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/contact_id/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>UID</name> @@ -40,11 +43,8 @@ </entityField> <entityField> <name>ORGANISATION_NAME</name> - <title>Customer</title> - </entityField> - <entityField> - <name>ORGANISATION_POINT_OF_CONTACT</name> - <title>Organisation point Of Contact</title> + <title>Organisation</title> + <groupable v="true" /> </entityField> <entityField> <name>ORGANISATION_ADDRESS</name> @@ -54,13 +54,16 @@ <name>PRIORITY</name> <title>Priority</title> <consumer>KeywordVisitRecommendationPriority</consumer> + <groupable v="true" /> <mandatory v="true" /> + <valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/priority/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/priority/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>PRIORITY_SOURCE</name> <title>Priority Source</title> <consumer>KeywordVisitRecommendationSource</consumer> + <groupable v="true" /> <displayValueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/priority_source/displayValueProcess.js</displayValueProcess> </entityField> <entityField> @@ -70,21 +73,14 @@ <resolution>DAY</resolution> <outputFormat>dd.MM.yyyy</outputFormat> <inputFormat>dd.MM.yyyy</inputFormat> + <groupable v="true" /> <mandatory v="true" /> + <valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/due_date/valueProcess.js</valueProcess> </entityField> <entityField> <name>INFO</name> <title>Info</title> - </entityField> - <entityField> - <name>DATE_PLANNED</name> - <title>Date Planned</title> - <contentType>DATE</contentType> - <resolution>DAY</resolution> - </entityField> - <entityField> - <name>USER_PLANNED</name> - <title>Planned By</title> + <contentType>LONG_TEXT</contentType> </entityField> <entityConsumer> <name>KeywordVisitRecommendationPriority</name> @@ -104,6 +100,12 @@ </entityConsumer> <entityConsumer> <name>OrganisationConsumer</name> + <children> + <entityParameter> + <name>OnlyActive_param</name> + <valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/organisationconsumer/children/onlyactive_param/valueProcess.js</valueProcess> + </entityParameter> + </children> <dependency> <name>dependency</name> <entityName>Organisation_entity</entityName> @@ -118,6 +120,15 @@ <expose v="true" /> <mandatory v="true" /> </entityParameter> + <entityParameter> + <name>OrgId_param</name> + <valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/personconsumer/children/orgid_param/valueProcess.js</valueProcess> + <expose v="true" /> + </entityParameter> + <entityParameter> + <name>OnlyActive_param</name> + <valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/personconsumer/children/onlyactive_param/valueProcess.js</valueProcess> + </entityParameter> </children> <dependency> <name>dependency</name> @@ -136,28 +147,42 @@ <children> <entityActionField> <name>NewVisitPlaneEntry</name> - <documentation>%aditoprj%/entity/VisitRecommendation_entity/entityfields/newentrygroup/children/newvisitplaneentry/documentation.adoc</documentation> <title>New Weekplanentry</title> <onActionProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/newentrygroup/children/newvisitplaneentry/onActionProcess.js</onActionProcess> <iconId>NEON:EXPORT</iconId> <state>AUTO</state> <stateProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/newentrygroup/children/newvisitplaneentry/stateProcess.js</stateProcess> - <tooltip>Create New Weekplanentry</tooltip> - <tooltipProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/newentrygroup/children/newvisitplaneentry/tooltipProcess.js</tooltipProcess> </entityActionField> </children> </entityActionGroup> <entityField> - <name>PRIORITY_ICON</name> + <name>ICON</name> <title></title> - <colorProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/priority_icon/colorProcess.js</colorProcess> + <colorProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/icon/colorProcess.js</colorProcess> <contentType>IMAGE</contentType> - <valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/priority_icon/valueProcess.js</valueProcess> + <valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/icon/valueProcess.js</valueProcess> </entityField> <entityField> <name>TARGET_CONTEXT</name> <valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/target_context/valueProcess.js</valueProcess> </entityField> + <entityField> + <name>USER_NEW</name> + <title>Created from</title> + <consumer>Employees</consumer> + <groupable v="true" /> + <valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/user_new/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>CONTACT_PERSON_ID</name> + <title>Contact</title> + <description></description> + <consumer>PersonConsumer</consumer> + <groupable v="true" /> + <linkedContext>Person</linkedContext> + <valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/contact_person_id/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/contact_person_id/displayValueProcess.js</displayValueProcess> + </entityField> <entityProvider> <name>#PROVIDER_AGGREGATES</name> <useAggregates v="true" /> @@ -176,9 +201,58 @@ <fieldName>SpecificContainerKeywords</fieldName> </dependency> </entityConsumer> + <entityParameter> + <name>ContactIdPerson_param</name> + <expose v="true" /> + </entityParameter> <entityField> - <name>ADDRESS_ZIP</name> - <title>Zip</title> + <name>RESPONSIBLE</name> + <title>Responsible</title> + <consumer>Employees</consumer> + <groupable v="true" /> + <mandatory v="true" /> + <valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/responsible/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/responsible/displayValueProcess.js</displayValueProcess> + </entityField> + <entityConsumer> + <name>Employees</name> + <children> + <entityParameter> + <name>OnlyActives_param</name> + <valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/employees/children/onlyactives_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + <dependency> + <name>dependency</name> + <entityName>Employee_entity</entityName> + <fieldName>Employees</fieldName> + </dependency> + </entityConsumer> + <entityField> + <name>STREET</name> + <title>Street</title> + </entityField> + <entityField> + <name>COUNTRY</name> + <title>Country</title> + <groupable v="true" /> + </entityField> + <entityField> + <name>ZIP</name> + <title>ZIP</title> + <groupable v="true" /> + </entityField> + <entityField> + <name>CITY</name> + <title>City</title> + <groupable v="true" /> + </entityField> + <entityField> + <name>STATUS</name> + </entityField> + <entityField> + <name>TARGET_ID</name> + <valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/target_id/valueProcess.js</valueProcess> </entityField> </entityFields> <recordContainers> @@ -186,6 +260,8 @@ <name>jDito</name> <jDitoRecordAlias>Data_alias</jDitoRecordAlias> <isFilterable v="true" /> + <isGroupable v="true" /> + <isSortable v="true" /> <contentProcess>%aditoprj%/entity/VisitRecommendation_entity/recordcontainers/jdito/contentProcess.js</contentProcess> <onInsert>%aditoprj%/entity/VisitRecommendation_entity/recordcontainers/jdito/onInsert.js</onInsert> <onUpdate>%aditoprj%/entity/VisitRecommendation_entity/recordcontainers/jdito/onUpdate.js</onUpdate> @@ -196,41 +272,76 @@ </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>ORGANISATION_NAME.value</name> + <isFilterable v="false" /> + <isLookupFilter v="false" /> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>STREET.value</name> <isFilterable v="true" /> - <isLookupFilter v="true" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> - <name>ORGANISATION_POINT_OF_CONTACT.value</name> + <name>COUNTRY.value</name> + <isFilterable v="true" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> - <name>ORGANISATION_ADDRESS.value</name> + <name>ZIP.value</name> + <isFilterable v="true" /> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>CITY.value</name> + <isFilterable v="true" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>PRIORITY.value</name> <isFilterable v="true" /> - <isLookupFilter v="true" /> + <isLookupFilter v="false" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>PRIORITY_SOURCE.value</name> + <isFilterable v="true" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>PRIORITY.displayValue</name> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>DUE_DATE.value</name> + <isFilterable v="true" /> + <isLookupFilter v="false" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>INFO.value</name> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>CONTACT_ID.value</name> + <isFilterable v="true" /> + <isLookupFilter v="true" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>PRIORITY_SOURCE.displayValue</name> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> - <name>ADDRESS_ZIP.value</name> + <name>USER_NEW.displayValue</name> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>USER_NEW.value</name> + <isFilterable v="true" /> + <isLookupFilter v="true" /> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>CONTACT_PERSON_ID.displayValue</name> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>CONTACT_PERSON_ID.value</name> <isFilterable v="true" /> + <isLookupFilter v="true" /> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>RESPONSIBLE.displayValue</name> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>RESPONSIBLE.value</name> + <isFilterable v="true" /> + <isLookupFilter v="true" /> </jDitoRecordFieldMapping> </recordFieldMappings> <filterExtensions> diff --git a/entity/VisitRecommendation_entity/entityfields/contact_id/displayValueProcess.js b/entity/VisitRecommendation_entity/entityfields/contact_id/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e91b48435345a0dad841873c3199e8f9f1fd5ad6 --- /dev/null +++ b/entity/VisitRecommendation_entity/entityfields/contact_id/displayValueProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("Contact_lib"); +import("system.result"); + +result.string(ContactUtils.getFullTitleByContactId(vars.get("$field.CONTACT_ID"))); \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/contact_id/valueProcess.js b/entity/VisitRecommendation_entity/entityfields/contact_id/valueProcess.js index 683ba24292b07fb95f063e4d5e7a2c25bcfe1807..f816ac54f7ec6f78adcdabf383dbb4b13faddb27 100644 --- a/entity/VisitRecommendation_entity/entityfields/contact_id/valueProcess.js +++ b/entity/VisitRecommendation_entity/entityfields/contact_id/valueProcess.js @@ -3,5 +3,5 @@ import("system.neon"); import("system.result"); import("system.vars"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && (vars.get("$this.value") == null || vars.get("$this.value") == undefined)) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) result.string(vars.get("$param.ContactId_param")); \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/contact_person_id/displayValueProcess.js b/entity/VisitRecommendation_entity/entityfields/contact_person_id/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..2b20cde46f73e3abf1d2d2a1fdf5d9380639900b --- /dev/null +++ b/entity/VisitRecommendation_entity/entityfields/contact_person_id/displayValueProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("Contact_lib"); +import("system.result"); + +result.string(ContactUtils.getFullTitleByContactId(vars.get("$field.CONTACT_PERSON_ID"))); \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/contact_person_id/valueProcess.js b/entity/VisitRecommendation_entity/entityfields/contact_person_id/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..a00c3df76bc3df83ed648214e443d6cdf4fb1a68 --- /dev/null +++ b/entity/VisitRecommendation_entity/entityfields/contact_person_id/valueProcess.js @@ -0,0 +1,7 @@ +import("system.logging"); +import("system.neon"); +import("system.result"); +import("system.vars"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && (vars.get("$this.value") == null || vars.get("$this.value") == undefined)) + result.string(vars.get("$param.ContactIdPerson_param")); \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/due_date/valueProcess.js b/entity/VisitRecommendation_entity/entityfields/due_date/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..9d7a1644833767138c6693baa5090f9d41247257 --- /dev/null +++ b/entity/VisitRecommendation_entity/entityfields/due_date/valueProcess.js @@ -0,0 +1,36 @@ +import("system.datetime"); +import("Sql_lib"); +import("Employee_lib"); +import("system.neon"); +import("system.vars"); +import("system.result"); + + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) +{ + var contactidResp = vars.get("$field.RESPONSIBLE") + var maturity = newSelect("AB_ATTRIBUTE.ATTRIBUTE_NAME") + .from("AB_ATTRIBUTERELATION") + .join("AB_ATTRIBUTE", "AB_ATTRIBUTE.AB_ATTRIBUTEID = AB_ATTRIBUTERELATION.ID_VALUE") + .where("AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID", "e8770b60-160c-466e-af57-4f90bd6e02d7") + .and("AB_ATTRIBUTERELATION.OBJECT_ROWID", contactidResp) + .cell(); + + var due_date = new Date(); + switch(maturity) + { + case "2 Weeks": + due_date =due_date.setDate(due_date.getDate() + 14); + break; + case "1 Month": + due_date = due_date.setMonth(due_date.getMonth() + 1); + break; + case "6 Months": + due_date = due_date.setMonth(due_date.getMonth() + 6); + break; + case "12 Months": + due_date = due_date.setMonth(due_date.getMonth() + 12); + break; + } + result.string(due_date); +} \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/employees/children/onlyactives_param/valueProcess.js b/entity/VisitRecommendation_entity/entityfields/employees/children/onlyactives_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..40effa0178464da0c7850912345f19c7fa95975a --- /dev/null +++ b/entity/VisitRecommendation_entity/entityfields/employees/children/onlyactives_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string(true); \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/priority_icon/colorProcess.js b/entity/VisitRecommendation_entity/entityfields/icon/colorProcess.js similarity index 82% rename from entity/VisitRecommendation_entity/entityfields/priority_icon/colorProcess.js rename to entity/VisitRecommendation_entity/entityfields/icon/colorProcess.js index ab4b8c5257b11b9cb7bd3dc359c767708096fec2..024b512f4ab73e7b68f250c62a934b403432666f 100644 --- a/entity/VisitRecommendation_entity/entityfields/priority_icon/colorProcess.js +++ b/entity/VisitRecommendation_entity/entityfields/icon/colorProcess.js @@ -5,20 +5,17 @@ import("system.neon"); switch(vars.getString("$field.PRIORITY")) { - case $KeywordRegistry.taskPriority$none(): - result.string(neon.PRIORITY_NONE_COLOR); - break; case $KeywordRegistry.visitRecommendationPriority$low(): - result.string(neon.PRIORITY_LOW_COLOR); + result.string(neon.PRIORITY_NONE_COLOR); break; case $KeywordRegistry.visitRecommendationPriority$medium(): - result.string(neon.PRIORITY_MEDIUM_COLOR); + result.string(neon.PRIORITY_LOW_COLOR); break; case $KeywordRegistry.visitRecommendationPriority$high(): - result.string(neon.PRIORITY_HIGH_COLOR); + result.string(neon.PRIORITY_MEDIUM_COLOR); break; case $KeywordRegistry.visitRecommendationPriority$veryHigh(): - result.string(neon.PRIORITY_HIGH_COLOR); + result.string(neon.PRIORITY_MEDIUM_COLOR); break; case $KeywordRegistry.visitRecommendationPriority$critical(): result.string(neon.PRIORITY_HIGH_COLOR); diff --git a/entity/VisitRecommendation_entity/entityfields/icon/valueProcess.js b/entity/VisitRecommendation_entity/entityfields/icon/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..4a854c12a8ace3163b6711ad66fb7c0b6de60095 --- /dev/null +++ b/entity/VisitRecommendation_entity/entityfields/icon/valueProcess.js @@ -0,0 +1,12 @@ +import("system.logging"); +import("system.vars"); +import("Keyword_lib"); +import("ActivityTask_lib"); +import("KeywordRegistry_basic"); +import("system.result"); + +var source = vars.get("$field.PRIORITY_SOURCE"); +if(source== "MANUAL") + result.string("NEON:CONVERSATION_PLANNING_MANUAL"); +else if(source== "VISITFREQUENCY") + result.string("NEON:CONVERSATION_PLANNING_FREQUENCY"); diff --git a/entity/VisitRecommendation_entity/entityfields/newentrygroup/children/newvisitplaneentry/documentation.adoc b/entity/VisitRecommendation_entity/entityfields/newentrygroup/children/newvisitplaneentry/documentation.adoc deleted file mode 100644 index cb90b44b24aeaa10d2a2516a74821433c31c6fae..0000000000000000000000000000000000000000 --- a/entity/VisitRecommendation_entity/entityfields/newentrygroup/children/newvisitplaneentry/documentation.adoc +++ /dev/null @@ -1 +0,0 @@ -Creates a new Weekplanentry \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/newentrygroup/children/newvisitplaneentry/onActionProcess.js b/entity/VisitRecommendation_entity/entityfields/newentrygroup/children/newvisitplaneentry/onActionProcess.js index 18fed0aa2bf4948e022c030e7276e08d780977bd..e5ac707432897a4fca32c7d98e93f4deea37f655 100644 --- a/entity/VisitRecommendation_entity/entityfields/newentrygroup/children/newvisitplaneentry/onActionProcess.js +++ b/entity/VisitRecommendation_entity/entityfields/newentrygroup/children/newvisitplaneentry/onActionProcess.js @@ -7,5 +7,8 @@ var params = {}; params["OrganisationId_param"] = vars.get("$field.CONTACT_ID") params["NoVisitPlanEmployeeWeek_param"] = true; params["ComingFromRecommendation_param"] = true; +params["ContactId_param"] = vars.get("$field.CONTACT_PERSON_ID"); +params["Entrydate_param"] = vars.get("$field.DUE_DATE"); +params["VisitrecommendationId_param"] = vars.get("$field.UID"); neon.openContext("VisitPlanEntry", null, null, neon.OPERATINGSTATE_NEW, params); \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/newentrygroup/children/newvisitplaneentry/tooltipProcess.js b/entity/VisitRecommendation_entity/entityfields/newentrygroup/children/newvisitplaneentry/tooltipProcess.js deleted file mode 100644 index 13967e50f1a7555e4a856ac9dde648b9501d5a4f..0000000000000000000000000000000000000000 --- a/entity/VisitRecommendation_entity/entityfields/newentrygroup/children/newvisitplaneentry/tooltipProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -import("system.translate"); -import("system.result"); - -result.string(translate.text("Create New Weekplanentry")); \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/organisationconsumer/children/onlyactive_param/valueProcess.js b/entity/VisitRecommendation_entity/entityfields/organisationconsumer/children/onlyactive_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..40effa0178464da0c7850912345f19c7fa95975a --- /dev/null +++ b/entity/VisitRecommendation_entity/entityfields/organisationconsumer/children/onlyactive_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string(true); \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/personconsumer/children/onlyactive_param/valueProcess.js b/entity/VisitRecommendation_entity/entityfields/personconsumer/children/onlyactive_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..40effa0178464da0c7850912345f19c7fa95975a --- /dev/null +++ b/entity/VisitRecommendation_entity/entityfields/personconsumer/children/onlyactive_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string(true); \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/personconsumer/children/orgid_param/valueProcess.js b/entity/VisitRecommendation_entity/entityfields/personconsumer/children/orgid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..e954cbeb0d367090f994ec596ab42d068a912cfd --- /dev/null +++ b/entity/VisitRecommendation_entity/entityfields/personconsumer/children/orgid_param/valueProcess.js @@ -0,0 +1,9 @@ +import("Sql_lib"); +import("system.vars"); +import("system.result"); + +if(vars.get("$field.CONTACT_ID")) +{ + orgid = newSelect("CONTACT.ORGANISATION_ID").from("CONTACT").where("CONTACT.CONTACTID", vars.get("$field.CONTACT_ID")).cell(); + result.string(orgid); +} diff --git a/entity/VisitRecommendation_entity/entityfields/priority/valueProcess.js b/entity/VisitRecommendation_entity/entityfields/priority/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..cbdf0752457c49ae5a0da79ccefde5d978056b3c --- /dev/null +++ b/entity/VisitRecommendation_entity/entityfields/priority/valueProcess.js @@ -0,0 +1,10 @@ +import("system.logging"); +import("system.neon"); +import("system.vars"); +import("KeywordRegistry_basic"); +import("system.result"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) + result.string($KeywordRegistry.visitRecommendationPriority$medium()); + + \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/priority_icon/valueProcess.js b/entity/VisitRecommendation_entity/entityfields/priority_icon/valueProcess.js deleted file mode 100644 index e966de8384cdb82778eb0d4ac5be2e27f7d129ae..0000000000000000000000000000000000000000 --- a/entity/VisitRecommendation_entity/entityfields/priority_icon/valueProcess.js +++ /dev/null @@ -1,5 +0,0 @@ -import("ActivityTask_lib"); -import("KeywordRegistry_basic"); -import("system.result"); - -result.string(TaskUtils.getStatusIcon($KeywordRegistry.taskStatus$new)); \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/responsible/displayValueProcess.js b/entity/VisitRecommendation_entity/entityfields/responsible/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..46777a8ba61d19bf3a9f8b3dfe737b8bc15744dc --- /dev/null +++ b/entity/VisitRecommendation_entity/entityfields/responsible/displayValueProcess.js @@ -0,0 +1,6 @@ +import("system.vars"); +import("Contact_lib"); +import("system.result"); + + +result.string(ContactUtils.getFullTitleByContactId(vars.get("$field.RESPONSIBLE"), false)); \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/responsible/valueProcess.js b/entity/VisitRecommendation_entity/entityfields/responsible/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..f5a6569b2823a8bf027f16e51ebda3a2c25d383d --- /dev/null +++ b/entity/VisitRecommendation_entity/entityfields/responsible/valueProcess.js @@ -0,0 +1,7 @@ +import("system.neon"); +import("system.vars"); +import("Employee_lib"); +import("system.result"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) + result.string(EmployeeUtils.getCurrentContactId()) \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/target_context/valueProcess.js b/entity/VisitRecommendation_entity/entityfields/target_context/valueProcess.js index a16a18c5851a7581712372aa29616de6b8ea61af..2899d9fff95bf928083f552f5b71d35327b7009b 100644 --- a/entity/VisitRecommendation_entity/entityfields/target_context/valueProcess.js +++ b/entity/VisitRecommendation_entity/entityfields/target_context/valueProcess.js @@ -1,3 +1,7 @@ +import("system.vars"); import("system.result"); -result.string("Organisation") \ No newline at end of file +if(vars.get("$field.CONTACT_PERSON_ID")) + result.string("Person") +else + result.string("Organisation") \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/target_id/valueProcess.js b/entity/VisitRecommendation_entity/entityfields/target_id/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..b68d32e6889172a4a1710a2ea1a45875faadf869 --- /dev/null +++ b/entity/VisitRecommendation_entity/entityfields/target_id/valueProcess.js @@ -0,0 +1,7 @@ +import("system.result"); +import("system.vars"); + +if(vars.get("$field.CONTACT_PERSON_ID")) + result.string(vars.get("$field.CONTACT_PERSON_ID")) +else + result.string(vars.get("$field.CONTACT_ID")) \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/user_new/valueProcess.js b/entity/VisitRecommendation_entity/entityfields/user_new/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..23de8e21545009a5333ff42b4d9d67e2c3afbf9a --- /dev/null +++ b/entity/VisitRecommendation_entity/entityfields/user_new/valueProcess.js @@ -0,0 +1,7 @@ +import("Employee_lib"); +import("system.result"); +import("system.neon"); +import("system.vars"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && (vars.get("$this.value") == null || vars.get("$this.value") == undefined)) + result.string(EmployeeUtils.getCurrentContactId()); \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/initFilterProcess.js b/entity/VisitRecommendation_entity/initFilterProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..bda986ba45af7b40c5781610a614703f255ea967 --- /dev/null +++ b/entity/VisitRecommendation_entity/initFilterProcess.js @@ -0,0 +1,37 @@ +import("Contact_lib"); +import("system.neon"); +import("system.vars"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); +import("system.result"); +import("Employee_lib"); + + +if (vars.get("$sys.presentationmode") === neon.CONTEXT_PRESENTATIONMODE_FILTER) +{ + var sourceKey = $KeywordRegistry.visitRecommendationPrioSource$manual() + filter = { + type: "group", + operator: "OR", + childs: [{ + type: "row", + name: "RESPONSIBLE", + operator: "EQUAL", + contenttype: "TEXT", + key: EmployeeUtils.getCurrentContactId(), + value: ContactUtils.getFullTitleByContactId(EmployeeUtils.getCurrentContactId(), false) + }, + { + type: "row", + name: "RESPONSIBLE", + operator: "ISNULL", + contenttype: "TEXT", + key: "" + } + ] + }; + res = JSON.stringify(filter); +} + +if (res) + result.string(res); \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/recordcontainers/jdito/contentProcess.js b/entity/VisitRecommendation_entity/recordcontainers/jdito/contentProcess.js index 42fecc4e3d198603e333edf0c71beed523ff615a..b81300d798fe257ccabdec92ab27e71394fc5f2b 100644 --- a/entity/VisitRecommendation_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/VisitRecommendation_entity/recordcontainers/jdito/contentProcess.js @@ -1,4 +1,4 @@ -import("system.SQLTYPES"); +import("JditoFilter_lib"); import("system.eMath"); import("system.tools"); import("PostalAddress_lib"); @@ -17,288 +17,258 @@ import("AttributeRegistry_basic"); import("KeywordRegistry_basic"); import("Util_lib"); import("Address_lib"); -import("JditoFilter_lib"); -var sqlMasker = new SqlMaskingUtils(); +var recommendationData = []; +var tmpData = []; +var activitySubQuery = ""; +var recommendationSQLData = newSelect( + [ + "VISITRECOMMENDATIONID", //0 + "VISITRECOMMENDATION.CONTACT_ID", //1 + "PRIORITY", //2 + "DUE_DATE", //3 + "SOURCE", //4 + "INFO", //5 + "ADDRESS.ADDRESS", //6 + "ADDRESS.COUNTRY", //7 + "ADDRESS.ZIP", //8 + "ADDRESS.CITY", //9 + "VISITRECOMMENDATION.USER_NEW", //10 + "VISITRECOMMENDATION.CONTACT_PERSON_ID",//11 + "VISITRECOMMENDATION.RESPONSIBLE", //12 + ]) + .from("VISITRECOMMENDATION") + .join("CONTACT", "coalesce(VISITRECOMMENDATION.CONTACT_PERSON_ID, VISITRECOMMENDATION.CONTACT_ID) = CONTACT.CONTACTID") + .leftJoin("ADDRESS", "CONTACT.ADDRESS_ID = ADDRESS.ADDRESSID") + .where("VISITRECOMMENDATION.STATUS is null") -var activitySubQuery = newSelect("max(ENTRYDATE)") - .from("ACTIVITY") - .join("ACTIVITYLINK", "ACTIVITYID = ACTIVITY_ID") - .where("ACTIVITYLINK.OBJECT_ROWID = org.ORGANISATIONID") - .and("ACTIVITY.CATEGORY", "VISIT") -var idValues = null; +var idValues = false; if (vars.exists("$local.idvalues") && vars.get("$local.idvalues")) - idValues = vars.get("$local.idvalues"); + idValues = true; -//dynamic Recommendations -//recommended Organisations containing the attribute Visit Frequency +if(idValues == true) + recommendationSQLData.and("VISITRECOMMENDATION.VISITRECOMMENDATIONID", vars.get("$local.idvalues"), SqlBuilder.IN()) -if (!idValues) -{ - var visitFrequencyData = newSelect([ - "org.ORGANISATIONID", - "NAME", - newSelect("CONTACT.CONTACTID") - .from("CONTACT") - .leftJoin("AB_ATTRIBUTERELATION", "CONTACT.CONTACTID = AB_ATTRIBUTERELATION.OBJECT_ROWID") - .leftJoin("AB_ATTRIBUTE", "AB_ATTRIBUTE.AB_ATTRIBUTEID = AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID") - .leftJoin("ORGANISATION", "ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID") - .where("AB_ATTRIBUTE.AB_ATTRIBUTEID", $AttributeRegistry.visitPlanPointOfContact()), - AddressUtils.formatOnelineSql(), - "visitPlanFrequency.ID_VALUE", - "'" + $KeywordRegistry.visitRecommendationPrioSource$visitFrequency()+"'" , - activitySubQuery, - "CONTACTID", - newSelect("min(ENTRYDATE)") - .from("VISITPLANENTRY") - .where("CONTACT.CONTACTID", "VISITPLANENTRY.ORGANISATION_CONTACT_ID") - .and(newWhere("VISITPLANENTRY.STATUS", $KeywordRegistry.visitPlanEntryStatus$planned()) - .or("VISITPLANENTRY.STATUS", $KeywordRegistry.visitPlanEntryStatus$Appointmentarranged())) - .and("VISITPLANENTRY.ENTRYDATE", newSelect("min(vp.ENTRYDATE)") - .from("VISITPLANENTRY", "vp") - .where(["VISITPLANENTRY", "ORGANISATION_CONTACT_ID", "vp"], "visitplanentry.ORGANISATION_CONTACT_ID") - .and(["VISITPLANENTRY", "ENTRYDATE", "vp"], datetime.today()) - .and(newWhere(["VISITPLANENTRY", "STATUS", "vp"], - $KeywordRegistry.visitPlanEntryStatus$planned()) - .or(["VISITPLANENTRY", "STATUS", "vp"], - $KeywordRegistry.visitPlanEntryStatus$Appointmentarranged())) - .cell()), - "ADDRESS.ZIP" - ]) - .from("CONTACT") - .join("ORGANISATION", "CONTACT.ORGANISATION_ID = org.ORGANISATIONID", "org") - .leftJoin("PERSON", "PERSON.PERSONID = CONTACT.PERSON_ID") - .leftJoin("ADDRESS", "ADDRESS_ID = ADDRESSID") - .join("AB_ATTRIBUTERELATION", "visitPlanFrequency.OBJECT_ROWID = CONTACT.CONTACTID", "visitPlanFrequency") - .where(["AB_ATTRIBUTERELATION", "AB_ATTRIBUTE_ID", "visitPlanFrequency"], $AttributeRegistry.visitPlanFrequency()) - .table(); - - - } +recommendationSQLData = recommendationSQLData.table(); -var prioSubSql = _getPrioByDueDateSubSql("VISITRECOMMENDATION.DUE_DATE", "VISITRECOMMENDATION.PRIORITY"); - -var recommendationSQLData = newSelect([ - "VISITRECOMMENDATIONID", - "VISITRECOMMENDATION.CONTACT_ID", - "ORGANISATION.NAME", - prioSubSql, - "VISITRECOMMENDATION.DUE_DATE", - "VISITRECOMMENDATION.SOURCE", - "VISITRECOMMENDATION.INFO", - AddressUtils.formatOnelineSql(), - newSelect("CONTACT.CONTACTID") - .from("CONTACT") - .leftJoin("AB_ATTRIBUTERELATION", "CONTACT.CONTACTID = AB_ATTRIBUTERELATION.OBJECT_ROWID") - .leftJoin("AB_ATTRIBUTE", "AB_ATTRIBUTE.AB_ATTRIBUTEID = AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID") - .leftJoin("ORGANISATION", "ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID") - .where("AB_ATTRIBUTE.AB_ATTRIBUTEID", $AttributeRegistry.visitPlanPointOfContact()) - .and("CONTACT.CONTACTID", "VISITRECOMMENDATION.CONTACT_ID") - .cell(), - - newSelect("min(ENTRYDATE)") - .from("VISITPLANENTRY") - .where("VISITPLANENTRY.ORGANISATION_CONTACT_ID", "VISITRECOMMENDATION.CONTACT_ID") - .and("VISITPLANENTRY.STATUS", $KeywordRegistry.visitPlanEntryStatus$planned()) - .or("VISITPLANENTRY.STATUS", $KeywordRegistry.visitPlanEntryStatus$Appointmentarranged()) - .and("VISITPLANENTRY.entrydate", datetime.today(), SqlBuilder.GREATER()) - .cell(), - - newSelect("VISITRECOMMENDATION.CONTACT_ID") - .from("VISITPLANEMPLOYEEWEEK, VISITPLANENTRY") - .where("VISITPLANENTRY.VISITPLANEMPLOYEEWEEK_ID", "VISITPLANEMPLOYEEWEEK.VISITPLANEMPLOYEEWEEKID") - .and("VISITRECOMMENDATION.CONTACT_ID", "VISITPLANENTRY.ORGANISATION_CONTACT_ID") - .and(newWhere("VISITPLANENTRY.STATUS", $KeywordRegistry.visitPlanEntryStatus$planned()) - .or("VISITPLANENTRY.STATUS", $KeywordRegistry.visitPlanEntryStatus$Appointmentarranged())) - .and("VISITPLANENTRY.entrydate", newSelect("min(vp.entrydate)") - .from("visitplanentry", "VP") - .where(["VISITPLANENTRY", "entrydate", "vp"], datetime.today(), SqlBuilder.GREATER()) - .and(["VISITPLANENTRY", "STATUS", "vp"], $KeywordRegistry.visitPlanEntryStatus$planned()) - .or(["VISITPLANENTRY", "STATUS", "vp"], $KeywordRegistry.visitPlanEntryStatus$Appointmentarranged()).cell()), - "ADDRESS.ZIP" -]) - .from("VISITRECOMMENDATION") - .join("CONTACT", "VISITRECOMMENDATION.CONTACT_ID = CONTACT.CONTACTID") - .leftJoin("ORGANISATION", "CONTACT.ORGANISATION_ID = ORGANISATION.ORGANISATIONID") - .join("ADDRESS", "CONTACT.ADDRESS_ID = ADDRESS.ADDRESSID") - .whereIfSet("VISITRECOMMENDATION.VISITRECOMMENDATIONID", idValues, SqlBuilder.IN()); - -var filterCond = new FilterSqlTranslator(vars.get("$local.filter"), "VISITRECOMMENDATION") - .addSqlFieldMapping("ORGANISATION_NAME", "ORGANISATION.NAME") - .addSqlFieldMapping("ADDRESS_ZIP", "ADDRESS.ZIP") - .addSpecialFieldConditionFn("PRIORITY", function (pFilterValue, pOperator) - { - switch (pOperator) - { - case "EQUAL": - return [prioSubSql[0] + " = ?", prioSubSql[1].concat([[pFilterValue, SQLTYPES.VARCHAR]])]; - case "NOT_EQUAL": - return [prioSubSql[0] + " != ?", prioSubSql[1].concat([[pFilterValue, SQLTYPES.VARCHAR]])]; - case "ISNULL": - return [prioSubSql[0] + " is null", prioSubSql[1]]; - case "ISNOTNULL": - return [prioSubSql[0] + " is not null", prioSubSql[1]]; - default: - return false; - } - }) - .getSqlCondition(); - -recommendationSQLData = recommendationSQLData.andIfSet(filterCond).table(); - -var recommendationData = recommendationSQLData.map(function ([uid, contactId, organisationName, priority, dueDate, prioSource, info, address, what, plannedDate, visitContact, addressZip]) +for( let i = 0; i < recommendationSQLData.length; i++) { - var title = ""; - if(visitContact) - { - var user = tools.getUserByAttribute(tools.CONTACTID, visitContact); - title = user[tools.TITLE] - } - - return [ - uid, - organisationName, - plannedDate, - address, - priority, - prioSource, - KeywordUtils.getViewValue($KeywordRegistry.visitRecommendationPrioSource(), prioSource), //Source of Priority (displayvalue) - dueDate, - info, - contactId, - "", - addressZip + if(recommendationSQLData[i][2]) + var prio = recommendationSQLData[i][2]; + else if(recommendationSQLData[i][3]) + prio = getPrioByDueDate(recommendationSQLData[i][3]); + else + prio = $KeywordRegistry.visitRecommendationPriority$low(); + + tmpData = [ + recommendationSQLData[i][0], //UID.value + ContactUtils.getFullTitleByContactId(recommendationSQLData[i][1]), //ORGANISATION_NAME.value + recommendationSQLData[i][6], //STREET.value + recommendationSQLData[i][7], //COUNTRY.value + recommendationSQLData[i][8], //ZIP.value + recommendationSQLData[i][9], //CITY.value + prio, //PRIORITY.value + recommendationSQLData[i][4], //PRIORITY_SOURCE.value + KeywordUtils.getViewValue($KeywordRegistry.visitRecommendationPriority(), prio), //PRIORITY.displayValue + recommendationSQLData[i][3], //DUE_DATE.value + recommendationSQLData[i][5], //INFO.value + recommendationSQLData[i][1], //CONTACT_ID.value + KeywordUtils.getViewValue($KeywordRegistry.visitRecommendationPrioSource(), recommendationSQLData[i][4]), //PRIORITY_SOURCE.displayValue + ContactUtils.getFullTitleByContactId(recommendationSQLData[i][10], false), //USER_NEW.displayvalue + recommendationSQLData[i][10], //USER_NEW.value + ContactUtils.getFullTitleByContactId(recommendationSQLData[i][11], false), //CONTACT_PERSON_ID.displayvalue + recommendationSQLData[i][11], //CONTACT_PERSON_ID.value + ContactUtils.getFullTitleByContactId(recommendationSQLData[i][12], false), //RESPONSIBLE.displayvalue + recommendationSQLData[i][12] //RESPONSIBLE.value ]; -}); + recommendationData.push(tmpData); +} + +//===========Visitfrequency============ var monthly = parseInt(datetime.ONE_DAY * 31); var semiannually = parseInt(datetime.ONE_DAY * 183); var quarterly = parseInt(datetime.ONE_DAY * 93); var yearly = parseInt(datetime.ONE_DAY * 365); -if (!idValues) +//dynamic Recommendations +//recommended Organisations containing the attribute Visit Frequency +if(idValues == false) { - var frequencyData = []; + + activitySubQuery = newSelect("max(ENTRYDATE)") + .from("ACTIVITY") + .join("ACTIVITYLINK", "ACTIVITYID = ACTIVITY_ID") + .where("ACTIVITYLINK.OBJECT_ROWID = CONTACT.CONTACTID") + .and("ACTIVITY.CATEGORY", "VISIT") + + var visitFrequencyData = newSelect(["''" //0 + , "CONTACT.CONTACTID" //1 + , "(" + newSelect("CONTACT.CONTACTID") + .from("CONTACT") + .leftJoin("AB_ATTRIBUTERELATION", "CONTACT.CONTACTID = AB_ATTRIBUTERELATION.OBJECT_ROWID") + .leftJoin("AB_ATTRIBUTE", "AB_ATTRIBUTE.AB_ATTRIBUTEID = AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID") + .leftJoin("ORGANISATION", "ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID") + .where("AB_ATTRIBUTE.AB_ATTRIBUTEID", $AttributeRegistry.visitPlanPointOfContact()) + + + ")" //2 + ,"ADDRESS.ADDRESS" //3 + ,"ADDRESS.COUNTRY" //4 + ,"ADDRESS.ZIP" //5 + ,"ADDRESS.CITY" //6 + , "visitPlanFrequency.ID_VALUE"//7 + , activitySubQuery //8 + , "org.NAME" //9 + , "PERSON.PERSONID" //10 + ]) + .from("CONTACT") + .join("ORGANISATION", "CONTACT.ORGANISATION_ID = org.ORGANISATIONID", "org") + .leftJoin("PERSON", "PERSON.PERSONID = CONTACT.PERSON_ID") + .leftJoin("ADDRESS", "ADDRESS_ID = ADDRESSID") + .join("AB_ATTRIBUTERELATION", "visitPlanFrequency.OBJECT_ROWID = CONTACT.CONTACTID", "visitPlanFrequency") + .where(["AB_ATTRIBUTERELATION", "AB_ATTRIBUTE_ID", "visitPlanFrequency"], $AttributeRegistry.visitPlanFrequency()) + .table() + for (var i = 0; i < visitFrequencyData.length; i++) { - let title = ""; - - if(visitFrequencyData[i][10]) - { - let user = tools.getUserByAttribute(tools.CONTACTID, visitFrequencyData[i][9]); - title = user[tools.TITLE] - } - - let tmpData = [ - visitFrequencyData[i][0], //UID - visitFrequencyData[i][1], //Organisation Name - visitFrequencyData[i][2], //point of contact - visitFrequencyData[i][3], //Address - "", //prio - visitFrequencyData[i][5], //Source of Priority (Id) - "", //Source of Priority (displayvalue) - "", //dueDate - "", //info - visitFrequencyData[i][7], //ContactId - "", - visitFrequencyData[i][9] - ]; + var isPersonContact = visitFrequencyData[i][10] != "" var dueDate = ""; - var lastVisitDate = visitFrequencyData[i][8]; - - if (!lastVisitDate) + var lastVisitDate = ""; + var today = datetime.date(); + if((visitFrequencyData[i][8]).length == 0) { - dueDate = datetime.date(); + dueDate = today; } else { - switch(visitFrequencyData[i][4]) + lastVisitDate = visitFrequencyData[i][8]; + switch(visitFrequencyData[i][7]) { case $AttributeRegistry.visitPlanFrequency$monthly(): - { dueDate = eMath.addInt(lastVisitDate, monthly); break; - } case $AttributeRegistry.visitPlanFrequency$quarterly(): - { dueDate = eMath.addInt(lastVisitDate, quarterly); break; - } case $AttributeRegistry.visitPlanFrequency$semiannually(): - { dueDate = eMath.addInt(lastVisitDate, semiannually); break; - } case $AttributeRegistry.visitPlanFrequency$yearly(): - { dueDate = eMath.addInt(lastVisitDate, yearly); break; - } default: - { break; - } - } } - tmpData[7] = dueDate; //Due Date - tmpData[4] = getPrioByDueDate(dueDate); //Priority - - frequencyData.push(tmpData); + + tmpData = [ + visitFrequencyData[i][1], //UID.value + visitFrequencyData[i][9], //ORGANISATION_NAME.value + visitFrequencyData[i][3], //STREET.value + visitFrequencyData[i][4], //COUNTRY.value + visitFrequencyData[i][5], //ZIP.value + visitFrequencyData[i][6], //CITY.value + getPrioByDueDate(dueDate), //PRIORITY.value + $KeywordRegistry.visitRecommendationPrioSource$visitFrequency(), //PRIORITY_SOURCE.value + KeywordUtils.getViewValue($KeywordRegistry.visitRecommendationPriority(), getPrioByDueDate(dueDate)), //PRIORITY.displayValue + dueDate, //DUE_DATE.value + "", //INFO.value + visitFrequencyData[i][1], //CONTACT_ID.value + KeywordUtils.getViewValue($KeywordRegistry.visitRecommendationPrioSource(), $KeywordRegistry.visitRecommendationPrioSource$visitFrequency()), //PRIORITY_SOURCE.displayValue + "", //USER_NEW.displayValue + "", //USER_NEW.value + ContactUtils.getFullTitleByContactId(visitFrequencyData[i][1], false), //CONTACT_PERSON_ID.displayValue + isPersonContact ? visitFrequencyData[i][1]: "", //CONTACT_PERSON_ID.value + "", //RESPONSIBLE.displayValue + "" //RESPONSIBLE.value + ]; + + + var manualRec = newSelect("VISITRECOMMENDATION.VISITRECOMMENDATIONID") + .from("VISITRECOMMENDATION") + .where("VISITRECOMMENDATION.CONTACT_ID", tmpData[0]) + .or("VISITRECOMMENDATION.CONTACT_PERSON_ID", tmpData[0]) + .cell() + + var visitEntry = newSelect("VISITPLANENTRY.VISITPLANENTRYID") + .from("VISITPLANENTRY") + .where(newWhere("VISITPLANENTRY.CONTACT_ID", tmpData[0]) + .or("VISITPLANENTRY.ORGANISATION_CONTACT_ID", tmpData[0])) + + var visitEntryExists = visitEntry.cell(); + + visitEntry = visitEntry.and(newWhere("VISITPLANENTRY.ENTRYDATE", eMath.subInt(vars.get("$sys.today"), datetime.ONE_DAY * 7), SqlBuilder.LESS_OR_EQUAL()) + .and("VISITPLANENTRY.STATUS", $KeywordRegistry.visitPlanEntryStatus$Visitreportcreated(), SqlBuilder.NOT_EQUAL())) + .or("VISITPLANENTRY.STATUS", $KeywordRegistry.visitPlanEntryStatus$Visitreportcreated(), SqlBuilder.EQUAL()).cell() + + if(!manualRec) //if manual Record was created, visitfrequency is not relevant + { + //!visitEntryExists - if no visitplanentry for the organisation/person from recommendation was created -> show recommendation so it can be planned + if(!visitEntryExists || visitEntry) + { + recommendationData.push(tmpData); + } + } } - var recordFilter = vars.get("$local.filter"); - if (recordFilter && recordFilter.filter) - frequencyData = JditoFilterUtils.filterRecords(["UID", "ORGANISATION_NAME", "", "ORGANISATION_ADDRESS", "PRIORITY", "", "", "DUE_DATE", "INFO", "CONTACT_ID", "", "ADDRESS_ZIP"], - frequencyData, recordFilter.filter); - recommendationData = recommendationData.concat(frequencyData); } +var filter = vars.get("$local.filter"); +//TODO: this is a workaround that filters the records manually, it should be possible to filter the users with a tools.* method +var filterFields = ["", "ORGANISATION_NAME", "STREET", "COUNTRY" , "ZIP", "CITY", "PRIORITY", "PRIORITY_SOURCE", "", "DUE_DATE", "INFO", "CONTACT_ID" + , "", "", "USER_NEW", "", "CONTACT_PERSON_ID", "", "RESPONSIBLE"]; +var filterFns = { + "$$$LOOKUPFIELD$$$" : function (pRecordValue, pFilterValue, pOperator, pRow) + { + if (pOperator == "CONTAINS") + { + pRow = [pRow[1], pRow[3], pRow[4], pRow[5]]; + var filterValues = pFilterValue.split(" ").filter(function (val) {return val.trim();}); + return filterValues.every(function (filterValue) + { + return pRow.some(function (fieldValue) + { + return (new RegExp(filterValue, "i")).test(fieldValue); + }); + }); + } + return false; + } +}; +recommendationData = JditoFilterUtils.filterRecords(filterFields, recommendationData, filter.filter, filterFns); -//add Display Value for Priority and PrioritySource -for (let i = 0; i < recommendationData.length; i++) -{ - recommendationData[i][6] = KeywordUtils.getViewValue($KeywordRegistry.visitRecommendationPriority(), recommendationData[i][4]) - recommendationData[i][10] = KeywordUtils.getViewValue($KeywordRegistry.visitRecommendationPrioSource(), recommendationData[i][5]) -} - -//sort Array by priority; highest priority first -ArrayUtils.sort2d(recommendationData, 4, true) -result.object(recommendationData); +var order = vars.get("$local.order"); -function _getPrioByDueDateSubSql (pDueDateField, pPriorityField) +var columnOrder = { + "ORGANISATION_NAME.value": 1, + "STREET.value": 2, + "COUNTRY.value": 3, + "ZIP.value": 4, + "CITY.value": 5, + "PRIORITY.value": 6, + "PRIORITY_SOURCE.value": 7, + "DUE_DATE.value": 9, + "USER_NEW.displayValue": 13, + "CONTACT_PERSON_ID.displayValue": 15, + "RESPONSIBLE.displayValue": 17 +}; +var sortOrder = []; +for (let field in order) { - var currentDate = datetime.date(); - var sqlMasker = new SqlMaskingUtils(); - //!SqlBuilder - var subSql = "case when " + pDueDateField + " < ? then '" + $KeywordRegistry.visitRecommendationPriority$critical() - + "' when " + pDueDateField + " < ? then '" + $KeywordRegistry.visitRecommendationPriority$veryHigh() - + "' when " + pDueDateField + " < ? then '" + $KeywordRegistry.visitRecommendationPriority$high() - + "' when " + pDueDateField + " < ? then '" + $KeywordRegistry.visitRecommendationPriority$medium() - + "' else '" + $KeywordRegistry.visitRecommendationPriority$low() + "' end"; - - var [table, field] = pDueDateField.split("."); - var dateFieldType = db.getColumnTypes(table, [field])[0]; - - var dateDiffs = [ - 0, //critical - datetime.ONE_DAY * 3, //very high - datetime.ONE_WEEK, //high - datetime.ONE_WEEK * 2 //medium - ]; - - var preparedValues = dateDiffs.map(function (dateDiff) + if (field in columnOrder) { - return [(currentDate + dateDiff).toString(), dateFieldType]; - }); - - if (pPriorityField) - subSql = sqlMasker.isNull(pPriorityField, "(" + subSql + ")"); - - return [subSql, preparedValues]; + sortOrder.push(columnOrder[field]); + sortOrder.push(order[field] == "DOWN"); + } } +if (!sortOrder.length) + sortOrder = [9, false]; //default sort by duedate + +ArrayUtils.sortMulti(recommendationData, sortOrder); +result.object(recommendationData); + function getPrioByDueDate(pDueDate) { var prio = ""; diff --git a/entity/VisitRecommendation_entity/recordcontainers/jdito/onInsert.js b/entity/VisitRecommendation_entity/recordcontainers/jdito/onInsert.js index 1da186c5ef681fd19c07d840b01e23304d33dba9..39eb6a4365c275ec35467aa8f880cf570f1acef0 100644 --- a/entity/VisitRecommendation_entity/recordcontainers/jdito/onInsert.js +++ b/entity/VisitRecommendation_entity/recordcontainers/jdito/onInsert.js @@ -3,16 +3,18 @@ import("system.db"); import("system.vars"); var rowData = vars.get("$local.rowdata"); -var contact_id = rowData["CONTACT_ID.value"]; var source = $KeywordRegistry.visitRecommendationPrioSource$manual(); var values = [ rowData["UID.value"], - contact_id, + rowData["CONTACT_ID.value"], rowData["DUE_DATE.value"], rowData["PRIORITY.value"], source, - vars.get("$field.INFO") + rowData["INFO.value"] || '', + rowData["CONTACT_PERSON_ID.value"] || '', + vars.get("$field.USER_NEW"), + vars.get("$field.RESPONSIBLE") ]; var columns = [ @@ -21,7 +23,10 @@ var columns = [ "DUE_DATE", "PRIORITY", "SOURCE", - "INFO" + "INFO", + "CONTACT_PERSON_ID", + "USER_NEW", + "RESPONSIBLE" ]; db.insertData("VISITRECOMMENDATION", columns, null, values); \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/recordcontainers/jdito/onUpdate.js b/entity/VisitRecommendation_entity/recordcontainers/jdito/onUpdate.js index b27ed4d0483f8515f6552defc190addbb70cf8b1..bf266e7b7780d5313d1b544cd2c0a8731dec2a08 100644 --- a/entity/VisitRecommendation_entity/recordcontainers/jdito/onUpdate.js +++ b/entity/VisitRecommendation_entity/recordcontainers/jdito/onUpdate.js @@ -5,11 +5,15 @@ import("system.vars"); var rowdata = vars.get("$local.rowdata"); var dbFields = { "ORGANISATION_NAME.value": "ORGANISATION_NAME", + "CONTACT_ID.value": "CONTACT_ID", "ORGANISATION_POINT_OF_CONTACT.value": "ORGANISATION_POINT_OF_CONTACT", "ORGANISATION_ADDRESS.value" : "ORGANISATION_ADDRESS", "PRIORITY.value" : "PRIORITY", "DUE_DATE.value": "DUE_DATE", - "INFO.value": "INFO" + "INFO.value": "INFO", + "CONTACT_PERSON_ID.value": "CONTACT_PERSON_ID", + "USER_NEW.value": "USER_NEW", + "RESPONSIBLE.value": "RESPONSIBLE" }; var fieldValues = {}; vars.get("$local.changed").forEach(function (field) diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index f8244417375d52b33172fa04a97c8b3fa70c7e4a..c1fa3d52f8c452a64eb937ce415637877e7077dc 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -7287,6 +7287,36 @@ <entry> <key>Email address</key> </entry> + <entry> + <key>Created from</key> + </entry> + <entry> + <key>12 Months</key> + </entry> + <entry> + <key>6 Months</key> + </entry> + <entry> + <key>1 Month</key> + </entry> + <entry> + <key>2 Weeks</key> + </entry> + <entry> + <key>Calendar week</key> + </entry> + <entry> + <key>Weekplan already exists!</key> + </entry> + <entry> + <key>Weekplan Info</key> + </entry> + <entry> + <key>requested</key> + </entry> + <entry> + <key>Status Appointment</key> + </entry> <entry> <key>#rememberme</key> </entry> @@ -7605,6 +7635,33 @@ <entry> <key>Delete this Function</key> </entry> + <entry> + <key>Subtotal</key> + </entry> + <entry> + <key>incl. Vat</key> + </entry> + <entry> + <key>Invoice Discount</key> + </entry> + <entry> + <key>discounted Vat</key> + </entry> + <entry> + <key>discounted Price</key> + </entry> + <entry> + <key>The selected Contact doesn't have an address set.</key> + </entry> + <entry> + <key>Sent offers</key> + </entry> + <entry> + <key>Salesproject phases</key> + </entry> + <entry> + <key>without Vat</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 4517c6f7aac0b43c7fcb82c9714283bbab20b136..c775a6fdeb8eeec19508ab5edc47113e1d37d0c6 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -471,7 +471,7 @@ <value>Priorität</value> </entry> <entry> - <key>Salesproject Phases</key> + <key>Salesproject phases</key> <value>Vertriebsprojektphasen</value> </entry> <entry> @@ -1843,7 +1843,7 @@ <value>Niedrigpreisstrategie</value> </entry> <entry> - <key>Sent Offers</key> + <key>Sent offers</key> <value>Versendete Angebote</value> </entry> <entry> @@ -3267,6 +3267,10 @@ <key>Singapore</key> <value>Singapur</value> </entry> + <entry> + <key>Calendar week</key> + <value>Kalenderwoche</value> + </entry> <entry> <key>French Guiana</key> <value>Französisch-Guayana</value> @@ -5742,6 +5746,10 @@ <key>medium</key> <value>mittel</value> </entry> + <entry> + <key>Site visit</key> + <value>Besuch vor Ort</value> + </entry> <entry> <key>D</key> <value>D</value> @@ -9662,6 +9670,10 @@ Bitte Datumseingabe prüfen</value> <key>Responsible Department</key> <value>zuständige Abteilung</value> </entry> + <entry> + <key>Weekplan already exists!</key> + <value>Wochenplan existiert bereits!</value> + </entry> <entry> <key>Shows the different conversion rates of the sales project phases</key> <value>zeigt die unterschiedlichen Umrechnungsraten der vertriebsprojektphasen</value> @@ -9819,6 +9831,37 @@ Bitte Datumseingabe prüfen</value> <key>Probability in %</key> <value>Wahrscheinlichkeit in %</value> </entry> + <entry> + <key>Created from</key> + <value>Ersteller</value> + </entry> + <entry> + <key>12 Months</key> + <value>12 Monate</value> + </entry> + <entry> + <key>6 Months</key> + <value>6 Monate</value> + </entry> + <entry> + <key>1 Month</key> + <value>1 Monat</value> + </entry> + <entry> + <key>2 Weeks</key> + <value>2 Wochen</value> + </entry> + <entry> + <key>Weekplan Info</key> + </entry> + <entry> + <key>requested</key> + <value>angefragt</value> + </entry> + <entry> + <key>Status Appointment</key> + <value>Status Termin</value> + </entry> <entry> <key>Standard City</key> <value>Standardstadt</value> @@ -10057,6 +10100,12 @@ Bitte Datumseingabe prüfen</value> <key>Filter set</key> <value>Filter gesetzt</value> </entry> + <entry> + <key>Sent Offers</key> + </entry> + <entry> + <key>Salesproject Phases</key> + </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 d8e9e46f3e99c126021f115bfa10d20a926e53be..f42c439be862ad8b8ffafe068fbb02e3c3b4061f 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -7350,6 +7350,36 @@ <entry> <key>Probability in %</key> </entry> + <entry> + <key>Created from</key> + </entry> + <entry> + <key>12 Months</key> + </entry> + <entry> + <key>6 Months</key> + </entry> + <entry> + <key>1 Month</key> + </entry> + <entry> + <key>2 Weeks</key> + </entry> + <entry> + <key>Calendar week</key> + </entry> + <entry> + <key>Weekplan already exists!</key> + </entry> + <entry> + <key>Weekplan Info</key> + </entry> + <entry> + <key>requested</key> + </entry> + <entry> + <key>Status Appointment</key> + </entry> <entry> <key>Standard City</key> </entry> @@ -7686,6 +7716,33 @@ <entry> <key>Delete this Function</key> </entry> + <entry> + <key>Subtotal</key> + </entry> + <entry> + <key>incl. Vat</key> + </entry> + <entry> + <key>Invoice Discount</key> + </entry> + <entry> + <key>discounted Vat</key> + </entry> + <entry> + <key>discounted Price</key> + </entry> + <entry> + <key>The selected Contact doesn't have an address set.</key> + </entry> + <entry> + <key>Sent offers</key> + </entry> + <entry> + <key>Salesproject phases</key> + </entry> + <entry> + <key>without Vat</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/neonView/KeywordEntryFilter_view/KeywordEntryFilter_view.aod b/neonView/KeywordEntryFilter_view/KeywordEntryFilter_view.aod index 8f78ef984bbdc413eaaabec6059d2888654ed04e..f1f2c7f997e1952354adade7eeb7c3bc91c4a09c 100644 --- a/neonView/KeywordEntryFilter_view/KeywordEntryFilter_view.aod +++ b/neonView/KeywordEntryFilter_view/KeywordEntryFilter_view.aod @@ -12,11 +12,16 @@ <treeTableViewTemplate> <name>EntriesTreeTable</name> <nodeExpandedField></nodeExpandedField> + <hideActions v="true" /> <hideContentSearch v="false" /> <entityField>#ENTITY</entityField> <defaultGroupFields> <element>CONTAINER</element> </defaultGroupFields> + <maxDBRow v="400" /> + <isCreatable v="true" /> + <isDeletable v="true" /> + <isEditable v="true" /> <columns> <neonTreeTableColumn> <name>6100879d-dc6a-4c7e-b750-f5b7e627f48a</name> diff --git a/neonView/VisitPlanEmployeeWeekFilter_view/VisitPlanEmployeeWeekFilter_view.aod b/neonView/VisitPlanEmployeeWeekFilter_view/VisitPlanEmployeeWeekFilter_view.aod index bcbed30d9f5fe37b6f0a77b8831fd8d3a854f9dc..dfb29c68381ec7aa1fa5318936f9c12029fb04c0 100644 --- a/neonView/VisitPlanEmployeeWeekFilter_view/VisitPlanEmployeeWeekFilter_view.aod +++ b/neonView/VisitPlanEmployeeWeekFilter_view/VisitPlanEmployeeWeekFilter_view.aod @@ -2,7 +2,7 @@ <neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.7" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.7"> <name>VisitPlanEmployeeWeekFilter_view</name> <majorModelMode>DISTRIBUTED</majorModelMode> - <filterable v="false" /> + <filterable v="true" /> <layout> <groupLayout> <name>layout</name> @@ -27,6 +27,10 @@ <name>41e665d5-0bcf-4e33-8080-809d839da15d</name> <entityField>YEAR</entityField> </neonTableColumn> + <neonTableColumn> + <name>51af23cb-462b-4b40-8923-97c9c9120dd1</name> + <entityField>CONTACT_ID</entityField> + </neonTableColumn> <neonTableColumn> <name>a5b55587-841d-42d5-b4b7-eff55f6f6858</name> <entityField>entriescount</entityField> @@ -68,6 +72,10 @@ <name>6a11aa05-3879-46f2-9944-2006d9caf928</name> <entityField>YEAR</entityField> </neonTreeTableColumn> + <neonTreeTableColumn> + <name>d8055245-cf8d-40cd-ad59-627c564d831d</name> + <entityField>CONTACT_ID</entityField> + </neonTreeTableColumn> <neonTreeTableColumn> <name>8db139d9-7dd7-4ea2-9c73-1c0accec2ef5</name> <entityField>entriescount</entityField> diff --git a/neonView/VisitPlanEntryEdit_view/VisitPlanEntryEdit_view.aod b/neonView/VisitPlanEntryEdit_view/VisitPlanEntryEdit_view.aod index 4538a67ca213ef3211f832ad3d82c9471c1f3b19..8a1cb76c31356be8827337a25b2b7966fc8104ad 100644 --- a/neonView/VisitPlanEntryEdit_view/VisitPlanEntryEdit_view.aod +++ b/neonView/VisitPlanEntryEdit_view/VisitPlanEntryEdit_view.aod @@ -28,6 +28,14 @@ <name>8347bc87-30f2-4335-b824-23e107b949b5</name> <entityField>ENTRYDATE</entityField> </entityFieldLink> + <entityFieldLink> + <name>be3740d4-344b-454d-a857-cedfa8177015</name> + <entityField>STATUS</entityField> + </entityFieldLink> + <entityFieldLink> + <name>7536ef8c-6888-40b9-adb0-42d8b4e2eb42</name> + <entityField>STATUS_APPOINTMENT</entityField> + </entityFieldLink> <entityFieldLink> <name>99cbd482-b7c7-4d5b-a17e-62f9ab49db8a</name> <entityField>BEGIN_TIME</entityField> @@ -36,6 +44,10 @@ <name>75e0b2e9-2cd9-4d27-a696-2494ec79daa4</name> <entityField>END_TIME</entityField> </entityFieldLink> + <entityFieldLink> + <name>78926e28-339b-41fe-a9bf-e5a49d07508f</name> + <entityField>VISITPLANEMPLOYEEWEEK_INFO</entityField> + </entityFieldLink> </fields> </genericViewTemplate> </children> diff --git a/neonView/VisitPlanEntryFilter_view/VisitPlanEntryFilter_view.aod b/neonView/VisitPlanEntryFilter_view/VisitPlanEntryFilter_view.aod index b514c136189ee96998f977ad5b170060dee690b0..6e48e82b678d90a15f433eeb684c6e97aa478575 100644 --- a/neonView/VisitPlanEntryFilter_view/VisitPlanEntryFilter_view.aod +++ b/neonView/VisitPlanEntryFilter_view/VisitPlanEntryFilter_view.aod @@ -64,6 +64,10 @@ <name>ca75adc7-5405-40af-bda0-52ae38e61f76</name> <entityField>STATUS</entityField> </neonTreeTableColumn> + <neonTreeTableColumn> + <name>c3110972-795b-4293-b082-8f8bee1aa2ec</name> + <entityField>STATUS_APPOINTMENT</entityField> + </neonTreeTableColumn> </columns> </treeTableViewTemplate> </children> diff --git a/neonView/VisitRecommendationEdit_view/VisitRecommendationEdit_view.aod b/neonView/VisitRecommendationEdit_view/VisitRecommendationEdit_view.aod index 1c9a8ce3e804c6a74cf5734705451f6e1b4de277..745453e6195772d55a92d874e276d6ef9dae6578 100644 --- a/neonView/VisitRecommendationEdit_view/VisitRecommendationEdit_view.aod +++ b/neonView/VisitRecommendationEdit_view/VisitRecommendationEdit_view.aod @@ -20,6 +20,14 @@ <name>1356cbc2-646b-4277-8671-cf004b2dffd8</name> <entityField>CONTACT_ID</entityField> </entityFieldLink> + <entityFieldLink> + <name>10948f7e-84ad-4647-83a0-e5003044c797</name> + <entityField>CONTACT_PERSON_ID</entityField> + </entityFieldLink> + <entityFieldLink> + <name>345df51a-686b-4960-b434-550cb6dd4d08</name> + <entityField>RESPONSIBLE</entityField> + </entityFieldLink> <entityFieldLink> <name>f4c34f77-c8cd-4eeb-a172-2f22a6de4029</name> <entityField>DUE_DATE</entityField> diff --git a/neonView/VisitRecommendationFilter_view/VisitRecommendationFilter_view.aod b/neonView/VisitRecommendationFilter_view/VisitRecommendationFilter_view.aod index 73cb8599d027fdde37a5abd28a12b7baef17c8d1..764f109ee4c8995466635b4d00452eacb11a2236 100644 --- a/neonView/VisitRecommendationFilter_view/VisitRecommendationFilter_view.aod +++ b/neonView/VisitRecommendationFilter_view/VisitRecommendationFilter_view.aod @@ -11,23 +11,43 @@ <children> <tableViewTemplate> <name>Table</name> - <favoriteActionGroup1>newEntryGroup</favoriteActionGroup1> <entityField>#ENTITY</entityField> + <favoriteActionGroup1>newEntryGroup</favoriteActionGroup1> <isCreatable v="true" /> <isDeletable v="true" /> <isEditable v="true" /> <columns> <neonTableColumn> <name>a87306f5-45b1-4969-ab2b-c6d17b54c4de</name> - <entityField>PRIORITY_ICON</entityField> + <entityField>ICON</entityField> </neonTableColumn> <neonTableColumn> <name>44659323-f1b5-4b29-afbf-eac2e7219e30</name> <entityField>ORGANISATION_NAME</entityField> </neonTableColumn> <neonTableColumn> - <name>703fad3a-2d5f-47b4-8cc3-edf14c08afef</name> - <entityField>ORGANISATION_ADDRESS</entityField> + <name>60559b0a-8a8a-4f1c-9489-83a26d250d57</name> + <entityField>CONTACT_PERSON_ID</entityField> + </neonTableColumn> + <neonTableColumn> + <name>b18d68b1-b592-4bd8-977c-3d5fcfbf60da</name> + <entityField>STREET</entityField> + </neonTableColumn> + <neonTableColumn> + <name>8dc56a28-7618-45c2-8bca-ffcb606f29b0</name> + <entityField>COUNTRY</entityField> + </neonTableColumn> + <neonTableColumn> + <name>ad163103-0080-4d54-b6b3-5de8b4653ad8</name> + <entityField>ZIP</entityField> + </neonTableColumn> + <neonTableColumn> + <name>ca45977f-a6f0-4e37-a736-55093b98b738</name> + <entityField>CITY</entityField> + </neonTableColumn> + <neonTableColumn> + <name>4d93f307-d229-43de-8e14-706a725e969e</name> + <entityField>RESPONSIBLE</entityField> </neonTableColumn> <neonTableColumn> <name>964bed99-4474-4017-b3cf-d6d51eb5b445</name> @@ -41,6 +61,10 @@ <name>85536cbf-d252-486e-a7ca-74b3ee9486c5</name> <entityField>DUE_DATE</entityField> </neonTableColumn> + <neonTableColumn> + <name>ced0751b-260b-4b24-b172-7dbcec016b98</name> + <entityField>USER_NEW</entityField> + </neonTableColumn> <neonTableColumn> <name>e11dc9c2-73fe-4b21-96cb-01bbe69f6bd7</name> <entityField>INFO</entityField> @@ -49,20 +73,40 @@ </tableViewTemplate> <treeTableViewTemplate> <name>Treetable</name> - <favoriteActionGroup1>newEntryGroup</favoriteActionGroup1> <entityField>#ENTITY</entityField> + <favoriteActionGroup1>newEntryGroup</favoriteActionGroup1> <columns> <neonTreeTableColumn> <name>297bae8e-4d8c-4fbf-90fb-240369d48ff9</name> - <entityField>PRIORITY_ICON</entityField> + <entityField>ICON</entityField> </neonTreeTableColumn> <neonTreeTableColumn> <name>621b2bf8-280a-4bd8-9a09-9cad5bdcda0e</name> <entityField>ORGANISATION_NAME</entityField> </neonTreeTableColumn> <neonTreeTableColumn> - <name>6a98ae55-a30e-48d4-8d45-1c63a359af5e</name> - <entityField>ORGANISATION_ADDRESS</entityField> + <name>009230b5-a78c-4718-875e-7ccfe080f348</name> + <entityField>CONTACT_PERSON_ID</entityField> + </neonTreeTableColumn> + <neonTreeTableColumn> + <name>b88f4159-c816-4955-877e-ed973a111aca</name> + <entityField>STREET</entityField> + </neonTreeTableColumn> + <neonTreeTableColumn> + <name>81d71829-f0db-4320-9ae8-b1863b45a7db</name> + <entityField>COUNTRY</entityField> + </neonTreeTableColumn> + <neonTreeTableColumn> + <name>e6de8082-b860-4d4d-a5a5-f73b62554ea6</name> + <entityField>ZIP</entityField> + </neonTreeTableColumn> + <neonTreeTableColumn> + <name>ece04c42-ac19-4565-829f-0c437e2c97e7</name> + <entityField>CITY</entityField> + </neonTreeTableColumn> + <neonTreeTableColumn> + <name>599ba04b-e1c4-4feb-89c9-850ab954fbb2</name> + <entityField>RESPONSIBLE</entityField> </neonTreeTableColumn> <neonTreeTableColumn> <name>8f02f53e-8e60-4c71-9fb3-5a4b32ff0776</name> @@ -76,6 +120,10 @@ <name>c2ca0e43-a94f-460b-8a42-4bc3a3755213</name> <entityField>DUE_DATE</entityField> </neonTreeTableColumn> + <neonTreeTableColumn> + <name>84116ee7-a557-4ef3-892e-beea40c1290a</name> + <entityField>USER_NEW</entityField> + </neonTreeTableColumn> <neonTreeTableColumn> <name>2fa2eb56-28ec-4bdc-a1ff-1ca0e26ab407</name> <entityField>INFO</entityField> diff --git a/process/Calendar_lib/process.js b/process/Calendar_lib/process.js index e9f96a4a9089f1ff65bb69dfb21ff41063f90ab8..978a653a75b7fa013cf05274dd8e9ee25550e00c 100644 --- a/process/Calendar_lib/process.js +++ b/process/Calendar_lib/process.js @@ -275,9 +275,11 @@ CalendarUtil.newSilentEvent = function( pSummary, pDescription, pWithLink, pUser * Priority of the task/appointment.<br> * @param {String} pReminder (optional) <p> * Reminder.<br> + * @param {[]} pExternalAttendees <p> + * external attendes ([mailaddress])<br> * @return {Object} <p> */ -CalendarUtil.createEntry = function(pUid, pType, pSummary, pDescription, pWithLink, pAppLinkContext, pAppLinkId, pUser, pAffectedUsers, pStart, pDuration, pCategory, pStatus, pPriority, pReminder ) +CalendarUtil.createEntry = function(pUid, pType, pSummary, pDescription, pWithLink, pAppLinkContext, pAppLinkId, pUser, pAffectedUsers, pStart, pDuration, pCategory, pStatus, pPriority, pReminder, pExternalAttendees ) { var Entry = {}; var framename; @@ -297,13 +299,23 @@ CalendarUtil.createEntry = function(pUid, pType, pSummary, pDescription, pWithLi if ( pStart == undefined ) pStart = datetime.toLong(datetime.toDate(parseInt(vars.getString("$sys.date")) + datetime.ONE_HOUR, "dd.MM.yyyy HH:00"), "dd.MM.yyyy HH:mm"); if ( pCategory == undefined || pCategory == null ) pCategory = ""; - if (pAffectedUsers == null || pAffectedUsers == undefined ) + if ( (pAffectedUsers == null || pAffectedUsers == undefined) && (pExternalAttendees == null || pExternalAttendees == undefined)) { Entry[calendars.AFFECTEDUSERS] = ""; } else { - Entry[calendars.AFFECTEDUSERS] = text.encodeMS(calendars.getCalendarUsers(pAffectedUsers)); + var externalAtt = []; + var affectedUsers = []; + if(pAffectedUsers) + affectedUsers = calendars.getCalendarUsers(pAffectedUsers); + + if(pExternalAttendees) + { + for(let i = 0; i < pExternalAttendees.length; i++) + externalAtt.push("; mailto:" + pExternalAttendees[i] + "; CN:" + pExternalAttendees[i] + "; ") + } + Entry[calendars.AFFECTEDUSERS] = text.encodeMS(affectedUsers.concat(externalAtt)); } Entry[calendars.TYPE] = pType; Entry[calendars.DTSTART] = pStart; @@ -334,10 +346,10 @@ CalendarUtil.createEntry = function(pUid, pType, pSummary, pDescription, pWithLi pStatus = CalendarUtil.mapCalendarStatus(pStatus, calendars.getBackendTypeTasks() ); } - - + if(pUid) Entry[calendars.ID] = pUid; + Entry[calendars.USER] = calendars.getCalendarUser(pUser); Entry[calendars.DESCRIPTION] = pDescription; Entry[calendars.SUMMARY] = pSummary; @@ -345,8 +357,7 @@ CalendarUtil.createEntry = function(pUid, pType, pSummary, pDescription, pWithLi Entry[calendars.CLASSIFICATION] = calendars.CLASSIFICATION_PUBLIC; Entry[calendars.CATEGORIES] = pCategory; Entry[calendars.TRANSPARENCY] = "OPAQUE"; - - + if( pPriority != undefined ) { Entry[calendars.PRIORITY] = pPriority; @@ -471,17 +482,17 @@ CalendarUtil.reset_filterEvent = function() } /* - * Gibt den richtigen Status zum Prüfen je nach Backend zurück + * Gibt den richtigen Status zum Prüfen je nach Backend zurück * Returns the matching status, to the corresponding backend. * * - * @param {String} pStatus req die konstante für den zu prüfenden status, + * @param {String} pStatus req die konstante für den zu prüfenden status, * z.B. calendars.STATUS_INPROCESS * - * @param {String} pCalendarType req die konstante für den typen des Termin- oder Aufgabenbackends, + * @param {String} pCalendarType req die konstante für den typen des Termin- oder Aufgabenbackends, * z.B. calendars.BACKEND_DB * - * @return {String} Konstanten für den Kalender (Backend-Typen), gibt es den status im backend nicht + * @return {String} Konstanten für den Kalender (Backend-Typen), gibt es den status im backend nicht * wird null geliefert */ CalendarUtil.mapCalendarStatus = function(pStatus, pCalendarType) diff --git a/process/KeywordRegistry_basic/process.js b/process/KeywordRegistry_basic/process.js index eaa206920ca8d3e012f686c6830db4b63d9942fd..350f1dfa09fffef32d06d180c1391b65a4c31275 100644 --- a/process/KeywordRegistry_basic/process.js +++ b/process/KeywordRegistry_basic/process.js @@ -308,4 +308,7 @@ $KeywordRegistry.knowledgeType$editorial = function(){return "EDITORIAL";} $KeywordRegistry.knowledgePublishLevel = function(){return "KnowledgePublishLevel";} $KeywordRegistry.knowledgePublishLevel$internal = function(){return "INTERNAL";} $KeywordRegistry.knowledgePublishLevel$partner = function(){return "PARTNER";} -$KeywordRegistry.knowledgePublishLevel$public = function(){return "PUBLIC";} \ No newline at end of file +$KeywordRegistry.knowledgePublishLevel$public = function(){return "PUBLIC";} +$KeywordRegistry.visitPlanEntryStatusAppointment = function(){return "VisitPlanEntryStatusAppointment";}; +$KeywordRegistry.visitPlanEntryStatusAppointment$requested = function(){return "VISITSTATUSAPPOINTMENTREQUESTED";}; +$KeywordRegistry.visitPlanEntryStatusAppointment$confirmed = function(){return "VISITSTATUSAPPOINTMENTCONFIRMED";}; \ No newline at end of file