From cc96d891b21f6294630a47bb5d93e5773793a376 Mon Sep 17 00:00:00 2001 From: John Mizerek Date: Wed, 28 Jan 2026 14:58:58 -0800 Subject: [PATCH] Store brand color without # prefix, normalize on output saveBrandColor.cfm no longer prepends # before storing. API responses (get.cfm, items.cfm, getForBuilder.cfm) prepend # if missing so consumers always get a CSS-ready value. Co-Authored-By: Claude Opus 4.5 --- api/businesses/get.cfm | 2 +- api/businesses/saveBrandColor.cfm | 4 ++-- api/menu/getForBuilder.cfm | 2 +- api/menu/items.cfm | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/businesses/get.cfm b/api/businesses/get.cfm index a7380ca..47a0889 100644 --- a/api/businesses/get.cfm +++ b/api/businesses/get.cfm @@ -141,7 +141,7 @@ try { "IsHiring": q.BusinessIsHiring == 1, "TaxRate": taxRate, "TaxRatePercent": taxRate * 100, - "BrandColor": len(q.BusinessBrandColor) ? q.BusinessBrandColor : "" + "BrandColor": len(q.BusinessBrandColor) ? (left(q.BusinessBrandColor, 1) == chr(35) ? q.BusinessBrandColor : chr(35) & q.BusinessBrandColor) : "" }; // Add header image URL if extension exists diff --git a/api/businesses/saveBrandColor.cfm b/api/businesses/saveBrandColor.cfm index 9164c43..e110e8e 100644 --- a/api/businesses/saveBrandColor.cfm +++ b/api/businesses/saveBrandColor.cfm @@ -47,8 +47,8 @@ if (len(brandColor) GT 0) { if (len(brandColor) != 6 || !reFind("^[0-9A-Fa-f]{6}$", brandColor)) { apiAbort({ "OK": false, "ERROR": "invalid_color", "MESSAGE": "Color must be a valid 6-digit hex color (e.g. 1B4D3E or ##1B4D3E)" }); } - // Store with # prefix, uppercase - brandColor = chr(35) & uCase(brandColor); + // Store uppercase, no # prefix + brandColor = uCase(brandColor); } // Update the database diff --git a/api/menu/getForBuilder.cfm b/api/menu/getForBuilder.cfm index 2c93919..0b29468 100644 --- a/api/menu/getForBuilder.cfm +++ b/api/menu/getForBuilder.cfm @@ -411,7 +411,7 @@ try { SELECT BusinessBrandColor FROM Businesses WHERE BusinessID = :bizId ", { bizId: businessID }, { datasource: "payfrit" }); if (qBrand.recordCount > 0 && len(trim(qBrand.BusinessBrandColor))) { - brandColor = qBrand.BusinessBrandColor; + brandColor = left(qBrand.BusinessBrandColor, 1) == chr(35) ? qBrand.BusinessBrandColor : chr(35) & qBrand.BusinessBrandColor; } } catch (any e) { // Column may not exist yet, ignore diff --git a/api/menu/items.cfm b/api/menu/items.cfm index 7ef995f..5b484ab 100644 --- a/api/menu/items.cfm +++ b/api/menu/items.cfm @@ -497,7 +497,7 @@ { datasource = "payfrit" } )> - +