From: Eileen Date: Thu, 19 Dec 2013 04:01:10 +0000 (+1300) Subject: CRM-14008 alter update greeting to update blanks as well as null X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a39ef8af08f176c94c1bfc64194e44f9dace4c8e;p=civicrm-core.git CRM-14008 alter update greeting to update blanks as well as null ---------------------------------------- * CRM-14008: Addressee greetings not being updated when they are empty http://issues.civicrm.org/jira/browse/CRM-14008 --- diff --git a/CRM/Contact/BAO/Contact/Utils.php b/CRM/Contact/BAO/Contact/Utils.php index 5f3e9a37f0..7a5556547e 100644 --- a/CRM/Contact/BAO/Contact/Utils.php +++ b/CRM/Contact/BAO/Contact/Utils.php @@ -989,8 +989,12 @@ Group By componentId"; $sql = "SELECT DISTINCT id, $idFldName FROM civicrm_contact WHERE contact_type = %1 "; } else { - $sql = "SELECT DISTINCT id, $idFldName FROM civicrm_contact WHERE contact_type = %1 - AND ( {$idFldName} IS NULL OR ( {$idFldName} IS NOT NULL AND {$displayFldName} IS NULL ) ) "; + $sql = " + SELECT DISTINCT id, $idFldName + FROM civicrm_contact + WHERE contact_type = %1 + AND ({$idFldName} IS NULL + OR ( {$idFldName} IS NOT NULL AND ({$displayFldName} IS NULL OR {$displayFldName} = '')) )"; } $dao = CRM_Core_DAO::executeQuery($sql, array(1 => array($contactType, 'String')));