Fix undefined menuName in saveWizard when using provided menuId
The menuName variable was only defined in the else branch (new menu creation) but referenced later in category logging. Now looks up the menu name from DB when using a provided menuId. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
8086065d38
commit
3613776ff3
1 changed files with 4 additions and 1 deletions
|
|
@ -294,7 +294,10 @@ try {
|
|||
// Use provided menuId (add-menu mode) or create/find menu
|
||||
if (providedMenuId > 0) {
|
||||
menuID = providedMenuId;
|
||||
response.steps.append("Using provided menu ID: " & menuID);
|
||||
// Look up the menu name for logging
|
||||
qMenuName = queryExecute("SELECT MenuName FROM Menus WHERE MenuID = :id", { id: menuID }, { datasource: "payfrit" });
|
||||
menuName = qMenuName.recordCount > 0 ? qMenuName.MenuName : "Menu " & menuID;
|
||||
response.steps.append("Using provided menu: " & menuName & " (ID: " & menuID & ")");
|
||||
} else {
|
||||
// Create a Menu record for this business (or get existing menu with same name)
|
||||
menuName = structKeyExists(wizardData, "menuName") && isSimpleValue(wizardData.menuName) && len(trim(wizardData.menuName))
|
||||
|
|
|
|||
Reference in a new issue