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,
|
Description as TaskTypeDescription,
|
||||||
Icon as TaskTypeIcon,
|
Icon as TaskTypeIcon,
|
||||||
Color as TaskTypeColor,
|
Color as TaskTypeColor,
|
||||||
|
RequiresServicePoint,
|
||||||
SortOrder,
|
SortOrder,
|
||||||
TaskCategoryID as CategoryID
|
TaskCategoryID as CategoryID
|
||||||
FROM tt_TaskTypes
|
FROM tt_TaskTypes
|
||||||
|
|
@ -67,7 +68,8 @@ try {
|
||||||
"TaskTypeDescription": isNull(row.TaskTypeDescription) ? "" : row.TaskTypeDescription,
|
"TaskTypeDescription": isNull(row.TaskTypeDescription) ? "" : row.TaskTypeDescription,
|
||||||
"TaskTypeIcon": isNull(row.TaskTypeIcon) ? "notifications" : row.TaskTypeIcon,
|
"TaskTypeIcon": isNull(row.TaskTypeIcon) ? "notifications" : row.TaskTypeIcon,
|
||||||
"TaskTypeColor": isNull(row.TaskTypeColor) ? "##9C27B0" : row.TaskTypeColor,
|
"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,
|
Description as TaskTypeDescription,
|
||||||
Icon as TaskTypeIcon,
|
Icon as TaskTypeIcon,
|
||||||
Color as TaskTypeColor,
|
Color as TaskTypeColor,
|
||||||
|
RequiresServicePoint,
|
||||||
SortOrder as SortOrder
|
SortOrder as SortOrder
|
||||||
FROM tt_TaskTypes
|
FROM tt_TaskTypes
|
||||||
WHERE BusinessID = :businessID
|
WHERE BusinessID = :businessID
|
||||||
|
|
@ -66,7 +67,8 @@ try {
|
||||||
"TaskTypeName": row.TaskTypeName,
|
"TaskTypeName": row.TaskTypeName,
|
||||||
"TaskTypeDescription": isNull(row.TaskTypeDescription) ? "" : row.TaskTypeDescription,
|
"TaskTypeDescription": isNull(row.TaskTypeDescription) ? "" : row.TaskTypeDescription,
|
||||||
"TaskTypeIcon": isNull(row.TaskTypeIcon) ? "notifications" : row.TaskTypeIcon,
|
"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" });
|
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)
|
// Get TaskTypeCategoryID (optional - links to TaskCategories for task creation)
|
||||||
taskTypeCategoryID = javaCast("null", "");
|
taskTypeCategoryID = javaCast("null", "");
|
||||||
if (structKeyExists(data, "TaskTypeCategoryID") && isNumeric(data.TaskTypeCategoryID) && data.TaskTypeCategoryID > 0) {
|
if (structKeyExists(data, "TaskTypeCategoryID") && isNumeric(data.TaskTypeCategoryID) && data.TaskTypeCategoryID > 0) {
|
||||||
|
|
@ -113,6 +119,7 @@ try {
|
||||||
Description = :taskTypeDescription,
|
Description = :taskTypeDescription,
|
||||||
Icon = :taskTypeIcon,
|
Icon = :taskTypeIcon,
|
||||||
Color = :taskTypeColor,
|
Color = :taskTypeColor,
|
||||||
|
RequiresServicePoint = :requiresServicePoint,
|
||||||
TaskCategoryID = :categoryID
|
TaskCategoryID = :categoryID
|
||||||
WHERE ID = :taskTypeID
|
WHERE ID = :taskTypeID
|
||||||
", {
|
", {
|
||||||
|
|
@ -120,6 +127,7 @@ try {
|
||||||
taskTypeDescription: { value: taskTypeDescription, cfsqltype: "cf_sql_varchar", null: !len(taskTypeDescription) },
|
taskTypeDescription: { value: taskTypeDescription, cfsqltype: "cf_sql_varchar", null: !len(taskTypeDescription) },
|
||||||
taskTypeIcon: { value: taskTypeIcon, cfsqltype: "cf_sql_varchar" },
|
taskTypeIcon: { value: taskTypeIcon, cfsqltype: "cf_sql_varchar" },
|
||||||
taskTypeColor: { value: taskTypeColor, 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) },
|
categoryID: { value: taskTypeCategoryID, cfsqltype: "cf_sql_integer", null: isNull(taskTypeCategoryID) },
|
||||||
taskTypeID: { value: taskTypeID, cfsqltype: "cf_sql_integer" }
|
taskTypeID: { value: taskTypeID, cfsqltype: "cf_sql_integer" }
|
||||||
}, { datasource: "payfrit" });
|
}, { datasource: "payfrit" });
|
||||||
|
|
@ -132,13 +140,14 @@ try {
|
||||||
} else {
|
} else {
|
||||||
// INSERT new task type
|
// INSERT new task type
|
||||||
queryTimed("
|
queryTimed("
|
||||||
INSERT INTO tt_TaskTypes (Name, Description, Icon, Color, BusinessID, TaskCategoryID)
|
INSERT INTO tt_TaskTypes (Name, Description, Icon, Color, RequiresServicePoint, BusinessID, TaskCategoryID)
|
||||||
VALUES (:taskTypeName, :taskTypeDescription, :taskTypeIcon, :taskTypeColor, :businessID, :categoryID)
|
VALUES (:taskTypeName, :taskTypeDescription, :taskTypeIcon, :taskTypeColor, :requiresServicePoint, :businessID, :categoryID)
|
||||||
", {
|
", {
|
||||||
taskTypeName: { value: taskTypeName, cfsqltype: "cf_sql_varchar" },
|
taskTypeName: { value: taskTypeName, cfsqltype: "cf_sql_varchar" },
|
||||||
taskTypeDescription: { value: taskTypeDescription, cfsqltype: "cf_sql_varchar", null: !len(taskTypeDescription) },
|
taskTypeDescription: { value: taskTypeDescription, cfsqltype: "cf_sql_varchar", null: !len(taskTypeDescription) },
|
||||||
taskTypeIcon: { value: taskTypeIcon, cfsqltype: "cf_sql_varchar" },
|
taskTypeIcon: { value: taskTypeIcon, cfsqltype: "cf_sql_varchar" },
|
||||||
taskTypeColor: { value: taskTypeColor, 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" },
|
businessID: { value: businessID, cfsqltype: "cf_sql_integer" },
|
||||||
categoryID: { value: taskTypeCategoryID, cfsqltype: "cf_sql_integer", null: isNull(taskTypeCategoryID) }
|
categoryID: { value: taskTypeCategoryID, cfsqltype: "cf_sql_integer", null: isNull(taskTypeCategoryID) }
|
||||||
}, { datasource: "payfrit" });
|
}, { datasource: "payfrit" });
|
||||||
|
|
|
||||||
Reference in a new issue