diff --git a/api/setup/analyzeMenuUrl.cfm b/api/setup/analyzeMenuUrl.cfm
index 8c23273..2b633d0 100644
--- a/api/setup/analyzeMenuUrl.cfm
+++ b/api/setup/analyzeMenuUrl.cfm
@@ -1078,6 +1078,10 @@
+
+
+
+
diff --git a/api/setup/saveWizard.cfm b/api/setup/saveWizard.cfm
index 6159b0d..4d3b675 100644
--- a/api/setup/saveWizard.cfm
+++ b/api/setup/saveWizard.cfm
@@ -201,26 +201,34 @@ try {
}
}
+ // Check if lat/lng provided (e.g. from Toast)
+ bizLat = structKeyExists(biz, "latitude") && isNumeric(biz.latitude) ? biz.latitude : 0;
+ bizLng = structKeyExists(biz, "longitude") && isNumeric(biz.longitude) ? biz.longitude : 0;
+
queryTimed("
- INSERT INTO Addresses (Line1, City, StateID, ZIPCode, UserID, AddressTypeID, AddedOn)
- VALUES (:line1, :city, :stateID, :zip, :userID, :typeID, NOW())
+ INSERT INTO Addresses (Line1, City, StateID, ZIPCode, UserID, AddressTypeID, Latitude, Longitude, AddedOn)
+ VALUES (:line1, :city, :stateID, :zip, :userID, :typeID, :lat, :lng, NOW())
", {
line1: len(addressLine1) ? addressLine1 : "Address pending",
city: len(city) ? city : "",
stateID: { value = stateID > 0 ? stateID : javaCast("null", ""), cfsqltype = "cf_sql_integer", null = stateID == 0 },
zip: len(zip) ? zip : "",
userID: userId,
- typeID: 2
+ typeID: 2,
+ lat: { value = bizLat != 0 ? bizLat : javaCast("null", ""), cfsqltype = "cf_sql_decimal", null = bizLat == 0 },
+ lng: { value = bizLng != 0 ? bizLng : javaCast("null", ""), cfsqltype = "cf_sql_decimal", null = bizLng == 0 }
}, { datasource: "payfrit" });
qNewAddr = queryTimed("SELECT LAST_INSERT_ID() as id", {}, { datasource: "payfrit" });
addressId = qNewAddr.id;
response.steps.append("Created address record (ID: " & addressId & ")");
- // Auto-geocode address in background
- thread action="run" name="geocode_#addressId#" addressId=addressId {
- include template="/api/inc/geocode.cfm";
- geocodeAddressById(attributes.addressId);
+ // Auto-geocode in background only if lat/lng not already provided
+ if (bizLat == 0 || bizLng == 0) {
+ thread action="run" name="geocode_#addressId#" addressId=addressId {
+ include template="/api/inc/geocode.cfm";
+ geocodeAddressById(attributes.addressId);
+ }
}
// Get community meal type (1=provide meals, 2=food bank donation)