Add and remove logging.
This commit is contained in:
@@ -68,7 +68,7 @@ exports.default = async function (socket, { txEnvelope, jobid }) {
|
||||
|
||||
exports.PbsSelectedCustomer = async function PbsSelectedCustomer(socket, selectedCustomerId) {
|
||||
try {
|
||||
if (socket.JobData.bodyshop.pbs_configuration.disablecontactvehicle === false) {
|
||||
if (socket.JobData.bodyshop.pbs_configuration.disablecontactvehicle !== true) {
|
||||
CdkBase.createLogEvent(socket, "INFO", `User selected customer ${selectedCustomerId || "NEW"}`);
|
||||
|
||||
//Upsert the contact information as per Wafaa's Email.
|
||||
@@ -90,19 +90,15 @@ exports.PbsSelectedCustomer = async function PbsSelectedCustomer(socket, selecte
|
||||
`Contact and Vehicle updates disabled. Skipping to accounting data insert.`
|
||||
);
|
||||
}
|
||||
CdkBase.createLogEvent(socket, "INFO", `Inserting account data.`);
|
||||
CdkBase.createLogEvent(socket, "INFO", `Inserting accounting posting data..`);
|
||||
const insertResponse = await InsertAccountPostingData(socket);
|
||||
|
||||
if (insertResponse.WasSuccessful) {
|
||||
CdkBase.createLogEvent(socket, "INFO", `Marking job as exported.`);
|
||||
await MarkJobExported(socket, socket.JobData.id);
|
||||
|
||||
//If export succesful, check to see if an RO exists.
|
||||
//If it does, update necessary elements, otherwise create it.
|
||||
// if (socket.jobData.bodyshop.pbs_configuration.ro_posting) { //TODO: Create `ro_posting` field on
|
||||
await CreateRepairOrderInPBS(socket, socket.ownerRef, socket.vehicleRef)
|
||||
// }
|
||||
if (socket.jobData.bodyshop.pbs_configuration.ro_posting) {
|
||||
await CreateRepairOrderInPBS(socket, socket.ownerRef, socket.vehicleRef)
|
||||
}
|
||||
socket.emit("export-success", socket.JobData.id);
|
||||
} else {
|
||||
CdkBase.createLogEvent(socket, "ERROR", `Export was not successful.`);
|
||||
@@ -630,11 +626,13 @@ async function CreateRepairOrderInPBS(socket) {
|
||||
if (RepairOrders.length === 0) {
|
||||
const InsertedRepairOrder = await RepairOrderChange(socket)
|
||||
socket.InsertedRepairOrder = InsertedRepairOrder;
|
||||
CdkBase.createLogEvent(socket, "INFO", `No repair orders found for vehicle. Inserting record.`);
|
||||
|
||||
} else if (RepairOrders.length > 0) {
|
||||
//Find out if it's a matching RO.
|
||||
const matchingRo = RepairOrders.find(ro => ro.Memo?.toLowerCase()?.includes(socket.JobData.ro_number.toLowerCase()))
|
||||
if (!matchingRo) {
|
||||
CdkBase.createLogEvent(socket, "INFO", `ROs found for customer, but none match. Inserting record.`);
|
||||
CdkBase.createLogEvent(socket, "INFO", `ROs found for vehicle, but none match. Inserting record.`);
|
||||
const InsertedRepairOrder = await RepairOrderChange(socket)
|
||||
socket.InsertedRepairOrder = InsertedRepairOrder;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user