From 0b523efa953de4316828c8dc775e15a245966dd7 Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Wed, 11 Aug 2021 07:58:01 -0700
Subject: [PATCH 1/8] IO-1304 Resolve ins co nm update on import.
---
.../jobs-available-table.container.jsx | 26 +++++--------------
1 file changed, 6 insertions(+), 20 deletions(-)
diff --git a/client/src/components/jobs-available-table/jobs-available-table.container.jsx b/client/src/components/jobs-available-table/jobs-available-table.container.jsx
index ae3accf53..01bf3203e 100644
--- a/client/src/components/jobs-available-table/jobs-available-table.container.jsx
+++ b/client/src/components/jobs-available-table/jobs-available-table.container.jsx
@@ -90,13 +90,7 @@ export function JobsAvailableContainer({
const estData = replaceEmpty(estDataRaw.data.available_jobs_by_pk);
- if (
- !(
-
- estData &&
- estData.est_data
- )
- ) {
+ if (!(estData && estData.est_data)) {
//We don't have the right data. Error!
setInsertLoading(false);
notification["error"]({
@@ -115,10 +109,7 @@ export function JobsAvailableContainer({
).data;
let existingVehicles;
- if (
- estData.est_data.vehicle &&
- estData.est_data.vin
- ) {
+ if (estData.est_data.vehicle && estData.est_data.vin) {
//There's vehicle data, need to double check the VIN.
existingVehicles = await client.query({
query: SEARCH_VEHICLE_BY_VIN,
@@ -197,13 +188,7 @@ export function JobsAvailableContainer({
setJobModalVisible(false);
setInsertLoading(true);
const estData = replaceEmpty(estDataRaw.data.available_jobs_by_pk);
- if (
- !(
-
- estData &&
- estData.est_data
- )
- ) {
+ if (!(estData && estData.est_data)) {
//We don't have the right data. Error!
setInsertLoading(false);
notification["error"]({
@@ -215,7 +200,8 @@ export function JobsAvailableContainer({
delete supp.owner;
delete supp.vehicle;
- if (importOptions.overrideHeaders) {
+ delete supp.ins_co_nm;
+ if (!importOptions.overrideHeaders) {
HeaderFields.forEach((item) => delete supp[item]);
}
@@ -396,7 +382,7 @@ export default connect(
function replaceEmpty(someObj, replaceValue = null) {
const replacer = (key, value) => (value === "" ? replaceValue : value);
//^ because you seem to want to replace (strings) "null" or "undefined" too
- console.log(someObj)
+ console.log(someObj);
const temp = JSON.stringify(someObj, replacer);
console.log(`temp`, temp);
return JSON.parse(temp);
From 9f7e0d611a7bc7165ac7033b6848925c71ac079c Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Wed, 11 Aug 2021 07:59:32 -0700
Subject: [PATCH 2/8] IO-1300 Resolve line desc to lower case error.
---
.../jobs-close-auto-allocate.component.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx b/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx
index df988d465..3f2a5222f 100644
--- a/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx
+++ b/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx
@@ -32,7 +32,7 @@ export function JobsCloseAutoAllocate({ bodyshop, joblines, form, disabled }) {
}
//Verify that this is also manually updated in server/job-costing
if (!jl.part_type && !jl.mod_lbr_ty) {
- const lineDesc = jl.line_desc.toLowerCase();
+ const lineDesc = jl.line_desc && jl.line_desc.toLowerCase();
if (lineDesc.includes("shop materials")) {
ret.profitcenter_part = defaults.profits["MASH"];
} else if (lineDesc.includes("paint/materials")) {
From e86160e530f02fb965f03be5d32fc7560b9b194e Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Wed, 11 Aug 2021 08:06:51 -0700
Subject: [PATCH 3/8] IO-1307 Resolve table check error on export tables.
---
.../accounting-payables-table.component.jsx | 1 +
.../accounting-payments-table.component.jsx | 1 +
.../accounting-receivables-table.component.jsx | 1 +
.../jobs-close-export-button.component.jsx | 6 ++++++
.../payable-export-button.component.jsx | 6 ++++++
.../payment-export-button.component.jsx | 7 +++++++
6 files changed, 22 insertions(+)
diff --git a/client/src/components/accounting-payables-table/accounting-payables-table.component.jsx b/client/src/components/accounting-payables-table/accounting-payables-table.component.jsx
index 097c66bb4..c28c95ca1 100644
--- a/client/src/components/accounting-payables-table/accounting-payables-table.component.jsx
+++ b/client/src/components/accounting-payables-table/accounting-payables-table.component.jsx
@@ -121,6 +121,7 @@ export default function AccountingPayablesTableComponent({ loading, bills }) {
billId={record.id}
disabled={transInProgress || !!record.exported}
loadingCallback={setTransInProgress}
+ setSelectedBills={setSelectedBills}
/>
),
diff --git a/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx b/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx
index 94ca9e50b..be98297b6 100644
--- a/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx
+++ b/client/src/components/accounting-payments-table/accounting-payments-table.component.jsx
@@ -120,6 +120,7 @@ export default function AccountingPayablesTableComponent({
paymentId={record.id}
disabled={transInProgress || !!record.exportedat}
loadingCallback={setTransInProgress}
+ setSelectedPayments={setSelectedPayments}
/>
),
},
diff --git a/client/src/components/accounting-receivables-table/accounting-receivables-table.component.jsx b/client/src/components/accounting-receivables-table/accounting-receivables-table.component.jsx
index 6f3a2dce3..5492e83ec 100644
--- a/client/src/components/accounting-receivables-table/accounting-receivables-table.component.jsx
+++ b/client/src/components/accounting-receivables-table/accounting-receivables-table.component.jsx
@@ -125,6 +125,7 @@ export default function AccountingReceivablesTableComponent({ loading, jobs }) {
diff --git a/client/src/components/jobs-close-export-button/jobs-close-export-button.component.jsx b/client/src/components/jobs-close-export-button/jobs-close-export-button.component.jsx
index b6e2006f8..d790328ff 100644
--- a/client/src/components/jobs-close-export-button/jobs-close-export-button.component.jsx
+++ b/client/src/components/jobs-close-export-button/jobs-close-export-button.component.jsx
@@ -24,6 +24,7 @@ export function JobsCloseExportButton({
currentUser,
jobId,
disabled,
+ setSelectedJobs,
}) {
const { t } = useTranslation();
const [updateJob] = useMutation(UPDATE_JOB);
@@ -147,6 +148,11 @@ export function JobsCloseExportButton({
}),
});
}
+ if (setSelectedJobs) {
+ setSelectedJobs((selectedJobs) => {
+ return selectedJobs.filter((i) => i.id !== jobId);
+ });
+ }
}
setLoading(false);
diff --git a/client/src/components/payable-export-button/payable-export-button.component.jsx b/client/src/components/payable-export-button/payable-export-button.component.jsx
index bdeaa4455..a25361256 100644
--- a/client/src/components/payable-export-button/payable-export-button.component.jsx
+++ b/client/src/components/payable-export-button/payable-export-button.component.jsx
@@ -25,6 +25,7 @@ export function PayableExportButton({
billId,
disabled,
loadingCallback,
+ setSelectedBills,
}) {
const { t } = useTranslation();
const [updateBill] = useMutation(UPDATE_BILLS);
@@ -142,6 +143,11 @@ export function PayableExportButton({
}),
});
}
+ if (setSelectedBills) {
+ setSelectedBills((selectedBills) => {
+ return selectedBills.filter((i) => i.id !== billId);
+ });
+ }
}
if (!!loadingCallback) loadingCallback(false);
diff --git a/client/src/components/payment-export-button/payment-export-button.component.jsx b/client/src/components/payment-export-button/payment-export-button.component.jsx
index 3c0254180..f05c839d2 100644
--- a/client/src/components/payment-export-button/payment-export-button.component.jsx
+++ b/client/src/components/payment-export-button/payment-export-button.component.jsx
@@ -24,6 +24,7 @@ export function PaymentExportButton({
paymentId,
disabled,
loadingCallback,
+ setSelectedPayments,
}) {
const { t } = useTranslation();
const [updatePayment] = useMutation(UPDATE_PAYMENTS);
@@ -141,6 +142,12 @@ export function PaymentExportButton({
}),
});
}
+
+ if (setSelectedPayments) {
+ setSelectedPayments((selectedBills) => {
+ return selectedBills.filter((i) => i.id !== paymentId);
+ });
+ }
}
if (!!loadingCallback) loadingCallback(false);
From fe5f4f27276c31730db141625d5ce6f2a86b6050 Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Wed, 11 Aug 2021 11:09:16 -0700
Subject: [PATCH 4/8] IO-1300 Resolve null line desc.
---
.../jobs-close-auto-allocate.component.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx b/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx
index 3f2a5222f..ff22bc70d 100644
--- a/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx
+++ b/client/src/components/jobs-close-auto-allocate/jobs-close-auto-allocate.component.jsx
@@ -32,7 +32,7 @@ export function JobsCloseAutoAllocate({ bodyshop, joblines, form, disabled }) {
}
//Verify that this is also manually updated in server/job-costing
if (!jl.part_type && !jl.mod_lbr_ty) {
- const lineDesc = jl.line_desc && jl.line_desc.toLowerCase();
+ const lineDesc = jl.line_desc ? jl.line_desc.toLowerCase() : "";
if (lineDesc.includes("shop materials")) {
ret.profitcenter_part = defaults.profits["MASH"];
} else if (lineDesc.includes("paint/materials")) {
From 18618efdc093ab030ee1d9d296647499af6ea86a Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Wed, 11 Aug 2021 11:16:22 -0700
Subject: [PATCH 5/8] Include sentry username
---
client/src/redux/user/user.sagas.js | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/client/src/redux/user/user.sagas.js b/client/src/redux/user/user.sagas.js
index de5d00c9b..598be0e24 100644
--- a/client/src/redux/user/user.sagas.js
+++ b/client/src/redux/user/user.sagas.js
@@ -28,6 +28,7 @@ import {
validatePasswordResetSuccess,
} from "./user.actions";
import UserActionTypes from "./user.types";
+import * as Sentry from "@sentry/browser";
export function* onEmailSignInStart() {
yield takeLatest(UserActionTypes.EMAIL_SIGN_IN_START, signInWithEmail);
@@ -178,6 +179,11 @@ export function* signInSuccessSaga({ payload }) {
]);
console.log("Setting $crisp segments", ["user"]);
window.$crisp.push(["set", "session:segments", [["user"]]]);
+
+ Sentry.setUser({
+ email: payload.email,
+ username: payload.displayName || payload.email,
+ });
} catch (error) {
console.log("Error updating Crisp settings.", error);
}
From b37970a6df88062fbd5e2a98a7ed7af063c5e185 Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Wed, 11 Aug 2021 13:50:37 -0700
Subject: [PATCH 6/8] IO-1300 Line Desc Null for Job costing
---
server/job/job-costing.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/server/job/job-costing.js b/server/job/job-costing.js
index e9de9b5ff..dfd547175 100644
--- a/server/job/job-costing.js
+++ b/server/job/job-costing.js
@@ -605,7 +605,7 @@ const formatGpPercent = (gppercent) => {
const getAdditionalCostCenter = (jl, profitCenters) => {
console.log("Checking additional cost center", jl.line_desc);
if (!jl.part_type && !jl.mod_lbr_ty) {
- const lineDesc = jl.line_desc.toLowerCase();
+ const lineDesc = jl.line_desc ? jl.line_desc.toLowerCase() : "";
//This logic is covered prior and assigned based on the labor type of the lines
// if (lineDesc.includes("shop materials")) {
// return profitCenters["MASH"];
From dd59f3d02638261b80d47b0e35452543bd84f52c Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Thu, 12 Aug 2021 09:46:50 -0700
Subject: [PATCH 7/8] IO-1286 Retry Supplement Importing fix.
---
.../jobs-available-table.container.jsx | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/client/src/components/jobs-available-table/jobs-available-table.container.jsx b/client/src/components/jobs-available-table/jobs-available-table.container.jsx
index 01bf3203e..07f8aa75e 100644
--- a/client/src/components/jobs-available-table/jobs-available-table.container.jsx
+++ b/client/src/components/jobs-available-table/jobs-available-table.container.jsx
@@ -187,7 +187,9 @@ export function JobsAvailableContainer({
setJobModalVisible(false);
setInsertLoading(true);
- const estData = replaceEmpty(estDataRaw.data.available_jobs_by_pk);
+
+ const estData = estDataRaw.data.available_jobs_by_pk;
+
if (!(estData && estData.est_data)) {
//We don't have the right data. Error!
setInsertLoading(false);
@@ -196,7 +198,7 @@ export function JobsAvailableContainer({
});
} else {
//create upsert job
- let supp = _.cloneDeep(estData.est_data);
+ let supp = replaceEmpty({ ...estData.est_data });
delete supp.owner;
delete supp.vehicle;
@@ -208,7 +210,7 @@ export function JobsAvailableContainer({
let suppDelta = await GetSupplementDelta(
client,
selectedJob,
- estData.est_data.joblines.data
+ supp.joblines.data
);
delete supp.joblines;
@@ -380,10 +382,10 @@ export default connect(
)(JobsAvailableContainer);
function replaceEmpty(someObj, replaceValue = null) {
- const replacer = (key, value) => (value === "" ? replaceValue : value);
+ const replacer = (key, value) =>
+ value === "" ? replaceValue || null : value;
//^ because you seem to want to replace (strings) "null" or "undefined" too
- console.log(someObj);
const temp = JSON.stringify(someObj, replacer);
- console.log(`temp`, temp);
+ console.log("Parsed", JSON.parse(temp));
return JSON.parse(temp);
}
From c1d7168260631108cc6fdfdf98eb94d52beeb117 Mon Sep 17 00:00:00 2001
From: Patrick Fic <>
Date: Thu, 12 Aug 2021 09:52:44 -0700
Subject: [PATCH 8/8] Resolve CI issue.
---
.../jobs-available-table/jobs-available-table.container.jsx | 1 -
1 file changed, 1 deletion(-)
diff --git a/client/src/components/jobs-available-table/jobs-available-table.container.jsx b/client/src/components/jobs-available-table/jobs-available-table.container.jsx
index 07f8aa75e..5eef71012 100644
--- a/client/src/components/jobs-available-table/jobs-available-table.container.jsx
+++ b/client/src/components/jobs-available-table/jobs-available-table.container.jsx
@@ -8,7 +8,6 @@ import {
import { Col, notification, Row } from "antd";
import Axios from "axios";
import Dinero from "dinero.js";
-import _ from "lodash";
import moment from "moment";
import queryString from "query-string";
import React, { useCallback, useEffect, useState } from "react";