use common "cremation" cemetery list

pull/11/head
Dan Gowans 2025-05-01 08:55:34 -04:00
parent c460d073e7
commit 57b6dbf35e
5 changed files with 12 additions and 8 deletions

View File

@ -1 +1,2 @@
export declare const cremationCemeteryKeys: Set<string>;
export declare function getCemeteryIdByKey(cemeteryKeyToSearch: string | undefined, user: User): number;

View File

@ -2,6 +2,7 @@
/* eslint-disable no-console */
import addCemetery from '../../database/addCemetery.js';
import { getCemeteryByKey } from '../../database/getCemetery.js';
export const cremationCemeteryKeys = new Set(['', '00', '`', 'N', 'R']);
const cemeteryKeyToCemetery = {
'00': {
cemeteryName: 'Crematorium',

View File

@ -6,6 +6,8 @@ import addCemetery, {
} from '../../database/addCemetery.js'
import { getCemeteryByKey } from '../../database/getCemetery.js'
export const cremationCemeteryKeys = new Set(['', '00', '`', 'N', 'R'])
const cemeteryKeyToCemetery: Record<string, AddCemeteryForm> = {
'00': {
cemeteryName: 'Crematorium',

View File

@ -22,7 +22,7 @@ import { updateBurialSiteStatus } from '../../database/updateBurialSite.js';
import { buildBurialSiteName } from '../../helpers/burialSites.helpers.js';
import { sunriseDB as databasePath } from '../../helpers/database.helpers.js';
import { getBurialSiteTypeId } from './data.burialSiteTypes.js';
import { getCemeteryIdByKey } from './data.cemeteries.js';
import { cremationCemeteryKeys, getCemeteryIdByKey } from './data.cemeteries.js';
import { getCommittalTypeIdByKey } from './data.committalTypes.js';
import { getDeathAgePeriod } from './data.deathAgePeriods.js';
import { getFeeIdByFeeDescription } from './data.fees.js';
@ -66,7 +66,7 @@ async function importFromMasterCSV() {
for (masterRow of cmmaster.data) {
const cemeteryId = getCemeteryIdByKey(masterRow.CM_CEMETERY, user);
let burialSiteId;
if (masterRow.CM_CEMETERY !== '' && masterRow.CM_CEMETERY !== '00') {
if (!cremationCemeteryKeys.has(masterRow.CM_CEMETERY)) {
const burialSiteTypeId = getBurialSiteTypeId(masterRow.CM_CEMETERY);
const burialSiteNameSegment1 = masterRow.CM_BLOCK === '0' ? '' : masterRow.CM_BLOCK;
const burialSiteNameSegment2 = (masterRow.CM_RANGE1 === '0' ? '' : masterRow.CM_RANGE1) +
@ -322,7 +322,7 @@ async function importFromPrepaidCSV() {
cemeteryKey = 'HC';
}
let burialSite;
if (cemeteryKey !== '') {
if (!cremationCemeteryKeys.has(cemeteryKey)) {
const cemeteryId = getCemeteryIdByKey(cemeteryKey, user);
const burialSiteNameSegment1 = prepaidRow.CMPP_BLOCK === '0' ? '' : prepaidRow.CMPP_BLOCK;
const burialSiteNameSegment2 = (prepaidRow.CMPP_RANGE1 === '0' ? '' : prepaidRow.CMPP_RANGE1) +

View File

@ -36,7 +36,7 @@ import { sunriseDB as databasePath } from '../../helpers/database.helpers.js'
import type * as recordTypes from '../../types/record.types.js'
import { getBurialSiteTypeId } from './data.burialSiteTypes.js'
import { getCemeteryIdByKey } from './data.cemeteries.js'
import { cremationCemeteryKeys, getCemeteryIdByKey } from './data.cemeteries.js'
import { getCommittalTypeIdByKey } from './data.committalTypes.js'
import { getDeathAgePeriod } from './data.deathAgePeriods.js'
import { getFeeIdByFeeDescription } from './data.fees.js'
@ -106,7 +106,7 @@ async function importFromMasterCSV(): Promise<void> {
let burialSiteId: number | undefined
if (masterRow.CM_CEMETERY !== '' && masterRow.CM_CEMETERY !== '00') {
if (!cremationCemeteryKeys.has(masterRow.CM_CEMETERY)) {
const burialSiteTypeId = getBurialSiteTypeId(masterRow.CM_CEMETERY)
const burialSiteNameSegment1 =
@ -524,7 +524,7 @@ async function importFromPrepaidCSV(): Promise<void> {
let burialSite: recordTypes.BurialSite | undefined
if (cemeteryKey !== '') {
if (!cremationCemeteryKeys.has(cemeteryKey)) {
const cemeteryId = getCemeteryIdByKey(cemeteryKey, user)
const burialSiteNameSegment1 =