Merged in release/2021-10-15 (pull request #247)
IO-233 Replace unknown CDK function. Approved-by: Patrick Fic
This commit is contained in:
@@ -15,7 +15,7 @@ const CalcualteAllocations = require("./cdk-calculate-allocations").default;
|
||||
|
||||
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 }) {
|
||||
socket.logEvents = [];
|
||||
@@ -422,7 +422,12 @@ async function QueryDmsCustomerById(socket, JobData, CustomerId) {
|
||||
}
|
||||
|
||||
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(
|
||||
socket,
|
||||
"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.
|
||||
arg2: {
|
||||
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.
|
||||
id: { value: newCustomerNumber },
|
||||
address: {
|
||||
addressLine: socket.JobData.ownr_addr1.replaceAll(
|
||||
replaceSpecialRegex,
|
||||
""
|
||||
),
|
||||
city: socket.JobData.ownr_city.replaceAll(
|
||||
replaceSpecialRegex,
|
||||
""
|
||||
),
|
||||
addressLine:
|
||||
socket.JobData.ownr_addr1 &&
|
||||
socket.JobData.ownr_addr1.replace(replaceSpecialRegex, ""),
|
||||
city: socket.JobData.ownr_city.replace(replaceSpecialRegex, ""),
|
||||
country: null,
|
||||
postalCode:
|
||||
socket.JobData.ownr_zip &&
|
||||
@@ -605,19 +606,16 @@ async function InsertDmsCustomer(socket, newCustomerNumber) {
|
||||
},
|
||||
demographics: null,
|
||||
name1: {
|
||||
companyname: socket.JobData.ownr_co_nm.replaceAll(
|
||||
replaceSpecialRegex,
|
||||
""
|
||||
),
|
||||
firstName: socket.JobData.ownr_fn.replaceAll(
|
||||
replaceSpecialRegex,
|
||||
""
|
||||
),
|
||||
companyname:
|
||||
socket.JobData.ownr_co_nm &&
|
||||
socket.JobData.ownr_co_nm.replace(replaceSpecialRegex, ""),
|
||||
firstName:
|
||||
socket.JobData.ownr_fn &&
|
||||
socket.JobData.ownr_fn.replace(replaceSpecialRegex, ""),
|
||||
fullname: null,
|
||||
lastName: socket.JobData.ownr_ln.replaceAll(
|
||||
replaceSpecialRegex,
|
||||
""
|
||||
),
|
||||
lastName:
|
||||
socket.JobData.ownr_ln &&
|
||||
socket.JobData.ownr_ln.replace(replaceSpecialRegex, ""),
|
||||
middleName: null,
|
||||
nameType: "Person",
|
||||
suffix: null,
|
||||
@@ -886,7 +884,9 @@ async function InsertDmsStartWip(socket) {
|
||||
arg2: {
|
||||
acctgDate: moment().format("YYYY-MM-DD"),
|
||||
//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.
|
||||
//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,
|
||||
|
||||
Reference in New Issue
Block a user