diff --git a/server/fortellis/fortellis.js b/server/fortellis/fortellis.js index 8f3fbeccb..45ab1b25e 100644 --- a/server/fortellis/fortellis.js +++ b/server/fortellis/fortellis.js @@ -285,7 +285,7 @@ async function FortellisSelectedCustomer({ socket, redisHelpers, selectedCustome //something CreateFortellisLogEvent(socket, "DEBUG", `{6} Successfully posted transaction to DMS.`); - await MarkJobExported({ socket, jobid: JobData.id, JobData }); + await MarkJobExported({ socket, jobid: JobData.id, JobData, redisHelpers }); try { CreateFortellisLogEvent(socket, "DEBUG", `{7} Updating Service Vehicle History.`); @@ -427,8 +427,8 @@ async function QueryDmsCustomerByName({ socket, redisHelpers, JobData }) { ? //? [["firstName", JobData.ownr_co_nm.replace(replaceSpecialRegex, "").toUpperCase()]] // Commented out until we receive direction. [["phone", JobData.ownr_ph1?.replace(replaceSpecialRegex, "")]] : [ - ["firstName", JobData.ownr_fn?.replace(/[^a-zA-Z-]/g, "").toUpperCase()], - ["lastName", JobData.ownr_ln?.replace(/[^a-zA-Z-]/g, "").toUpperCase()] + ["firstName", JobData.ownr_fn?.replace(/[^a-zA-Z0-9-]/g, "").toUpperCase()], + ["lastName", JobData.ownr_ln?.replace(/[^a-zA-Z0-9-]/g, "").toUpperCase()] ]; try { const result = await MakeFortellisCall({ @@ -471,9 +471,9 @@ async function InsertDmsCustomer({ socket, redisHelpers, JobData }) { : { customerName: { //"suffix": "Mr.", - firstName: JobData.ownr_fn && JobData.ownr_fn.replace(/[^a-zA-Z-]/g, "").toUpperCase(), + firstName: JobData.ownr_fn && JobData.ownr_fn.replace(/[^a-zA-Z0-9-]/g, "").toUpperCase(), //"middleName": "", - lastName: JobData.ownr_ln && JobData.ownr_ln.replace(/[^a-zA-Z-]/g, "").toUpperCase() + lastName: JobData.ownr_ln && JobData.ownr_ln.replace(/[^a-zA-Z0-9-]/g, "").toUpperCase() //"title": "", //"nickName": "" } @@ -1295,8 +1295,14 @@ async function DeleteDmsWip({ socket, redisHelpers, JobData }) { } } -async function MarkJobExported({ socket, jobid, JobData }) { +async function MarkJobExported({ socket, jobid, JobData, redisHelpers }) { CreateFortellisLogEvent(socket, "DEBUG", `Marking job as exported for id ${jobid}`); + + const transwips = await redisHelpers.getSessionTransactionData( + socket.id, + getTransactionType(JobData.id), + FortellisCacheEnums.transWips + ); const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {}); const currentToken = @@ -1315,7 +1321,7 @@ async function MarkJobExported({ socket, jobid, JobData }) { jobid: jobid, successful: true, useremail: socket.user.email, - metadata: socket.transWips + metadata: transwips }, bill: { exported: true,