mirror of
https://codeberg.org/artfulrobot/contactcats.git
synced 2025-06-26 01:38:04 +02:00
checkin (broken)
This commit is contained in:
parent
a01abba787
commit
06fec5daf7
21 changed files with 2025 additions and 376 deletions
67
schema/ContactCategory.entityType.php
Normal file
67
schema/ContactCategory.entityType.php
Normal file
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
use CRM_Contactcats_ExtensionUtil as E;
|
||||
|
||||
return [
|
||||
'name' => 'ContactCategory',
|
||||
'table' => 'civicrm_contact_category',
|
||||
'class' => 'CRM_Contactcats_DAO_ContactCategory',
|
||||
'getInfo' => fn() => [
|
||||
'title' => E::ts('Contact Category'),
|
||||
'title_plural' => E::ts('Contact Categories'),
|
||||
'description' => E::ts('Stores a category for each contact'),
|
||||
'log' => FALSE,
|
||||
],
|
||||
'getIndices' => fn() => [
|
||||
'index_category' => [
|
||||
'fields' => [
|
||||
'category' => TRUE,
|
||||
],
|
||||
],
|
||||
],
|
||||
'getFields' => fn() => [
|
||||
'id' => [
|
||||
'title' => E::ts('ID'),
|
||||
'sql_type' => 'int unsigned',
|
||||
'input_type' => 'Number',
|
||||
'required' => TRUE,
|
||||
'description' => E::ts('Unique ID, corresponds to contact id'),
|
||||
'primary_key' => TRUE,
|
||||
'auto_increment' => TRUE,
|
||||
],
|
||||
'contact_id' => [
|
||||
'title' => E::ts('Contact ID'),
|
||||
'sql_type' => 'int unsigned',
|
||||
'input_type' => 'EntityRef',
|
||||
'required' => TRUE,
|
||||
'description' => E::ts('Same as id but for FormBuilder'),
|
||||
'input_attrs' => [
|
||||
'label' => E::ts('Contact'),
|
||||
],
|
||||
'entity_reference' => [
|
||||
'entity' => 'Contact',
|
||||
'key' => 'id',
|
||||
'on_delete' => 'CASCADE',
|
||||
],
|
||||
],
|
||||
'category' => [
|
||||
'title' => E::ts('Category'),
|
||||
'sql_type' => 'int unsigned',
|
||||
'input_type' => 'Select',
|
||||
'required' => TRUE,
|
||||
'default' => 0,
|
||||
'pseudoconstant' => [
|
||||
'option_group_name' => 'contact_categories',
|
||||
],
|
||||
],
|
||||
'next_category' => [
|
||||
'title' => E::ts('Next Category'),
|
||||
'sql_type' => 'int unsigned',
|
||||
'input_type' => 'Select',
|
||||
'required' => TRUE,
|
||||
'default' => 0,
|
||||
'pseudoconstant' => [
|
||||
'option_group_name' => 'contact_categories',
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
85
schema/ContactCategoryDescription.entityType.php
Normal file
85
schema/ContactCategoryDescription.entityType.php
Normal file
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
use CRM_Contactcats_ExtensionUtil as E;
|
||||
|
||||
return [
|
||||
'name' => 'ContactCategoryDescription',
|
||||
'table' => 'civicrm_contact_category_description',
|
||||
'class' => 'CRM_Contactcats_DAO_ContactCategoryDescription',
|
||||
'getInfo' => fn() => [
|
||||
'title' => E::ts('Contact Category Description'),
|
||||
'title_plural' => E::ts('Contact Category Descriptions'),
|
||||
'description' => E::ts('Holds definition of a "Contact category"'),
|
||||
'log' => FALSE,
|
||||
],
|
||||
'getIndices' => fn() => [
|
||||
'index_category' => [
|
||||
'fields' => [
|
||||
'category' => TRUE,
|
||||
],
|
||||
],
|
||||
],
|
||||
'getFields' => fn() => [
|
||||
'id' => [
|
||||
'title' => E::ts('ID'),
|
||||
'sql_type' => 'int unsigned',
|
||||
'input_type' => 'Number',
|
||||
'required' => TRUE,
|
||||
'description' => E::ts('Unique Contact Category Description ID'),
|
||||
'primary_key' => TRUE,
|
||||
'auto_increment' => TRUE,
|
||||
],
|
||||
'label' => [
|
||||
'title' => E::ts('Category name'),
|
||||
'sql_type' => 'varchar(255)',
|
||||
'input_type' => 'Text',
|
||||
'required' => TRUE,
|
||||
'description' => E::ts('Same as id but for FormBuilder'),
|
||||
'input_attrs' => [
|
||||
'text_length' => 255,
|
||||
'label' => E::ts('Category name'),
|
||||
],
|
||||
],
|
||||
'search_type' => [
|
||||
'title' => E::ts('What defines this search?'),
|
||||
'sql_type' => 'varchar(12)',
|
||||
'input_type' => 'Select',
|
||||
'required' => TRUE,
|
||||
'default' => 'search',
|
||||
'pseudoconstant' => [
|
||||
'callback' => fn() => [
|
||||
// 'name' => 'title',
|
||||
'search' => E::ts('Search Kit search'),
|
||||
'group' => E::ts('Group'),
|
||||
// Future:
|
||||
// 'sql' => E::ts('SQL template'),
|
||||
],
|
||||
],
|
||||
],
|
||||
'search_data' => [
|
||||
'title' => E::ts('JSON blob specifies particulars to for the search_type'),
|
||||
'description' => E::ts('Holds data specific to the search specification (e.g. a group ID when Group is selected).'),
|
||||
'sql_type' => 'text',
|
||||
'serialize' => 'JSON',
|
||||
],
|
||||
'color' => [
|
||||
'title' => E::ts('Colour for category label'),
|
||||
'sql_type' => 'varchar(7)',
|
||||
'default' => '',
|
||||
'required' => TRUE,
|
||||
],
|
||||
'icon' => [
|
||||
'title' => E::ts('Icon'),
|
||||
'sql_type' => 'varchar(64)',
|
||||
'default' => '',
|
||||
'required' => TRUE,
|
||||
'description' => E::ts('The name of a Font Awesome icon to use to represent this, e.g. fa-trophy'),
|
||||
],
|
||||
'execution_order' => [
|
||||
'title' => E::ts('Execution order'),
|
||||
'description' => E::ts('The first category to match is assigned. Lower numbers are tested first.'),
|
||||
'sql_type' => 'tinyint unsigned',
|
||||
'default' => '10',
|
||||
'required' => TRUE,
|
||||
],
|
||||
],
|
||||
];
|
Loading…
Add table
Add a link
Reference in a new issue