Merged in feature/IO-2233-CDK-VEHICLE-LICENSE-PLATE (pull request #826)

IO-2233 Check for null and if stripped string is size 0 send null instead

Approved-by: Patrick Fic
This commit is contained in:
Allan Carr
2023-05-31 00:33:20 +00:00
committed by Patrick Fic

View File

@@ -729,9 +729,15 @@ async function InsertDmsVehicle(socket) {
deliveryDate: moment()
// .tz(socket.JobData.bodyshop.timezone)
.format("YYYYMMDD"),
licensePlateNo: String(socket.JobData.plate_no)
.replace(/([^\w]|_)/g, "")
.toUpperCase(),
licensePlateNo:
socket.JobData.plate_no === null
? null
: String(socket.JobData.plate_no).replace(/([^\w]|_)/g, "")
.length === 0
? null
: String(socket.JobData.plate_no)
.replace(/([^\w]|_)/g, "")
.toUpperCase(),
make: socket.txEnvelope.dms_make,
modelAbrev: socket.txEnvelope.dms_model,
modelYear: socket.JobData.v_model_yr,