IO-1841 Remove special characters on QB Export.

This commit is contained in:
Patrick Fic
2022-06-06 12:20:32 -07:00
parent fd8dab911f
commit a0b238c4bb
3 changed files with 12 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
import { Card, Col, Row, Space, Statistic, Table, Typography } from "antd"; import { Card, Col, Row, Statistic, Table, Typography } from "antd";
import React from "react"; import React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { connect } from "react-redux"; import { connect } from "react-redux";

View File

@@ -211,7 +211,7 @@ async function QueryInsuranceCo(oauthClient, qbo_realmId, req, job) {
qbo_realmId, qbo_realmId,
"query", "query",
`select * From Customer where DisplayName = '${StandardizeName( `select * From Customer where DisplayName = '${StandardizeName(
job.ins_co_nm job.ins_co_nm.trim()
)}'` )}'`
), ),
method: "POST", method: "POST",
@@ -239,7 +239,7 @@ async function InsertInsuranceCo(oauthClient, qbo_realmId, req, job, bodyshop) {
const insCo = bodyshop.md_ins_cos.find((i) => i.name === job.ins_co_nm); const insCo = bodyshop.md_ins_cos.find((i) => i.name === job.ins_co_nm);
const Customer = { const Customer = {
DisplayName: job.ins_co_nm, DisplayName: job.ins_co_nm.trim(),
BillWithParent: true, BillWithParent: true,
BillAddr: { BillAddr: {
City: job.ownr_city, City: job.ownr_city,
@@ -269,6 +269,7 @@ async function InsertInsuranceCo(oauthClient, qbo_realmId, req, job, bodyshop) {
} }
} }
exports.InsertInsuranceCo = InsertInsuranceCo; exports.InsertInsuranceCo = InsertInsuranceCo;
async function QueryOwner(oauthClient, qbo_realmId, req, job) { async function QueryOwner(oauthClient, qbo_realmId, req, job) {
const ownerName = generateOwnerTier(job, true, null); const ownerName = generateOwnerTier(job, true, null);
const result = await oauthClient.makeApiCall({ const result = await oauthClient.makeApiCall({

View File

@@ -6,11 +6,11 @@ exports.addQbxmlHeader = addQbxmlHeader = (xml) => {
}; };
exports.generateSourceTier = (jobs_by_pk) => { exports.generateSourceTier = (jobs_by_pk) => {
return jobs_by_pk.ins_co_nm && jobs_by_pk.ins_co_nm.trim(); return jobs_by_pk.ins_co_nm && jobs_by_pk.ins_co_nm.trim().replace(":", " ");
}; };
exports.generateJobTier = (jobs_by_pk) => { exports.generateJobTier = (jobs_by_pk) => {
return jobs_by_pk.ro_number && jobs_by_pk.ro_number.trim(); return jobs_by_pk.ro_number && jobs_by_pk.ro_number.trim().replace(":", " ");
}; };
exports.generateOwnerTier = (jobs_by_pk, isThreeTier, twotierpref) => { exports.generateOwnerTier = (jobs_by_pk, isThreeTier, twotierpref) => {
@@ -24,7 +24,9 @@ exports.generateOwnerTier = (jobs_by_pk, isThreeTier, twotierpref) => {
: `${`${jobs_by_pk.ownr_ln || ""} ${ : `${`${jobs_by_pk.ownr_ln || ""} ${
jobs_by_pk.ownr_fn || "" jobs_by_pk.ownr_fn || ""
}`.substring(0, 30)} #${jobs_by_pk.owner.accountingid || ""}` }`.substring(0, 30)} #${jobs_by_pk.owner.accountingid || ""}`
).trim(); )
.trim()
.replace(":", " ");
} else { } else {
//What's the 2 tier pref? //What's the 2 tier pref?
if (twotierpref === "source") { if (twotierpref === "source") {
@@ -40,7 +42,9 @@ exports.generateOwnerTier = (jobs_by_pk, isThreeTier, twotierpref) => {
: `${`${jobs_by_pk.ownr_ln || ""} ${ : `${`${jobs_by_pk.ownr_ln || ""} ${
jobs_by_pk.ownr_fn || "" jobs_by_pk.ownr_fn || ""
}`.substring(0, 30)} #${jobs_by_pk.owner.accountingid || ""}` }`.substring(0, 30)} #${jobs_by_pk.owner.accountingid || ""}`
).trim(); )
.trim()
.replace(":", " ");
} }
} }
}; };