From 718df69ef8b5c4b5b2e099e6969abe560f188edc Mon Sep 17 00:00:00 2001 From: "c.wimmer" <c.wimmer@cwimmer-nb.aditosoftware.local> Date: Fri, 9 Oct 2020 09:29:26 +0200 Subject: [PATCH] [Projekt: Crowd-Development / Besuch vor Ort][TicketNr.: 1066738][[aus Schmalz] Besuchsvorschlag anlegen] [Projekt: Crowd-Development / Besuch vor Ort][TicketNr.: 1066740][[aus Schmalz] Neuer Wochenplaneintrag] [Projekt: Crowd-Development / Besuch vor Ort][TicketNr.: 1066737][[aus Schmalz] Besuchsvorschlag - Darstellung in der Filterview] --- ...VisitrecommendationpriorityUserNewResp.xml | 11 + .../Data_alias/basic/2020.2.0/changelog.xml | 2 + ...nsert_VisitFrequencyAttributeUsagePers.xml | 12 + aliasDefinition/Data_alias/Data_alias.aod | 42 ++ .../Appointment_entity/Appointment_entity.aod | 4 + entity/Appointment_entity/afterUiInit.js | 11 + entity/Employee_entity/Employee_entity.aod | 6 + .../recordcontainers/jdito/onInsert.js | 58 +-- entity/Person_entity/Person_entity.aod | 361 +++++++++--------- .../newvisitrecommendation/onActionProcess.js | 15 + .../newvisitrecommendation/stateProcess.js | 7 + .../visitplan_prio.displayvalue/expression.js | 6 + .../VisitPlanEntry_entity.aod | 9 +- entity/VisitPlanEntry_entity/afterSave.js | 38 ++ .../entityfields/contact_id/valueProcess.js | 9 + .../children/orgid_param/valueProcess.js | 9 + .../recordcontainers/jdito/onUpdate.js | 3 +- .../VisitRecommendation_entity.aod | 118 +++++- .../entityfields/contact_id/stateProcess.js | 2 +- .../contact_person_id/stateProcess.js | 7 + .../contact_person_id/valueProcess.js | 7 + .../onlyactives_param/valueProcess.js | 3 + .../newvisitplaneentry/onActionProcess.js | 1 + .../children/orgid_param/valueProcess.js | 7 + .../entityfields/priority/valueProcess.js | 10 + .../entityfields/user_new/valueProcess.js | 7 + .../recordcontainers/jdito/contentProcess.js | 312 ++++++++------- .../recordcontainers/jdito/onInsert.js | 10 +- .../recordcontainers/jdito/onUpdate.js | 5 +- .../VisitPlanEntryEdit_view.aod | 4 + .../VisitRecommendationEdit_view.aod | 8 + .../VisitRecommendationFilter_view.aod | 36 +- process/Calendar_lib/process.js | 33 +- 33 files changed, 791 insertions(+), 382 deletions(-) create mode 100644 .liquibase/Data_alias/basic/2020.2.0/alter_VisitrecommendationpriorityUserNewResp.xml create mode 100644 .liquibase/Data_alias/basic/2020.2.0/insert_VisitFrequencyAttributeUsagePers.xml create mode 100644 entity/Person_entity/entityfields/newvisitrecommendation/onActionProcess.js create mode 100644 entity/Person_entity/entityfields/newvisitrecommendation/stateProcess.js create mode 100644 entity/Person_entity/recordcontainers/db/recordfieldmappings/visitplan_prio.displayvalue/expression.js create mode 100644 entity/VisitPlanEntry_entity/afterSave.js create mode 100644 entity/VisitPlanEntry_entity/entityfields/contact_id/valueProcess.js create mode 100644 entity/VisitPlanEntry_entity/entityfields/persons/children/orgid_param/valueProcess.js create mode 100644 entity/VisitRecommendation_entity/entityfields/contact_person_id/stateProcess.js create mode 100644 entity/VisitRecommendation_entity/entityfields/contact_person_id/valueProcess.js create mode 100644 entity/VisitRecommendation_entity/entityfields/employees/children/onlyactives_param/valueProcess.js create mode 100644 entity/VisitRecommendation_entity/entityfields/personconsumer/children/orgid_param/valueProcess.js create mode 100644 entity/VisitRecommendation_entity/entityfields/priority/valueProcess.js create mode 100644 entity/VisitRecommendation_entity/entityfields/user_new/valueProcess.js diff --git a/.liquibase/Data_alias/basic/2020.2.0/alter_VisitrecommendationpriorityUserNewResp.xml b/.liquibase/Data_alias/basic/2020.2.0/alter_VisitrecommendationpriorityUserNewResp.xml new file mode 100644 index 0000000000..c57e89387f --- /dev/null +++ b/.liquibase/Data_alias/basic/2020.2.0/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/2020.2.0/changelog.xml b/.liquibase/Data_alias/basic/2020.2.0/changelog.xml index 620de86991..0b29f64c0e 100644 --- a/.liquibase/Data_alias/basic/2020.2.0/changelog.xml +++ b/.liquibase/Data_alias/basic/2020.2.0/changelog.xml @@ -13,4 +13,6 @@ <include relativeToChangelogFile="true" file="alter_VisitrecommendationpriorityDatatype.xml"/> <include relativeToChangelogFile="true" file="alter_KeywordTitlesForTranslation.xml"/> <include relativeToChangelogFile="true" file="alter_CommrestrictionsEmployeeInvolved.xml"/> + <include relativeToChangelogFile="true" file="alter_VisitrecommendationpriorityUserNewResp.xml"/> + <include relativeToChangelogFile="true" file="insert_VisitFrequencyAttributeUsagePers.xml"/> </databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/2020.2.0/insert_VisitFrequencyAttributeUsagePers.xml b/.liquibase/Data_alias/basic/2020.2.0/insert_VisitFrequencyAttributeUsagePers.xml new file mode 100644 index 0000000000..ac24208cb2 --- /dev/null +++ b/.liquibase/Data_alias/basic/2020.2.0/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/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod index 31f424c2a7..5d68313f1f 100644 --- a/aliasDefinition/Data_alias/Data_alias.aod +++ b/aliasDefinition/Data_alias/Data_alias.aod @@ -14778,6 +14778,48 @@ <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> </entityFields> </entityDb> <entityDb> diff --git a/entity/Appointment_entity/Appointment_entity.aod b/entity/Appointment_entity/Appointment_entity.aod index 6f51538041..0521b12a0a 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> </entityFields> <recordContainers> <jDitoRecordContainer> diff --git a/entity/Appointment_entity/afterUiInit.js b/entity/Appointment_entity/afterUiInit.js index 12e19779bd..b018dcc372 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 60ea8401f6..2ed1146344 100644 --- a/entity/Employee_entity/Employee_entity.aod +++ b/entity/Employee_entity/Employee_entity.aod @@ -268,6 +268,12 @@ <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> </dependencies> <children> <entityParameter> diff --git a/entity/Employee_entity/recordcontainers/jdito/onInsert.js b/entity/Employee_entity/recordcontainers/jdito/onInsert.js index 4ad2125ac5..fef358b770 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/Person_entity/Person_entity.aod b/entity/Person_entity/Person_entity.aod index bf2838ef62..ba8961236d 100644 --- a/entity/Person_entity/Person_entity.aod +++ b/entity/Person_entity/Person_entity.aod @@ -731,7 +731,7 @@ </entityParameter> <entityParameter> <name>OrgId_param</name> - <expose v="false" /> + <expose v="true" /> </entityParameter> <entityParameter> <name>OnlyShowContactIds_param</name> @@ -1005,175 +1005,6 @@ </entityParameter> </children> </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> - </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> - <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> - <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> - <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> - <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" /> @@ -1233,13 +1064,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> @@ -1381,6 +1205,189 @@ </entityParameter> </children> </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> + </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> + <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> + <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> + <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> + <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> </entityFields> <recordContainers> <dbRecordContainer> diff --git a/entity/Person_entity/entityfields/newvisitrecommendation/onActionProcess.js b/entity/Person_entity/entityfields/newvisitrecommendation/onActionProcess.js new file mode 100644 index 0000000000..20eba0e1ac --- /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 0000000000..aefbc6e8f7 --- /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 0000000000..ad8d13c1e0 --- /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/VisitPlanEntry_entity/VisitPlanEntry_entity.aod b/entity/VisitPlanEntry_entity/VisitPlanEntry_entity.aod index f059c7a986..3646feab56 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> @@ -182,6 +183,7 @@ <title>Contact</title> <consumer>Persons</consumer> <mandatory v="true" /> + <valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/contact_id/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/contact_id/displayValueProcess.js</displayValueProcess> </entityField> <entityConsumer> @@ -193,13 +195,10 @@ </dependency> <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> </entityConsumer> <entityParameter> diff --git a/entity/VisitPlanEntry_entity/afterSave.js b/entity/VisitPlanEntry_entity/afterSave.js new file mode 100644 index 0000000000..b88d0076dd --- /dev/null +++ b/entity/VisitPlanEntry_entity/afterSave.js @@ -0,0 +1,38 @@ +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("Calendar_lib"); +import("Communication_lib"); + +var savedData = vars.get("$local.entitydata"); +if(savedData["STATUS"] == "VISITSTATUSAPPPLANED") +{ + var summary = translate.text("Besuch vor Ort") + " | " + 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); +} \ No newline at end of file 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 0000000000..5862792995 --- /dev/null +++ b/entity/VisitPlanEntry_entity/entityfields/contact_id/valueProcess.js @@ -0,0 +1,9 @@ +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.ContactId_param")); + + 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 0000000000..c6e583e8bd --- /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/recordcontainers/jdito/onUpdate.js b/entity/VisitPlanEntry_entity/recordcontainers/jdito/onUpdate.js index c22eeca420..47ab3597f5 100644 --- a/entity/VisitPlanEntry_entity/recordcontainers/jdito/onUpdate.js +++ b/entity/VisitPlanEntry_entity/recordcontainers/jdito/onUpdate.js @@ -1,3 +1,4 @@ +import("system.datetime"); import("Sql_lib"); import("system.logging"); import("system.neon"); @@ -11,7 +12,7 @@ var values = [ rowData["BEGIN_TIME.value"], rowData["END_TIME.value"], rowData["ORGANISATION_CONTACT_ID.value"], - rowData["STATUS"] + rowData["STATUS.value"] ]; var columns = [ diff --git a/entity/VisitRecommendation_entity/VisitRecommendation_entity.aod b/entity/VisitRecommendation_entity/VisitRecommendation_entity.aod index 2aed7529f6..60cad0f250 100644 --- a/entity/VisitRecommendation_entity/VisitRecommendation_entity.aod +++ b/entity/VisitRecommendation_entity/VisitRecommendation_entity.aod @@ -5,8 +5,6 @@ <documentation>%aditoprj%/entity/VisitRecommendation_entity/documentation.adoc</documentation> <title>Visit Recommendation</title> <grantCreate v="true" /> - <grantUpdateProcess>%aditoprj%/entity/VisitRecommendation_entity/grantUpdateProcess.js</grantUpdateProcess> - <grantDeleteProcess>%aditoprj%/entity/VisitRecommendation_entity/grantDeleteProcess.js</grantDeleteProcess> <iconId>VAADIN:BRIEFCASE</iconId> <image>VAADIN:BRIEFCASE</image> <titlePlural>Visit Recommendations</titlePlural> @@ -29,7 +27,7 @@ <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> <valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/contact_id/valueProcess.js</valueProcess> @@ -40,7 +38,7 @@ </entityField> <entityField> <name>ORGANISATION_NAME</name> - <title>Customer</title> + <title>Organisation</title> </entityField> <entityField> <name>ORGANISATION_POINT_OF_CONTACT</name> @@ -55,6 +53,7 @@ <title>Priority</title> <consumer>KeywordVisitRecommendationPriority</consumer> <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> @@ -75,6 +74,7 @@ <entityField> <name>INFO</name> <title>Info</title> + <contentType>LONG_TEXT</contentType> </entityField> <entityField> <name>DATE_PLANNED</name> @@ -123,6 +123,11 @@ <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> </children> </entityConsumer> <entityParameter> @@ -158,6 +163,19 @@ <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> + <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> + <stateProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/contact_person_id/stateProcess.js</stateProcess> + <valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/contact_person_id/valueProcess.js</valueProcess> + </entityField> <entityProvider> <name>#PROVIDER_AGGREGATES</name> <useAggregates v="true" /> @@ -176,11 +194,53 @@ </entityParameter> </children> </entityConsumer> + <entityParameter> + <name>ContactIdPerson_param</name> + <expose v="true" /> + </entityParameter> + <entityField> + <name>RESPONSIBLE</name> + <title>Responsible</title> + <consumer>Employees</consumer> + <mandatory v="true" /> + </entityField> + <entityConsumer> + <name>Employees</name> + <dependency> + <name>dependency</name> + <entityName>Employee_entity</entityName> + <fieldName>Employees</fieldName> + </dependency> + <children> + <entityParameter> + <name>OnlyActives_param</name> + <valueProcess>%aditoprj%/entity/VisitRecommendation_entity/entityfields/employees/children/onlyactives_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityField> + <name>STREET</name> + <title>Street</title> + </entityField> + <entityField> + <name>COUNTRY</name> + <title>Country</title> + </entityField> + <entityField> + <name>ZIP</name> + <title>ZIP</title> + </entityField> + <entityField> + <name>CITY</name> + <title>City</title> + </entityField> </entityFields> <recordContainers> <jDitoRecordContainer> <name>jDito</name> <jDitoRecordAlias>Data_alias</jDitoRecordAlias> + <isFilterable 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> @@ -191,26 +251,38 @@ </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>ORGANISATION_NAME.value</name> - <isFilterable v="true" /> - <isLookupFilter v="true" /> + <isFilterable v="false" /> + <isLookupFilter v="false" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>ORGANISATION_POINT_OF_CONTACT.value</name> + <isFilterable v="false" /> + <isLookupFilter v="false" /> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>STREET.value</name> <isFilterable v="true" /> - <isLookupFilter v="true" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> - <name>ORGANISATION_ADDRESS.value</name> + <name>COUNTRY.value</name> + <isFilterable v="true" /> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>ZIP.value</name> + <isFilterable v="true" /> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>CITY.value</name> <isFilterable v="true" /> - <isLookupFilter 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> @@ -218,7 +290,7 @@ <jDitoRecordFieldMapping> <name>DUE_DATE.value</name> <isFilterable v="true" /> - <isLookupFilter v="true" /> + <isLookupFilter v="false" /> </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>INFO.value</name> @@ -231,6 +303,30 @@ <jDitoRecordFieldMapping> <name>PRIORITY_SOURCE.displayValue</name> </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <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> <filterExtensionSet> diff --git a/entity/VisitRecommendation_entity/entityfields/contact_id/stateProcess.js b/entity/VisitRecommendation_entity/entityfields/contact_id/stateProcess.js index 5cc1152733..7092871f22 100644 --- a/entity/VisitRecommendation_entity/entityfields/contact_id/stateProcess.js +++ b/entity/VisitRecommendation_entity/entityfields/contact_id/stateProcess.js @@ -4,4 +4,4 @@ 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 + result.string(neon.COMPONENTSTATE_INVISIBLE) \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/contact_person_id/stateProcess.js b/entity/VisitRecommendation_entity/entityfields/contact_person_id/stateProcess.js new file mode 100644 index 0000000000..07f9475d01 --- /dev/null +++ b/entity/VisitRecommendation_entity/entityfields/contact_person_id/stateProcess.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("$param.ContactIdPerson_param") && vars.exists("$param.ContactIdPerson_param")) + result.string(neon.COMPONENTSTATE_INVISIBLE) \ 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 0000000000..a00c3df76b --- /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/employees/children/onlyactives_param/valueProcess.js b/entity/VisitRecommendation_entity/entityfields/employees/children/onlyactives_param/valueProcess.js new file mode 100644 index 0000000000..40effa0178 --- /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/newentrygroup/children/newvisitplaneentry/onActionProcess.js b/entity/VisitRecommendation_entity/entityfields/newentrygroup/children/newvisitplaneentry/onActionProcess.js index 18fed0aa2b..acfb69e6db 100644 --- a/entity/VisitRecommendation_entity/entityfields/newentrygroup/children/newvisitplaneentry/onActionProcess.js +++ b/entity/VisitRecommendation_entity/entityfields/newentrygroup/children/newvisitplaneentry/onActionProcess.js @@ -7,5 +7,6 @@ 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"); neon.openContext("VisitPlanEntry", null, null, neon.OPERATINGSTATE_NEW, params); \ 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 0000000000..2ff71eb236 --- /dev/null +++ b/entity/VisitRecommendation_entity/entityfields/personconsumer/children/orgid_param/valueProcess.js @@ -0,0 +1,7 @@ +import("Sql_lib"); +import("system.vars"); +import("system.result"); + + +orgid = newSelect("CONTACT.ORGANISATION_ID").from("CONTACT").where("CONTACT.CONTACTID", vars.get("$field.CONTACT_ID")).cell(); +result.string(orgid); \ No newline at end of file diff --git a/entity/VisitRecommendation_entity/entityfields/priority/valueProcess.js b/entity/VisitRecommendation_entity/entityfields/priority/valueProcess.js new file mode 100644 index 0000000000..13ce2e0a28 --- /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) + result.string($KeywordRegistry.visitRecommendationPriority$medium()); + + \ 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 0000000000..23de8e2154 --- /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/recordcontainers/jdito/contentProcess.js b/entity/VisitRecommendation_entity/recordcontainers/jdito/contentProcess.js index 2dcf9d4752..7c0a4be84c 100644 --- a/entity/VisitRecommendation_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/VisitRecommendation_entity/recordcontainers/jdito/contentProcess.js @@ -1,3 +1,4 @@ +import("JditoFilter_lib"); import("system.eMath"); import("system.tools"); import("PostalAddress_lib"); @@ -20,6 +21,19 @@ import("Address_lib"); var recommendationData = []; var tmpData = []; var activitySubQuery = ""; +//var conditionRecommendation = JditoFilterUtils.getSqlCondition(vars.get("$local.filter").filter, "VISITRECOMMENDATION", null, { +// "PRIORITY": "VISITRECOMMENDATION.PRIORITY", +// "PRIORITY_SOURCE" : "VISITRECOMMENDATION.SOURCE", +// "DUE_DATE" : "VISITRECOMMENDATION.DUE_DATE", +// "CONTACT_ID" : "VISITRECOMMENDATION.CONTACT_ID", +// "USER_NEW" : "VISITRECOMMENDATION.USER_NEW", +// "CONTACT_PERSON_ID" : "VISITRECOMMENDATION.CONTACT_PERSON_ID", //ToDo bei Filter nicht auf Firma einschränken +// "RESPONSIBLE" : "VISITRECOMMENDATION.RESPONSIBLE", +// "STREET" : "ADDRESS.ADDRESS", +// "ZIP" : "ADDRESS.ZIP", +// "CITY" : "ADDRESS.CITY", +// "COUNTRY" : "ADDRESS.COUNTRY" +//}); activitySubQuery = newSelect("max(ENTRYDATE)") .from("ACTIVITY") @@ -27,208 +41,222 @@ activitySubQuery = newSelect("max(ENTRYDATE)") .where("ACTIVITYLINK.OBJECT_ROWID = org.ORGANISATIONID") .and("ACTIVITY.CATEGORY", "VISIT") -var idValues = false; -if (vars.exists("$local.idvalues") && vars.get("$local.idvalues")) - idValues = true -//dynamic Recommendations -//recommended Organisations containing the attribute Visit Frequency - -if(idValues == false) -{ - 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()) - .cell(), 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())]) - .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(); - } +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") -var recommendationSQLData = newSelect(["VISITRECOMMENDATIONID", "VISITRECOMMENDATION.CONTACT_ID", "PRIORITY", "DUE_DATE", "SOURCE", "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)") +var entrydate = newSelect("min(ENTRYDATE)") .from("VISITPLANENTRY") - .where("VISITPLANENTRY.ORGANISATION_CONTACT_ID", "VISITRECOMMENDATION.CONTACT_ID") - .and("VISITPLANENTRY.STATUS", $KeywordRegistry.visitPlanEntryStatus$planned()) + .where("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()) -]) - .from("VISITRECOMMENDATION") - .join("CONTACT", "VISITRECOMMENDATION.CONTACT_ID = CONTACT.CONTACTID") - .join("ADDRESS", "CONTACT.ADDRESS_ID = ADDRESS.ADDRESSID") - + .cell(); + +var idValues = false; +if (vars.exists("$local.idvalues") && vars.get("$local.idvalues")) + idValues = true; + if(idValues == true) - recommendationSQLData.where("VISITRECOMMENDATION.VISITRECOMMENDATIONID", vars.get("$local.idvalues"), SqlBuilder.IN()) - + recommendationSQLData.and("VISITRECOMMENDATION.VISITRECOMMENDATIONID", vars.get("$local.idvalues"), SqlBuilder.IN()) + recommendationSQLData = recommendationSQLData.table(); for( let i = 0; i < recommendationSQLData.length; i++) -{ +{ tmpData = []; - var organisationName = ContactUtils.getFullTitleByContactId(recommendationSQLData[i][1]) if(recommendationSQLData[i][2]) - var prio = recommendationSQLData[i][2] - + var prio = recommendationSQLData[i][2]; else if(recommendationSQLData[i][3]) prio = getPrioByDueDate(recommendationSQLData[i][3]); - else prio = $KeywordRegistry.visitRecommendationPriority$low(); + tmpData[0] = recommendationSQLData[i][0]; //UID.value + tmpData[1] = ContactUtils.getFullTitleByContactId(recommendationSQLData[i][1]); //ORGANISATION_NAME.value + tmpData[2] = entrydate; //ORGANISATION_POINT_OF_CONTACT.value + tmpData[3] = recommendationSQLData[i][6]; //STREET.value + tmpData[4] = recommendationSQLData[i][7]; //COUNTRY.value + tmpData[5] = recommendationSQLData[i][8]; //ZIP.value + tmpData[6] = recommendationSQLData[i][9]; //CITY.value + tmpData[7] = prio; //PRIORITY.value + tmpData[8] = recommendationSQLData[i][4]; //PRIORITY_SOURCE.value + tmpData[9] = KeywordUtils.getViewValue($KeywordRegistry.visitRecommendationPriority(), prio) //PRIORITY.displayValue + tmpData[10] = recommendationSQLData[i][3]; //DUE_DATE.value + tmpData[11] = recommendationSQLData[i][5]; //INFO.value + tmpData[12] = recommendationSQLData[i][1]; //CONTACT_ID.value + tmpData[13] = KeywordUtils.getViewValue($KeywordRegistry.visitRecommendationPrioSource(), recommendationSQLData[i][4]) //PRIORITY_SOURCE.displayValue + tmpData[14] = ContactUtils.getFullTitleByContactId(recommendationSQLData[i][10], false); //USER_NEW.displayvalue + tmpData[15] = recommendationSQLData[i][10]; //USER_NEW.value + tmpData[16] = ContactUtils.getFullTitleByContactId(recommendationSQLData[i][11], false); //CONTACT_PERSON_ID.displayvalue + tmpData[17] = recommendationSQLData[i][11]; //CONTACT_PERSON_ID.value + tmpData[18] = ContactUtils.getFullTitleByContactId(recommendationSQLData[i][12], false); //RESPONSIBLE.displayvalue + tmpData[19] = recommendationSQLData[i][12]; //RESPONSIBLE.value - var title = ""; - if(recommendationSQLData[i][9]){ - var user = tools.getUserByAttribute(tools.CONTACTID, recommendationSQLData[i][9]); - title = user[tools.TITLE] - } - - tmpData[0] = recommendationSQLData[i][0]; //UID - tmpData[1] = organisationName; //Organisation Name - tmpData[3] = recommendationSQLData[i][6]; //Address - tmpData[4] = prio; - tmpData[5] = recommendationSQLData[i][4]; //Source of Priority (Id) - tmpData[7] = recommendationSQLData[i][3]; //Due Date - tmpData[8] = recommendationSQLData[i][5]; //Info - tmpData[9] = recommendationSQLData[i][1]; //CONTACT_ID - tmpData[2] = recommendationSQLData[i][8]; //Data_planned - tmpData[6] = KeywordUtils.getViewValue($KeywordRegistry.visitRecommendationPrioSource(), recommendationSQLData[i][4]) //Source of Priority (displayvalue) - - 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); +//dynamic Recommendations +//recommended Organisations containing the attribute Visit Frequency if(idValues == false) { + 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()) + .toString() + + ")" //2 + ,"ADDRESS.ADDRESS" //3 + ,"ADDRESS.COUNTRY" //4 + ,"ADDRESS.ZIP" //5 + ,"ADDRESS.CITY" //6 + , "visitPlanFrequency.ID_VALUE"//7 + , activitySubQuery //8 + , newSelect("min(ENTRYDATE)") //9 + .from("VISITPLANENTRY") + .where("CONTACT.CONTACTID", "VISITPLANENTRY.ORGANISATION_CONTACT_ID") + .and(newWhere("VISITPLANENTRY.STATUS", $KeywordRegistry.visitPlanEntryStatus$planned()) + .or("VISITPLANENTRY.STATUS", $KeywordRegistry.visitPlanEntryStatus$Appointmentarranged())) + , "org.NAME"])//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++) { tmpData = []; - - let title = ""; - - if(visitFrequencyData[i][9]) - { - let user = tools.getUserByAttribute(tools.CONTACTID, visitFrequencyData[i][9]); - title = user[tools.TITLE] - } - - tmpData[0] = visitFrequencyData[i][0]; //UID - tmpData[1] = visitFrequencyData[i][1]; //Organisation Name - tmpData[3] = visitFrequencyData[i][2]; //Address - tmpData[5] = visitFrequencyData[i][4]; //Source of Priority (Id) - tmpData[8] = ""; - tmpData[4] = visitFrequencyData[i][5]; //last visit - tmpData[9] = visitFrequencyData[i][6]; //ContactId - tmpData[2] = visitFrequencyData[i][1]; //OrganisationId - tmpData[6] = KeywordUtils.getViewValue($KeywordRegistry.visitRecommendationPrioSource(), visitFrequencyData[i][4]) //Source of Priority (displayvalue) + tmpData[0] = visitFrequencyData[i][1]; //UID.value + tmpData[1] = visitFrequencyData[i][10]; //ORGANISATION_NAME.value + tmpData[2] = visitFrequencyData[i][9]; //ORGANISATION_POINT_OF_CONTACT.value + tmpData[3] = visitFrequencyData[i][3]; //STREET.value + tmpData[4] = visitFrequencyData[i][4]; //COUNTRY.value + tmpData[5] = visitFrequencyData[i][5]; //ZIP.value + tmpData[6] = visitFrequencyData[i][6]; //CITY.value + tmpData[7] = ""; //PRIORITY.value + tmpData[8] = visitFrequencyData[i][7]; //PRIORITY_SOURCE.value + tmpData[9] = ""; //PRIORITY.displayValue + tmpData[10] = ""; //DUE_DATE.value + tmpData[11] = ""; //INFO.value + tmpData[12] = visitFrequencyData[i][1]; //CONTACT_ID.value + tmpData[13] = KeywordUtils.getViewValue($KeywordRegistry.visitRecommendationPrioSource(), visitFrequencyData[i][7]); //PRIORITY_SOURCE.displayValue + tmpData[14] = ""; //USER_NEW.displayValue + tmpData[15] = ""; //USER_NEW.value + tmpData[16] = ContactUtils.getFullTitleByContactId(visitFrequencyData[i][1], false); //CONTACT_PERSON_ID.displayValue + tmpData[17] = ""; //CONTACT_PERSON_ID.value + tmpData[18] = ""; //RESPONSIBLE.displayValue + tmpData[19] = ""; //RESPONSIBLE.value + var dueDate = ""; var lastVisitDate = ""; - - if((visitFrequencyData[i][5]).length == 0) + if((visitFrequencyData[i][8]).length == 0) { dueDate = datetime.date(); } else { - lastVisitDate = visitFrequencyData[i][5]; - switch(visitFrequencyData[i][3]) + 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 - + tmpData[7] = getPrioByDueDate(dueDate); //PRIORITY.value + tmpData[9] = KeywordUtils.getViewValue($KeywordRegistry.visitRecommendationPrioSource(), tmpData[7]) //PRIORITY.displayValue + tmpData[10] = dueDate; //DUE_DATE.value + recommendationData.push(tmpData); } } - -//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) +//ArrayUtils.sort2d(recommendationData, 7, true) + +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 = ["", "", "", "STREET", "COUNTRY" , "ZIP", "CITY", "PRIORITY", "PRIORITY_SOURCE", "", "DUE_DATE", "INFO", "CONTACT_ID" + , "", "", "USER_NEW", "", "CONTACT_PERSON_ID", "", "RESPONSIBLE"]; +var filterFns = { + "ROLE_FILTER" : function (pRecordVal, pFilterVal, pOperator) + { + if (!pRecordVal) + pRecordVal = []; + switch (pOperator) + { + case "EQUAL": + return pRecordVal.indexOf(pFilterVal) !== -1; + case "NOT_EQUAL": + return pRecordVal.indexOf(pFilterVal) === -1; + case "ISNULL": + return pRecordVal.length === 0; + case "ISNOTNULL": + return pRecordVal.length !== 0; + default: + return false; + } + }, + "$$$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); + result.object(recommendationData); diff --git a/entity/VisitRecommendation_entity/recordcontainers/jdito/onInsert.js b/entity/VisitRecommendation_entity/recordcontainers/jdito/onInsert.js index 1da186c5ef..7854dbf79c 100644 --- a/entity/VisitRecommendation_entity/recordcontainers/jdito/onInsert.js +++ b/entity/VisitRecommendation_entity/recordcontainers/jdito/onInsert.js @@ -12,7 +12,10 @@ var values = [ 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 +24,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 b27ed4d048..8d745ec146 100644 --- a/entity/VisitRecommendation_entity/recordcontainers/jdito/onUpdate.js +++ b/entity/VisitRecommendation_entity/recordcontainers/jdito/onUpdate.js @@ -9,7 +9,10 @@ var dbFields = { "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/neonView/VisitPlanEntryEdit_view/VisitPlanEntryEdit_view.aod b/neonView/VisitPlanEntryEdit_view/VisitPlanEntryEdit_view.aod index 4a216530f8..e52679fea7 100644 --- a/neonView/VisitPlanEntryEdit_view/VisitPlanEntryEdit_view.aod +++ b/neonView/VisitPlanEntryEdit_view/VisitPlanEntryEdit_view.aod @@ -28,6 +28,10 @@ <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>99cbd482-b7c7-4d5b-a17e-62f9ab49db8a</name> <entityField>BEGIN_TIME</entityField> diff --git a/neonView/VisitRecommendationEdit_view/VisitRecommendationEdit_view.aod b/neonView/VisitRecommendationEdit_view/VisitRecommendationEdit_view.aod index d58550498e..c26295ea94 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 c841039215..933d4aec62 100644 --- a/neonView/VisitRecommendationFilter_view/VisitRecommendationFilter_view.aod +++ b/neonView/VisitRecommendationFilter_view/VisitRecommendationFilter_view.aod @@ -26,8 +26,28 @@ <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> @@ -64,6 +88,10 @@ <name>6a98ae55-a30e-48d4-8d45-1c63a359af5e</name> <entityField>ORGANISATION_ADDRESS</entityField> </neonTreeTableColumn> + <neonTreeTableColumn> + <name>599ba04b-e1c4-4feb-89c9-850ab954fbb2</name> + <entityField>RESPONSIBLE</entityField> + </neonTreeTableColumn> <neonTreeTableColumn> <name>8f02f53e-8e60-4c71-9fb3-5a4b32ff0776</name> <entityField>PRIORITY</entityField> @@ -76,6 +104,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 0a9a4b99e7..9f56dc3529 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) -- GitLab