make exceptions from searchkit easier to find

This commit is contained in:
Rich Lott / Artful Robot 2025-04-02 10:56:54 +01:00
parent c2546732b5
commit 3b42e99a96

View file

@ -90,6 +90,7 @@ class Processor {
\CRM_Core_Transaction::create()->run(function($tx) use (&$summary) { \CRM_Core_Transaction::create()->run(function($tx) use (&$summary) {
$this->resetTable(); $this->resetTable();
foreach ($this->categories as $cat) { foreach ($this->categories as $cat) {
try {
if ($cat['search_type'] === 'group') { if ($cat['search_type'] === 'group') {
$this->assignCategoryFromGroup($cat); $this->assignCategoryFromGroup($cat);
} }
@ -100,7 +101,15 @@ class Processor {
$this->assignDefaultCategory($cat); $this->assignDefaultCategory($cat);
} }
else { else {
throw new CRM_Core_DAO("Invalid search_type: $cat[search_type] for category $cat[id]"); throw new CRM_Core_Exception("Invalid search_type: $cat[search_type] for category $cat[id]");
}
}
catch (\Exception $e) {
throw new CRM_Core_Exception(
"ContactCats failed to run category $cat[id] $cat[search_type] $cat[label]: " . $e->getMessage(),
0,
[],
$e);
} }
// future... // future...
} }
@ -267,8 +276,6 @@ class Processor {
$apiParams = $search['api_params']; $apiParams = $search['api_params'];
if ($search['api_entity'] === 'Contact' && in_array('id', $apiParams['select'] ?? [])) { if ($search['api_entity'] === 'Contact' && in_array('id', $apiParams['select'] ?? [])) {
$contactIdKey = 'id'; $contactIdKey = 'id';
// We only need the ID.
$apiParams['select'] = ['id'];
if ($this->contact_id) { if ($this->contact_id) {
// Limit to one contact. // Limit to one contact.
$apiParams['where'][] = ['id', '=', $this->contact_id]; $apiParams['where'][] = ['id', '=', $this->contact_id];