Smart groups with deleted/disabled custom fields throw fatal error on its usage.
To replicate -
- Create a smart group with custom date as one of the filter.
- Disable the custom field after the smart group creation.
- The update smart group count
/civicrm/group?reset=1&update_smart_groups=1
functionality returns a DB error.
- Usage of this group in mailings does not calculate the recipient -
Possible Solutions
- Fix the code to ignore the disabled custom field criteria while fetching the formvalues for the smart group.
This calculates the count and retrieves all the contacts correctly but is not following the exact filter condition setup by the user while creating this group.
-
Produce a warning on the custom field delete page that this field is being used by a smart group. And avoid deletion?
-
System Status warning with an indication that there are some smart groups configured on your site that uses disabled custom fields as a filter.
-
Probably 1 and 3 both?