From 2ddf0fcdae8f287515b397b2c94603a4a9da0f5c Mon Sep 17 00:00:00 2001 From: Aniessh Sethh Date: Thu, 9 Aug 2018 09:56:31 +0530 Subject: [PATCH] Fix for CRM-314 --- CRM/Event/Form/SelfSvcTransfer.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/CRM/Event/Form/SelfSvcTransfer.php b/CRM/Event/Form/SelfSvcTransfer.php index 7452ccb246..e3ede8ea34 100644 --- a/CRM/Event/Form/SelfSvcTransfer.php +++ b/CRM/Event/Form/SelfSvcTransfer.php @@ -337,10 +337,22 @@ class CRM_Event_Form_SelfSvcTransfer extends CRM_Core_Form { } else { //cancel 'from' participant row - $query = "select contact_id from civicrm_email where email = '" . $params['email'] . "'"; - $dao = CRM_Core_DAO::executeQuery($query); - while ($dao->fetch()) { - $contact_id = $dao->contact_id; + try{ + $contact_id_result = civicrm_api3('Contact', 'get', array( + 'sequential' => 1, + 'return' => array("id"), + 'email' => $params['email'], + 'options' => array('limit' => 1), + )); + $contact_id_result = $contact_id_result['values'][0]; + $contact_id = $contact_id_result['contact_id']; + $contact_is_deleted = $contact_id_result['contact_is_deleted']; + if ($contact_is_deleted || !is_numeric($contact_id)) { + CRM_Core_Error::statusBounce(ts('Contact does not exist.')); + } + } + catch (CiviCRM_API3_Exception $e) { + CRM_Core_Error::statusBounce(ts('Contact does not exist.')); } } $from_participant = $params = array(); -- 2.25.1