Merged in release/2022-02-11 (pull request #378)

Release/2022 02 11
This commit is contained in:
Patrick Fic
2022-02-10 22:49:49 +00:00
13 changed files with 104 additions and 49 deletions

View File

@@ -3872,6 +3872,27 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>disablecontactvehiclecreation</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>dms_acctnumber</name>
<definition_loaded>false</definition_loaded>

View File

@@ -93,6 +93,7 @@ function BillEnterModalContainer({
deductedfromlbr,
lbr_adjustment,
location: lineLocation,
part_type,
...restI
} = i;

View File

@@ -6,6 +6,7 @@ import { INSERT_NEW_DOCUMENT } from "../../graphql/documents.queries";
import { axiosAuthInterceptorId } from "../../utils/CleanAxios";
import client from "../../utils/GraphQLClient";
import exifr from "exifr";
import { store } from "../../redux/store";
//Context: currentUserEmail, bodyshop, jobid, invoiceid
@@ -112,7 +113,19 @@ export const uploadToCloudinary = async (
);
if (cloudinaryUploadResponse.status !== 200) {
if (!!onError) onError(cloudinaryUploadResponse.statusText);
if (!!onError) {
onError(cloudinaryUploadResponse.statusText);
}
try {
axios.post("/newlog", {
message: "client-cloudinary-upload-error",
type: "error",
user: store.getState().user.email,
object: cloudinaryUploadResponse,
});
} catch (error) {}
notification["error"]({
message: i18n.t("documents.errors.insert", {
message: cloudinaryUploadResponse.statusText,

View File

@@ -129,6 +129,15 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
>
<Input />
</Form.Item>
{bodyshop.pbs_serialnumber && (
<Form.Item
label={t("bodyshop.fields.dms.disablecontactvehiclecreation")}
valuePropName="checked"
name={["pbs_configuration", "disablecontactvehicle"]}
>
<Switch />
</Form.Item>
)}
</LayoutFormRow>
<LayoutFormRow header={t("bodyshop.labels.dms.cdk.payers")}>
<Form.List name={["cdk_configuration", "payers"]}>

View File

@@ -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",

View File

@@ -246,6 +246,7 @@
"dms": {
"cashierid": "",
"default_journal": "",
"disablecontactvehiclecreation": "",
"dms_acctnumber": "",
"dms_wip_acctnumber": "",
"generic_customer_number": "",

View File

@@ -246,6 +246,7 @@
"dms": {
"cashierid": "",
"default_journal": "",
"disablecontactvehiclecreation": "",
"dms_acctnumber": "",
"dms_wip_acctnumber": "",
"generic_customer_number": "",

View File

@@ -928,6 +928,7 @@
- md_referral_sources
- md_responsibility_centers
- md_ro_statuses
- pbs_configuration
- phone
- prodtargethrs
- production_config

View File

@@ -179,7 +179,10 @@ app.post("/data/arms", data.arms);
var ioevent = require("./server/ioevent/ioevent");
app.post("/ioevent", ioevent.default);
app.post("/newlog", (req, res) => {
const { message, type, user, record, object } = req.body;
logger.log(message, type, user, record, object);
});
var cdkGetMake = require("./server/cdk/cdk-get-makes");
app.post("/cdk/getvehicles", fb.validateFirebaseIdToken, cdkGetMake.default);

View File

@@ -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,

View File

@@ -93,6 +93,7 @@ exports.default = async (req, res) => {
.end({ allowEmptyTags: true });
allxmlsToUpload.push({
count: autoHouseObject.AutoHouseExport.RepairOrder.length,
xml: ret,
filename: `IM_${bodyshop.autohouseid}_${moment().format(
"DDMMYYYY_HHMMSS"
@@ -123,12 +124,12 @@ exports.default = async (req, res) => {
}
}
for (const xmlObj of allxmlsToUpload) {
fs.writeFileSync(`./logs/${xmlObj.filename}`, xmlObj.xml);
}
// for (const xmlObj of allxmlsToUpload) {
// fs.writeFileSync(`./logs/${xmlObj.filename}`, xmlObj.xml);
// }
res.json(allxmlsToUpload);
return;
// res.json(allxmlsToUpload);
// return;
let sftp = new Client();
sftp.on("error", (errors) =>
@@ -227,7 +228,11 @@ const CreateRepairOrderTag = (job, errorCallback) => {
InsuredorClaimantFlag: null,
},
VehicleInformation: {
Year: parseInt(job.v_model_yr.match(/\d/g).join(""), 10) || "",
Year: job.v_model_yr
? parseInt(job.v_model_yr.match(/\d/g))
? parseInt(job.v_model_yr.match(/\d/g).join(""), 10)
: ""
: "",
Make: job.v_make_desc || "",
Model: job.v_model_desc || "",
VIN: job.v_vin || "",
@@ -267,22 +272,14 @@ const CreateRepairOrderTag = (job, errorCallback) => {
},
Dates: {
DateofLoss:
(job.loss_date &&
moment(job.loss_date)
.tz(job.bodyshop.timezone)
.format(AhDateFormat)) ||
"",
(job.loss_date && moment(job.loss_date).format(AhDateFormat)) || "",
InitialCustomerContactDate: null,
FirstFollowUpDate: null,
ReferralDate: null,
EstimateAppointmentDate: null,
SecondFollowUpDate: null,
AssignedDate:
(job.asgn_date &&
moment(job.asgn_date)
.tz(job.bodyshop.timezone)
.format(AhDateFormat)) ||
"",
(job.asgn_date && moment(job.asgn_date).format(AhDateFormat)) || "",
EstComplete: null,
CustomerAuthorizationDate: null,
InsuranceAuthorizationDate: null,
@@ -808,9 +805,9 @@ const GenerateDetailLines = (job, line, statuses) => {
MarkUp: null,
OrderedOn:
(line.parts_order_lines[0] &&
moment(line.parts_order_lines[0].parts_order.order_date)
.tz(job.bodyshop.timezone)
.format(AhDateFormat)) ||
moment(line.parts_order_lines[0].parts_order.order_date).format(
AhDateFormat
)) ||
"",
OriginalCost: null,
OriginalInvoiceNumber: null,
@@ -830,9 +827,7 @@ const GenerateDetailLines = (job, line, statuses) => {
ExpectedOn: null,
ReceivedOn:
line.billlines[0] &&
moment(line.billlines[0].bill.date)
.tz(job.bodyshop.timezone)
.format(AhDateFormat),
moment(line.billlines[0].bill.date).format(AhDateFormat),
OrderedBy: null,
ShipVia: null,
VendorContact: null,

View File

@@ -581,7 +581,6 @@ exports.AUTOHOUSE_QUERY = `query AUTOHOUSE_EXPORT($start: timestamptz, $bodyshop
ownr_st
ownr_ph1
ownr_zip
referral_source
loss_type
v_model_yr
v_model_desc

View File

@@ -148,14 +148,14 @@ exports.job = async (req, res) => {
//Propagate the expected load to each day.
const yesterday = moment().tz(timezone).subtract(1, "day");
const today = moment().tz(timezone).startOf("day");
const today = moment().tz(timezone);
const end = moment.tz(timezone).max([
const end = moment.max([
...filteredArrJobs.map((a) => moment(a.scheduled_in).tz(timezone)),
...filteredCompJobs
.map((p) => moment(p.actual_completion || p.scheduled_completion).tz(timezone))
.filter((p) => p.isValid() && p.isAfter(yesterday)),
moment().tz(timezone).add(5, "days"),
moment().tz(timezone).add(15, "days"),
]);
const range = Math.round(moment.duration(end.diff(today)).asDays());
for (var day = 0; day < range; day++) {
@@ -199,7 +199,7 @@ exports.job = async (req, res) => {
const possibleDates = [];
delete load.productionTotal;
const loadKeys = Object.keys(load).sort((a, b) =>
moment(a).tz(timezone).isAfter(moment(b).tz(timezone)) ? 1 : -1
moment(a).isAfter(moment(b)) ? 1 : -1
);
loadKeys.forEach((loadKey) => {