Merged in release/2021-10-15 (pull request #247)

IO-233 Replace unknown CDK function.

Approved-by: Patrick Fic
This commit is contained in:
Patrick Fic
2021-10-12 19:06:35 +00:00

View File

@@ -15,7 +15,7 @@ const CalcualteAllocations = require("./cdk-calculate-allocations").default;
const moment = require("moment"); const moment = require("moment");
const replaceSpecialRegex = `[^a-zA-Z0-9 .,\n #]+`; const replaceSpecialRegex = `[^a-zA-Z0-9 .,\n #]+/g`;
exports.default = async function (socket, { txEnvelope, jobid }) { exports.default = async function (socket, { txEnvelope, jobid }) {
socket.logEvents = []; socket.logEvents = [];
@@ -422,7 +422,12 @@ async function QueryDmsCustomerById(socket, JobData, CustomerId) {
} }
async function QueryDmsCustomerByName(socket, JobData) { async function QueryDmsCustomerByName(socket, JobData) {
const ownerName = `${JobData.ownr_ln},${JobData.ownr_fn}`; const ownerName = (
JobData.ownr_co_nm
? JobData.ownr_co_nm
: `${JobData.ownr_ln},${JobData.ownr_fn}`
).replace(replaceSpecialRegex, "");
CdkBase.createLogEvent( CdkBase.createLogEvent(
socket, socket,
"DEBUG", "DEBUG",
@@ -439,7 +444,7 @@ async function QueryDmsCustomerByName(socket, JobData) {
arg1: { dealerId: JobData.bodyshop.cdk_dealerid }, //TODO: Verify why this does not follow the other standards. arg1: { dealerId: JobData.bodyshop.cdk_dealerid }, //TODO: Verify why this does not follow the other standards.
arg2: { arg2: {
verb: "EXACT", verb: "EXACT",
key: ownerName.replaceAll(replaceSpecialRegex, ""), key: ownerName,
}, },
}); });
@@ -576,14 +581,10 @@ async function InsertDmsCustomer(socket, newCustomerNumber) {
//TODO: Verify whether we need to bring more information in. //TODO: Verify whether we need to bring more information in.
id: { value: newCustomerNumber }, id: { value: newCustomerNumber },
address: { address: {
addressLine: socket.JobData.ownr_addr1.replaceAll( addressLine:
replaceSpecialRegex, socket.JobData.ownr_addr1 &&
"" socket.JobData.ownr_addr1.replace(replaceSpecialRegex, ""),
), city: socket.JobData.ownr_city.replace(replaceSpecialRegex, ""),
city: socket.JobData.ownr_city.replaceAll(
replaceSpecialRegex,
""
),
country: null, country: null,
postalCode: postalCode:
socket.JobData.ownr_zip && socket.JobData.ownr_zip &&
@@ -605,19 +606,16 @@ async function InsertDmsCustomer(socket, newCustomerNumber) {
}, },
demographics: null, demographics: null,
name1: { name1: {
companyname: socket.JobData.ownr_co_nm.replaceAll( companyname:
replaceSpecialRegex, socket.JobData.ownr_co_nm &&
"" socket.JobData.ownr_co_nm.replace(replaceSpecialRegex, ""),
), firstName:
firstName: socket.JobData.ownr_fn.replaceAll( socket.JobData.ownr_fn &&
replaceSpecialRegex, socket.JobData.ownr_fn.replace(replaceSpecialRegex, ""),
""
),
fullname: null, fullname: null,
lastName: socket.JobData.ownr_ln.replaceAll( lastName:
replaceSpecialRegex, socket.JobData.ownr_ln &&
"" socket.JobData.ownr_ln.replace(replaceSpecialRegex, ""),
),
middleName: null, middleName: null,
nameType: "Person", nameType: "Person",
suffix: null, suffix: null,
@@ -886,7 +884,9 @@ async function InsertDmsStartWip(socket) {
arg2: { arg2: {
acctgDate: moment().format("YYYY-MM-DD"), acctgDate: moment().format("YYYY-MM-DD"),
//socket.JobData.invoice_date //socket.JobData.invoice_date
desc: socket.txEnvelope.story.replaceAll(replaceSpecialRegex, ""), desc:
socket.txEnvelope.story &&
socket.txEnvelope.story.replace(replaceSpecialRegex, ""),
docType: 10 || 7, //Need to check what this usually would be? Apparently it is almost always 10 or 7. docType: 10 || 7, //Need to check what this usually would be? Apparently it is almost always 10 or 7.
//1 Cash Receipt , 2 Check, 3 Journal Voucher, 4 Parts invoice, 5 Payable Invoice, 6 Recurring Entry, 7 Repair Order Invoice, 8 Vehicle Purchase Invoice, 9 Vehicle Sale Invoice, 10 Other, 11 Payroll, 12 Finance Charge, 13 FMLR Invoice, 14 Parts Credit Memo, 15 Manufacturer Document, 16 FMLR Credit Memo //1 Cash Receipt , 2 Check, 3 Journal Voucher, 4 Parts invoice, 5 Payable Invoice, 6 Recurring Entry, 7 Repair Order Invoice, 8 Vehicle Purchase Invoice, 9 Vehicle Sale Invoice, 10 Other, 11 Payroll, 12 Finance Charge, 13 FMLR Invoice, 14 Parts Credit Memo, 15 Manufacturer Document, 16 FMLR Credit Memo
m13Flag: 0, m13Flag: 0,