Autohouse replace fix.

This commit is contained in:
Patrick Fic
2022-06-28 08:31:24 -07:00
parent f2e7808fa0
commit 4582c493ee

View File

@@ -107,7 +107,7 @@ exports.default = async (req, res) => {
} catch (error) {
//Error at the shop level.
logger.log("autohouse-error-shop", "ERROR", "api", bodyshop.id, {
error,
...error,
});
allErrors.push({
@@ -135,7 +135,7 @@ exports.default = async (req, res) => {
let sftp = new Client();
sftp.on("error", (errors) =>
logger.log("autohouse-sftp-error", "ERROR", "api", null, {
errors,
...errors,
})
);
try {
@@ -160,7 +160,7 @@ exports.default = async (req, res) => {
//***TODO Change filing naming when creating the cron job. IM_ShopInternalName_DDMMYYYY_HHMMSS.xml
} catch (error) {
logger.log("autohouse-sftp-error", "ERROR", "api", null, {
error,
...error,
});
} finally {
sftp.end();
@@ -185,7 +185,11 @@ const CreateRepairOrderTag = (job, errorCallback) => {
//Level 2
if (!job.job_totals) {
errorCallback({ job, error: { toString: () => "No job totals for RO." } });
errorCallback({
jobid: jobid,
ro_number: job.ro_number,
error: { toString: () => "No job totals for RO." },
});
return {};
}
@@ -658,7 +662,7 @@ const CreateRepairOrderTag = (job, errorCallback) => {
error,
});
errorCallback({ job, error });
errorCallback({ jobid: jobid, ro_number: job.ro_number, error });
}
};
@@ -889,7 +893,9 @@ const GenerateDetailLines = (job, line, statuses) => {
OriginalCost: null,
OriginalInvoiceNumber: null,
PriceEach: line.act_price || 0,
PartNumber: _.escape(line.oem_partno.replace(/[^\x00-\x7F]/g, "")),
PartNumber: line.oem_partno
? line.oem_partno.replace(/[^\x00-\x7F]/g, "")
: "",
ProfitPercent: null,
PurchaseOrderNumber: null,
Qty: line.part_qty || 0,