Skip to content
Snippets Groups Projects
Commit ab6b0938 authored by Carolin Wimmer's avatar Carolin Wimmer
Browse files

[Projekt: Crowd-Development / Besuch vor Ort][TicketNr.: 1068785][[Bug]...

[Projekt: Crowd-Development / Besuch vor Ort][TicketNr.: 1068785][[Bug] Wochplan - Filter nach Jahr funktioniert nicht]
parent 6fb34fff
No related branches found
No related tags found
No related merge requests found
import("Keyword_lib");
import("Address_lib");
import("Person_lib");
import("Contact_lib");
import("KeywordRegistry_basic");
import("system.translate");
import("Sql_lib");
import("AttributeRegistry_basic");
import("system.datetime");
import("system.logging");
import("Communication_lib");
import("system.db");
import("system.vars");
import("system.neon");
import("Communication_lib");
import("system.datetime");
import("system.eMath");
import("system.calendars");
import("Calendar_lib");
import("system.date");
import("Context_lib");
import("system.util");
import("system.eMath");
import("system.text");
var params = {};
var mailAffectedUser = [];
import("Calendar_lib");
import("system.vars");
import("system.neon");
import("system.result");
import("Contact_lib")
var selectionRowData = vars.get("$sys.selectionRows");
var uid = selectionRowData[0].UID;
var isGroup = selectionRowData[0].ISGROUP; //not Bool
var entryDateAsLong = selectionRowData[0].ENTRYDATE;
var entryDate = datetime.toDate(entryDateAsLong, "dd-MM-yyyy");
var startTime = selectionRowData[0].BEGIN_TIME;
var endTime = selectionRowData[0].END_TIME;
var organisationContact_id = selectionRowData[0].ORGANISATION_CONTACT_ID;
var organisationName = OrganisationUtils.getNameByContactId(organisationContact_id);
var contact_id = selectionRowData[0].CONTACT_ID;
var contactName = ContactUtils.getFullTitleByContactId(contact_id);
var contactMail = CommUtil.getStandardSubSqlMail(contact_id)
var contactData = newSelect("CONTACT.DEPARTMENT, CONTACT.CONTACTROLE")
.from("CONTACT")
.where("CONTACT.CONTACTID", contact_id)
.arrayRow()
var department = contactData[0];
var contactRole = contactData[1];
var addressId = newSelect("CONTACT.ADDRESS_ID")
.from("CONTACT")
.where("CONTACT.CONTACTID", organisationContact_id)
.cell();
var organisationAddress = new AddrObject(organisationContact_id);
var organisationAddressFormatted = organisationAddress.getFormattedAddress(false, "{salutation_name}\n {street} {buildingno}\n {country_short} - {zip} {city}");
var contactCommunication = newSelect("COMMUNICATION.MEDIUM_ID, COMMUNICATION.ADDR")
.from("COMMUNICATION")
.where("COMMUNICATION.CONTACT_ID", contact_id)
.table();
if(contactCommunication.length > 0)
if(selectionRowData[0].VISITRECOMMENDATION_ID)
{
var communicationString;
for (let i = 0; i < contactCommunication.length; i++)
{
communicationString += KeywordUtils.getViewValue($KeywordRegistry.communicationMedium(), contactCommunication[i][0]) + ": "
+ contactCommunication[i][1] + "</br>"
}
communicationString = communicationString.substring(9);
db.updateData("VISITRECOMMENDATION", ["STATUS"], db.getColumnTypes("VISITRECOMMENDATION", ["STATUS"]), ["PLANNED"]
, "VISITRECOMMENDATIONID = '" + selectionRowData[0].VISITRECOMMENDATION_ID + "'");
}
var summary = translate.text("Visit") + " " + contactName + " | "+ organisationName;
var description = contactName + "</br>"
+ department + "</br>"
+ contactRole + "</br>"
+ communicationString + "</br>" + "</br>"
+ organisationName + "</br>"
+ organisationAddressFormatted;
userMailto = [];
userMailto.push("mailto:" + contactMail, "CN:" + contactMail);
mailAffectedUser.push(text.encodeMS(userMailto));
var fullName = ContactUtils.getFullTitleByContactId(selectionRowData[0].CONTACT_ID, true)
var summary = translate.text("Besuch vor Ort") + " || " + fullName;
var description = fullName;
var standardMail = CommUtil.getStandardMail(selectionRowData[0].CONTACT_ID);
var startTime = selectionRowData[0].BEGIN_TIME;
var endTime = selectionRowData[0].END_TIME;
var duration = eMath.subInt(endTime, startTime);
var entryDate = datetime.toDate(selectionRowData[0].ENTRYDATE, "dd-MM-yyyy");
startTime = entryDate + " " + datetime.toDate(selectionRowData[0].BEGIN_TIME, "HH:mm:ss.S");
startTime = datetime.toLong(startTime, "dd-MM-yyyy HH:mm:ss.S");
var startdate = entryDate + " " + datetime.toDate(startTime, "HH:mm:ss.S");
startdate = datetime.toLong(startdate, "dd-MM-yyyy HH:mm:ss.S");
var params = {};
params["Entry_param"] = JSON.stringify(CalendarUtil.createEntry(util.getNewUUID(), calendars.VEVENT, summary, description, false, null, null
, null, null, startTime, duration, null, null, null, null, [standardMail]));
var duration = eMath.subInt(endTime, startTime);
var entry = CalendarUtil.createEntry("", calendars.VEVENT, summary, description, false, false, false,
vars.get("$sys.user"), [vars.get("$sys.user")], startdate, duration, null, calendars.STATUS_TENTATIVE, null, null);
params["Entry_param"] = JSON.stringify(entry);
var uidAppointment = calendars.insert([entry]);
var columns = ["AB_APPOINTMENTLINK_ID",
"APPOINTMENT_ID",
"OBJECT_TYPE",
"OBJECT_ROWID"]
var values = [util.getNewUUID(),
uidAppointment[0],
"Organisation",
organisationContact_id]
db.insertData("AB_APPOINTMENTLINK", columns, null, values)
values = [util.getNewUUID(),
uidAppointment[0],
"Person",
contact_id]
db.insertData("AB_APPOINTMENTLINK", columns, null, values)
values = [$KeywordRegistry.visitPlanEntryStatus$Appointmentarranged(), uidAppointment[0], $KeywordRegistry.visitPlanEntryStatusAppointment$requested()];
columns = ["STATUS", "APPOINTMENT_ID", "STATUS_APPOINTMENT"];
newWhere("VISITPLANENTRY.VISITPLANENTRYID", uid)
.updateData(true, "VISITPLANENTRY", columns, null, values);
params["PresetLinks_param"] = JSON.stringify([
["Organisation", selectionRowData[0].ORGANISATION_CONTACT_ID],
["Person", selectionRowData[0].CONTACT_ID]
]);
neon.openContext("Appointment", "AppointmentEdit_view", [vars.get("$field.UID")], neon.OPERATINGSTATE_NEW, params, null);
result.string(true);
neon.setFieldValue("$field.STATUS", $KeywordRegistry.visitPlanEntryStatus$Appointmentarranged());
neon.setFieldValue("$field.STATUS_APPOINTMENT", $KeywordRegistry.visitPlanEntryStatusAppointment$requested());
neon.refreshAll();
\ No newline at end of file
......@@ -182,6 +182,7 @@ if(idValues == false)
"" //RESPONSIBLE.value
];
var manualRec = newSelect("VISITRECOMMENDATION.VISITRECOMMENDATIONID")
.from("VISITRECOMMENDATION")
.where("VISITRECOMMENDATION.CONTACT_ID", tmpData[0])
......@@ -199,8 +200,9 @@ if(idValues == false)
.and("VISITPLANENTRY.STATUS", $KeywordRegistry.visitPlanEntryStatus$Visitreportcreated(), SqlBuilder.NOT_EQUAL()))
.or("VISITPLANENTRY.STATUS", $KeywordRegistry.visitPlanEntryStatus$Visitreportcreated(), SqlBuilder.EQUAL()).cell()
if(!manualRec)
if(!manualRec) //if manual Record was created, visitfrequency is not relevant
{
//!visitEntryExists - if no visitplanentry for the organisation/person from recommendation was created -> show recommendation so it can be planned
if(!visitEntryExists || visitEntry)
{
recommendationData.push(tmpData);
......
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