2021-11-11 08:39:18 +00:00
|
|
|
<?php
|
2022-04-03 16:31:00 +00:00
|
|
|
use \Drupal\Core\Field\BaseFieldDefinition;
|
|
|
|
|
2022-05-07 12:56:35 +00:00
|
|
|
function opencase_cases_update_90004() {
|
|
|
|
$field_storage_definition = BaseFieldDefinition::create('string_long')
|
|
|
|
->setRevisionable(TRUE)
|
|
|
|
->setLabel(t('Description'))
|
|
|
|
->setSettings(array(
|
|
|
|
'default_value' => '',
|
|
|
|
'max_length' => 255,
|
|
|
|
'text_processing' => 0,
|
|
|
|
))
|
|
|
|
->setDisplayConfigurable('form', true)
|
|
|
|
->setDisplayConfigurable('view', true);
|
|
|
|
|
|
|
|
|
|
|
|
\Drupal::entityDefinitionUpdateManager()
|
|
|
|
->installFieldStorageDefinition('description', 'oc_case_fee', 'opencase_cases', $field_storage_definition);
|
|
|
|
}
|
|
|
|
|
2022-04-03 16:31:00 +00:00
|
|
|
function opencase_cases_update_90002() {
|
|
|
|
$field_storage_definition = BaseFieldDefinition::create('entity_reference')
|
|
|
|
->setLabel(t('Target'))
|
|
|
|
->setRevisionable(TRUE)
|
|
|
|
->setSetting('target_type', 'oc_actor')
|
|
|
|
->setSetting('handler', 'default')
|
|
|
|
->setDefaultValueCallback('\Drupal\opencase_cases\Entity\OCCase::defaultTarget')
|
|
|
|
->setDisplayConfigurable('form', true)
|
|
|
|
->setDisplayConfigurable('view', true);
|
|
|
|
|
|
|
|
|
|
|
|
\Drupal::entityDefinitionUpdateManager()
|
|
|
|
->installFieldStorageDefinition('oc_target', 'oc_case', 'opencase_cases', $field_storage_definition);
|
|
|
|
}
|
2021-11-11 08:39:18 +00:00
|
|
|
|
|
|
|
function opencase_cases_update_8025() {
|
|
|
|
//check if the table exists first. If not, then create the entity.
|
|
|
|
if(!db_table_exists('oc_case_provision')) {
|
|
|
|
\Drupal::entityTypeManager()->clearCachedDefinitions();
|
|
|
|
\Drupal::entityDefinitionUpdateManager()
|
|
|
|
->installEntityType(\Drupal::entityTypeManager()->getDefinition('oc_case_provision'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function opencase_cases_update_8026() {
|
2022-04-03 16:31:00 +00:00
|
|
|
$storage_definition = BaseFieldDefinition::create('entity_reference')
|
2021-11-11 08:39:18 +00:00
|
|
|
->setLabel(t('Role'))
|
|
|
|
->setSetting('target_type', 'taxonomy_term')
|
|
|
|
->setSetting('handler_settings', ['target_bundles' => ['oc_case_provider_role' => 'oc_case_provider_role']])
|
|
|
|
->setSetting('handler', 'default')
|
|
|
|
->setTranslatable(TRUE)
|
|
|
|
->setCardinality(1)
|
|
|
|
->setDisplayConfigurable("view", true)
|
|
|
|
->setDisplayConfigurable("form", true)
|
|
|
|
->setRequired(FALSE);
|
|
|
|
\Drupal::entityDefinitionUpdateManager()
|
|
|
|
->installFieldStorageDefinition('oc_case_provider_role', 'oc_case_provision', 'oc_case_provision', $storage_definition);
|
|
|
|
}
|
2021-11-11 14:07:13 +00:00
|
|
|
|
|
|
|
function opencase_cases_update_8027() {
|
|
|
|
//check if the table exists first. If not, then create the entity.
|
|
|
|
if(!db_table_exists('oc_case_fee')) {
|
|
|
|
\Drupal::entityTypeManager()->clearCachedDefinitions();
|
|
|
|
\Drupal::entityDefinitionUpdateManager()
|
|
|
|
->installEntityType(\Drupal::entityTypeManager()->getDefinition('oc_case_fee'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function opencase_cases_update_8028() {
|
|
|
|
$storage_definition = \Drupal\Core\Field\BaseFieldDefinition::create('decimal')
|
|
|
|
->setLabel(t('Amount'))
|
|
|
|
->setRevisionable(TRUE)
|
|
|
|
->setSettings([
|
|
|
|
'prefix' => '£',
|
|
|
|
])
|
|
|
|
->SetDisplayConfigurable("form", true)
|
|
|
|
->SetDisplayConfigurable("view", true);
|
|
|
|
\Drupal::entityDefinitionUpdateManager()
|
|
|
|
->installFieldStorageDefinition('amount', 'oc_case_fee', 'oc_case_fee', $storage_definition);
|
|
|
|
$storage_definition = \Drupal\Core\Field\BaseFieldDefinition::create('entity_reference')
|
|
|
|
->setLabel(t('Fee Category'))
|
|
|
|
->setSetting('target_type', 'taxonomy_term')
|
|
|
|
->setSetting('handler_settings', ['target_bundles' => ['oc_fee_category' => 'oc_fee_category']])
|
|
|
|
->setSetting('handler', 'default')
|
|
|
|
->setTranslatable(TRUE)
|
|
|
|
->setCardinality(1)
|
|
|
|
->setDisplayConfigurable("view", true)
|
|
|
|
->setDisplayConfigurable("form", true)
|
|
|
|
->setRequired(FALSE);
|
|
|
|
\Drupal::entityDefinitionUpdateManager()
|
|
|
|
->installFieldStorageDefinition('oc_fee_category', 'oc_case_fee', 'oc_case_fee', $storage_definition);
|
|
|
|
}
|
2021-11-11 15:27:25 +00:00
|
|
|
|
|
|
|
function opencase_cases_update_8029() {
|
|
|
|
$storage_definition = \Drupal\Core\Field\BaseFieldDefinition::create('string_long')
|
|
|
|
->setRevisionable(TRUE)
|
|
|
|
->setLabel(t('Notes'))
|
|
|
|
->setSettings(array(
|
|
|
|
'default_value' => '',
|
|
|
|
'max_length' => 255,
|
|
|
|
'text_processing' => 0,
|
|
|
|
))
|
|
|
|
->setDisplayConfigurable('form', true)
|
|
|
|
->setDisplayConfigurable('view', true);
|
|
|
|
\Drupal::entityDefinitionUpdateManager()
|
|
|
|
->installFieldStorageDefinition('notes', 'oc_case', 'oc_case', $storage_definition);
|
|
|
|
}
|
2021-11-12 09:11:00 +00:00
|
|
|
|
|
|
|
function opencase_cases_update_8030() {
|
|
|
|
$storage_definition = \Drupal\Core\Field\BaseFieldDefinition::create('decimal')
|
|
|
|
->setLabel(t('Total Fee'))
|
|
|
|
->setRevisionable(TRUE)
|
|
|
|
->setSettings([
|
|
|
|
'prefix' => '£',
|
|
|
|
])
|
|
|
|
->SetDisplayConfigurable("view", true);
|
|
|
|
\Drupal::entityDefinitionUpdateManager()
|
|
|
|
->installFieldStorageDefinition('total_fee', 'oc_case', 'oc_case', $storage_definition);
|
|
|
|
}
|