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) { } catch (error) {
//Error at the shop level. //Error at the shop level.
logger.log("autohouse-error-shop", "ERROR", "api", bodyshop.id, { logger.log("autohouse-error-shop", "ERROR", "api", bodyshop.id, {
error, ...error,
}); });
allErrors.push({ allErrors.push({
@@ -135,7 +135,7 @@ exports.default = async (req, res) => {
let sftp = new Client(); let sftp = new Client();
sftp.on("error", (errors) => sftp.on("error", (errors) =>
logger.log("autohouse-sftp-error", "ERROR", "api", null, { logger.log("autohouse-sftp-error", "ERROR", "api", null, {
errors, ...errors,
}) })
); );
try { try {
@@ -160,7 +160,7 @@ exports.default = async (req, res) => {
//***TODO Change filing naming when creating the cron job. IM_ShopInternalName_DDMMYYYY_HHMMSS.xml //***TODO Change filing naming when creating the cron job. IM_ShopInternalName_DDMMYYYY_HHMMSS.xml
} catch (error) { } catch (error) {
logger.log("autohouse-sftp-error", "ERROR", "api", null, { logger.log("autohouse-sftp-error", "ERROR", "api", null, {
error, ...error,
}); });
} finally { } finally {
sftp.end(); sftp.end();
@@ -185,7 +185,11 @@ const CreateRepairOrderTag = (job, errorCallback) => {
//Level 2 //Level 2
if (!job.job_totals) { 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 {}; return {};
} }
@@ -658,7 +662,7 @@ const CreateRepairOrderTag = (job, errorCallback) => {
error, error,
}); });
errorCallback({ job, error }); errorCallback({ jobid: jobid, ro_number: job.ro_number, error });
} }
}; };
@@ -889,7 +893,9 @@ const GenerateDetailLines = (job, line, statuses) => {
OriginalCost: null, OriginalCost: null,
OriginalInvoiceNumber: null, OriginalInvoiceNumber: null,
PriceEach: line.act_price || 0, 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, ProfitPercent: null,
PurchaseOrderNumber: null, PurchaseOrderNumber: null,
Qty: line.part_qty || 0, Qty: line.part_qty || 0,