From 9f4f065adc13424066cf28c3708d3eeb1e67a114 Mon Sep 17 00:00:00 2001 From: Matthew Wire Date: Sat, 24 Jul 2021 23:19:54 +0100 Subject: [PATCH] Fix error message when unable to delete managedentity --- CRM/Core/ManagedEntities.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CRM/Core/ManagedEntities.php b/CRM/Core/ManagedEntities.php index 3ed9c14388..ca558b13af 100644 --- a/CRM/Core/ManagedEntities.php +++ b/CRM/Core/ManagedEntities.php @@ -367,6 +367,9 @@ class CRM_Core_ManagedEntities { if ((bool) $check['count']) { $result = civicrm_api($dao->entity_type, 'delete', $params); if ($result['is_error']) { + if (isset($dao->name)) { + $params['name'] = $dao->name; + } $this->onApiError($dao->entity_type, 'delete', $params, $result); } } @@ -482,7 +485,7 @@ class CRM_Core_ManagedEntities { 'result' => $result, ]); throw new Exception('API error: ' . $result['error_message'] . ' on ' . $entity . '.' . $action - . !empty($params['name']) ? '( entity name ' . $params['name'] . ')' : '' + . (!empty($params['name']) ? '( entity name ' . $params['name'] . ')' : '') ); } -- 2.25.1