From fc3ea2bdf8c97d80645ded1c9ec6dcd0ce007f25 Mon Sep 17 00:00:00 2001 From: Dave Richer Date: Tue, 29 Oct 2024 07:37:40 -0700 Subject: [PATCH] release/2024-11-01 - Misc fixes Signed-off-by: Dave Richer --- server/accounting/qb-receivables-lines.js | 2 +- server/accounting/qbxml/qbxml-payables.js | 7 ++++--- server/accounting/qbxml/qbxml-payments.js | 7 +++++-- server/accounting/qbxml/qbxml-receivables.js | 7 +++++-- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/server/accounting/qb-receivables-lines.js b/server/accounting/qb-receivables-lines.js index 8476ce6d4..043dc8e89 100644 --- a/server/accounting/qb-receivables-lines.js +++ b/server/accounting/qb-receivables-lines.js @@ -63,7 +63,7 @@ exports.default = function ({ bodyshop, jobs_by_pk, qbo = false, items, taxCodes ); if (!account) { - logger.log("qbxml-receivables-no-account", "warn", null, jobline.id, null); + logger.log("qbxml-receivables-no-account", "warn", null, jobline.id); throw new Error( `A matching account does not exist for the part allocation. Center: ${jobline.profitcenter_part}` ); diff --git a/server/accounting/qbxml/qbxml-payables.js b/server/accounting/qbxml/qbxml-payables.js index 9ffe4513f..ef588e0fb 100644 --- a/server/accounting/qbxml/qbxml-payables.js +++ b/server/accounting/qbxml/qbxml-payables.js @@ -42,9 +42,10 @@ exports.default = async (req, res) => { //For each invoice. res.status(200).json(QbXmlToExecute); } catch (error) { - logger.log("qbxml-payable-error", "ERROR", req.user.email, req.body.billsToQuery, { - error: error.message, - stack: error.stack + logger.log("qbxml-payable-error", "ERROR", req?.user?.email, null, { + billsToQuery: req?.body?.billsToQuery, + error: error?.message, + stack: error?.stack }); res.status(400).send(JSON.stringify(error)); } diff --git a/server/accounting/qbxml/qbxml-payments.js b/server/accounting/qbxml/qbxml-payments.js index cdc08d2e4..68e7b8778 100644 --- a/server/accounting/qbxml/qbxml-payments.js +++ b/server/accounting/qbxml/qbxml-payments.js @@ -21,7 +21,9 @@ exports.default = async (req, res) => { const client = req.userGraphQLClient; try { - logger.log("qbxml-payments-create", "DEBUG", req.user.email, req.body.paymentsToQuery, null); + logger.log("qbxml-payments-create", "DEBUG", req?.user?.email, null, { + paymentsToQuery: req.body?.paymentsToQuery + }); const result = await client.setHeaders({ Authorization: BearerToken }).request(queries.QUERY_PAYMENTS_FOR_EXPORT, { payments: paymentsToQuery @@ -62,7 +64,8 @@ exports.default = async (req, res) => { res.status(200).json(QbXmlToExecute); } catch (error) { - logger.log("qbxml-payments-error", "error", req.user.email, req.body.paymentsToQuery, { + logger.log("qbxml-payments-error", "error", req?.user?.email, null, { + paymentsToQuery: req.body?.paymentsToQuery, error: error.message, stack: error.stack }); diff --git a/server/accounting/qbxml/qbxml-receivables.js b/server/accounting/qbxml/qbxml-receivables.js index 0e8a4f20d..c4353704e 100644 --- a/server/accounting/qbxml/qbxml-receivables.js +++ b/server/accounting/qbxml/qbxml-receivables.js @@ -23,7 +23,9 @@ exports.default = async (req, res) => { const client = req.userGraphQLClient; try { - logger.log("qbxml-receivables-create", "DEBUG", req.user.email, req.body.jobIds, null); + logger.log("qbxml-receivables-create", "DEBUG", req?.user?.email, null, { + jobIds: req?.body?.jobIds + }); const result = await client .setHeaders({ Authorization: BearerToken }) @@ -74,7 +76,8 @@ exports.default = async (req, res) => { res.status(200).json(QbXmlToExecute); } catch (error) { - logger.log("qbxml-receivables-error", "error", req.user.email, req.body.jobIds, { + logger.log("qbxml-receivables-error", "error", req?.user?.email, null, { + jobIds: req.body?.jobIds, error: error.message, stack: error.stack });