Fixes and tidies

This commit is contained in:
Rich Lott / Artful Robot 2025-02-27 18:10:48 +00:00
parent e56be4ce31
commit 69d4c6b2e8
11 changed files with 191 additions and 40 deletions

View file

@ -17,9 +17,7 @@ return [
'style' => 'Inline',
'help_pre' => E::ts(''),
'help_post' => E::ts(''),
'weight' => 18,
'collapse_adv_display' => TRUE,
'created_date' => '2025-02-20 13:59:06',
'is_public' => FALSE,
'icon' => '',
],
@ -35,7 +33,7 @@ return [
'version' => 4,
'values' => [
'custom_group_id.name' => 'Category_changes',
'name' => 'Previous_Category',
'name' => 'previous_category_id',
'label' => E::ts('Previous Category'),
'data_type' => 'EntityReference',
'html_type' => 'Autocomplete-Select',
@ -44,7 +42,7 @@ return [
'text_length' => 255,
'note_columns' => 60,
'note_rows' => 4,
'column_name' => 'previous_category_117',
'column_name' => 'previous_category_id',
'fk_entity' => 'ContactCategoryDefinition',
],
'match' => [
@ -62,7 +60,7 @@ return [
'version' => 4,
'values' => [
'custom_group_id.name' => 'Category_changes',
'name' => 'New_Category',
'name' => 'new_category_id',
'label' => E::ts('New Category'),
'data_type' => 'EntityReference',
'html_type' => 'Autocomplete-Select',
@ -71,7 +69,7 @@ return [
'text_length' => 255,
'note_columns' => 60,
'note_rows' => 4,
'column_name' => 'new_category_118',
'column_name' => 'new_category_id',
'fk_entity' => 'ContactCategoryDefinition',
],
'match' => [

View file

@ -0,0 +1,26 @@
<?php
use CRM_Contactcats_ExtensionUtil as E;
return [
[
'name' => 'OptionValue_Changed_category',
'entity' => 'OptionValue',
'cleanup' => 'unused',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'option_group_id.name' => 'activity_type',
'label' => E::ts('Changed category'),
'name' => 'changed_contact_category',
'description' => E::ts('<p>This activity is automatically added when a contact is moved from one category to another.</p>'),
'icon' => 'fa-tags',
],
'match' => [
// Should this be option_group_id.name?
'option_group_id',
'name',
],
],
],
];

View file

@ -0,0 +1,104 @@
<?php
use CRM_Contactcats_ExtensionUtil as E;
return [
[
'name' => 'SavedSearch_SavedSearch_Contact_Category_Counts',
'entity' => 'SavedSearch',
'cleanup' => 'unused',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'SavedSearch_Contact_Category_Counts',
'label' => E::ts('Category Counts query'),
'api_entity' => 'ContactCategoryDefinition',
'api_params' => [
'version' => 4,
'select' => [
'id',
'label',
'color',
'icon',
'COUNT(ContactCategoryDefinition_ContactCategory_category_definition_id_01.id) AS COUNT_ContactCategoryDefinition_ContactCategory_category_definition_id_01_id',
],
'orderBy' => [],
'where' => [],
'groupBy' => ['id'],
'join' => [
[
'ContactCategory AS ContactCategoryDefinition_ContactCategory_category_definition_id_01',
'LEFT',
[
'id',
'=',
'ContactCategoryDefinition_ContactCategory_category_definition_id_01.category_definition_id',
],
],
],
'having' => [],
],
],
'match' => ['name'],
],
],
[
'name' => 'SavedSearch_SavedSearch_Contact_Category_Counts_SearchDisplay_Category_counts',
'entity' => 'SearchDisplay',
'cleanup' => 'unused',
'update' => 'unmodified',
'params' => [
'version' => 4,
'values' => [
'name' => 'Category_counts',
'label' => E::ts('Category counts'),
'saved_search_id.name' => 'SavedSearch_Contact_Category_Counts',
'type' => 'table',
'settings' => [
'description' => E::ts('Shows a list of all categories and how many contacts are in each one.'),
'sort' => [
['label', 'ASC'],
],
'limit' => 50,
'pager' => FALSE,
'placeholder' => 0,
'columns' => [
[
'type' => 'field',
'key' => 'label',
'dataType' => 'String',
'label' => E::ts('Category'),
'sortable' => TRUE,
'rewrite' => '',
'icons' => [
[
'field' => 'icon',
'side' => 'left',
],
[
'field' => 'icon',
'side' => 'left',
],
],
'cssRules' => [],
],
[
'type' => 'field',
'key' => 'COUNT_ContactCategoryDefinition_ContactCategory_category_definition_id_01_id',
'dataType' => 'Integer',
'label' => E::ts('Count'),
'sortable' => TRUE,
'alignment' => 'text-right',
],
],
'actions' => FALSE,
'classes' => ['table', 'table-striped'],
],
],
'match' => [
'saved_search_id',
'name',
],
],
],
];