'bao' => 'CRM_Activity_BAO_Activity',
'localizable' => 0,
'FKClassName' => 'CRM_Core_DAO_Phone',
+ 'deprecated' => TRUE,
'html' => [
'type' => 'EntityRef',
'label' => ts("Phone (called)"),
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
'localizable' => 0,
+ 'deprecated' => TRUE,
'html' => [
'type' => 'Text',
],
'bao' => 'CRM_Activity_BAO_Activity',
'localizable' => 0,
'FKClassName' => 'CRM_Contact_DAO_Relationship',
+ 'deprecated' => TRUE,
'html' => [
'label' => ts("Relationship"),
],
'entity' => 'Activity',
'bao' => 'CRM_Activity_BAO_Activity',
'localizable' => 0,
+ 'deprecated' => TRUE,
'add' => '2.2',
],
'original_id' => [
'bao' => 'CRM_Activity_BAO_Activity',
'localizable' => 0,
'FKClassName' => 'CRM_Activity_DAO_Activity',
+ 'deprecated' => TRUE,
'html' => [
'label' => ts("Original Activity"),
],
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
'localizable' => 0,
+ 'deprecated' => TRUE,
'html' => [
'type' => 'Select',
'label' => ts("Preferred Mail Format"),
'entity' => 'Contact',
'bao' => 'CRM_Contact_BAO_Contact',
'localizable' => 0,
+ 'deprecated' => TRUE,
'html' => [
'type' => 'Text',
],
'entity' => 'Address',
'bao' => 'CRM_Core_BAO_Address',
'localizable' => 0,
+ 'deprecated' => TRUE,
'add' => '1.1',
],
'country_id' => [
'entity' => 'Phone',
'bao' => 'CRM_Core_BAO_Phone',
'localizable' => 0,
+ 'deprecated' => TRUE,
'add' => '1.1',
],
'phone' => [
'description' => 'True for auto-increment, calculated, or otherwise non-editable fields.',
'default_value' => FALSE,
],
+ [
+ 'name' => 'deprecated',
+ 'data_type' => 'Boolean',
+ 'default_value' => FALSE,
+ ],
[
'name' => 'output_formatters',
'data_type' => 'Array',
*/
public $readonly = FALSE;
+ /**
+ * @var bool
+ */
+ public $deprecated = FALSE;
+
/**
* @var callable[]
*/
return $this;
}
+ /**
+ * @param bool $deprecated
+ * @return $this
+ */
+ public function setDeprecated($deprecated) {
+ $this->deprecated = (bool) $deprecated;
+
+ return $this;
+ }
+
}
$field->setSerialize($data['serialize'] ?? NULL);
$field->setDefaultValue($data['default'] ?? NULL);
$field->setDescription($data['description'] ?? NULL);
+ $field->setDeprecated($data['deprecated'] ?? FALSE);
self::setInputTypeAndAttrs($field, $data, $dataTypeName);
$field->setPermission($data['permission'] ?? NULL);
'loadOptions' => ['id', 'label'],
'action' => 'create',
'select' => ['name', 'label', 'input_type', 'input_attrs', 'required', 'options', 'help_pre', 'help_post', 'serialize', 'data_type', 'entity', 'fk_entity', 'readonly'],
- 'where' => [['input_type', 'IS NOT NULL']],
+ 'where' => [['deprecated', '=', FALSE], ['input_type', 'IS NOT NULL']],
];
if (in_array($entityName, \CRM_Contact_BAO_ContactType::basicTypes(TRUE), TRUE)) {
$params['values']['contact_type'] = $entityName;
->addSelect('name', 'title_plural')
->setChain([
'actions' => ['$name', 'getActions', ['where' => [['name', 'IN', ['update', 'delete']]]], 'name'],
- 'fields' => ['$name', 'getFields', ['where' => [['type', '=', 'Field']]], 'name'],
+ 'fields' => ['$name', 'getFields', ['where' => [['deprecated', '=', FALSE], ['type', '=', 'Field']]], 'name'],
])
->execute()->first();
}
$getFields = civicrm_api4($entity['name'], 'getFields', [
'select' => ['name', 'title', 'label', 'description', 'type', 'options', 'input_type', 'input_attrs', 'data_type', 'serialize', 'entity', 'fk_entity', 'readonly', 'operators', 'suffixes', 'nullable'],
- 'where' => [['name', 'NOT IN', ['api_key', 'hash']]],
+ 'where' => [['deprecated', '=', FALSE], ['name', 'NOT IN', ['api_key', 'hash']]],
'orderBy' => ['label'],
]);
foreach ($getFields as $field) {
action: 'update',
select: ['name', 'label', 'description', 'input_type', 'data_type', 'serialize', 'options', 'fk_entity', 'nullable'],
loadOptions: ['id', 'name', 'label', 'description', 'color', 'icon'],
- where: [["readonly", "=", false]],
+ where: [['deprecated', '=', FALSE], ["readonly", "=", false]],
}).then(function(fields) {
ctrl.fields = fields;
});
$this->assertEquals(['name', 'label'], $fields['campaign_id']['suffixes']);
}
- public function testRequiredAndNullable() {
+ public function testRequiredAndNullableAndDeprecated() {
$actFields = Activity::getFields(FALSE)
->setAction('create')
->execute()->indexBy('name');
$this->assertFalse($actFields['activity_type_id']['nullable']);
$this->assertFalse($actFields['subject']['required']);
$this->assertTrue($actFields['subject']['nullable']);
+ $this->assertFalse($actFields['subject']['deprecated']);
+ $this->assertTrue($actFields['phone_id']['deprecated']);
}
public function testGetSuffixes() {
{if $field.uniqueTitle}
'unique_title' => {$tsFunctionName}('{$field.uniqueTitle}'),
{/if}
+{if $field.deprecated}
+ 'deprecated' => TRUE,
+{/if}
{if $field.html}
'html' => array(
{foreach from=$field.html item=val key=key}