mirror of
https://codeberg.org/artfulrobot/contactcats.git
synced 2025-06-25 12:58:05 +02:00
make exceptions from searchkit easier to find
This commit is contained in:
parent
c2546732b5
commit
3b42e99a96
1 changed files with 19 additions and 12 deletions
|
@ -90,17 +90,26 @@ 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) {
|
||||||
if ($cat['search_type'] === 'group') {
|
try {
|
||||||
$this->assignCategoryFromGroup($cat);
|
if ($cat['search_type'] === 'group') {
|
||||||
|
$this->assignCategoryFromGroup($cat);
|
||||||
|
}
|
||||||
|
elseif ($cat['search_type'] === 'search') {
|
||||||
|
$this->assignCategoryFromSearch($cat);
|
||||||
|
}
|
||||||
|
elseif ($cat['search_type'] === 'default') {
|
||||||
|
$this->assignDefaultCategory($cat);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new CRM_Core_Exception("Invalid search_type: $cat[search_type] for category $cat[id]");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elseif ($cat['search_type'] === 'search') {
|
catch (\Exception $e) {
|
||||||
$this->assignCategoryFromSearch($cat);
|
throw new CRM_Core_Exception(
|
||||||
}
|
"ContactCats failed to run category $cat[id] $cat[search_type] $cat[label]: " . $e->getMessage(),
|
||||||
elseif ($cat['search_type'] === 'default') {
|
0,
|
||||||
$this->assignDefaultCategory($cat);
|
[],
|
||||||
}
|
$e);
|
||||||
else {
|
|
||||||
throw new CRM_Core_DAO("Invalid search_type: $cat[search_type] for category $cat[id]");
|
|
||||||
}
|
}
|
||||||
// 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];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue