tweak connectedDatabase undefined check
parent
3eb4958f65
commit
7d8a63dfb4
|
|
@ -47,7 +47,7 @@ export function addLotOccupancy(lotOccupancyForm, requestSession, connectedDatab
|
|||
occupantComment: lotOccupancyForm.occupantComment
|
||||
}, requestSession, database);
|
||||
}
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return lotOccupancyId;
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ export function addLotOccupancy(
|
|||
)
|
||||
}
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ export function addLotOccupancyOccupant(lotOccupancyOccupantForm, requestSession
|
|||
recordUpdate_userName, recordUpdate_timeMillis)
|
||||
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
||||
.run(lotOccupancyOccupantForm.lotOccupancyId, lotOccupantIndex, lotOccupancyOccupantForm.occupantName, lotOccupancyOccupantForm.occupantAddress1, lotOccupancyOccupantForm.occupantAddress2, lotOccupancyOccupantForm.occupantCity, lotOccupancyOccupantForm.occupantProvince, lotOccupancyOccupantForm.occupantPostalCode, lotOccupancyOccupantForm.occupantPhoneNumber, lotOccupancyOccupantForm.occupantEmailAddress, lotOccupancyOccupantForm.occupantComment ?? '', lotOccupancyOccupantForm.lotOccupantTypeId, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return lotOccupantIndex;
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ export function addLotOccupancyOccupant(
|
|||
rightNowMillis
|
||||
)
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ export function addOrUpdateLotField(lotFieldForm, requestSession, connectedDatab
|
|||
values (?, ?, ?, ?, ?, ?, ?)`)
|
||||
.run(lotFieldForm.lotId, lotFieldForm.lotTypeFieldId, lotFieldForm.lotFieldValue, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
|
||||
}
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return result.changes > 0;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ export function addOrUpdateLotField(
|
|||
)
|
||||
}
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ export function addOrUpdateLotOccupancyField(lotOccupancyFieldForm, requestSessi
|
|||
values (?, ?, ?, ?, ?, ?, ?)`)
|
||||
.run(lotOccupancyFieldForm.lotOccupancyId, lotOccupancyFieldForm.occupancyTypeFieldId, lotOccupancyFieldForm.lotOccupancyFieldValue, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
|
||||
}
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return result.changes > 0;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ export function addOrUpdateLotOccupancyField(
|
|||
)
|
||||
}
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export function addWorkOrderLotOccupancy(workOrderLotOccupancyForm, requestSessi
|
|||
values (?, ?, ?, ?, ?, ?)`)
|
||||
.run(workOrderLotOccupancyForm.workOrderId, workOrderLotOccupancyForm.lotOccupancyId, requestSession.user.userName, rightNowMillis, requestSession.user.userName, rightNowMillis);
|
||||
}
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ export function addWorkOrderLotOccupancy(
|
|||
)
|
||||
}
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export function deleteLotField(lotId, lotTypeFieldId, requestSession, connectedD
|
|||
where lotId = ?
|
||||
and lotTypeFieldId = ?`)
|
||||
.run(requestSession.user.userName, rightNowMillis, lotId, lotTypeFieldId);
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return result.changes > 0;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ export function deleteLotField(
|
|||
)
|
||||
.run(requestSession.user!.userName, rightNowMillis, lotId, lotTypeFieldId)
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export function deleteLotOccupancyField(lotOccupancyId, occupancyTypeFieldId, re
|
|||
where lotOccupancyId = ?
|
||||
and occupancyTypeFieldId = ?`)
|
||||
.run(requestSession.user.userName, rightNowMillis, lotOccupancyId, occupancyTypeFieldId);
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return result.changes > 0;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export function deleteLotOccupancyField(
|
|||
occupancyTypeFieldId
|
||||
)
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ export function getFee(feeId, connectedDatabase) {
|
|||
where f.recordDelete_timeMillis is null
|
||||
and f.feeId = ?`)
|
||||
.get(feeId);
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return fee;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ export function getFee(
|
|||
)
|
||||
.get(feeId)
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ export function getFees(feeCategoryId, additionalFilters, connectedDatabase) {
|
|||
expectedOrderNumber += 1;
|
||||
}
|
||||
}
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return fees;
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ export function getFees(
|
|||
}
|
||||
}
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export function getLotComments(lotId, connectedDatabase) {
|
|||
and lotId = ?
|
||||
order by lotCommentDate desc, lotCommentTime desc, lotCommentId desc`)
|
||||
.all(lotId);
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return lotComments;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ export function getLotComments(
|
|||
)
|
||||
.all(lotId)
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export function getLotFields(lotId, connectedDatabase) {
|
|||
and f.lotTypeFieldId not in (select lotTypeFieldId from LotFields where lotId = ? and recordDelete_timeMillis is null)
|
||||
order by lotTypeOrderNumber, f.orderNumber, f.lotTypeField`)
|
||||
.all(lotId, lotId, lotId, lotId);
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return lotFields;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ export function getLotFields(
|
|||
)
|
||||
.all(lotId, lotId, lotId, lotId)
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ export function getLotOccupancies(filters, options, connectedDatabase) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ export function getLotOccupancies(
|
|||
}
|
||||
}
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ export function getLotOccupancy(lotOccupancyId, connectedDatabase) {
|
|||
offset: 0
|
||||
}, database).workOrders;
|
||||
}
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return lotOccupancy;
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ export function getLotOccupancy(
|
|||
).workOrders
|
||||
}
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export function getLotOccupancyComments(lotOccupancyId, connectedDatabase) {
|
|||
and lotOccupancyId = ?
|
||||
order by lotOccupancyCommentDate desc, lotOccupancyCommentTime desc, lotOccupancyCommentId desc`)
|
||||
.all(lotOccupancyId);
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === null) {
|
||||
database.close();
|
||||
}
|
||||
return lotComments;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ export function getLotOccupancyComments(
|
|||
)
|
||||
.all(lotOccupancyId)
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === null) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ export function getLotOccupancyFees(lotOccupancyId, connectedDatabase) {
|
|||
and o.lotOccupancyId = ?
|
||||
order by o.recordCreate_timeMillis`)
|
||||
.all(lotOccupancyId);
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return lotOccupancyFees;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ export function getLotOccupancyFees(
|
|||
)
|
||||
.all(lotOccupancyId)
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ export function getLotOccupancyFields(lotOccupancyId, connectedDatabase) {
|
|||
and f.occupancyTypeFieldId not in (select occupancyTypeFieldId from LotOccupancyFields where lotOccupancyId = ? and recordDelete_timeMillis is null)
|
||||
order by occupancyTypeOrderNumber, f.orderNumber, f.occupancyTypeField`)
|
||||
.all(lotOccupancyId, lotOccupancyId, lotOccupancyId, lotOccupancyId);
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return lotOccupancyFields;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ export function getLotOccupancyFields(
|
|||
)
|
||||
.all(lotOccupancyId, lotOccupancyId, lotOccupancyId, lotOccupancyId)
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export function getLotOccupancyOccupants(lotOccupancyId, connectedDatabase) {
|
|||
and o.lotOccupancyId = ?
|
||||
order by t.orderNumber, t.lotOccupantType, o.occupantName, o.lotOccupantIndex`)
|
||||
.all(lotOccupancyId);
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return lotOccupancyOccupants;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ export function getLotOccupancyOccupants(
|
|||
)
|
||||
.all(lotOccupancyId)
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export function getLotOccupancyTransactions(lotOccupancyId, connectedDatabase) {
|
|||
and lotOccupancyId = ?
|
||||
order by transactionDate, transactionTime, transactionIndex`)
|
||||
.all(lotOccupancyId);
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return lotOccupancyTransactions;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ export function getLotOccupancyTransactions(
|
|||
)
|
||||
.all(lotOccupancyId)
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export function getLotTypeFields(lotTypeId, connectedDatabase) {
|
|||
}
|
||||
expectedOrderNumber += 1;
|
||||
}
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return lotTypeFields;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ export function getLotTypeFields(
|
|||
expectedOrderNumber += 1
|
||||
}
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ export function getLots(filters, options, connectedDatabase) {
|
|||
count = lots.length;
|
||||
}
|
||||
}
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ export function getLots(
|
|||
}
|
||||
}
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ export function getNextWorkOrderNumber(connectedDatabase) {
|
|||
' where userFn_matchesWorkOrderNumberSyntax(workOrderNumber) = 1' +
|
||||
" order by cast(substr(workOrderNumber, instr(workOrderNumber, '-') + 1) as integer) desc")
|
||||
.get();
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
let workOrderNumberIndex = 0;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ export function getNextWorkOrderNumber(
|
|||
)
|
||||
.get()
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ export function getOccupancyTypeFields(occupancyTypeId, connectedDatabase) {
|
|||
}
|
||||
expectedOrderNumber += 1;
|
||||
}
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return occupancyTypeFields;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ export function getOccupancyTypeFields(
|
|||
expectedOrderNumber += 1
|
||||
}
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export function getOccupancyTypePrints(occupancyTypeId, connectedDatabase) {
|
|||
}
|
||||
prints.push(result.printEJS);
|
||||
}
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return prints;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ export function getOccupancyTypePrints(
|
|||
prints.push(result.printEJS)
|
||||
}
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ function _getWorkOrder(sql, workOrderIdOrWorkOrderNumber, options, connectedData
|
|||
}, database);
|
||||
}
|
||||
}
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return workOrder;
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ function _getWorkOrder(
|
|||
}
|
||||
}
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export function getWorkOrderComments(workOrderId, connectedDatabase) {
|
|||
and workOrderId = ?
|
||||
order by workOrderCommentDate desc, workOrderCommentTime desc, workOrderCommentId desc`)
|
||||
.all(workOrderId);
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return workOrderComments;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ export function getWorkOrderComments(
|
|||
)
|
||||
.all(workOrderId)
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ export function getWorkOrderMilestones(filters, options, connectedDatabase) {
|
|||
}, database).lotOccupancies;
|
||||
}
|
||||
}
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return workOrderMilestones;
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ export function getWorkOrderMilestones(
|
|||
}
|
||||
}
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ export function getWorkOrders(filters, options, connectedDatabase) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close();
|
||||
}
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ export function getWorkOrders(
|
|||
}
|
||||
}
|
||||
|
||||
if (!connectedDatabase) {
|
||||
if (connectedDatabase === undefined) {
|
||||
database.close()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue