From faa3fe68cc0ebbd2ef8859e99f94b4a033dd97cc Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Fri, 29 Mar 2019 10:43:23 +1100 Subject: [PATCH] Do not cause a fatal error if no contact_id field for a note is filled in when viewing contact notes --- CRM/Contact/Page/View/Note.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/CRM/Contact/Page/View/Note.php b/CRM/Contact/Page/View/Note.php index efc21dd17d..39fe00be8c 100644 --- a/CRM/Contact/Page/View/Note.php +++ b/CRM/Contact/Page/View/Note.php @@ -117,11 +117,13 @@ class CRM_Contact_Page_View_Note extends CRM_Core_Page { 'Note', $note->id ); - $contact = new CRM_Contact_DAO_Contact(); - $contact->id = $note->contact_id; - $contact->find(); - $contact->fetch(); - $values[$note->id]['createdBy'] = $contact->display_name; + if (!empty($note->contact_id)) { + $contact = new CRM_Contact_DAO_Contact(); + $contact->id = $note->contact_id; + $contact->find(); + $contact->fetch(); + $values[$note->id]['createdBy'] = $contact->display_name; + } $values[$note->id]['comment_count'] = CRM_Core_BAO_Note::getChildCount($note->id); // paper icon view for attachments part -- 2.25.1