Skip to content
Snippets Groups Projects
Commit 9ba193b0 authored by Benjamin Ulrich's avatar Benjamin Ulrich :speech_balloon:
Browse files

Merge branch '1079014_VisitplanEntry_Appointment' into '2021.1'

1079014 visitplan entry appointment

See merge request xrm/basic!1232
parents 27315026 0f1315be
No related branches found
No related tags found
No related merge requests found
Showing
with 303 additions and 44 deletions
......@@ -8,4 +8,5 @@
<include relativeToChangelogFile="true" file="alter_dataTypesToDateTime.xml"/>
<include relativeToChangelogFile="true" file="Grouptask/changelog.xml"/>
<include relativeToChangelogFile="true" file="Campaign/changelog.xml"/>
<include relativeToChangelogFile="true" file="Visitplan/changelog.xml"/>
</databaseChangeLog>
\ No newline at end of file
......@@ -208,6 +208,10 @@
<valueProcess>%aditoprj%/entity/Appointment_entity/entityfields/appointmentlinks/children/appointmentstate_param/valueProcess.js</valueProcess>
<expose v="false" />
</entityParameter>
<entityParameter>
<name>AppointmentId_param</name>
<valueProcess>%aditoprj%/entity/Appointment_entity/entityfields/appointmentlinks/children/appointmentid_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityActionField>
......@@ -268,6 +272,10 @@
<valueProcess>%aditoprj%/entity/Appointment_entity/entityfields/erroronpermissiondenied/valueProcess.js</valueProcess>
<expose v="true" />
</entityParameter>
<entityParameter>
<name>Visitplanentry_param</name>
<expose v="true" />
</entityParameter>
<entityParameter>
<name>VisitPlanId_param</name>
<expose v="true" />
......
import("KeywordRegistry_basic");
import("Sql_lib");
import("system.calendars");
import("system.question");
......@@ -43,9 +44,21 @@ if (fields["REMINDER.value"])
event[calendars.ID] = calendars.insert([event])[0];
neon.setFieldValue("$field.UID", event[calendars.ID]);
vars.set("$context.editmode", calendars.MODE_UPDATE);
if(vars.exists("$param.VisitPlanId_param") && vars.get("$param.VisitPlanId_param"))
if(vars.get("$param.Visitplanentry_param"))
{
newWhere("VISITPLANENTRY.VISITPLANENTRYID", vars.get("$param.VisitPlanId_param")).updateData(true, "VISITPLANENTRY", ["APPOINTMENT_ID"], null, [event[calendars.ID]]);
}
\ No newline at end of file
var statusApp = $KeywordRegistry.visitPlanEntryStatusAppointment$requested();
var statusPlan = $KeywordRegistry.visitPlanEntryStatus$planned();
if(event[calendars.STATUS] == "CONFIRMED")
{
statusApp = $KeywordRegistry.visitPlanEntryStatusAppointment$confirmed();
statusPlan = $KeywordRegistry.visitPlanEntryStatus$Appointmentarranged();
}
var columns = ["APPOINTMENT_ID", "STATUS_APPOINTMENT", "STATUS"];
var values = [event[calendars.ID], statusApp, statusPlan];
var updateEntry = newWhere("VISITPLANENTRY.VISITPLANENTRYID", vars.get("$param.Visitplanentry_param"))
.updateData(true, "VISITPLANENTRY", columns, null, values);
}
vars.set("$context.editmode", calendars.MODE_UPDATE);
import("KeywordRegistry_basic");
import("Sql_lib");
import("system.neon");
import("system.calendars");
import("system.vars");
......@@ -66,6 +68,22 @@ if(event)
}
if(vars.get("$param.Visitplanentry_param"))
{
var statusApp = $KeywordRegistry.visitPlanEntryStatusAppointment$requested();
var statusPlan = $KeywordRegistry.visitPlanEntryStatus$planned();
if(event[calendars.STATUS] == "CONFIRMED")
{
statusApp = $KeywordRegistry.visitPlanEntryStatusAppointment$confirmed();
statusPlan = $KeywordRegistry.visitPlanEntryStatus$Appointmentarranged();
}
var values = [statusPlan, statusApp];
var columns = ["STATUS", "STATUS_APPOINTMENT"];
var updateEntry = newWhere("VISITPLANENTRY.VISITPLANENTRYID", visitplanentry)
.updateData(true, "VISITPLANENTRY", columns, null, values);
}
/**
* checks if the entryParam has different values like the current fieldvalues
......
......@@ -173,7 +173,11 @@
<entityField>
<name>APPOINTMENT_ID</name>
<documentation>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/appointment_id/documentation.adoc</documentation>
<title>Appointment</title>
<consumer>Appointments</consumer>
<linkedContext>Appointment</linkedContext>
<valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/appointment_id/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/appointment_id/displayValueProcess.js</displayValueProcess>
</entityField>
<entityParameter>
<name>VisitPlanEmployeeWeek_param</name>
......@@ -362,17 +366,83 @@
</entityParameter>
</children>
</entityConsumer>
<entityActionField>
<name>NewActivity</name>
<documentation>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/newactivity/documentation.adoc</documentation>
<title>Create Visitreport</title>
<onActionProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/newactivity/onActionProcess.js</onActionProcess>
<isMenuAction v="true" />
<iconId>VAADIN:HOURGLASS_END</iconId>
<stateProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/newactivity/stateProcess.js</stateProcess>
<tooltip>Create Visitreport</tooltip>
<tooltipProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/newactivity/tooltipProcess.js</tooltipProcess>
</entityActionField>
<entityConsumer>
<name>Appointments</name>
<isOneToOneRelationship v="true" />
<dependency>
<name>dependency</name>
<entityName>Appointment_entity</entityName>
<fieldName>LinkedAppointments</fieldName>
</dependency>
<children>
<entityParameter>
<name>LinkedObjectId_param</name>
<valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/appointments/children/linkedobjectid_param/valueProcess.js</valueProcess>
</entityParameter>
<entityParameter>
<name>Visitplanentry_param</name>
<valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/appointments/children/visitplanentry_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityField>
<name>APPOINTMENT_BEGIN_TIME</name>
<title>Appointment Start</title>
<contentType>DATE</contentType>
<outputFormat>dd.MM.yyyy HH:mm</outputFormat>
<valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/appointment_begin_time/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>APPOINTMENT_END_TIME</name>
<title>Appointment End</title>
<contentType>DATE</contentType>
<outputFormat>dd.MM.yyyy HH:mm</outputFormat>
<valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/appointment_end_time/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>APPOINTMENT_STATUS</name>
<title>Appointment Status</title>
<valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/appointment_status/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/appointment_status/displayValueProcess.js</displayValueProcess>
</entityField>
<entityField>
<name>APPOINTMENT_SUBJECT</name>
<title>Appointment Subject</title>
<valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/appointment_subject/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>syncIcon</name>
<colorProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/syncicon/colorProcess.js</colorProcess>
<contentType>IMAGE</contentType>
<valueProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/syncicon/valueProcess.js</valueProcess>
</entityField>
<entityActionGroup>
<name>entityActionGroup</name>
<iconId>VAADIN:CALENDAR</iconId>
<children>
<entityActionField>
<name>NewActivity</name>
<documentation>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newactivity/documentation.adoc</documentation>
<title>Create Visitreport</title>
<onActionProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newactivity/onActionProcess.js</onActionProcess>
<isMenuAction v="true" />
<iconId>VAADIN:HOURGLASS_END</iconId>
<stateProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newactivity/stateProcess.js</stateProcess>
<tooltip>Create Visitreport</tooltip>
<tooltipProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newactivity/tooltipProcess.js</tooltipProcess>
</entityActionField>
<entityActionField>
<name>NewAppointment</name>
<documentation>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newappointment/documentation.adoc</documentation>
<title>New Appointment</title>
<onActionProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newappointment/onActionProcess.js</onActionProcess>
<iconId>VAADIN:CALENDAR</iconId>
<state>EDITABLE</state>
<tooltip>Create new Appointment</tooltip>
<tooltipProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/newappointment/tooltipProcess.js</tooltipProcess>
</entityActionField>
</children>
</entityActionGroup>
<entityActionField>
<name>OpenRoute</name>
<documentation>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/openroute/documentation.adoc</documentation>
......@@ -382,33 +452,45 @@
<iconId>VAADIN:MAP_MARKER</iconId>
<stateProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/openroute/stateProcess.js</stateProcess>
</entityActionField>
<entityActionField>
<name>NewAppointment</name>
<documentation>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/newappointment/documentation.adoc</documentation>
<title>New Appointment</title>
<onActionProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/newappointment/onActionProcess.js</onActionProcess>
<isMenuAction v="true" />
<iconId>VAADIN:CALENDAR</iconId>
<entityActionGroup>
<name>sync</name>
<title>synchronize</title>
<iconId>VAADIN:REFRESH</iconId>
<state>EDITABLE</state>
<stateProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/newappointment/stateProcess.js</stateProcess>
<tooltip>Create new Appointment</tooltip>
<tooltipProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/newappointment/tooltipProcess.js</tooltipProcess>
</entityActionField>
<stateProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/sync/stateProcess.js</stateProcess>
<children>
<entityActionField>
<name>syncPlanToAppointment</name>
<title>synchronize Plan to Appointment</title>
<onActionProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/sync/children/syncplantoappointment/onActionProcess.js</onActionProcess>
<isObjectAction v="false" />
<selectionType>MULTI</selectionType>
<iconId>VAADIN:ARROW_CIRCLE_RIGHT</iconId>
</entityActionField>
<entityActionField>
<name>syncAppointmentToPlan</name>
<title>synchronize Appointment to Plan</title>
<onActionProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/sync/children/syncappointmenttoplan/onActionProcess.js</onActionProcess>
<isObjectAction v="false" />
<selectionType>MULTI</selectionType>
<iconId>VAADIN:ARROW_CIRCLE_LEFT</iconId>
</entityActionField>
</children>
</entityActionGroup>
<entityActionGroup>
<name>entityActionGroup</name>
<iconId>VAADIN:CALENDAR</iconId>
<name>ActionGroupOpenDayRoute</name>
<children>
<entityActionField>
<name>OpenDayRoute</name>
<documentation>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/opendayroute/documentation.adoc</documentation>
<documentation>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/actiongroupopendayroute/children/opendayroute/documentation.adoc</documentation>
<title>Open Route of the day</title>
<onActionProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/opendayroute/onActionProcess.js</onActionProcess>
<onActionProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/actiongroupopendayroute/children/opendayroute/onActionProcess.js</onActionProcess>
<isObjectAction v="false" />
<selectionType>MULTI</selectionType>
<iconId>VAADIN:MAP_MARKER</iconId>
<stateProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/opendayroute/stateProcess.js</stateProcess>
<stateProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/actiongroupopendayroute/children/opendayroute/stateProcess.js</stateProcess>
<tooltip>Open route</tooltip>
<tooltipProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/entityactiongroup/children/opendayroute/tooltipProcess.js</tooltipProcess>
<tooltipProcess>%aditoprj%/entity/VisitPlanEntry_entity/entityfields/actiongroupopendayroute/children/opendayroute/tooltipProcess.js</tooltipProcess>
</entityActionField>
</children>
</entityActionGroup>
......
......@@ -18,7 +18,8 @@ if(vars.get("$param.CurrentContext_param") != null)
newWhere("VISITRECOMMENDATION.VISITRECOMMENDATIONID", savedData["VISITRECOMMENDATION_ID"])
.updateData(true, "VISITRECOMMENDATION", ["STATUS"], null, ["PLANNED"]);
}
if(savedData["STATUS_APPOINTMENT"] == $KeywordRegistry.visitPlanEntryStatusAppointment$confirmed())
if(savedData["STATUS_APPOINTMENT"] == $KeywordRegistry.visitPlanEntryStatusAppointment$confirmed()
&& !savedData["APPOINTMENT_ID"])
{
var summary = translate.text("Site visit") + " | " + savedData["CONTACT_ID.displayValue"];
var description = savedData["CONTACT_ID.displayValue"];
......@@ -34,19 +35,24 @@ if(vars.get("$param.CurrentContext_param") != null)
var end = new Date(datetime.today(vars.get("$sys.timezone")) + Number(savedData["END_TIME"]));
var links = [
{
"OBJECT_ID": savedData["ORGANISATION_CONTACT_ID"],
"OBJECT_TYPE": "Organisation"
},
{
"OBJECT_ID": savedData["CONTACT_ID"],
"OBJECT_TYPE": "Person"
}
{
"OBJECT_ID": savedData["ORGANISATION_CONTACT_ID"],
"OBJECT_TYPE": "Organisation"
},
{
"OBJECT_ID": savedData["CONTACT_ID"],
"OBJECT_TYPE": "Person"
},
{
"OBJECT_ID" : vars.get("$field.VISITPLANENTRYID"),
"OBJECT_TYPE" : "Visitplanentry"
}
]
var params = {
"Entry_param" : JSON.stringify(CalendarUtil.createEntry(summary, description, links, undefined, undefined,
start, end, undefined, undefined, undefined, [standardMail], undefined, undefined, undefined))
start, end, undefined, undefined, undefined, [standardMail], undefined, undefined, undefined)),
"Visitplanentry_param": vars.get("$field.VISITPLANENTRYID")
};
neon.openContext("Appointment", "AppointmentEdit_view", [vars.get("$field.VISITPLANENTRYID")], neon.OPERATINGSTATE_NEW, params, null);
......
import("system.result");
import("system.calendars");
import("system.vars");
var appointmentId = vars.get("$field.APPOINTMENT_ID");
var entryBegin = "";
if(appointmentId)
{
var entry = calendars.getEntry(appointmentId, null, null);
if(entry)
{
entryBegin = entry[calendars.DTSTART];
}
}
result.string(entryBegin);
\ No newline at end of file
import("system.vars");
import("system.result");
import("system.calendars");
var appointmentId = vars.get("$field.APPOINTMENT_ID");
var entryEnd = "";
if(appointmentId)
{
var entry = calendars.getEntry(appointmentId, null, null);
if(entry)
{
entryEnd = entry[calendars.DTEND];
}
}
result.string(entryEnd);
\ No newline at end of file
import("system.vars");
import("system.result");
import("system.calendars");
var appointmentId = vars.get("$field.APPOINTMENT_ID");
var entrySubject = "";
if(appointmentId)
{
var entry = calendars.getEntry(appointmentId, null, null);
if(entry)
{
entrySubject = entry[calendars.SUMMARY];
}
}
result.string(entrySubject);
\ No newline at end of file
import("Appointment_lib");
import("system.vars");
import("system.result");
result.string(AppointmentUtils.getAppointmentStatusDisplayValue(vars.get("$field.APPOINTMENT_STATUS")));
import("system.vars");
import("system.result");
import("system.calendars");
var appointmentId = vars.get("$field.APPOINTMENT_ID");
var entryStatus = "";
if(appointmentId)
{
var entry = calendars.getEntry(appointmentId, null, null);
if(entry)
{
entryStatus = entry[calendars.STATUS];
}
}
result.string(entryStatus);
\ No newline at end of file
import("system.vars");
import("system.result");
import("system.calendars");
var appointmentId = vars.get("$field.APPOINTMENT_ID");
var entrySubject = "";
if(appointmentId)
{
var entry = calendars.getEntry(appointmentId, null, null);
if(entry)
{
entrySubject = entry[calendars.SUMMARY]
}
}
result.string(entrySubject);
\ No newline at end of file
import("system.result");
import("system.vars");
result.string(vars.get("$field.VISITPLANENTRYID"));
import("system.result");
result.string(true)
\ No newline at end of file
import("Sql_lib");
import("AttributeRegistry_basic");
import("system.db");
import("KeywordRegistry_basic");
import("Contact_lib");
import("Employee_lib");
import("system.vars");
import("ActivityTask_lib");
var links = [];
var pointOfContact = newSelect("CONTACT.CONTACTID", db.getCurrentAlias())
.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", vars.get("$field.ORGANISATION_CONTACT_ID"))
.cell();
if(pointOfContact)
{
links.push([ContactUtils.getContextByContactId(pointOfContact), pointOfContact]);
}
else
{
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.VISITPLANENTRYID"));
import("system.datetime");
import("system.result");
import("system.vars");
import("system.neon");
var state = neon.COMPONENTSTATE_DISABLED;
if (vars.get("$sys.selectionRows") != "" && vars.get("$sys.selectionRows") != undefined)
var today = vars.get("$sys.date")
if (vars.get("$field.ENTRYDATE") <= today)
{
state = neon.COMPONENTSTATE_EDITABLE;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment