CiviCRM extension: Provides tokens for any related contact, for all available contact tokens. E.g., to get the spouse's first name, or parent's marriage date.
Other
1
stars
5
forks
source link
fix bad query when token is for a non-existent relationship #6
If $relatedContactIDs is populated, then this query will do the rather sane act of making an API call to retrieve token data from the contacts in that array. If $relatedContactIDs is NOT populated, then getTokenDetails() will make an API call to get token details for EVERY contact in the db. Oops. Crashes my UI every time.
Anyway, if $relatedContactIDs isn't populated, that means that there are no contacts that have the relationship this token is trying to process, so this patch skips it.
I just found out what happens when you try to process a token for a relationship that doesn't exist, and it's not pretty.
The line in question is:
If
$relatedContactIDs
is populated, then this query will do the rather sane act of making an API call to retrieve token data from the contacts in that array. If$relatedContactIDs
is NOT populated, thengetTokenDetails()
will make an API call to get token details for EVERY contact in the db. Oops. Crashes my UI every time.Anyway, if
$relatedContactIDs
isn't populated, that means that there are no contacts that have the relationship this token is trying to process, so this patch skips it.