From bd9c2cd0af2c917c113b85f80e50f97f68ae6534 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Wed, 9 Feb 2022 16:46:32 -0800 Subject: [PATCH] IO-1727 Skip posting contact and vehicle for PBS.. --- bodyshop_translations.babel | 21 ++++++++ ...p-info.responsibilitycenters.component.jsx | 9 ++++ client/src/translations/en_us/common.json | 1 + client/src/translations/es/common.json | 1 + client/src/translations/fr/common.json | 1 + hasura/metadata/tables.yaml | 1 + server/accounting/pbs/pbs-job-export.js | 50 +++++++++++-------- 7 files changed, 64 insertions(+), 20 deletions(-) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 939e5bb18..a77e7e73f 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -3872,6 +3872,27 @@ + + disablecontactvehiclecreation + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + dms_acctnumber false diff --git a/client/src/components/shop-info/shop-info.responsibilitycenters.component.jsx b/client/src/components/shop-info/shop-info.responsibilitycenters.component.jsx index 3b89799f4..3dad78a86 100644 --- a/client/src/components/shop-info/shop-info.responsibilitycenters.component.jsx +++ b/client/src/components/shop-info/shop-info.responsibilitycenters.component.jsx @@ -129,6 +129,15 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) { > + {bodyshop.pbs_serialnumber && ( + + + + )} diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 65de30e1a..4377750a0 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -246,6 +246,7 @@ "dms": { "cashierid": "Cashier ID", "default_journal": "Default Journal", + "disablecontactvehiclecreation": "Disable Contact & Vehicle Updates/Creation", "dms_acctnumber": "DMS Account #", "dms_wip_acctnumber": "DMS W.I.P. Account #", "generic_customer_number": "Generic Customer Number", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 096511350..28bddd12a 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -246,6 +246,7 @@ "dms": { "cashierid": "", "default_journal": "", + "disablecontactvehiclecreation": "", "dms_acctnumber": "", "dms_wip_acctnumber": "", "generic_customer_number": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index c9bd6291b..6fc35a8a7 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -246,6 +246,7 @@ "dms": { "cashierid": "", "default_journal": "", + "disablecontactvehiclecreation": "", "dms_acctnumber": "", "dms_wip_acctnumber": "", "generic_customer_number": "", diff --git a/hasura/metadata/tables.yaml b/hasura/metadata/tables.yaml index 004cdf5a8..fbcd2db79 100644 --- a/hasura/metadata/tables.yaml +++ b/hasura/metadata/tables.yaml @@ -928,6 +928,7 @@ - md_referral_sources - md_responsibility_centers - md_ro_statuses + - pbs_configuration - phone - prodtargethrs - production_config diff --git a/server/accounting/pbs/pbs-job-export.js b/server/accounting/pbs/pbs-job-export.js index e7bdcdb80..f6f83dfb7 100644 --- a/server/accounting/pbs/pbs-job-export.js +++ b/server/accounting/pbs/pbs-job-export.js @@ -103,28 +103,38 @@ exports.PbsSelectedCustomer = async function PbsSelectedCustomer( selectedCustomerId ) { try { - CdkBase.createLogEvent( - socket, - "DEBUG", - `User selected customer ${selectedCustomerId || "NEW"}` - ); + if ( + socket.JobData.bodyshop.pbs_configuration.disablecontactvehicle === false + ) { + CdkBase.createLogEvent( + socket, + "DEBUG", + `User selected customer ${selectedCustomerId || "NEW"}` + ); - //Upsert the contact information as per Wafaa's Email. - CdkBase.createLogEvent( - socket, - "DEBUG", - `Upserting contact information to DMS for ${ - socket.JobData.ownr_fn || "" - } ${socket.JobData.ownr_ln || ""} ${socket.JobData.ownr_co_nm || ""}` - ); - const ownerRef = await UpsertContactData(socket, selectedCustomerId); + //Upsert the contact information as per Wafaa's Email. + CdkBase.createLogEvent( + socket, + "DEBUG", + `Upserting contact information to DMS for ${ + socket.JobData.ownr_fn || "" + } ${socket.JobData.ownr_ln || ""} ${socket.JobData.ownr_co_nm || ""}` + ); + const ownerRef = await UpsertContactData(socket, selectedCustomerId); - CdkBase.createLogEvent( - socket, - "DEBUG", - `Upserting vehicle information to DMS for ${socket.JobData.v_vin}` - ); - await UpsertVehicleData(socket, ownerRef.ReferenceId); + CdkBase.createLogEvent( + socket, + "DEBUG", + `Upserting vehicle information to DMS for ${socket.JobData.v_vin}` + ); + await UpsertVehicleData(socket, ownerRef.ReferenceId); + } else { + CdkBase.createLogEvent( + socket, + "DEBUG", + `Contact and Vehicle updates disabled. Skipping to accounting data insert.` + ); + } CdkBase.createLogEvent(socket, "DEBUG", `Inserting account data.`); CdkBase.createLogEvent( socket,