X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FDeprecatedUtils.php;h=0fda33b51655724e5c3e980d03e9cf7c6fd576d4;hb=28ebaf5ff30bf42d12ddb91dd6a95ec4fa4859c7;hp=4ec6275a363a9e75ca8b2c090152e23eb71a5a17;hpb=c825f7b252ea9f2d74b46d246286166d4407143c;p=civicrm-core.git diff --git a/CRM/Utils/DeprecatedUtils.php b/CRM/Utils/DeprecatedUtils.php index 4ec6275a36..0fda33b516 100644 --- a/CRM/Utils/DeprecatedUtils.php +++ b/CRM/Utils/DeprecatedUtils.php @@ -285,11 +285,13 @@ function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = F } $dao = new CRM_Core_DAO(); $qParams = array(); - $svq = $dao->singleValueQuery("SELECT id FROM civicrm_contact WHERE id = $value", + $svq = $dao->singleValueQuery("SELECT is_deleted FROM civicrm_contact WHERE id = $value", $qParams ); - if (!$svq) { + if (!isset($svq)) { return civicrm_api3_create_error("Invalid Contact ID: There is no contact record with contact_id = $value."); + } else if ($svq == 1) { + return civicrm_api3_create_error("Invalid Contact ID: contact_id $value is a soft-deleted contact."); } $values['contact_id'] = $values['contribution_contact_id']; @@ -871,7 +873,7 @@ function _civicrm_api3_deprecated_add_formatted_param(&$values, &$params) { return TRUE; } - if (isset($values['preferred_communication_method'])) { + if (!empty($values['preferred_communication_method'])) { $comm = array(); $pcm = array_change_key_case(array_flip(CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method')), CASE_LOWER);