check more object properties
parent
dba4d60a97
commit
b121aef70f
|
|
@ -22,8 +22,8 @@ function getWorkOrderUrl(request, milestone) {
|
||||||
function buildEventSummary(milestone) {
|
function buildEventSummary(milestone) {
|
||||||
let summary = (milestone.workOrderMilestoneCompletionDate ? '✔ ' : '') +
|
let summary = (milestone.workOrderMilestoneCompletionDate ? '✔ ' : '') +
|
||||||
((milestone.workOrderMilestoneTypeId ?? -1) === -1
|
((milestone.workOrderMilestoneTypeId ?? -1) === -1
|
||||||
? (milestone.workOrderMilestoneDescription ?? '')
|
? milestone.workOrderMilestoneDescription ?? ''
|
||||||
: (milestone.workOrderMilestoneType ?? '')).trim();
|
: milestone.workOrderMilestoneType ?? '').trim();
|
||||||
let occupantCount = 0;
|
let occupantCount = 0;
|
||||||
for (const lotOccupancy of milestone.workOrderLotOccupancies) {
|
for (const lotOccupancy of milestone.workOrderLotOccupancies) {
|
||||||
for (const occupant of lotOccupancy.lotOccupancyOccupants) {
|
for (const occupant of lotOccupancy.lotOccupancyOccupants) {
|
||||||
|
|
@ -32,7 +32,10 @@ function buildEventSummary(milestone) {
|
||||||
if (summary !== '') {
|
if (summary !== '') {
|
||||||
summary += ': ';
|
summary += ': ';
|
||||||
}
|
}
|
||||||
summary += (occupant.occupantName ?? '') + ' ' + (occupant.occupantFamilyName ?? '');
|
summary +=
|
||||||
|
(occupant.occupantName ?? '') +
|
||||||
|
' ' +
|
||||||
|
(occupant.occupantFamilyName ?? '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -260,13 +263,13 @@ export async function handler(request, response) {
|
||||||
for (const occupant of lotOccupancy.lotOccupancyOccupants) {
|
for (const occupant of lotOccupancy.lotOccupancyOccupants) {
|
||||||
if (organizerSet) {
|
if (organizerSet) {
|
||||||
calendarEvent.createAttendee({
|
calendarEvent.createAttendee({
|
||||||
name: occupant.occupantName + ' ' + occupant.occupantFamilyName,
|
name: `${occupant.occupantName ?? ''} ${occupant.occupantFamilyName ?? ''}`,
|
||||||
email: configFunctions.getProperty('settings.workOrders.calendarEmailAddress')
|
email: configFunctions.getProperty('settings.workOrders.calendarEmailAddress')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
calendarEvent.organizer({
|
calendarEvent.organizer({
|
||||||
name: occupant.occupantName + ' ' + occupant.occupantFamilyName,
|
name: `${occupant.occupantName ?? ''} ${occupant.occupantFamilyName ?? ''}`,
|
||||||
email: configFunctions.getProperty('settings.workOrders.calendarEmailAddress')
|
email: configFunctions.getProperty('settings.workOrders.calendarEmailAddress')
|
||||||
});
|
});
|
||||||
organizerSet = true;
|
organizerSet = true;
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,8 @@ function buildEventSummary(milestone: recordTypes.WorkOrderMilestone): string {
|
||||||
let summary =
|
let summary =
|
||||||
(milestone.workOrderMilestoneCompletionDate ? '✔ ' : '') +
|
(milestone.workOrderMilestoneCompletionDate ? '✔ ' : '') +
|
||||||
((milestone.workOrderMilestoneTypeId ?? -1) === -1
|
((milestone.workOrderMilestoneTypeId ?? -1) === -1
|
||||||
? (milestone.workOrderMilestoneDescription ?? '')
|
? milestone.workOrderMilestoneDescription ?? ''
|
||||||
: (milestone.workOrderMilestoneType ?? '')
|
: milestone.workOrderMilestoneType ?? ''
|
||||||
).trim()
|
).trim()
|
||||||
|
|
||||||
let occupantCount = 0
|
let occupantCount = 0
|
||||||
|
|
@ -65,7 +65,10 @@ function buildEventSummary(milestone: recordTypes.WorkOrderMilestone): string {
|
||||||
summary += ': '
|
summary += ': '
|
||||||
}
|
}
|
||||||
|
|
||||||
summary += (occupant.occupantName ?? '') + ' ' + (occupant.occupantFamilyName ?? '')
|
summary +=
|
||||||
|
(occupant.occupantName ?? '') +
|
||||||
|
' ' +
|
||||||
|
(occupant.occupantFamilyName ?? '')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -355,12 +358,12 @@ export async function handler(
|
||||||
// Create event
|
// Create event
|
||||||
const eventData: ICalEventData = {
|
const eventData: ICalEventData = {
|
||||||
start: milestoneDate,
|
start: milestoneDate,
|
||||||
created: new Date(milestone.recordCreate_timeMillis),
|
created: new Date(milestone.recordCreate_timeMillis!),
|
||||||
stamp: new Date(milestone.recordCreate_timeMillis),
|
stamp: new Date(milestone.recordCreate_timeMillis!),
|
||||||
lastModified: new Date(
|
lastModified: new Date(
|
||||||
Math.max(
|
Math.max(
|
||||||
milestone.recordUpdate_timeMillis,
|
milestone.recordUpdate_timeMillis!,
|
||||||
milestone.workOrderRecordUpdate_timeMillis
|
milestone.workOrderRecordUpdate_timeMillis!
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
allDay: !milestone.workOrderMilestoneTime,
|
allDay: !milestone.workOrderMilestoneTime,
|
||||||
|
|
@ -406,14 +409,18 @@ export async function handler(
|
||||||
for (const occupant of lotOccupancy.lotOccupancyOccupants!) {
|
for (const occupant of lotOccupancy.lotOccupancyOccupants!) {
|
||||||
if (organizerSet) {
|
if (organizerSet) {
|
||||||
calendarEvent.createAttendee({
|
calendarEvent.createAttendee({
|
||||||
name: occupant.occupantName + ' ' + occupant.occupantFamilyName,
|
name: `${occupant.occupantName ?? ''} ${
|
||||||
|
occupant.occupantFamilyName ?? ''
|
||||||
|
}`,
|
||||||
email: configFunctions.getProperty(
|
email: configFunctions.getProperty(
|
||||||
'settings.workOrders.calendarEmailAddress'
|
'settings.workOrders.calendarEmailAddress'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
calendarEvent.organizer({
|
calendarEvent.organizer({
|
||||||
name: occupant.occupantName + ' ' + occupant.occupantFamilyName,
|
name: `${occupant.occupantName ?? ''} ${
|
||||||
|
occupant.occupantFamilyName ?? ''
|
||||||
|
}`,
|
||||||
email: configFunctions.getProperty(
|
email: configFunctions.getProperty(
|
||||||
'settings.workOrders.calendarEmailAddress'
|
'settings.workOrders.calendarEmailAddress'
|
||||||
)
|
)
|
||||||
|
|
@ -424,7 +431,7 @@ export async function handler(
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
calendarEvent.organizer({
|
calendarEvent.organizer({
|
||||||
name: milestone.recordCreate_userName,
|
name: milestone.recordCreate_userName!,
|
||||||
email: configFunctions.getProperty(
|
email: configFunctions.getProperty(
|
||||||
'settings.workOrders.calendarEmailAddress'
|
'settings.workOrders.calendarEmailAddress'
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue