From 7bc2eb388e87530c2e560770249c30dc988bd9e8 Mon Sep 17 00:00:00 2001 From: Ken West Date: Thu, 13 Nov 2014 23:02:22 +1100 Subject: [PATCH] CRM-15593 Prevent contributions being imported for is_deleted contacts --- CRM/Utils/DeprecatedUtils.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CRM/Utils/DeprecatedUtils.php b/CRM/Utils/DeprecatedUtils.php index eff034adaf..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']; -- 2.25.1