Allow child businesses to use parent service points without grant

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
John Mizerek 2026-02-07 11:58:44 -08:00
parent 87ff082279
commit e40e87efe0

View file

@ -263,7 +263,16 @@
{ datasource = "payfrit" }
)>
<cfif qSPOwner.recordCount GT 0 AND qSPOwner.BusinessID NEQ BusinessID>
<!--- SP belongs to another business - check for active grant --->
<!--- SP belongs to another business - check if ordering business is a child of SP owner --->
<cfset qParent = queryTimed(
"SELECT ParentBusinessID FROM Businesses WHERE ID = ? LIMIT 1",
[ { value = BusinessID, cfsqltype = "cf_sql_integer" } ],
{ datasource = "payfrit" }
)>
<cfset isChildOfSPOwner = qParent.recordCount GT 0 AND val(qParent.ParentBusinessID) EQ qSPOwner.BusinessID>
<cfif NOT isChildOfSPOwner>
<!--- Not a child business - check for active grant --->
<cfset qGrant = queryTimed(
"SELECT ID, OwnerBusinessID, EconomicsType, EconomicsValue, EligibilityScope, TimePolicyType, TimePolicyData
FROM ServicePointGrants
@ -291,6 +300,8 @@
<cfset grantEconomicsType = qGrant.EconomicsType>
<cfset grantEconomicsValue = qGrant.EconomicsValue>
</cfif>
<!--- If isChildOfSPOwner is true, no grant needed - child can use parent's service points --->
</cfif>
</cfif>
<cfset nowDt = now()>