lot name help text
to assist with complicated regular expressionsdeepsource-autofix-76c6eb20
parent
584c6eb9a5
commit
6234060ffc
|
|
@ -2,7 +2,11 @@ import { config as cemeteryConfig } from "./config.cemetery.ontario.js";
|
||||||
export const config = Object.assign({}, cemeteryConfig);
|
export const config = Object.assign({}, cemeteryConfig);
|
||||||
config.aliases.occupancyStartDate = "Interment Date";
|
config.aliases.occupancyStartDate = "Interment Date";
|
||||||
config.aliases.externalReceiptNumber = "GP Receipt Number";
|
config.aliases.externalReceiptNumber = "GP Receipt Number";
|
||||||
config.settings.lot.lotNamePattern = /^[A-Z]{2}(-\d*[A-Z]?){3,5}$/;
|
config.settings.lot.lotNamePattern =
|
||||||
|
/^[\dA-Z]{2}-(B[\dA-Z]+-)?(R[\dA-Z]+-)?(L[\dA-Z]+-)?G[\dA-Z]+(, Interment \d+)?$/;
|
||||||
|
config.settings.lot.lotNameHelpText =
|
||||||
|
"Two digit cemetery-Block-Range-Lot-Grave, Interment number\n" +
|
||||||
|
"ex. XX-BA-R41-L15-G3A, Interment 1";
|
||||||
config.settings.lot.lotNameSortNameFunction = (lotName) => {
|
config.settings.lot.lotNameSortNameFunction = (lotName) => {
|
||||||
const numericPadding = "00000";
|
const numericPadding = "00000";
|
||||||
const lotNameSplit = lotName.toUpperCase().split("-");
|
const lotNameSplit = lotName.toUpperCase().split("-");
|
||||||
|
|
@ -23,7 +27,10 @@ config.settings.lot.lotNameSortNameFunction = (lotName) => {
|
||||||
return cleanLotNamePieces.join("-");
|
return cleanLotNamePieces.join("-");
|
||||||
};
|
};
|
||||||
config.settings.lotOccupancy.occupantCityDefault = "Sault Ste. Marie";
|
config.settings.lotOccupancy.occupantCityDefault = "Sault Ste. Marie";
|
||||||
config.settings.lotOccupancy.prints = ["pdf/ssm.cemetery.contract", "pdf/ssm.cemetery.burialPermit"];
|
config.settings.lotOccupancy.prints = [
|
||||||
|
"pdf/ssm.cemetery.contract",
|
||||||
|
"pdf/ssm.cemetery.burialPermit"
|
||||||
|
];
|
||||||
config.settings.map.mapCityDefault = "Sault Ste. Marie";
|
config.settings.map.mapCityDefault = "Sault Ste. Marie";
|
||||||
config.settings.workOrders.workOrderNumberLength = 6;
|
config.settings.workOrders.workOrderNumberLength = 6;
|
||||||
config.settings.workOrders.workOrderMilestoneDateRecentBeforeDays = 7;
|
config.settings.workOrders.workOrderMilestoneDateRecentBeforeDays = 7;
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,47 @@
|
||||||
import {
|
import { config as cemeteryConfig } from "./config.cemetery.ontario.js";
|
||||||
config as cemeteryConfig
|
|
||||||
} from "./config.cemetery.ontario.js";
|
|
||||||
|
|
||||||
export const config = Object.assign({}, cemeteryConfig);
|
export const config = Object.assign({}, cemeteryConfig);
|
||||||
|
|
||||||
config.aliases.occupancyStartDate = "Interment Date";
|
config.aliases.occupancyStartDate = "Interment Date";
|
||||||
config.aliases.externalReceiptNumber = "GP Receipt Number";
|
config.aliases.externalReceiptNumber = "GP Receipt Number";
|
||||||
|
|
||||||
config.settings.lot.lotNamePattern = /^[A-Z]{2}(-\d*[A-Z]?){3,5}$/;
|
config.settings.lot.lotNamePattern =
|
||||||
|
/^[\dA-Z]{2}-(B[\dA-Z]+-)?(R[\dA-Z]+-)?(L[\dA-Z]+-)?G[\dA-Z]+(, Interment \d+)?$/;
|
||||||
|
|
||||||
|
config.settings.lot.lotNameHelpText =
|
||||||
|
"Two digit cemetery-Block-Range-Lot-Grave, Interment number\n" +
|
||||||
|
"ex. XX-BA-R41-L15-G3A, Interment 1";
|
||||||
|
|
||||||
config.settings.lot.lotNameSortNameFunction = (lotName) => {
|
config.settings.lot.lotNameSortNameFunction = (lotName) => {
|
||||||
|
const numericPadding = "00000";
|
||||||
|
|
||||||
const numericPadding = "00000";
|
const lotNameSplit = lotName.toUpperCase().split("-");
|
||||||
|
|
||||||
const lotNameSplit = lotName.toUpperCase().split("-");
|
const cleanLotNamePieces: string[] = [];
|
||||||
|
|
||||||
const cleanLotNamePieces: string[] = [];
|
for (const lotNamePiece of lotNameSplit) {
|
||||||
|
let numericPiece = numericPadding;
|
||||||
|
let letterPiece = "";
|
||||||
|
|
||||||
for (const lotNamePiece of lotNameSplit) {
|
for (const letter of lotNamePiece) {
|
||||||
|
if (letterPiece === "" && "0123456789".includes(letter)) {
|
||||||
let numericPiece = numericPadding;
|
numericPiece += letter;
|
||||||
let letterPiece = "";
|
} else {
|
||||||
|
letterPiece += letter;
|
||||||
for (const letter of lotNamePiece) {
|
|
||||||
|
|
||||||
if (letterPiece === "" && "0123456789".includes(letter)) {
|
|
||||||
numericPiece += letter;
|
|
||||||
} else {
|
|
||||||
letterPiece += letter;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanLotNamePieces.push(numericPiece.slice(-1 * numericPadding.length) + letterPiece);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return cleanLotNamePieces.join("-");
|
cleanLotNamePieces.push(numericPiece.slice(-1 * numericPadding.length) + letterPiece);
|
||||||
};
|
}
|
||||||
|
|
||||||
|
return cleanLotNamePieces.join("-");
|
||||||
|
};
|
||||||
|
|
||||||
config.settings.lotOccupancy.occupantCityDefault = "Sault Ste. Marie";
|
config.settings.lotOccupancy.occupantCityDefault = "Sault Ste. Marie";
|
||||||
config.settings.lotOccupancy.prints = ["pdf/ssm.cemetery.contract", "pdf/ssm.cemetery.burialPermit"];
|
config.settings.lotOccupancy.prints = [
|
||||||
|
"pdf/ssm.cemetery.contract",
|
||||||
|
"pdf/ssm.cemetery.burialPermit"
|
||||||
|
];
|
||||||
|
|
||||||
config.settings.map.mapCityDefault = "Sault Ste. Marie";
|
config.settings.map.mapCityDefault = "Sault Ste. Marie";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ export declare function getProperty(propertyName: "aliases.externalReceiptNumber
|
||||||
export declare function getProperty(propertyName: "settings.map.mapCityDefault"): string;
|
export declare function getProperty(propertyName: "settings.map.mapCityDefault"): string;
|
||||||
export declare function getProperty(propertyName: "settings.map.mapProvinceDefault"): string;
|
export declare function getProperty(propertyName: "settings.map.mapProvinceDefault"): string;
|
||||||
export declare function getProperty(propertyName: "settings.lot.lotNamePattern"): RegExp;
|
export declare function getProperty(propertyName: "settings.lot.lotNamePattern"): RegExp;
|
||||||
|
export declare function getProperty(propertyName: "settings.lot.lotNameHelpText"): string;
|
||||||
export declare function getProperty(propertyName: "settings.lot.lotNameSortNameFunction"): (lotName: string) => string;
|
export declare function getProperty(propertyName: "settings.lot.lotNameSortNameFunction"): (lotName: string) => string;
|
||||||
export declare function getProperty(propertyName: "settings.lotOccupancy.occupancyEndDateIsRequired"): boolean;
|
export declare function getProperty(propertyName: "settings.lotOccupancy.occupancyEndDateIsRequired"): boolean;
|
||||||
export declare function getProperty(propertyName: "settings.lotOccupancy.occupantCityDefault"): string;
|
export declare function getProperty(propertyName: "settings.lotOccupancy.occupantCityDefault"): string;
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,7 @@ export function getProperty(propertyName: "settings.map.mapCityDefault"): string
|
||||||
export function getProperty(propertyName: "settings.map.mapProvinceDefault"): string;
|
export function getProperty(propertyName: "settings.map.mapProvinceDefault"): string;
|
||||||
|
|
||||||
export function getProperty(propertyName: "settings.lot.lotNamePattern"): RegExp;
|
export function getProperty(propertyName: "settings.lot.lotNamePattern"): RegExp;
|
||||||
|
export function getProperty(propertyName: "settings.lot.lotNameHelpText"): string;
|
||||||
|
|
||||||
export function getProperty(
|
export function getProperty(
|
||||||
propertyName: "settings.lot.lotNameSortNameFunction"
|
propertyName: "settings.lot.lotNameSortNameFunction"
|
||||||
|
|
|
||||||
|
|
@ -134,17 +134,16 @@ function getFeeIdByFeeDescription(feeDescription) {
|
||||||
function buildLotName(lotNamePieces) {
|
function buildLotName(lotNamePieces) {
|
||||||
return (lotNamePieces.cemetery +
|
return (lotNamePieces.cemetery +
|
||||||
"-" +
|
"-" +
|
||||||
(lotNamePieces.block === "" ? "" : lotNamePieces.block + "-") +
|
(lotNamePieces.block === "" ? "" : "B" + lotNamePieces.block + "-") +
|
||||||
(lotNamePieces.range1 === "0" && lotNamePieces.range2 === ""
|
(lotNamePieces.range1 === "0" && lotNamePieces.range2 === ""
|
||||||
? ""
|
? ""
|
||||||
: lotNamePieces.range1 + lotNamePieces.range2 + "-") +
|
: "R" + lotNamePieces.range1 + lotNamePieces.range2 + "-") +
|
||||||
(lotNamePieces.lot1 === "0" && lotNamePieces.lot2 === ""
|
(lotNamePieces.lot1 === "0" && lotNamePieces.lot2 === ""
|
||||||
? ""
|
? ""
|
||||||
: lotNamePieces.lot1 + lotNamePieces.lot2 + "-") +
|
: "L" + lotNamePieces.lot1 + lotNamePieces.lot2 + "-") +
|
||||||
lotNamePieces.grave1 +
|
("G" + lotNamePieces.grave1 + lotNamePieces.grave2) +
|
||||||
lotNamePieces.grave2 +
|
", " +
|
||||||
"-" +
|
("Interment " + lotNamePieces.interment));
|
||||||
lotNamePieces.interment);
|
|
||||||
}
|
}
|
||||||
const casketLotType = cacheFunctions.getLotTypesByLotType("Casket Grave");
|
const casketLotType = cacheFunctions.getLotTypesByLotType("Casket Grave");
|
||||||
const columbariumLotType = cacheFunctions.getLotTypesByLotType("Columbarium");
|
const columbariumLotType = cacheFunctions.getLotTypesByLotType("Columbarium");
|
||||||
|
|
|
||||||
|
|
@ -361,17 +361,16 @@ function buildLotName(lotNamePieces: {
|
||||||
return (
|
return (
|
||||||
lotNamePieces.cemetery +
|
lotNamePieces.cemetery +
|
||||||
"-" +
|
"-" +
|
||||||
(lotNamePieces.block === "" ? "" : lotNamePieces.block + "-") +
|
(lotNamePieces.block === "" ? "" : "B" + lotNamePieces.block + "-") +
|
||||||
(lotNamePieces.range1 === "0" && lotNamePieces.range2 === ""
|
(lotNamePieces.range1 === "0" && lotNamePieces.range2 === ""
|
||||||
? ""
|
? ""
|
||||||
: lotNamePieces.range1 + lotNamePieces.range2 + "-") +
|
: "R" + lotNamePieces.range1 + lotNamePieces.range2 + "-") +
|
||||||
(lotNamePieces.lot1 === "0" && lotNamePieces.lot2 === ""
|
(lotNamePieces.lot1 === "0" && lotNamePieces.lot2 === ""
|
||||||
? ""
|
? ""
|
||||||
: lotNamePieces.lot1 + lotNamePieces.lot2 + "-") +
|
: "L" + lotNamePieces.lot1 + lotNamePieces.lot2 + "-") +
|
||||||
lotNamePieces.grave1 +
|
("G" + lotNamePieces.grave1 + lotNamePieces.grave2) +
|
||||||
lotNamePieces.grave2 +
|
", " +
|
||||||
"-" +
|
("Interment " + lotNamePieces.interment)
|
||||||
lotNamePieces.interment
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -435,7 +434,6 @@ const intermentWorkOrderMilestoneType =
|
||||||
|
|
||||||
function getFuneralHome(funeralHomeKey: string): recordTypes.LotOccupancyOccupant {
|
function getFuneralHome(funeralHomeKey: string): recordTypes.LotOccupancyOccupant {
|
||||||
switch (funeralHomeKey) {
|
switch (funeralHomeKey) {
|
||||||
|
|
||||||
case "AR": {
|
case "AR": {
|
||||||
return {
|
return {
|
||||||
lotOccupantTypeId: funeralDirectorLotOccupantType.lotOccupantTypeId,
|
lotOccupantTypeId: funeralDirectorLotOccupantType.lotOccupantTypeId,
|
||||||
|
|
@ -447,7 +445,7 @@ function getFuneralHome(funeralHomeKey: string): recordTypes.LotOccupancyOccupan
|
||||||
occupantPostalCode: "P6A 2L9",
|
occupantPostalCode: "P6A 2L9",
|
||||||
occupantPhoneNumber: "705-759-2522",
|
occupantPhoneNumber: "705-759-2522",
|
||||||
occupantEmailAddress: ""
|
occupantEmailAddress: ""
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
case "NO": {
|
case "NO": {
|
||||||
return {
|
return {
|
||||||
|
|
@ -460,7 +458,7 @@ function getFuneralHome(funeralHomeKey: string): recordTypes.LotOccupancyOccupan
|
||||||
occupantPostalCode: "P6B 0B6",
|
occupantPostalCode: "P6B 0B6",
|
||||||
occupantPhoneNumber: "705-945-7758",
|
occupantPhoneNumber: "705-945-7758",
|
||||||
occupantEmailAddress: ""
|
occupantEmailAddress: ""
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
case "OS": {
|
case "OS": {
|
||||||
return {
|
return {
|
||||||
|
|
@ -473,7 +471,7 @@ function getFuneralHome(funeralHomeKey: string): recordTypes.LotOccupancyOccupan
|
||||||
occupantPostalCode: "P6A 1P7",
|
occupantPostalCode: "P6A 1P7",
|
||||||
occupantPhoneNumber: "705-759-8456",
|
occupantPhoneNumber: "705-759-8456",
|
||||||
occupantEmailAddress: ""
|
occupantEmailAddress: ""
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -482,7 +480,7 @@ function getFuneralHome(funeralHomeKey: string): recordTypes.LotOccupancyOccupan
|
||||||
occupantName: funeralHomeKey,
|
occupantName: funeralHomeKey,
|
||||||
occupantCity: "Sault Ste. Marie",
|
occupantCity: "Sault Ste. Marie",
|
||||||
occupantProvince: "ON"
|
occupantProvince: "ON"
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function importFromMasterCSV() {
|
function importFromMasterCSV() {
|
||||||
|
|
@ -772,21 +770,23 @@ function importFromMasterCSV() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (masterRow.CM_FUNERAL_HOME !== "") {
|
if (masterRow.CM_FUNERAL_HOME !== "") {
|
||||||
|
|
||||||
const funeralHomeOccupant = getFuneralHome(masterRow.CM_FUNERAL_HOME);
|
const funeralHomeOccupant = getFuneralHome(masterRow.CM_FUNERAL_HOME);
|
||||||
|
|
||||||
addLotOccupancyOccupant({
|
addLotOccupancyOccupant(
|
||||||
lotOccupancyId: deceasedLotOccupancyId,
|
{
|
||||||
lotOccupantTypeId: funeralHomeOccupant.lotOccupantTypeId,
|
lotOccupancyId: deceasedLotOccupancyId,
|
||||||
occupantName: funeralHomeOccupant.occupantName,
|
lotOccupantTypeId: funeralHomeOccupant.lotOccupantTypeId,
|
||||||
occupantAddress1: funeralHomeOccupant.occupantAddress1,
|
occupantName: funeralHomeOccupant.occupantName,
|
||||||
occupantAddress2: funeralHomeOccupant.occupantAddress2,
|
occupantAddress1: funeralHomeOccupant.occupantAddress1,
|
||||||
occupantCity: funeralHomeOccupant.occupantCity,
|
occupantAddress2: funeralHomeOccupant.occupantAddress2,
|
||||||
occupantProvince: funeralHomeOccupant.occupantProvince,
|
occupantCity: funeralHomeOccupant.occupantCity,
|
||||||
occupantPostalCode: funeralHomeOccupant.occupantPostalCode,
|
occupantProvince: funeralHomeOccupant.occupantProvince,
|
||||||
occupantPhoneNumber: funeralHomeOccupant.occupantPhoneNumber,
|
occupantPostalCode: funeralHomeOccupant.occupantPostalCode,
|
||||||
occupantEmailAddress: funeralHomeOccupant.occupantEmailAddress
|
occupantPhoneNumber: funeralHomeOccupant.occupantPhoneNumber,
|
||||||
}, user);
|
occupantEmailAddress: funeralHomeOccupant.occupantEmailAddress
|
||||||
|
},
|
||||||
|
user
|
||||||
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
addOrUpdateLotOccupancyField(
|
addOrUpdateLotOccupancyField(
|
||||||
|
|
@ -1388,7 +1388,6 @@ function importFromWorkOrderCSV() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (workOrderRow.WO_DEATH_PLACE !== "") {
|
if (workOrderRow.WO_DEATH_PLACE !== "") {
|
||||||
|
|
||||||
addOrUpdateLotOccupancyField(
|
addOrUpdateLotOccupancyField(
|
||||||
{
|
{
|
||||||
lotOccupancyId: lotOccupancyId,
|
lotOccupancyId: lotOccupancyId,
|
||||||
|
|
@ -1401,7 +1400,6 @@ function importFromWorkOrderCSV() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (workOrderRow.WO_AGE !== "") {
|
if (workOrderRow.WO_AGE !== "") {
|
||||||
addOrUpdateLotOccupancyField(
|
addOrUpdateLotOccupancyField(
|
||||||
{
|
{
|
||||||
|
|
@ -1429,10 +1427,10 @@ function importFromWorkOrderCSV() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (workOrderRow.WO_FUNERAL_HOME !== "") {
|
if (workOrderRow.WO_FUNERAL_HOME !== "") {
|
||||||
|
|
||||||
const funeralHomeOccupant = getFuneralHome(workOrderRow.WO_FUNERAL_HOME);
|
const funeralHomeOccupant = getFuneralHome(workOrderRow.WO_FUNERAL_HOME);
|
||||||
|
|
||||||
addLotOccupancyOccupant({
|
addLotOccupancyOccupant(
|
||||||
|
{
|
||||||
lotOccupancyId: lotOccupancyId,
|
lotOccupancyId: lotOccupancyId,
|
||||||
lotOccupantTypeId: funeralHomeOccupant.lotOccupantTypeId,
|
lotOccupantTypeId: funeralHomeOccupant.lotOccupantTypeId,
|
||||||
occupantName: funeralHomeOccupant.occupantName,
|
occupantName: funeralHomeOccupant.occupantName,
|
||||||
|
|
@ -1443,7 +1441,9 @@ function importFromWorkOrderCSV() {
|
||||||
occupantPostalCode: funeralHomeOccupant.occupantPostalCode,
|
occupantPostalCode: funeralHomeOccupant.occupantPostalCode,
|
||||||
occupantPhoneNumber: funeralHomeOccupant.occupantPhoneNumber,
|
occupantPhoneNumber: funeralHomeOccupant.occupantPhoneNumber,
|
||||||
occupantEmailAddress: funeralHomeOccupant.occupantEmailAddress
|
occupantEmailAddress: funeralHomeOccupant.occupantEmailAddress
|
||||||
}, user);
|
},
|
||||||
|
user
|
||||||
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
addOrUpdateLotOccupancyField(
|
addOrUpdateLotOccupancyField(
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ export interface Config {
|
||||||
};
|
};
|
||||||
lot: {
|
lot: {
|
||||||
lotNamePattern?: RegExp;
|
lotNamePattern?: RegExp;
|
||||||
|
lotNameHelpText?: string;
|
||||||
lotNameSortNameFunction?: (lotName: string) => string;
|
lotNameSortNameFunction?: (lotName: string) => string;
|
||||||
};
|
};
|
||||||
lotOccupancy: {
|
lotOccupancy: {
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ export interface Config {
|
||||||
};
|
};
|
||||||
lot: {
|
lot: {
|
||||||
lotNamePattern?: RegExp;
|
lotNamePattern?: RegExp;
|
||||||
|
lotNameHelpText?: string;
|
||||||
lotNameSortNameFunction?: (lotName: string) => string;
|
lotNameSortNameFunction?: (lotName: string) => string;
|
||||||
};
|
};
|
||||||
lotOccupancy: {
|
lotOccupancy: {
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,11 @@
|
||||||
accesskey="f"
|
accesskey="f"
|
||||||
<%= (isCreate ? " autofocus" : "") %> />
|
<%= (isCreate ? " autofocus" : "") %> />
|
||||||
</div>
|
</div>
|
||||||
|
<% if (configFunctions.getProperty("settings.lot.lotNameHelpText")) { %>
|
||||||
|
<p class="help">
|
||||||
|
<%- configFunctions.getProperty("settings.lot.lotNameHelpText").replace(/\n/g, "<br />") %>
|
||||||
|
</p>
|
||||||
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue