Dealing with joint greetings (code provided)

Published
2009-10-15 15:37
Written by
SarahGladstone - member of the CiviCRM community - view blog guidelines
The topic of how to properly greet and send mail to couples, such as "Jane and John Doe" has been discussed many times, such as at the blog post: http://civicrm.org/node/558. But the problem with the approach in the blog ( and included in CiviCRM 3.0 ) Is it requires information about someone's spouse in their contact record and marking half on the contacts "Do not mail" even though there are times when I DO want to communicate with just one spouse or the other for different events. So I wrote some code that implements a new token called "contact.joint_greeting_casual". The code can be downloaded from jointgreetings.zip. After downloading and unzipping the file, follow the directions for using hooks with Joomla at the CiviCRM wiki. I have tested my code in CiviCRM 2.2.8 and 3.0.1. I have tested it with both mailing labels and emails. The logic is as follows: If there is a spouse relationship defined and both people share a last name = Jane and John Doe = John and Jane Doe If there is a spouse relationship defined and last names are different: = Jane Smith-Doe and John Doe If there is a spouse relationship defined and both people share a last name, and one or both have a title: = Dr. Jane and John Doe = Dr. John and Judge Jane Doe = John and Dr. Jane Doe ( This is not 100% compliant with etiquette rules as the person with the title should be listed first and in the case of 2 people with the same title it should be Drs. Jane and John Doe) If there is a spouse relationship defined and last names are different, and one or both have a title: = Dr. Jane Smith-Doe and John Doe If there is a household defined ( but no spouse relationships ) then the oldest 2 people in the household are treated as spouses. If a women is widowed by a husband ( ie there is a spouse relationship between a woman and a deceased man with a shared last name) = Mrs. John Doe If a married person's title in their contact record is a "courtesy" title such as "Mr Ms Miss or Mrs" , then it is ignored. If a single person ( not a widow) is encountered, then their "Display Name" is used as their greeting. These formats are based on the rules at: Emily Post. For an interesting discussion for how to address a widow, check Business writing. In summary: how to address a widow: The proper etiquette is to use Mrs. John Smith, not Mrs. Jane Smith. This is because technically, Mrs. Jane Smith indicates a woman who has divorced but kept her husband's last name. Mrs. John Smith indicates a married woman or a widow. Now, this is a distinction that is fast falling out of usage, so take it with a grain of salt. Sometimes rules change, but there are still older (and generally high-income) women who take this very seriously. My own mother would have a heart-attack if she were a widow and received formal mail addressed as "Mrs. Sally Smith" as this implies she is divorced. ( The horror! what would the postal carrier think! ). Other women of her age often introduce themselves and sign their letters as Mrs. John Smith. Also: Special thanks to Donald Lobo for helping me figure out the hooks for tokens. -Sarah
Filed under

Comments

Matt H (not verified)
2009-10-16 - 04:32

Hi. Great post and very timely code! Have been thinking about that issue today as we migratedour contacts from our old database to civiCRM.
We don't neccesarily want to put do not email on some of our contacts but still want to be able to send out updates to them collectively at times.
Excellent work Mr. Gladstone and also thanks to Lobo too :-)

I am using households, but I am currently just checking for the oldest 2 people. I'll update my code to check for the head of household too. I am assuming you only have 1 or 2 people marked as head of household. How do deal with widows? Do you leave the deceased husband marked as "head of houshold"

Well it's all hypothetical at this point because without your code, we've been mailing to households! For individual contacts I've relied on the fact at members with a recorded date of death are also marked as deceased and excluded from any mailing labels or email blasts.

I'm postulating using head of household as a way of selecting on recipient per household. If you have records for John Johnson, Jane Johnson and their household, without your code, we've named the household record using the joint greeting as a name, "Mr. & Mrs. John Johnson" and used household when we wanted to send to both persons.

Using your code, one could use the individual contacts, but could use a relationship, group or tag to limit the selected contacts and avoid generating two mailing labels to "Mr. & Mrs. John Johnson", one from John's record and one from Jane's.

What I have been doing is selecting everyone ( John Doe, Jane Doe, and their kids) then I check the box "Merge labels for contacts with the same address" to avoid duplicate mailing labels. So even thought my search criteria includes John Doe AND Jane Doe and their kids, there is only 1 mailing label generated.

I updated the code to check for "head of household" relationships as well as "household member of". Download the code from the same link ( http://www.poger.net/utils/jointgreetings.zip). The code will treat the first 2 heads of households as spouses. If there is just 1 head of household or none, then the oldest 2 people will be treated as spouses.

Thanks,
Sarah

Guest (not verified)
2009-10-20 - 04:28

Is anyone working on a drupal module wrapper for Sarah's code?

Anonymous (not verified)
2010-08-10 - 00:41

Did anyone ever create a Drupal version of this.
... thanks.