Change ``OR (d.dept_id=gd.dept_id AND d.group_membership=1)`` to use defined constant - ALERTS_DEPT_AND_GROUPS.