Add RequiresServicePoint flag to task types API
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4240fe76cc
commit
945ab6a919
3 changed files with 17 additions and 4 deletions
|
|
@ -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
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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" });
|
||||
|
|
|
|||
Reference in a new issue