mirror of
https://codeberg.org/artfulrobot/contactcats.git
synced 2025-06-25 09:48:05 +02:00
SK/FB work
This commit is contained in:
parent
16f2b6235d
commit
a4c9251f5e
10 changed files with 163 additions and 233 deletions
|
@ -24,6 +24,11 @@ class Processor {
|
|||
->addOrderBy('execution_order')
|
||||
->execute()->getArrayCopy();
|
||||
|
||||
// Check the last item is the 'default' one.
|
||||
if ((end($this->categories)['search_type'] ?? '') !== 'default') {
|
||||
throw new CRM_Core_Exception("ContactCategoryDefinition unconfigured; no default category.");
|
||||
}
|
||||
|
||||
// Identify groups and searches used by definitions.
|
||||
$groupIDs = $searchIDs = [];
|
||||
foreach ($this->categories as $cat) {
|
||||
|
@ -72,8 +77,10 @@ class Processor {
|
|||
// TODO: check things like searches that group by contact_id
|
||||
}
|
||||
|
||||
/**
|
||||
* Main calling point.
|
||||
*/
|
||||
public function run() {
|
||||
|
||||
$this->refreshSmartGroups();
|
||||
$summary = [];
|
||||
\CRM_Core_Transaction::create()->run(function($tx) use (&$summary) {
|
||||
|
@ -85,6 +92,12 @@ class Processor {
|
|||
elseif ($cat['search_type'] === 'search') {
|
||||
$this->assignCategoryFromSearch($cat);
|
||||
}
|
||||
elseif ($cat['search_type'] === 'default') {
|
||||
$this->assignDefaultCategory($cat);
|
||||
}
|
||||
else {
|
||||
throw new CRM_Core_DAO("Invalid search_type: $cat[search_type] for category $cat[id]");
|
||||
}
|
||||
// future...
|
||||
}
|
||||
$summary = $this->createChangeActivities();
|
||||
|
@ -96,10 +109,10 @@ class Processor {
|
|||
protected function createChangeActivities() {
|
||||
Civi::log()->debug("Calculate changes", ['=' => 'timed', '=start' => "changes"]);
|
||||
$changes = CRM_Core_DAO::executeQuery(<<<SQL
|
||||
SELECT id, category, next_category
|
||||
SELECT id, category_definition_id, next_category
|
||||
FROM civicrm_contact_category
|
||||
WHERE next_category <> category
|
||||
ORDER BY category, next_category
|
||||
WHERE next_category <> category_definition_id
|
||||
ORDER BY category_definition_id, next_category
|
||||
SQL);
|
||||
$lastChange = [0, 0];
|
||||
$batch = [];
|
||||
|
@ -147,10 +160,11 @@ class Processor {
|
|||
|
||||
Civi::log()->debug('Apply changes', ['=change' => 'applyChanges', '=timed' => 1]);
|
||||
CRM_Core_DAO::executeQuery("UPDATE civicrm_contact_category
|
||||
SET category = next_category WHERE category <> next_category")->free();
|
||||
SET category_definition_id = next_category
|
||||
WHERE category_definition_id IS NULL OR category_definition_id <> next_category")->free();
|
||||
Civi::log()->debug('', ['=pop' => 1]);
|
||||
|
||||
$summary = CRM_Core_DAO::executeQuery("SELECT next_category, count(*) from civicrm_contact_category group by next_category")->fetchAll();
|
||||
$summary = CRM_Core_DAO::executeQuery("SELECT next_category, count(*) from civicrm_contact_category GROUP BY next_category")->fetchAll();
|
||||
$summary['changes'] = $n;
|
||||
$_ = memory_get_peak_usage(TRUE);
|
||||
$summary['memory_use'] = @round($_ / pow(1024, ($i = floor(log($_, 1024)))), 2) . ' ' . ['b', 'kb', 'mb', 'gb', 'tb', 'pb'][$i];
|
||||
|
@ -176,12 +190,14 @@ class Processor {
|
|||
Civi::log()->debug('Resetting table', ['=' => 'start,timed']);
|
||||
// clear out temp space.
|
||||
CRM_Core_DAO::executeQuery("UPDATE civicrm_contact_category SET next_category = 0;")->free();
|
||||
Civi::log()->debug('Resetting table stage 2');
|
||||
// ensure we have all our contacts covered.
|
||||
// TODO: is it quicker to do a WHERE NOT EXISTS?
|
||||
// Q: is it quicker to do a WHERE NOT EXISTS? A: nope.
|
||||
CRM_Core_DAO::executeQuery(<<<SQL
|
||||
INSERT IGNORE INTO civicrm_contact_category
|
||||
SELECT id, id contact_id, 0 as category, 0 next_category
|
||||
INSERT INTO civicrm_contact_category
|
||||
SELECT id, id contact_id, NULL as category_definition_id, 0 next_category
|
||||
FROM civicrm_contact
|
||||
WHERE NOT EXISTS (SELECT id FROM civicrm_contact_category WHERE id = civicrm_contact.id)
|
||||
SQL)->free();
|
||||
Civi::log()->debug('', ['=' => 'pop']);
|
||||
}
|
||||
|
@ -205,6 +221,7 @@ class Processor {
|
|||
WHERE next_category = 0
|
||||
SQL;
|
||||
CRM_Core_DAO::executeQuery($sql)->free();
|
||||
Civi::log()->debug('', ['=' => 'pop']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -212,6 +229,7 @@ class Processor {
|
|||
*/
|
||||
protected function assignCategoryFromSearch(array $cat) {
|
||||
$search = $this->searchDetails[$cat['search_data']['saved_search_id']];
|
||||
Civi::log()->debug("Doing $cat[id] $cat[label]", ['=' => 'timed', '=start' => "ss" . $cat['search_data']['saved_search_id']]);
|
||||
|
||||
$apiParams = $search['api_params'];
|
||||
if ($search['api_entity'] === 'Contact' && in_array('id', $apiParams['select'] ?? [])) {
|
||||
|
@ -225,7 +243,7 @@ class Processor {
|
|||
// We don't need them ordered.
|
||||
unset($apiParams['orderBy']);
|
||||
|
||||
$contactIDs = civicrm_api4($search['api_entity'], $search['get'], $apiParams)->column($contactIdKey);
|
||||
$contactIDs = civicrm_api4($search['api_entity'], 'get', $apiParams)->column($contactIdKey);
|
||||
// Unsure if this batching is needed
|
||||
$batchSize = 10000;
|
||||
while ($batch = array_splice($contactIDs, 0, $batchSize)) {
|
||||
|
@ -241,6 +259,12 @@ class Processor {
|
|||
SQL;
|
||||
CRM_Core_DAO::executeQuery($sql)->free();
|
||||
}
|
||||
Civi::log()->debug('', ['=' => 'pop']);
|
||||
}
|
||||
|
||||
protected function assignDefaultCategory(array $cat) {
|
||||
$id = (int) $cat['id'];
|
||||
CRM_Core_DAO::executeQuery("UPDATE civicrm_contact_category SET next_category = $id WHERE next_category = 0;")->free();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<div af-fieldset="" af-title="Contacts by Category">
|
||||
<af-field name="Contact_ContactCategory_contact_id_01.category" defn="{input_attrs: {multiple: true}}" />
|
||||
<af-field name="contact_sub_type" defn="{input_attrs: {multiple: true}}" />
|
||||
<div af-fieldset="">
|
||||
<div class="af-container af-layout-inline af-container-style-pane" af-title="Filters">
|
||||
<af-field name="Contact_ContactCategory_contact_id_01.category_definition_id" defn="{search_operator: 'IN', input_attrs: {autoOpen: true, multiple: true}, security: 'FBAC', label: 'Category'}" />
|
||||
<af-field name="display_name" defn="{search_operator: 'CONTAINS', input_attrs: {}, label: 'Name'}" />
|
||||
</div>
|
||||
<crm-search-display-table search-name="Contacts_by_category" display-name="Contacts_by_category_Table_1"></crm-search-display-table>
|
||||
</div>
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
{
|
||||
"type": "search",
|
||||
"requires": null,
|
||||
"entity_type": null,
|
||||
"join_entity": null,
|
||||
"title": "Contacts by category",
|
||||
"description": "Individuals only",
|
||||
"placement": [],
|
||||
"summary_contact_type": null,
|
||||
"summary_weight": null,
|
||||
"icon": "fa-tags",
|
||||
"server_route": "civicrm/contact/search/category",
|
||||
"is_public": false,
|
||||
"permission": [
|
||||
"access CiviCRM"
|
||||
],
|
||||
"permission_operator": "AND",
|
||||
"redirect": null,
|
||||
"submit_enabled": true,
|
||||
"submit_limit": null,
|
||||
"create_submission": false,
|
||||
"manual_processing": false,
|
||||
"allow_verification_by_email": false,
|
||||
"email_confirmation_template_id": null,
|
||||
"navigation": {
|
||||
"parent": "Search",
|
||||
"label": "Contacts by category",
|
||||
"weight": 0
|
||||
},
|
||||
"modified_date": "2024-02-28 16:59:26",
|
||||
"requires": null,
|
||||
"entity_type": null,
|
||||
"join_entity": null,
|
||||
"summary_contact_type": null,
|
||||
"summary_weight": null,
|
||||
"is_public": false,
|
||||
"redirect": null,
|
||||
"submit_enabled": true,
|
||||
"submit_limit": null,
|
||||
"create_submission": null,
|
||||
"manual_processing": null,
|
||||
"allow_verification_by_email": null,
|
||||
"email_confirmation_template_id": null
|
||||
"modified_date": "2025-02-25 14:51:17"
|
||||
}
|
||||
|
|
|
@ -26,7 +26,21 @@
|
|||
ctrl.moveIdx = null;
|
||||
ctrl.categoryToEdit = null;
|
||||
ctrl.categoryDefinitions = null;
|
||||
ctrl.categoryDefinitions = await crmApi4("ContactCategoryDefinition", 'get', { orderBy: { label: 'ASC' }, withLabels: true });
|
||||
ctrl.categoryDefinitions = await crmApi4("ContactCategoryDefinition", 'get', { orderBy: { execution_order: 'ASC' }, withLabels: true });
|
||||
// Ensure we have the minimum of what we need.
|
||||
if (!ctrl.categoryDefinitions.find(c => c.search_type === 'default')) {
|
||||
// There's no default one.
|
||||
ctrl.categoryDefinitions.push({
|
||||
id: 0,
|
||||
execution_order: ctrl.categoryDefinitions.length,
|
||||
label: '9999 ' + ts('Other'),
|
||||
search_type: 'default',
|
||||
search_data: {},
|
||||
color: '#666666',
|
||||
icon: 'fa-person-circle-question',
|
||||
description: ts('Any contact not matching any of the categories is assigned this category.'),
|
||||
})
|
||||
}
|
||||
updateOrders();
|
||||
console.log("Got", ctrl.categoryDefinitions);
|
||||
|
||||
|
@ -89,7 +103,7 @@
|
|||
ctrl.categoryDefinitions.splice(idx, 0, item);
|
||||
ctrl.moveIdx = null;
|
||||
updateOrders();
|
||||
$ctrl.dirty = 'dirty';
|
||||
ctrl.dirty = 'dirty';
|
||||
};
|
||||
|
||||
ctrl.deleteCategory = idx => {
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<button ng-if="$ctrl.moveIdx === null && row.deleted" ng-click="row.deleted = false;$ctrl.dirty = 'dirty';">
|
||||
<i class="fa-trash crm-i"></i> {{ts('Un-Delete')}}
|
||||
</button>
|
||||
<button ng-if="$ctrl.moveIdx === null && !row.deleted" ng-click="$ctrl.moveIdx = idx"
|
||||
<button ng-if="$ctrl.moveIdx === null && !row.deleted && row.search_type !== 'default'" ng-click="$ctrl.moveIdx = idx"
|
||||
class="btn"
|
||||
ng-disabled="$ctrl.categoryDefinitions.length === 1"
|
||||
>
|
||||
|
@ -48,7 +48,7 @@
|
|||
<i class="fa-circle-xmark crm-i"></i> {{ts('Cancel Move')}}
|
||||
</button>
|
||||
<button ng-click="$ctrl.moveTo(idx+1)" ng-show="$ctrl.moveIdx !== null && (idx === 0 && $ctrl.moveIdx > 0)" ><i class="fa-sort-up crm-i" ></i>{{ts('Before this')}}</button>
|
||||
<button ng-click="$ctrl.moveTo(idx+1)" ng-show="$ctrl.moveIdx !== null && (idx + 1 < $ctrl.moveIdx || idx > $ctrl.moveIdx)"><i class="fa-sort-down crm-i" ></i>{{ts('After this')}}</button>
|
||||
<button ng-click="$ctrl.moveTo(idx+1)" ng-show="$ctrl.moveIdx !== null && row.search_type !== 'default' && (idx + 1 < $ctrl.moveIdx || idx > $ctrl.moveIdx)"><i class="fa-sort-down crm-i" ></i>{{ts('After this')}}</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -102,66 +102,66 @@
|
|||
/>
|
||||
</div>
|
||||
|
||||
<div crm-ui-field="{name: 'cc.color', title: ts('Color')}" >
|
||||
<input
|
||||
crm-ui-id="ci.color"
|
||||
name="color"
|
||||
type="color"
|
||||
ng-model="$ctrl.categoryToEdit.color"
|
||||
class="crm-form-color"
|
||||
/>
|
||||
</div>
|
||||
<div crm-ui-field="{name: 'cc.color', title: ts('Color')}" >
|
||||
<input
|
||||
crm-ui-id="ci.color"
|
||||
name="color"
|
||||
type="color"
|
||||
ng-model="$ctrl.categoryToEdit.color"
|
||||
class="crm-form-color"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div crm-ui-field="{name: 'cc.icon', title: ts('Icon')}" >
|
||||
<input
|
||||
crm-ui-id="cc.icon"
|
||||
crm-ui-icon-picker
|
||||
ng-model="$ctrl.categoryToEdit.icon"
|
||||
/>
|
||||
</div>
|
||||
<div crm-ui-field="{name: 'cc.icon', title: ts('Icon')}" >
|
||||
<!-- this seems buggy, doesn't update to show the icon given. -->
|
||||
<input
|
||||
crm-ui-id="cc.icon"
|
||||
crm-ui-icon-picker
|
||||
ng-model="$ctrl.categoryToEdit.icon"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div crm-ui-field="{name: 'cc.description', title: ts('Description')}" >
|
||||
<input
|
||||
crm-ui-id="ci.description"
|
||||
name="description"
|
||||
ng-model="$ctrl.categoryToEdit.description"
|
||||
class="crm-form-textarea"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</div>
|
||||
<div crm-ui-field="{name: 'cc.description', title: ts('Description')}" >
|
||||
<input
|
||||
crm-ui-id="ci.description"
|
||||
name="description"
|
||||
ng-model="$ctrl.categoryToEdit.description"
|
||||
class="crm-form-textarea"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div crm-ui-field="{name: 'cc.search_type', title: ts('How are contacts identified?')}" >
|
||||
<select
|
||||
crm-ui-id="ci.search_type"
|
||||
name="search_type"
|
||||
ng-model="$ctrl.categoryToEdit.search_type"
|
||||
ng-change="$ctrl.fixSearchData()"
|
||||
>
|
||||
<option value="search" >{{ts('Search Kit search')}}</option>
|
||||
<option value="group" >{{ts('Group')}}</option>
|
||||
<!-- future? <option value="sql_template" >{{ts('SQL template')}}</option> -->
|
||||
</select>
|
||||
</div>
|
||||
<div ng-if="cc.search_type !== 'default'" crm-ui-field="{name: 'cc.search_type', title: ts('How are contacts identified?')}" >
|
||||
<select
|
||||
crm-ui-id="ci.search_type"
|
||||
name="search_type"
|
||||
ng-model="$ctrl.categoryToEdit.search_type"
|
||||
ng-change="$ctrl.fixSearchData()"
|
||||
>
|
||||
<option value="search" >{{ts('Search Kit search')}}</option>
|
||||
<option value="group" >{{ts('Group')}}</option>
|
||||
<!-- future? <option value="sql_template" >{{ts('SQL template')}}</option> -->
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- fields for search kit -->
|
||||
<div ng-if="$ctrl.categoryToEdit.search_type === 'search'" crm-ui-field="{name:'cc.saved_search_id', title: ts('Search Kit search')}" >
|
||||
<input crm-ui-id='cc.saved_search_id' crm-entityref="{entity: 'SavedSearch', select: {allowClear:false}}"
|
||||
ng-model="$ctrl.categoryToEdit.search_data.saved_search_id" />
|
||||
</div>
|
||||
<!-- fields for search kit -->
|
||||
<div ng-if="$ctrl.categoryToEdit.search_type === 'search'" crm-ui-field="{name:'cc.saved_search_id', title: ts('Search Kit search')}" >
|
||||
<input crm-ui-id='cc.saved_search_id' crm-entityref="{entity: 'SavedSearch', select: {allowClear:false}}"
|
||||
ng-model="$ctrl.categoryToEdit.search_data.saved_search_id" />
|
||||
</div>
|
||||
|
||||
<!-- fields for groups -->
|
||||
<div ng-if="$ctrl.categoryToEdit.search_type === 'group'" crm-ui-field="{name:'cc.group_id', title: ts('Group')}" >
|
||||
<input crm-ui-id='cc.group_id' crm-entityref="{entity: 'Group', select: {allowClear:false}}"
|
||||
ng-model="$ctrl.categoryToEdit.search_data.group_id" />
|
||||
</div>
|
||||
<!-- fields for groups -->
|
||||
<div ng-if="$ctrl.categoryToEdit.search_type === 'group'" crm-ui-field="{name:'cc.group_id', title: ts('Group')}" >
|
||||
<input crm-ui-id='cc.group_id' crm-entityref="{entity: 'Group', select: {allowClear:false}}"
|
||||
ng-model="$ctrl.categoryToEdit.search_data.group_id" />
|
||||
</div>
|
||||
|
||||
|
||||
<!-- type=button means when you hit Enter in an input above this button is skipped while it looks for the first submit button. -->
|
||||
<button type=button ng-click="$ctrl.view = 'list'"
|
||||
class="btn btn-secondary"
|
||||
>Cancel</button>
|
||||
<button ng-click="$ctrl.updateEditedThing()" >Done</button>
|
||||
|
||||
<!-- type=button means when you hit Enter in an input above this button is skipped while it looks for the first submit button. -->
|
||||
<button type=button ng-click="$ctrl.view = 'list'"
|
||||
class="btn btn-secondary"
|
||||
>Cancel</button>
|
||||
<button ng-click="$ctrl.updateEditedThing()" >Done</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
use CRM_Contactcats_ExtensionUtil as E;
|
||||
|
||||
return [
|
||||
[
|
||||
'name' => 'OptionValue_changed_contact_category',
|
||||
'entity' => 'OptionValue',
|
||||
'cleanup' => 'unused',
|
||||
'update' => 'unmodified',
|
||||
'params' => [
|
||||
'version' => 4,
|
||||
'values' => [
|
||||
'option_group_id.name' => 'activity_type',
|
||||
'label' => E::ts('Changed Contact Category'),
|
||||
'name' => 'changed_contact_category',
|
||||
'icon' => 'fa-tags',
|
||||
],
|
||||
'match' => [
|
||||
'option_group_id',
|
||||
'name',
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
|
@ -1,83 +0,0 @@
|
|||
<?php
|
||||
use CRM_Contactcats_ExtensionUtil as E;
|
||||
|
||||
return [
|
||||
[
|
||||
'name' => 'SavedSearch_Contact_Category_Summary',
|
||||
'entity' => 'SavedSearch',
|
||||
'cleanup' => 'always',
|
||||
'update' => 'unmodified',
|
||||
'params' => [
|
||||
'version' => 4,
|
||||
'values' => [
|
||||
'name' => 'Contact_Category_Summary',
|
||||
'label' => E::ts('Contact Category Summary'),
|
||||
'api_entity' => 'ContactCategory',
|
||||
'api_params' => [
|
||||
'version' => 4,
|
||||
'select' => [
|
||||
'category:label',
|
||||
'COUNT(contact_id) AS COUNT_contact_id',
|
||||
],
|
||||
'orderBy' => [],
|
||||
'where' => [],
|
||||
'groupBy' => [
|
||||
'category',
|
||||
],
|
||||
'join' => [],
|
||||
'having' => [],
|
||||
],
|
||||
],
|
||||
'match' => [
|
||||
'name',
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'SavedSearch_Contact_Category_Summary_SearchDisplay_Contact_Category_Summary',
|
||||
'entity' => 'SearchDisplay',
|
||||
'cleanup' => 'always',
|
||||
'update' => 'unmodified',
|
||||
'params' => [
|
||||
'version' => 4,
|
||||
'values' => [
|
||||
'name' => 'Contact_Category_Summary',
|
||||
'label' => E::ts('Contact Category Summary'),
|
||||
'saved_search_id.name' => 'Contact_Category_Summary',
|
||||
'type' => 'table',
|
||||
'settings' => [
|
||||
'description' => NULL,
|
||||
'sort' => [],
|
||||
'limit' => 0,
|
||||
'pager' => FALSE,
|
||||
'placeholder' => 5,
|
||||
'columns' => [
|
||||
[
|
||||
'type' => 'field',
|
||||
'key' => 'category:label',
|
||||
'dataType' => 'Integer',
|
||||
'label' => E::ts('Category'),
|
||||
'sortable' => TRUE,
|
||||
],
|
||||
[
|
||||
'type' => 'field',
|
||||
'key' => 'COUNT_contact_id',
|
||||
'dataType' => 'Integer',
|
||||
'label' => E::ts('Count'),
|
||||
'sortable' => TRUE,
|
||||
],
|
||||
],
|
||||
'actions' => TRUE,
|
||||
'classes' => [
|
||||
'table',
|
||||
'table-striped',
|
||||
],
|
||||
],
|
||||
],
|
||||
'match' => [
|
||||
'saved_search_id',
|
||||
'name',
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
|
@ -19,11 +19,7 @@ return [
|
|||
'id',
|
||||
'contact_sub_type:label',
|
||||
'display_name',
|
||||
'Contact_ContactCategory_contact_id_01.category:label',
|
||||
'Synopsis_Fields.Amount_of_last_contribution',
|
||||
'Synopsis_Fields.Date_of_Last_Contribution',
|
||||
'Synopsis_Fields.Total_Lifetime_Contributions',
|
||||
'Synopsis_Fields.Total_count_of_contributions',
|
||||
'Contact_ContactCategory_contact_id_01_ContactCategory_ContactCategoryDefinition_category_definition_id_01.label',
|
||||
],
|
||||
'orderBy' => [],
|
||||
'where' => [
|
||||
|
@ -43,6 +39,25 @@ return [
|
|||
'=',
|
||||
'Contact_ContactCategory_contact_id_01.contact_id',
|
||||
],
|
||||
[
|
||||
'Contact_ContactCategory_contact_id_01.id',
|
||||
'=',
|
||||
'id',
|
||||
],
|
||||
],
|
||||
[
|
||||
'ContactCategoryDefinition AS Contact_ContactCategory_contact_id_01_ContactCategory_ContactCategoryDefinition_category_definition_id_01',
|
||||
'INNER',
|
||||
[
|
||||
'Contact_ContactCategory_contact_id_01.category_definition_id',
|
||||
'=',
|
||||
'Contact_ContactCategory_contact_id_01_ContactCategory_ContactCategoryDefinition_category_definition_id_01.id',
|
||||
],
|
||||
[
|
||||
'Contact_ContactCategory_contact_id_01_ContactCategory_ContactCategoryDefinition_category_definition_id_01.id',
|
||||
'=',
|
||||
'Contact_ContactCategory_contact_id_01.category_definition_id',
|
||||
],
|
||||
],
|
||||
],
|
||||
'having' => [],
|
||||
|
@ -77,13 +92,6 @@ return [
|
|||
'pager' => [],
|
||||
'placeholder' => 5,
|
||||
'columns' => [
|
||||
[
|
||||
'type' => 'field',
|
||||
'key' => 'Contact_ContactCategory_contact_id_01.category:label',
|
||||
'dataType' => 'Integer',
|
||||
'label' => E::ts('Category'),
|
||||
'sortable' => TRUE,
|
||||
],
|
||||
[
|
||||
'type' => 'field',
|
||||
'key' => 'display_name',
|
||||
|
@ -108,34 +116,10 @@ return [
|
|||
],
|
||||
[
|
||||
'type' => 'field',
|
||||
'key' => 'Synopsis_Fields.Total_Lifetime_Contributions',
|
||||
'dataType' => 'Money',
|
||||
'label' => E::ts('£ total'),
|
||||
'key' => 'Contact_ContactCategory_contact_id_01_ContactCategory_ContactCategoryDefinition_category_definition_id_01.label',
|
||||
'dataType' => 'String',
|
||||
'label' => E::ts('Category'),
|
||||
'sortable' => TRUE,
|
||||
'alignment' => 'text-right',
|
||||
],
|
||||
[
|
||||
'type' => 'field',
|
||||
'key' => 'Synopsis_Fields.Total_count_of_contributions',
|
||||
'dataType' => 'Integer',
|
||||
'label' => E::ts('Count donations'),
|
||||
'sortable' => TRUE,
|
||||
'alignment' => 'text-right',
|
||||
],
|
||||
[
|
||||
'type' => 'field',
|
||||
'key' => 'Synopsis_Fields.Date_of_Last_Contribution',
|
||||
'dataType' => 'Timestamp',
|
||||
'label' => E::ts('Latest donation'),
|
||||
'sortable' => TRUE,
|
||||
],
|
||||
[
|
||||
'type' => 'field',
|
||||
'key' => 'Synopsis_Fields.Amount_of_last_contribution',
|
||||
'dataType' => 'Money',
|
||||
'label' => E::ts('£ latest'),
|
||||
'sortable' => TRUE,
|
||||
'alignment' => 'text-right',
|
||||
],
|
||||
],
|
||||
'actions' => TRUE,
|
||||
|
@ -143,9 +127,11 @@ return [
|
|||
'table-striped',
|
||||
],
|
||||
'headerCount' => TRUE,
|
||||
'actions_display_mode' => 'menu',
|
||||
],
|
||||
],
|
||||
'match' => [
|
||||
'saved_search_id',
|
||||
'name',
|
||||
],
|
||||
],
|
||||
|
|
|
@ -46,14 +46,22 @@ return [
|
|||
'category_definition_id' => [
|
||||
'title' => E::ts('Category Definition'),
|
||||
'sql_type' => 'int unsigned',
|
||||
'required' => TRUE,
|
||||
'default' => 0,
|
||||
'input_type' => 'EntityRef',
|
||||
'required' => FALSE,
|
||||
'default' => NULL,
|
||||
// 'input_type' => 'EntityRef',
|
||||
'input_type' => 'Select',
|
||||
'entity_reference' => [
|
||||
'entity' => 'ContactCategoryDefinition',
|
||||
'key' => 'id',
|
||||
'on_delete' => 'CASCADE',
|
||||
],
|
||||
'pseudoconstant' => [
|
||||
'prefetch' => TRUE,
|
||||
'table' => 'civicrm_contact_category_definition',
|
||||
'key_column' => 'id',
|
||||
'label_column' => 'label',
|
||||
'name_column' => 'id',
|
||||
],
|
||||
],
|
||||
'next_category' => [
|
||||
'title' => E::ts('Next Category'),
|
||||
|
|
|
@ -10,6 +10,8 @@ return [
|
|||
'title_plural' => E::ts('Contact Category Definitions'),
|
||||
'description' => E::ts('Holds definition of a "Contact category"'),
|
||||
'log' => FALSE,
|
||||
'label_field' => 'label',
|
||||
'icon' => 'fa-tags',
|
||||
],
|
||||
'getFields' => fn() => [
|
||||
'id' => [
|
||||
|
@ -42,6 +44,7 @@ return [
|
|||
// 'name' => 'title',
|
||||
'search' => E::ts('Search Kit search'),
|
||||
'group' => E::ts('Group'),
|
||||
'default' => E::ts('Default category'),
|
||||
// Future:
|
||||
// 'sql' => E::ts('SQL template'),
|
||||
],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue