Merged in release/2022-05-06 (pull request #458)
Add backwards compatibility for log generation.
This commit is contained in:
@@ -48,6 +48,7 @@ export function JobsCloseExportButton({
|
||||
if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) {
|
||||
PartnerResponse = await axios.post(`/qbo/receivables`, {
|
||||
jobIds: [jobId],
|
||||
elgen: true,
|
||||
});
|
||||
} else {
|
||||
//Default is QBD
|
||||
|
||||
@@ -40,6 +40,7 @@ export function JobsExportAllButton({
|
||||
if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) {
|
||||
PartnerResponse = await axios.post(`/qbo/receivables`, {
|
||||
jobIds: jobIds,
|
||||
elgen: true,
|
||||
});
|
||||
} else {
|
||||
let QbXmlResponse;
|
||||
|
||||
@@ -43,6 +43,7 @@ export function PayableExportAll({
|
||||
if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) {
|
||||
PartnerResponse = await axios.post(`/qbo/payables`, {
|
||||
bills: billids,
|
||||
elgen: true,
|
||||
});
|
||||
} else {
|
||||
let QbXmlResponse;
|
||||
|
||||
@@ -44,6 +44,7 @@ export function PayableExportButton({
|
||||
if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) {
|
||||
PartnerResponse = await axios.post(`/qbo/payables`, {
|
||||
bills: [billId],
|
||||
elgen: true,
|
||||
});
|
||||
} else {
|
||||
//Default is QBD
|
||||
|
||||
@@ -41,6 +41,7 @@ export function PaymentExportButton({
|
||||
if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) {
|
||||
PartnerResponse = await axios.post(`/qbo/payments`, {
|
||||
payments: [paymentId],
|
||||
elgen: true,
|
||||
});
|
||||
} else {
|
||||
//Default is QBD
|
||||
|
||||
@@ -39,6 +39,7 @@ export function PaymentsExportAllButton({
|
||||
if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) {
|
||||
PartnerResponse = await axios.post(`/qbo/payments`, {
|
||||
payments: paymentIds,
|
||||
elgen: true,
|
||||
});
|
||||
} else {
|
||||
let QbXmlResponse;
|
||||
|
||||
@@ -45,7 +45,7 @@ exports.default = async (req, res) => {
|
||||
await refreshOauthToken(oauthClient, req);
|
||||
|
||||
const BearerToken = req.headers.authorization;
|
||||
const { bills: billsToQuery } = req.body;
|
||||
const { bills: billsToQuery, elgen } = req.body;
|
||||
//Query Job Info
|
||||
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {
|
||||
headers: {
|
||||
@@ -92,6 +92,7 @@ exports.default = async (req, res) => {
|
||||
);
|
||||
|
||||
// //No error. Mark the job exported & insert export log.
|
||||
if (elgen) {
|
||||
const result = await client
|
||||
.setHeaders({ Authorization: BearerToken })
|
||||
.request(queries.QBO_MARK_BILL_EXPORTED, {
|
||||
@@ -109,6 +110,7 @@ exports.default = async (req, res) => {
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
ret.push({ billid: bill.id, success: true });
|
||||
} catch (error) {
|
||||
@@ -121,6 +123,7 @@ exports.default = async (req, res) => {
|
||||
});
|
||||
|
||||
//Add the export log error.
|
||||
if (elgen) {
|
||||
const result = await client
|
||||
.setHeaders({ Authorization: BearerToken })
|
||||
.request(queries.INSERT_EXPORT_LOG, {
|
||||
@@ -139,6 +142,7 @@ exports.default = async (req, res) => {
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
res.status(200).json(ret);
|
||||
} catch (error) {
|
||||
|
||||
@@ -52,7 +52,7 @@ exports.default = async (req, res) => {
|
||||
await refreshOauthToken(oauthClient, req);
|
||||
|
||||
const BearerToken = req.headers.authorization;
|
||||
const { payments: paymentsToQuery } = req.body;
|
||||
const { payments: paymentsToQuery, elgen } = req.body;
|
||||
//Query Job Info
|
||||
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {
|
||||
headers: {
|
||||
@@ -157,6 +157,7 @@ exports.default = async (req, res) => {
|
||||
}
|
||||
|
||||
// //No error. Mark the payment exported & insert export log.
|
||||
if (elgen) {
|
||||
const result = await client
|
||||
.setHeaders({ Authorization: BearerToken })
|
||||
.request(queries.QBO_MARK_PAYMENT_EXPORTED, {
|
||||
@@ -173,6 +174,7 @@ exports.default = async (req, res) => {
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
ret.push({ paymentid: payment.id, success: true });
|
||||
} catch (error) {
|
||||
@@ -182,6 +184,7 @@ exports.default = async (req, res) => {
|
||||
(error && error.message),
|
||||
});
|
||||
//Add the export log error.
|
||||
if (elgen) {
|
||||
const result = await client
|
||||
.setHeaders({ Authorization: BearerToken })
|
||||
.request(queries.INSERT_EXPORT_LOG, {
|
||||
@@ -198,6 +201,7 @@ exports.default = async (req, res) => {
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
ret.push({
|
||||
paymentid: payment.id,
|
||||
|
||||
@@ -46,7 +46,7 @@ exports.default = async (req, res) => {
|
||||
await refreshOauthToken(oauthClient, req);
|
||||
|
||||
const BearerToken = req.headers.authorization;
|
||||
const { jobIds } = req.body;
|
||||
const { jobIds, elgen } = req.body;
|
||||
//Query Job Info
|
||||
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {
|
||||
headers: {
|
||||
@@ -141,12 +141,14 @@ exports.default = async (req, res) => {
|
||||
);
|
||||
|
||||
// //No error. Mark the job exported & insert export log.
|
||||
if (elgen) {
|
||||
const result = await client
|
||||
.setHeaders({ Authorization: BearerToken })
|
||||
.request(queries.QBO_MARK_JOB_EXPORTED, {
|
||||
jobId: job.id,
|
||||
job: {
|
||||
status: bodyshop.md_ro_statuses.default_exported || "Exported*",
|
||||
status:
|
||||
bodyshop.md_ro_statuses.default_exported || "Exported*",
|
||||
date_exported: moment().tz(bodyshop.timezone),
|
||||
},
|
||||
logs: [
|
||||
@@ -159,6 +161,7 @@ exports.default = async (req, res) => {
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
ret.push({ jobid: job.id, success: true });
|
||||
} catch (error) {
|
||||
ret.push({
|
||||
@@ -169,6 +172,7 @@ exports.default = async (req, res) => {
|
||||
(error && error.message),
|
||||
});
|
||||
//Add the export log error.
|
||||
if (elgen) {
|
||||
const result = await client
|
||||
.setHeaders({ Authorization: BearerToken })
|
||||
.request(queries.INSERT_EXPORT_LOG, {
|
||||
@@ -187,6 +191,7 @@ exports.default = async (req, res) => {
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
res.status(200).json(ret);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user