From 945ab6a919bccb43e677540e2b90827a262a5d51 Mon Sep 17 00:00:00 2001 From: John Mizerek Date: Mon, 9 Mar 2026 16:50:02 -0700 Subject: [PATCH] Add RequiresServicePoint flag to task types API Co-Authored-By: Claude Opus 4.6 --- api/tasks/listAllTypes.cfm | 4 +++- api/tasks/listTypes.cfm | 4 +++- api/tasks/saveType.cfm | 13 +++++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/api/tasks/listAllTypes.cfm b/api/tasks/listAllTypes.cfm index 97e144f..ceb57ff 100644 --- a/api/tasks/listAllTypes.cfm +++ b/api/tasks/listAllTypes.cfm @@ -50,6 +50,7 @@ try { Description as TaskTypeDescription, Icon as TaskTypeIcon, Color as TaskTypeColor, + RequiresServicePoint, SortOrder, TaskCategoryID as CategoryID FROM tt_TaskTypes @@ -67,7 +68,8 @@ try { "TaskTypeDescription": isNull(row.TaskTypeDescription) ? "" : row.TaskTypeDescription, "TaskTypeIcon": isNull(row.TaskTypeIcon) ? "notifications" : row.TaskTypeIcon, "TaskTypeColor": isNull(row.TaskTypeColor) ? "##9C27B0" : row.TaskTypeColor, - "CategoryID": isNull(row.CategoryID) ? "" : row.CategoryID + "CategoryID": isNull(row.CategoryID) ? "" : row.CategoryID, + "RequiresServicePoint": row.RequiresServicePoint == 1 }); } diff --git a/api/tasks/listTypes.cfm b/api/tasks/listTypes.cfm index 98a7eec..d80e78a 100644 --- a/api/tasks/listTypes.cfm +++ b/api/tasks/listTypes.cfm @@ -51,6 +51,7 @@ try { Description as TaskTypeDescription, Icon as TaskTypeIcon, Color as TaskTypeColor, + RequiresServicePoint, SortOrder as SortOrder FROM tt_TaskTypes WHERE BusinessID = :businessID @@ -66,7 +67,8 @@ try { "TaskTypeName": row.TaskTypeName, "TaskTypeDescription": isNull(row.TaskTypeDescription) ? "" : row.TaskTypeDescription, "TaskTypeIcon": isNull(row.TaskTypeIcon) ? "notifications" : row.TaskTypeIcon, - "TaskTypeColor": isNull(row.TaskTypeColor) ? "##9C27B0" : row.TaskTypeColor + "TaskTypeColor": isNull(row.TaskTypeColor) ? "##9C27B0" : row.TaskTypeColor, + "RequiresServicePoint": row.RequiresServicePoint == 1 }); } diff --git a/api/tasks/saveType.cfm b/api/tasks/saveType.cfm index 7995869..f4cc9b4 100644 --- a/api/tasks/saveType.cfm +++ b/api/tasks/saveType.cfm @@ -78,6 +78,12 @@ try { apiAbort({ "OK": false, "ERROR": "invalid_params", "MESSAGE": "TaskTypeColor must be a valid hex color" }); } + // Get RequiresServicePoint (optional, default true) + requiresServicePoint = 1; + if (structKeyExists(data, "RequiresServicePoint")) { + requiresServicePoint = data.RequiresServicePoint ? 1 : 0; + } + // Get TaskTypeCategoryID (optional - links to TaskCategories for task creation) taskTypeCategoryID = javaCast("null", ""); if (structKeyExists(data, "TaskTypeCategoryID") && isNumeric(data.TaskTypeCategoryID) && data.TaskTypeCategoryID > 0) { @@ -113,6 +119,7 @@ try { Description = :taskTypeDescription, Icon = :taskTypeIcon, Color = :taskTypeColor, + RequiresServicePoint = :requiresServicePoint, TaskCategoryID = :categoryID WHERE ID = :taskTypeID ", { @@ -120,6 +127,7 @@ try { taskTypeDescription: { value: taskTypeDescription, cfsqltype: "cf_sql_varchar", null: !len(taskTypeDescription) }, taskTypeIcon: { value: taskTypeIcon, cfsqltype: "cf_sql_varchar" }, taskTypeColor: { value: taskTypeColor, cfsqltype: "cf_sql_varchar" }, + requiresServicePoint: { value: requiresServicePoint, cfsqltype: "cf_sql_integer" }, categoryID: { value: taskTypeCategoryID, cfsqltype: "cf_sql_integer", null: isNull(taskTypeCategoryID) }, taskTypeID: { value: taskTypeID, cfsqltype: "cf_sql_integer" } }, { datasource: "payfrit" }); @@ -132,13 +140,14 @@ try { } else { // INSERT new task type queryTimed(" - INSERT INTO tt_TaskTypes (Name, Description, Icon, Color, BusinessID, TaskCategoryID) - VALUES (:taskTypeName, :taskTypeDescription, :taskTypeIcon, :taskTypeColor, :businessID, :categoryID) + INSERT INTO tt_TaskTypes (Name, Description, Icon, Color, RequiresServicePoint, BusinessID, TaskCategoryID) + VALUES (:taskTypeName, :taskTypeDescription, :taskTypeIcon, :taskTypeColor, :requiresServicePoint, :businessID, :categoryID) ", { taskTypeName: { value: taskTypeName, cfsqltype: "cf_sql_varchar" }, taskTypeDescription: { value: taskTypeDescription, cfsqltype: "cf_sql_varchar", null: !len(taskTypeDescription) }, taskTypeIcon: { value: taskTypeIcon, cfsqltype: "cf_sql_varchar" }, taskTypeColor: { value: taskTypeColor, cfsqltype: "cf_sql_varchar" }, + requiresServicePoint: { value: requiresServicePoint, cfsqltype: "cf_sql_integer" }, businessID: { value: businessID, cfsqltype: "cf_sql_integer" }, categoryID: { value: taskTypeCategoryID, cfsqltype: "cf_sql_integer", null: isNull(taskTypeCategoryID) } }, { datasource: "payfrit" });