Published
Saturday, October 31, 2015 - 09:52
Written by

Your CiviCRM installation may have undead contacts.  Contacts are marked as deceased in CiviCRM by setting the is_deceased column to 1; living contacts are marked with 0.  However, it's possible for import mistakes to cause contacts to have a value of null for is_deceased.  The result is that the contacts don't appear as dead when you view them, but they're excluded from mailings and other features that filter on is_deceased = 0.  The same goes for Do not mail, Do not email, and so forth.

A recent question on StackExchange, along with the Halloween holiday, prompted me to write an extension that checks your system for zombies.  It uses the new Status Messages page to display a notice with the fields with an inappropriate null value:

For developers, this is also an illustration of hook_civicrm_check(), which allows extensions to define checks that can display status messages.  Check out the code on Github for the details.

Because it's using these new features, it's only available for CiviCRM 4.7, but you should download and test a copy of your site with the new version anyway.

Comments

Can it differentiate old, slow Ramero zombies from hip, modern iZombies?

To-date I've been using a custom field to mark a contact's undead status. That way you can indicate whether they are the older kind, modern, or just someone who's not too bright. And it's flexible enough to use for vampires etc. But it's good to know that is_deceased can just be null when you don't need all that complexity.

I think it's a wonderful recognition of Halloween to release a zombie killer. However, I think it's worth pointing out that a mad scientist has developed a prototype for a zombie vaccination. However, the mad scientish is now trapped in a swamp of primordial goo and we are looking for an intrepid developer to convert the vaccine to a patch (or more specifically a couple of lines in an upgrade script https://issues.civicrm.org/jira/browse/CRM-17147)

ohh scientish.... and I AM drinking red wine as I write...

.... and I thought scientish was one of those quaint antipodean terms for "somewhat like a scientist".

Do similar issues apply to boolean fields on other tables- for example is_deleted on activities and is_active on relationships?