From 50fb017dd12b319185f7ce1e153a59bc45ea5703 Mon Sep 17 00:00:00 2001 From: Michael Devery Date: Thu, 19 Oct 2017 13:01:55 +0100 Subject: [PATCH] CRM-21334: Replace direct SQL query with BAO save call (to trigger hooks) --- CRM/Contact/BAO/Contact.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index 565096516e3f..b8c743abe1f2 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -946,11 +946,12 @@ public static function deleteContactImage($id) { if (!$id) { return FALSE; } - $query = " -UPDATE civicrm_contact -SET image_URL=NULL -WHERE id={$id}; "; - CRM_Core_DAO::executeQuery($query); + + $contact = new self(); + $contact->id = $id; + $contact->image_URL = 'null'; + $contact->save(); + return TRUE; }