import cleanup
parent
0d2f6f78ce
commit
3c4c85df19
|
|
@ -13,6 +13,7 @@ const urnGardenBurialSiteTypeId = cacheFunctions.getBurialSiteTypesByBurialSiteT
|
|||
?.burialSiteTypeId;
|
||||
export function getBurialSiteTypeId(cemeteryKey) {
|
||||
switch (cemeteryKey) {
|
||||
case '':
|
||||
case '00': {
|
||||
return cremationBurialSiteTypeId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ const urnGardenBurialSiteTypeId =
|
|||
|
||||
export function getBurialSiteTypeId(cemeteryKey: string): number {
|
||||
switch (cemeteryKey) {
|
||||
case '':
|
||||
case '00': {
|
||||
return cremationBurialSiteTypeId
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import type { ContractType } from '../../types/record.types.js';
|
||||
export declare const availableBurialSiteStatusId: number;
|
||||
export declare const reservedBurialSiteStatusId: number;
|
||||
export declare const takenBurialSiteStatusId: number;
|
||||
export declare const preneedContractType: import("../../types/record.types.js").ContractType;
|
||||
export declare const deceasedContractType: import("../../types/record.types.js").ContractType;
|
||||
export declare const cremationContractType: import("../../types/record.types.js").ContractType;
|
||||
export declare const preneedContractType: ContractType;
|
||||
export declare const deceasedContractType: ContractType;
|
||||
export declare const cremationContractType: ContractType;
|
||||
export declare const acknowledgedWorkOrderMilestoneTypeId: number | undefined;
|
||||
export declare const deathWorkOrderMilestoneTypeId: number | undefined;
|
||||
export declare const funeralWorkOrderMilestoneTypeId: number | undefined;
|
||||
|
|
|
|||
|
|
@ -1,29 +1,27 @@
|
|||
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/no-await-expression-member */
|
||||
import * as cacheFunctions from '../../helpers/functions.cache.js';
|
||||
/*
|
||||
* Burial Site Status IDs
|
||||
*/
|
||||
export const availableBurialSiteStatusId = (await cacheFunctions.getBurialSiteStatusByBurialSiteStatus('Available'))
|
||||
.burialSiteStatusId;
|
||||
export const reservedBurialSiteStatusId = (await cacheFunctions.getBurialSiteStatusByBurialSiteStatus('Reserved'))
|
||||
.burialSiteStatusId;
|
||||
export const takenBurialSiteStatusId = (await cacheFunctions.getBurialSiteStatusByBurialSiteStatus('Taken'))
|
||||
.burialSiteStatusId;
|
||||
export const availableBurialSiteStatusId = cacheFunctions.getBurialSiteStatusByBurialSiteStatus('Available')
|
||||
?.burialSiteStatusId;
|
||||
export const reservedBurialSiteStatusId = cacheFunctions.getBurialSiteStatusByBurialSiteStatus('Reserved')
|
||||
?.burialSiteStatusId;
|
||||
export const takenBurialSiteStatusId = cacheFunctions.getBurialSiteStatusByBurialSiteStatus('Taken')
|
||||
?.burialSiteStatusId;
|
||||
/*
|
||||
* Contract Type IDs
|
||||
*/
|
||||
export const preneedContractType = (await cacheFunctions.getContractTypeByContractType('Preneed'));
|
||||
export const deceasedContractType = (await cacheFunctions.getContractTypeByContractType('Interment'));
|
||||
export const cremationContractType = (await cacheFunctions.getContractTypeByContractType('Cremation'));
|
||||
export const preneedContractType = cacheFunctions.getContractTypeByContractType('Preneed');
|
||||
export const deceasedContractType = cacheFunctions.getContractTypeByContractType('Interment');
|
||||
export const cremationContractType = cacheFunctions.getContractTypeByContractType('Cremation');
|
||||
/*
|
||||
* Work Order Milestone Type IDs
|
||||
*/
|
||||
export const acknowledgedWorkOrderMilestoneTypeId = (await cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType('Acknowledged'))?.workOrderMilestoneTypeId;
|
||||
export const deathWorkOrderMilestoneTypeId = (await cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType('Death'))?.workOrderMilestoneTypeId;
|
||||
export const funeralWorkOrderMilestoneTypeId = (await cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType('Funeral'))?.workOrderMilestoneTypeId;
|
||||
export const cremationWorkOrderMilestoneTypeId = (await cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType('Cremation'))?.workOrderMilestoneTypeId;
|
||||
export const intermentWorkOrderMilestoneTypeId = (await cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType('Interment'))?.workOrderMilestoneTypeId;
|
||||
export const acknowledgedWorkOrderMilestoneTypeId = cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType('Acknowledged')?.workOrderMilestoneTypeId;
|
||||
export const deathWorkOrderMilestoneTypeId = cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType('Death')?.workOrderMilestoneTypeId;
|
||||
export const funeralWorkOrderMilestoneTypeId = cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType('Funeral')?.workOrderMilestoneTypeId;
|
||||
export const cremationWorkOrderMilestoneTypeId = cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType('Cremation')?.workOrderMilestoneTypeId;
|
||||
export const intermentWorkOrderMilestoneTypeId = cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType('Interment')?.workOrderMilestoneTypeId;
|
||||
/*
|
||||
* Work Order Type IDs
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,70 +1,63 @@
|
|||
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion, unicorn/no-await-expression-member */
|
||||
|
||||
import * as cacheFunctions from '../../helpers/functions.cache.js'
|
||||
import type { ContractType } from '../../types/record.types.js'
|
||||
|
||||
/*
|
||||
* Burial Site Status IDs
|
||||
*/
|
||||
|
||||
export const availableBurialSiteStatusId =
|
||||
(await cacheFunctions.getBurialSiteStatusByBurialSiteStatus('Available'))!
|
||||
.burialSiteStatusId
|
||||
cacheFunctions.getBurialSiteStatusByBurialSiteStatus('Available')
|
||||
?.burialSiteStatusId as number
|
||||
|
||||
export const reservedBurialSiteStatusId =
|
||||
(await cacheFunctions.getBurialSiteStatusByBurialSiteStatus('Reserved'))!
|
||||
.burialSiteStatusId
|
||||
cacheFunctions.getBurialSiteStatusByBurialSiteStatus('Reserved')
|
||||
?.burialSiteStatusId as number
|
||||
|
||||
export const takenBurialSiteStatusId =
|
||||
(await cacheFunctions.getBurialSiteStatusByBurialSiteStatus('Taken'))!
|
||||
.burialSiteStatusId
|
||||
|
||||
cacheFunctions.getBurialSiteStatusByBurialSiteStatus('Taken')
|
||||
?.burialSiteStatusId as number
|
||||
|
||||
/*
|
||||
* Contract Type IDs
|
||||
*/
|
||||
|
||||
export const preneedContractType =
|
||||
(await cacheFunctions.getContractTypeByContractType('Preneed'))!
|
||||
export const preneedContractType = cacheFunctions.getContractTypeByContractType(
|
||||
'Preneed'
|
||||
) as ContractType
|
||||
|
||||
export const deceasedContractType =
|
||||
(await cacheFunctions.getContractTypeByContractType('Interment'))!
|
||||
cacheFunctions.getContractTypeByContractType('Interment') as ContractType
|
||||
|
||||
export const cremationContractType =
|
||||
(await cacheFunctions.getContractTypeByContractType('Cremation'))!
|
||||
cacheFunctions.getContractTypeByContractType('Cremation') as ContractType
|
||||
|
||||
/*
|
||||
* Work Order Milestone Type IDs
|
||||
*/
|
||||
|
||||
export const acknowledgedWorkOrderMilestoneTypeId = (
|
||||
await cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType(
|
||||
export const acknowledgedWorkOrderMilestoneTypeId =
|
||||
cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType(
|
||||
'Acknowledged'
|
||||
)
|
||||
)?.workOrderMilestoneTypeId
|
||||
|
||||
export const deathWorkOrderMilestoneTypeId = (
|
||||
await cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType(
|
||||
export const deathWorkOrderMilestoneTypeId =
|
||||
cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType(
|
||||
'Death'
|
||||
)
|
||||
)?.workOrderMilestoneTypeId
|
||||
|
||||
export const funeralWorkOrderMilestoneTypeId = (
|
||||
await cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType(
|
||||
export const funeralWorkOrderMilestoneTypeId =
|
||||
cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType(
|
||||
'Funeral'
|
||||
)
|
||||
)?.workOrderMilestoneTypeId
|
||||
|
||||
export const cremationWorkOrderMilestoneTypeId = (
|
||||
await cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType(
|
||||
export const cremationWorkOrderMilestoneTypeId =
|
||||
cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType(
|
||||
'Cremation'
|
||||
)
|
||||
)?.workOrderMilestoneTypeId
|
||||
|
||||
export const intermentWorkOrderMilestoneTypeId = (
|
||||
await cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType(
|
||||
export const intermentWorkOrderMilestoneTypeId =
|
||||
cacheFunctions.getWorkOrderMilestoneTypeByWorkOrderMilestoneType(
|
||||
'Interment'
|
||||
)
|
||||
)?.workOrderMilestoneTypeId
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -65,9 +65,9 @@ async function importFromMasterCSV() {
|
|||
try {
|
||||
for (masterRow of cmmaster.data) {
|
||||
const cemeteryId = getCemeteryIdByKey(masterRow.CM_CEMETERY, user);
|
||||
const burialSiteTypeId = getBurialSiteTypeId(masterRow.CM_CEMETERY);
|
||||
let burialSiteId;
|
||||
if (masterRow.CM_CEMETERY !== '00') {
|
||||
if (masterRow.CM_CEMETERY !== '' && masterRow.CM_CEMETERY !== '00') {
|
||||
const burialSiteTypeId = getBurialSiteTypeId(masterRow.CM_CEMETERY);
|
||||
const burialSiteNameSegment1 = masterRow.CM_BLOCK === '0' ? '' : masterRow.CM_BLOCK;
|
||||
const burialSiteNameSegment2 = (masterRow.CM_RANGE1 === '0' ? '' : masterRow.CM_RANGE1) +
|
||||
(masterRow.CM_RANGE2 === '0' ? '' : masterRow.CM_RANGE2);
|
||||
|
|
@ -161,9 +161,9 @@ async function importFromMasterCSV() {
|
|||
if (masterRow.CM_REMARK1 !== '') {
|
||||
addContractComment({
|
||||
contractId: preneedContractId,
|
||||
comment: masterRow.CM_REMARK1,
|
||||
commentDateString: preneedContractStartDateString,
|
||||
commentTimeString: '00:00',
|
||||
comment: masterRow.CM_REMARK1
|
||||
commentTimeString: '00:00'
|
||||
}, user);
|
||||
}
|
||||
if (masterRow.CM_REMARK2 !== '') {
|
||||
|
|
@ -236,10 +236,10 @@ async function importFromMasterCSV() {
|
|||
contractStartDateString: deceasedContractStartDateString,
|
||||
contractEndDateString: deceasedContractEndDateString,
|
||||
contractTypeFieldIds: '',
|
||||
committalTypeId,
|
||||
funeralHomeId,
|
||||
funeralDirectorName: masterRow.CM_FUNERAL_HOME,
|
||||
funeralDateString,
|
||||
committalTypeId,
|
||||
purchaserName: masterRow.CM_PRENEED_OWNER === ''
|
||||
? masterRow.CM_DECEASED_NAME
|
||||
: masterRow.CM_PRENEED_OWNER,
|
||||
|
|
@ -267,25 +267,25 @@ async function importFromMasterCSV() {
|
|||
if (masterRow.CM_REMARK1 !== '') {
|
||||
addContractComment({
|
||||
contractId: deceasedContractId,
|
||||
comment: masterRow.CM_REMARK1,
|
||||
commentDateString: deceasedContractStartDateString,
|
||||
commentTimeString: '00:00',
|
||||
comment: masterRow.CM_REMARK1
|
||||
commentTimeString: '00:00'
|
||||
}, user);
|
||||
}
|
||||
if (masterRow.CM_REMARK2 !== '') {
|
||||
addContractComment({
|
||||
contractId: deceasedContractId,
|
||||
comment: masterRow.CM_REMARK2,
|
||||
commentDateString: deceasedContractStartDateString,
|
||||
commentTimeString: '00:00',
|
||||
comment: masterRow.CM_REMARK2
|
||||
commentTimeString: '00:00'
|
||||
}, user);
|
||||
}
|
||||
if (masterRow.CM_WORK_ORDER.trim() !== '') {
|
||||
addContractComment({
|
||||
contractId: deceasedContractId,
|
||||
comment: `Imported Contract #${masterRow.CM_WORK_ORDER}`,
|
||||
commentDateString: deceasedContractStartDateString,
|
||||
commentTimeString: '00:00',
|
||||
comment: `Imported Contract #${masterRow.CM_WORK_ORDER}`
|
||||
commentTimeString: '00:00'
|
||||
}, user);
|
||||
}
|
||||
updateBurialSiteStatus(burialSiteId ?? '', importIds.takenBurialSiteStatusId, user);
|
||||
|
|
|
|||
|
|
@ -104,11 +104,11 @@ async function importFromMasterCSV(): Promise<void> {
|
|||
for (masterRow of cmmaster.data) {
|
||||
const cemeteryId = getCemeteryIdByKey(masterRow.CM_CEMETERY, user)
|
||||
|
||||
const burialSiteTypeId = getBurialSiteTypeId(masterRow.CM_CEMETERY)
|
||||
|
||||
let burialSiteId: number | undefined
|
||||
|
||||
if (masterRow.CM_CEMETERY !== '00') {
|
||||
if (masterRow.CM_CEMETERY !== '' && masterRow.CM_CEMETERY !== '00') {
|
||||
const burialSiteTypeId = getBurialSiteTypeId(masterRow.CM_CEMETERY)
|
||||
|
||||
const burialSiteNameSegment1 =
|
||||
masterRow.CM_BLOCK === '0' ? '' : masterRow.CM_BLOCK
|
||||
const burialSiteNameSegment2 =
|
||||
|
|
@ -262,9 +262,10 @@ async function importFromMasterCSV(): Promise<void> {
|
|||
addContractComment(
|
||||
{
|
||||
contractId: preneedContractId,
|
||||
|
||||
comment: masterRow.CM_REMARK1,
|
||||
commentDateString: preneedContractStartDateString,
|
||||
commentTimeString: '00:00',
|
||||
comment: masterRow.CM_REMARK1
|
||||
commentTimeString: '00:00'
|
||||
},
|
||||
user
|
||||
)
|
||||
|
|
@ -398,10 +399,10 @@ async function importFromMasterCSV(): Promise<void> {
|
|||
contractEndDateString: deceasedContractEndDateString,
|
||||
contractTypeFieldIds: '',
|
||||
|
||||
committalTypeId,
|
||||
funeralHomeId,
|
||||
funeralDirectorName: masterRow.CM_FUNERAL_HOME,
|
||||
funeralDateString,
|
||||
committalTypeId,
|
||||
|
||||
purchaserName:
|
||||
masterRow.CM_PRENEED_OWNER === ''
|
||||
|
|
@ -440,9 +441,10 @@ async function importFromMasterCSV(): Promise<void> {
|
|||
addContractComment(
|
||||
{
|
||||
contractId: deceasedContractId,
|
||||
|
||||
comment: masterRow.CM_REMARK1,
|
||||
commentDateString: deceasedContractStartDateString,
|
||||
commentTimeString: '00:00',
|
||||
comment: masterRow.CM_REMARK1
|
||||
commentTimeString: '00:00'
|
||||
},
|
||||
user
|
||||
)
|
||||
|
|
@ -452,9 +454,10 @@ async function importFromMasterCSV(): Promise<void> {
|
|||
addContractComment(
|
||||
{
|
||||
contractId: deceasedContractId,
|
||||
|
||||
comment: masterRow.CM_REMARK2,
|
||||
commentDateString: deceasedContractStartDateString,
|
||||
commentTimeString: '00:00',
|
||||
comment: masterRow.CM_REMARK2
|
||||
commentTimeString: '00:00'
|
||||
},
|
||||
user
|
||||
)
|
||||
|
|
@ -464,9 +467,10 @@ async function importFromMasterCSV(): Promise<void> {
|
|||
addContractComment(
|
||||
{
|
||||
contractId: deceasedContractId,
|
||||
|
||||
comment: `Imported Contract #${masterRow.CM_WORK_ORDER}`,
|
||||
commentDateString: deceasedContractStartDateString,
|
||||
commentTimeString: '00:00',
|
||||
comment: `Imported Contract #${masterRow.CM_WORK_ORDER}`
|
||||
commentTimeString: '00:00'
|
||||
},
|
||||
user
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue