Strip address from business name when Toast embeds it in the name field
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e403e49487
commit
95dc4c49fc
1 changed files with 11 additions and 0 deletions
|
|
@ -1161,6 +1161,17 @@
|
|||
</cfif>
|
||||
</cfif>
|
||||
|
||||
<!--- Clean business name: strip address if it was embedded in the name --->
|
||||
<cfif structKeyExists(toastBusiness, "name") AND structKeyExists(toastBusiness, "address")>
|
||||
<cfset bizAddr1 = listFirst(toastBusiness.address, ",")>
|
||||
<cfif len(bizAddr1) AND findNoCase(bizAddr1, toastBusiness.name)>
|
||||
<cfset toastBusiness["name"] = trim(replaceNoCase(toastBusiness.name, bizAddr1, ""))>
|
||||
</cfif>
|
||||
<!--- Also strip leading/trailing dashes or pipes left over --->
|
||||
<cfset toastBusiness["name"] = trim(reReplace(toastBusiness.name, "[\-\|]+$", ""))>
|
||||
<cfset toastBusiness["name"] = trim(reReplace(toastBusiness.name, "^[\-\|]+", ""))>
|
||||
</cfif>
|
||||
|
||||
<!--- Update category item counts --->
|
||||
<cfloop from="1" to="#arrayLen(toastCategories)#" index="ci">
|
||||
<cfset catName = toastCategories[ci].name>
|
||||
|
|
|
|||
Reference in a new issue