From 63b930101e0413e7537fff720e4a2b6ac67965b0 Mon Sep 17 00:00:00 2001 From: Rich Lott / Artful Robot Date: Wed, 2 Apr 2025 10:57:23 +0100 Subject: [PATCH] fix setup --- .../ContactCategoryDefinition/Setup.php | 33 +++++++++---------- ...Search_ContactCategories_0_2_Locus.mgd.php | 2 +- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/Civi/Api4/Action/ContactCategoryDefinition/Setup.php b/Civi/Api4/Action/ContactCategoryDefinition/Setup.php index 8c46555..acef84c 100644 --- a/Civi/Api4/Action/ContactCategoryDefinition/Setup.php +++ b/Civi/Api4/Action/ContactCategoryDefinition/Setup.php @@ -26,7 +26,7 @@ class Setup extends AbstractAction { // TODO: could offer this as a hook. // For now, it's hard-coded. if ($this->scheme === 'ForumZFDFundraising1') { - $this->implementForumZFDFundraising1($result); + return $this->implementForumZFDFundraising1($result); } throw new CRM_Core_Exception("Unknown scheme " . $this->scheme); } @@ -123,12 +123,12 @@ class Setup extends AbstractAction { 'label' => '1.4', 'description' => E::ts('Occasional donor: new'), 'color' => '#7d008c', - 'icon' => 'fa-card-plus', + 'icon' => 'fa-circle-plus', ], [ '_search_name' => 'ContactCategories_Locus_1_3', 'label' => '1.3', - 'description' => E::ts('Occasional donor: one-time'), // FIXME: + 'description' => E::ts('Occasional donor: one-time'), 'color' => '#6d0079', 'icon' => 'fa-money-bill-1', ], @@ -143,7 +143,7 @@ class Setup extends AbstractAction { '_search_name' => 'ContactCategories_Locus_1_1', 'label' => '1.1', 'description' => E::ts('Occasional donor: expired'), - 'color' => '#fff', + 'color' => '#58325c', 'icon' => 'fa-road-circle-xmark', ], [ @@ -151,7 +151,7 @@ class Setup extends AbstractAction { 'label' => '0.2', 'description' => E::ts('Interested'), 'color' => '#613b05', - 'icon' => '', + 'icon' => 'fa-eye', ], ]; @@ -166,23 +166,23 @@ class Setup extends AbstractAction { } $saveApi = ContactCategoryDefinition::save(FALSE) - ->setDefaults([ 'search_type' => 'search' ]); + ->setDefaults(['search_type:name' => 'search']); $order = 1; foreach ($src as $rec) { - $src['search_data'] = ['saved_search_id' => $nameToIdMatch[$rec['_search_name']]]; - $src['execution_order'] = $src['presentation_order'] = $order++; + $rec['search_data'] = ['saved_search_id' => $nameToIdMatch[$rec['_search_name']]]; + $rec['execution_order'] = $rec['presentation_order'] = $order++; unset($rec['_search_name']); $saveApi->addRecord($rec); } $saveApi->addRecord([ - 'label' => '0.1', - 'description' => E::ts('Uninterested'), - 'color' => '#555', - 'icon' => 'fa-ban', - 'search_type' => 'default', - 'presentation_order' => $order, - 'execution_order' => $order, - ]); + 'label' => '0.1', + 'description' => E::ts('Uninterested'), + 'color' => '#555', + 'icon' => 'fa-ban', + 'search_type:name' => 'default', + 'presentation_order' => $order, + 'execution_order' => $order, + ]); $r = $saveApi->execute(); $result->exchangeArray($r->getArrayCopy()); @@ -202,4 +202,3 @@ class Setup extends AbstractAction { } } - diff --git a/managed/SavedSearch_ContactCategories_0_2_Locus.mgd.php b/managed/SavedSearch_ContactCategories_0_2_Locus.mgd.php index 1e5eb2c..044bcf9 100644 --- a/managed/SavedSearch_ContactCategories_0_2_Locus.mgd.php +++ b/managed/SavedSearch_ContactCategories_0_2_Locus.mgd.php @@ -10,7 +10,7 @@ return [ 'params' => [ 'version' => 4, 'values' => [ - 'name' => 'ContactCategories_0_2_Locus', + 'name' => 'ContactCategories_Locus_0_2', 'label' => E::ts('ContactCategories 0.2 Locus'), 'api_entity' => 'Contact', 'api_params' => [