use common "cremation" cemetery list
parent
c460d073e7
commit
57b6dbf35e
|
|
@ -1 +1,2 @@
|
||||||
|
export declare const cremationCemeteryKeys: Set<string>;
|
||||||
export declare function getCemeteryIdByKey(cemeteryKeyToSearch: string | undefined, user: User): number;
|
export declare function getCemeteryIdByKey(cemeteryKeyToSearch: string | undefined, user: User): number;
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
import addCemetery from '../../database/addCemetery.js';
|
import addCemetery from '../../database/addCemetery.js';
|
||||||
import { getCemeteryByKey } from '../../database/getCemetery.js';
|
import { getCemeteryByKey } from '../../database/getCemetery.js';
|
||||||
|
export const cremationCemeteryKeys = new Set(['', '00', '`', 'N', 'R']);
|
||||||
const cemeteryKeyToCemetery = {
|
const cemeteryKeyToCemetery = {
|
||||||
'00': {
|
'00': {
|
||||||
cemeteryName: 'Crematorium',
|
cemeteryName: 'Crematorium',
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ import addCemetery, {
|
||||||
} from '../../database/addCemetery.js'
|
} from '../../database/addCemetery.js'
|
||||||
import { getCemeteryByKey } from '../../database/getCemetery.js'
|
import { getCemeteryByKey } from '../../database/getCemetery.js'
|
||||||
|
|
||||||
|
export const cremationCemeteryKeys = new Set(['', '00', '`', 'N', 'R'])
|
||||||
|
|
||||||
const cemeteryKeyToCemetery: Record<string, AddCemeteryForm> = {
|
const cemeteryKeyToCemetery: Record<string, AddCemeteryForm> = {
|
||||||
'00': {
|
'00': {
|
||||||
cemeteryName: 'Crematorium',
|
cemeteryName: 'Crematorium',
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import { updateBurialSiteStatus } from '../../database/updateBurialSite.js';
|
||||||
import { buildBurialSiteName } from '../../helpers/burialSites.helpers.js';
|
import { buildBurialSiteName } from '../../helpers/burialSites.helpers.js';
|
||||||
import { sunriseDB as databasePath } from '../../helpers/database.helpers.js';
|
import { sunriseDB as databasePath } from '../../helpers/database.helpers.js';
|
||||||
import { getBurialSiteTypeId } from './data.burialSiteTypes.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 { getCommittalTypeIdByKey } from './data.committalTypes.js';
|
||||||
import { getDeathAgePeriod } from './data.deathAgePeriods.js';
|
import { getDeathAgePeriod } from './data.deathAgePeriods.js';
|
||||||
import { getFeeIdByFeeDescription } from './data.fees.js';
|
import { getFeeIdByFeeDescription } from './data.fees.js';
|
||||||
|
|
@ -66,7 +66,7 @@ async function importFromMasterCSV() {
|
||||||
for (masterRow of cmmaster.data) {
|
for (masterRow of cmmaster.data) {
|
||||||
const cemeteryId = getCemeteryIdByKey(masterRow.CM_CEMETERY, user);
|
const cemeteryId = getCemeteryIdByKey(masterRow.CM_CEMETERY, user);
|
||||||
let burialSiteId;
|
let burialSiteId;
|
||||||
if (masterRow.CM_CEMETERY !== '' && masterRow.CM_CEMETERY !== '00') {
|
if (!cremationCemeteryKeys.has(masterRow.CM_CEMETERY)) {
|
||||||
const burialSiteTypeId = getBurialSiteTypeId(masterRow.CM_CEMETERY);
|
const burialSiteTypeId = getBurialSiteTypeId(masterRow.CM_CEMETERY);
|
||||||
const burialSiteNameSegment1 = masterRow.CM_BLOCK === '0' ? '' : masterRow.CM_BLOCK;
|
const burialSiteNameSegment1 = masterRow.CM_BLOCK === '0' ? '' : masterRow.CM_BLOCK;
|
||||||
const burialSiteNameSegment2 = (masterRow.CM_RANGE1 === '0' ? '' : masterRow.CM_RANGE1) +
|
const burialSiteNameSegment2 = (masterRow.CM_RANGE1 === '0' ? '' : masterRow.CM_RANGE1) +
|
||||||
|
|
@ -322,7 +322,7 @@ async function importFromPrepaidCSV() {
|
||||||
cemeteryKey = 'HC';
|
cemeteryKey = 'HC';
|
||||||
}
|
}
|
||||||
let burialSite;
|
let burialSite;
|
||||||
if (cemeteryKey !== '') {
|
if (!cremationCemeteryKeys.has(cemeteryKey)) {
|
||||||
const cemeteryId = getCemeteryIdByKey(cemeteryKey, user);
|
const cemeteryId = getCemeteryIdByKey(cemeteryKey, user);
|
||||||
const burialSiteNameSegment1 = prepaidRow.CMPP_BLOCK === '0' ? '' : prepaidRow.CMPP_BLOCK;
|
const burialSiteNameSegment1 = prepaidRow.CMPP_BLOCK === '0' ? '' : prepaidRow.CMPP_BLOCK;
|
||||||
const burialSiteNameSegment2 = (prepaidRow.CMPP_RANGE1 === '0' ? '' : prepaidRow.CMPP_RANGE1) +
|
const burialSiteNameSegment2 = (prepaidRow.CMPP_RANGE1 === '0' ? '' : prepaidRow.CMPP_RANGE1) +
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ import { sunriseDB as databasePath } from '../../helpers/database.helpers.js'
|
||||||
import type * as recordTypes from '../../types/record.types.js'
|
import type * as recordTypes from '../../types/record.types.js'
|
||||||
|
|
||||||
import { getBurialSiteTypeId } from './data.burialSiteTypes.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 { getCommittalTypeIdByKey } from './data.committalTypes.js'
|
||||||
import { getDeathAgePeriod } from './data.deathAgePeriods.js'
|
import { getDeathAgePeriod } from './data.deathAgePeriods.js'
|
||||||
import { getFeeIdByFeeDescription } from './data.fees.js'
|
import { getFeeIdByFeeDescription } from './data.fees.js'
|
||||||
|
|
@ -106,7 +106,7 @@ async function importFromMasterCSV(): Promise<void> {
|
||||||
|
|
||||||
let burialSiteId: number | undefined
|
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 burialSiteTypeId = getBurialSiteTypeId(masterRow.CM_CEMETERY)
|
||||||
|
|
||||||
const burialSiteNameSegment1 =
|
const burialSiteNameSegment1 =
|
||||||
|
|
@ -524,7 +524,7 @@ async function importFromPrepaidCSV(): Promise<void> {
|
||||||
|
|
||||||
let burialSite: recordTypes.BurialSite | undefined
|
let burialSite: recordTypes.BurialSite | undefined
|
||||||
|
|
||||||
if (cemeteryKey !== '') {
|
if (!cremationCemeteryKeys.has(cemeteryKey)) {
|
||||||
const cemeteryId = getCemeteryIdByKey(cemeteryKey, user)
|
const cemeteryId = getCemeteryIdByKey(cemeteryKey, user)
|
||||||
|
|
||||||
const burialSiteNameSegment1 =
|
const burialSiteNameSegment1 =
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue