Added full_name field to actors, and made the administer entities permission finer grained
This commit is contained in:
parent
6fbaf433e8
commit
3dd71bf2c0
@ -6,6 +6,14 @@ body {
|
||||
font-size: 1em !important;
|
||||
}
|
||||
|
||||
div[data-drupal-selector=edit-user-bulk-form] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.layout-container {
|
||||
max-width: 95% !important;
|
||||
}
|
||||
|
||||
/* Free the people from the tyranny of the useless search button */
|
||||
#edit-submit-actor-search{
|
||||
display: none;
|
||||
|
7
modules/opencase_cases/opencase_cases.links.menu.yml
Normal file
7
modules/opencase_cases/opencase_cases.links.menu.yml
Normal file
@ -0,0 +1,7 @@
|
||||
opencase_cases.manage_case_types:
|
||||
title: 'Manage case types'
|
||||
description: 'Configure types of cases and their fields'
|
||||
menu_name: opencase
|
||||
parent: opencase.opencase_admin_menu
|
||||
url: internal:/admin/opencase/oc_case_type
|
||||
weight: 2
|
@ -10,7 +10,7 @@ field_name: field_linked_opencase_actor
|
||||
entity_type: user
|
||||
bundle: user
|
||||
label: 'Person in OpenCase'
|
||||
description: 'If this user is also a person in OpenCase (e.g. a staff member or a volunteer), start typing the name here to link them. This will ensure they have access to the right cases.'
|
||||
description: 'If this user is also a person in OpenCase (e.g. a staff member or a volunteer), start typing the name here to link them. This will make their name appear against activities they are involved in.'
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
|
@ -5,9 +5,14 @@ view edit delete all actor entities:
|
||||
title: 'View/Edit/Delete all types of people'
|
||||
description: ''
|
||||
|
||||
administer opencase entity bundles:
|
||||
title: 'Administer OpenCase Actor/Case/Activity Types'
|
||||
description: 'Create, configure and delete types of actor (such as "Client" or "Legal Advisor"), types of case (such as "Housing" or "Asylum") and types of activity (such as "Case Note" or "Interview")'
|
||||
administer actor bundles:
|
||||
title: 'Administer OpenCase Person Types'
|
||||
|
||||
administer case bundles:
|
||||
title: 'Administer OpenCase Case Types'
|
||||
|
||||
administer activity bundles:
|
||||
title: 'Administer OpenCase Activity Types'
|
||||
|
||||
administer actor entities:
|
||||
title: 'Administer Actor entities'
|
||||
@ -45,6 +50,11 @@ revert all case revisions:
|
||||
delete all case revisions:
|
||||
title: 'Delete all revisions'
|
||||
description: 'Role requires permission to <em>view Case revisions</em> and <em>delete rights</em> for case entities in question or <em>administer case entities</em>.'
|
||||
|
||||
|
||||
view published activity entities:
|
||||
title: 'View published Activity entities'
|
||||
|
||||
add activity entities:
|
||||
title: 'Create new Activity entities'
|
||||
|
||||
|
@ -24,7 +24,7 @@ use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
|
||||
* },
|
||||
* },
|
||||
* config_prefix = "oc_activity_type",
|
||||
* admin_permission = "administer opencase entity bundles",
|
||||
* admin_permission = "administer activity bundles",
|
||||
* bundle_of = "oc_activity",
|
||||
* entity_keys = {
|
||||
* "id" = "id",
|
||||
|
@ -114,10 +114,14 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
||||
$translation->setOwnerId(0);
|
||||
}
|
||||
}
|
||||
|
||||
$name = $this->get('first_name')->value . ' ';
|
||||
if ($this->get('middle_names')->value) $name .= $this->get('middle_names')->value . ' ';
|
||||
$name .= $this->get('last_name')->value . ' ';
|
||||
|
||||
if ($this->get('full_name')->value) {
|
||||
$name = $this->get('full_name')->value . ' ';
|
||||
} else {
|
||||
$name = $this->get('first_name')->value . ' ';
|
||||
if ($this->get('middle_names')->value) $name .= $this->get('middle_names')->value . ' ';
|
||||
$name .= $this->get('last_name')->value . ' ';
|
||||
}
|
||||
$name .= '(' . $this->type->entity->label() . ')';
|
||||
|
||||
$this->setName($name);
|
||||
@ -238,6 +242,24 @@ class OCActor extends RevisionableContentEntityBase implements OCActorInterface
|
||||
'weight' => -10,
|
||||
]);
|
||||
|
||||
// When configuring a person type, you will need to choose whether to have full name or first and last name fields displayed.
|
||||
$fields['full_name'] = BaseFieldDefinition::create('string')
|
||||
->setDescription(t('The person\'s name.'))
|
||||
->setLabel(t('Name'))
|
||||
->setRevisionable(TRUE)
|
||||
->setSettings([
|
||||
'max_length' => 20,
|
||||
'text_processing' => 0,
|
||||
])
|
||||
->setDisplayConfigurable("form", true)
|
||||
->setDisplayConfigurable("view", true)
|
||||
->setDefaultValue('')
|
||||
->setDisplayOptions('form', [
|
||||
'type' => 'string_textfield',
|
||||
'weight' => -50,
|
||||
])
|
||||
->setRequired(TRUE);
|
||||
|
||||
$fields['first_name'] = BaseFieldDefinition::create('string')
|
||||
->setLabel(t('First Name'))
|
||||
->setDescription(t("The person's first name."))
|
||||
|
@ -24,7 +24,7 @@ use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
|
||||
* },
|
||||
* },
|
||||
* config_prefix = "oc_actor_type",
|
||||
* admin_permission = "administer opencase entity bundles",
|
||||
* admin_permission = "administer actor bundles",
|
||||
* bundle_of = "oc_actor",
|
||||
* entity_keys = {
|
||||
* "id" = "id",
|
||||
|
@ -144,24 +144,7 @@ class OCBankAccount extends ContentEntityBase implements OCBankAccountInterface
|
||||
->setDescription(t('The user ID of author of the Bank Account entity.'))
|
||||
->setRevisionable(TRUE)
|
||||
->setSetting('target_type', 'user')
|
||||
->setSetting('handler', 'default')
|
||||
->setDisplayOptions('view', [
|
||||
'label' => 'hidden',
|
||||
'type' => 'author',
|
||||
'weight' => 0,
|
||||
])
|
||||
->setDisplayOptions('form', [
|
||||
'type' => 'entity_reference_autocomplete',
|
||||
'weight' => 5,
|
||||
'settings' => [
|
||||
'match_operator' => 'CONTAINS',
|
||||
'size' => '60',
|
||||
'autocomplete_type' => 'tags',
|
||||
'placeholder' => '',
|
||||
],
|
||||
])
|
||||
->setDisplayConfigurable('form', TRUE)
|
||||
->setDisplayConfigurable('view', TRUE);
|
||||
->setSetting('handler', 'default');
|
||||
|
||||
$fields['name'] = BaseFieldDefinition::create('string')
|
||||
->setLabel(t('Name'))
|
||||
|
@ -24,7 +24,7 @@ use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
|
||||
* },
|
||||
* },
|
||||
* config_prefix = "oc_case_type",
|
||||
* admin_permission = "administer opencase entity bundles",
|
||||
* admin_permission = "administer case bundles",
|
||||
* bundle_of = "oc_case",
|
||||
* entity_keys = {
|
||||
* "id" = "id",
|
||||
|
@ -49,15 +49,16 @@ class ContextualMenu extends BlockBase {
|
||||
*/
|
||||
private function generateLinksForAddingNewActivities($title, $query = []) {
|
||||
$title = t($title);
|
||||
$markup = "<h1>$title: </h1>";
|
||||
$markup = "<br /><p><strong>$title: </strong>";
|
||||
$allActivityTypes = \Drupal::service('entity_type.bundle.info')->getBundleInfo('oc_activity');
|
||||
foreach($allActivityTypes as $machine_name => $activityType) {
|
||||
$label = $activityType['label'];
|
||||
$url = \Drupal\Core\Url::fromRoute("entity.oc_activity.add_form", ['oc_activity_type' => $machine_name]);
|
||||
$url->setOption('query', $query);
|
||||
$link = \Drupal\Core\Link::fromTextAndUrl($label, $url)->toString();
|
||||
$markup .= "<p>$link</p>";
|
||||
$markup .= " $link";
|
||||
}
|
||||
$markup .= "</p>";
|
||||
return "<div class='openactor_add_links'>$markup</div>";
|
||||
}
|
||||
}
|
||||
|
@ -50,13 +50,6 @@ opencase.manage_person_types:
|
||||
parent: opencase.opencase_admin_menu
|
||||
url: internal:/admin/opencase/oc_actor_type
|
||||
weight: 1
|
||||
opencase.manage_case_types:
|
||||
title: 'Manage case types'
|
||||
description: 'Configure types of cases and their fields'
|
||||
menu_name: opencase
|
||||
parent: opencase.opencase_admin_menu
|
||||
url: internal:/admin/opencase/oc_case_type
|
||||
weight: 2
|
||||
opencase.manage_activity_types:
|
||||
title: 'Manage activity types'
|
||||
description: 'Configure types of activities and their fields'
|
||||
|
Reference in New Issue
Block a user