From ec4a4a5864ddeb354984d05e12b6e1958cef54f1 Mon Sep 17 00:00:00 2001 From: Jaap Jansma <jaap.jansma@civicoop.org> Date: Tue, 9 Jan 2024 07:36:54 +0100 Subject: [PATCH] Added error handling for the contact summary tab output. Prevent a hard failure. --- CHANGELOG.md | 1 + CRM/Contact/DataProcessorContactSummaryTab.php | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58a3737e..efc6f50c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Version 1.95 (not yet released) +* Added error handling for the contact summary tab output. Prevent a hard failure. * Added field for event availability information. # Version 1.94 diff --git a/CRM/Contact/DataProcessorContactSummaryTab.php b/CRM/Contact/DataProcessorContactSummaryTab.php index b7814f5a..8f912157 100644 --- a/CRM/Contact/DataProcessorContactSummaryTab.php +++ b/CRM/Contact/DataProcessorContactSummaryTab.php @@ -65,11 +65,20 @@ class CRM_Contact_DataProcessorContactSummaryTab implements UIFormOutputInterfac continue; } + $count = 0; + if ($contactId) { + try { + $count = $outputClass->getCount($contactId, $output, $dataprocessor); + } catch (\Exception $e) { + // Do nothing + } + } + $tab = [ 'id' => 'dataprocessor_' . $dataprocessor['name'], 'title' => $outputClass->getTitleForUiLink($output, $dataprocessor), 'icon' => $outputClass->getIconForUiLink($output, $dataprocessor), - 'count' => $contactId ? $outputClass->getCount($contactId, $output, $dataprocessor) : 0, + 'count' => $count, 'url' => CRM_Utils_System::url('civicrm/dataprocessor/page/contactsummary', array('contact_id' => $contactId, 'data_processor' => $dataprocessor['name'], 'reset' => 1, 'force' => 1)), 'class' => '', ]; -- GitLab