Fix subtotal/itemCount null handling in history API

Use val() instead of ?: for SUM results that may be empty strings

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
John Mizerek 2026-01-23 21:59:33 -08:00
parent e9eb708de1
commit 405914c586

View file

@ -109,8 +109,8 @@ try {
AND (OrderLineItemIsDeleted = 0 OR OrderLineItemIsDeleted IS NULL)
", { orderId: { value = row.OrderID, cfsqltype = "cf_sql_integer" } });
itemCount = qItems.ItemCount ?: 0;
subtotal = qItems.Subtotal ?: 0;
itemCount = val(qItems.ItemCount);
subtotal = val(qItems.Subtotal);
tax = subtotal * 0.0875;
total = subtotal + tax;