Compare commits
36 Commits
Author | SHA1 | Date | |
---|---|---|---|
fd661f6a2f | |||
679f40c16d | |||
ebd755d86c | |||
c507fb29b7 | |||
af0040479e | |||
3198c00f5a | |||
2e40dc46f2 | |||
7a21352ac4 | |||
8b274c0d6c | |||
775a08319c | |||
352ea000f0 | |||
ec99009f16 | |||
d2bd27c960 | |||
b5f567f872 | |||
221d16c7fa | |||
6b3b744900 | |||
1c0195a632 | |||
a47a06aef3 | |||
33feac1977 | |||
ddab3e450a | |||
e588a70a1b | |||
c0c415e691 | |||
6c384605ec | |||
09650469bf | |||
48dabf1701 | |||
08fe6dc362 | |||
3f01a3ad41 | |||
d589ef8d69 | |||
a267e222b8 | |||
910350699d | |||
c729750705 | |||
351bdb5afd | |||
2a31b1c8ce | |||
667b109de8 | |||
92d4f74ad7 | |||
487415c679 |
31
config/install/block.block.opencaseaddactors.yml
Normal file
31
config/install/block.block.opencaseaddactors.yml
Normal file
@ -0,0 +1,31 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- system.menu.opencase-add-actors
|
||||
module:
|
||||
- system
|
||||
- user
|
||||
theme:
|
||||
- bartik
|
||||
id: opencaseaddactors
|
||||
theme: bartik
|
||||
region: sidebar_first
|
||||
weight: -8
|
||||
provider: null
|
||||
plugin: 'system_menu_block:opencase-add-actors'
|
||||
settings:
|
||||
id: 'system_menu_block:opencase-add-actors'
|
||||
label: 'Add Actors'
|
||||
provider: system
|
||||
label_display: visible
|
||||
level: 1
|
||||
depth: 0
|
||||
visibility:
|
||||
user_role:
|
||||
id: user_role
|
||||
roles:
|
||||
authenticated: authenticated
|
||||
negate: false
|
||||
context_mapping:
|
||||
user: '@user.current_user_context:current_user'
|
@ -15,5 +15,5 @@ settings:
|
||||
id: opencase_contextual_menu
|
||||
label: 'OpenCase Contextual Menu'
|
||||
provider: opencase
|
||||
label_display: visible
|
||||
label_display: '0'
|
||||
visibility: { }
|
||||
|
7
config/install/system.menu.opencase-add-actors.yml
Normal file
7
config/install/system.menu.opencase-add-actors.yml
Normal file
@ -0,0 +1,7 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies: { }
|
||||
id: opencase-add-actors
|
||||
label: 'OpenCase Add Actors'
|
||||
description: ''
|
||||
locked: false
|
@ -27,7 +27,7 @@ display:
|
||||
role:
|
||||
authenticated: authenticated
|
||||
cache:
|
||||
type: tag
|
||||
type: none
|
||||
options: { }
|
||||
query:
|
||||
type: views_query
|
||||
@ -389,7 +389,18 @@ display:
|
||||
title: 'Activity List'
|
||||
header: { }
|
||||
footer: { }
|
||||
empty: { }
|
||||
empty:
|
||||
area_text_custom:
|
||||
id: area_text_custom
|
||||
table: views
|
||||
field: area_text_custom
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
empty: true
|
||||
tokenize: false
|
||||
content: 'This case has no activities yet. To add one, use the links in the sidebar to the right.'
|
||||
plugin_id: text_custom
|
||||
relationships: { }
|
||||
arguments:
|
||||
oc_case:
|
||||
|
@ -27,7 +27,7 @@ display:
|
||||
role:
|
||||
authenticated: authenticated
|
||||
cache:
|
||||
type: tag
|
||||
type: none
|
||||
options: { }
|
||||
query:
|
||||
type: views_query
|
||||
@ -48,10 +48,23 @@ display:
|
||||
sort_asc_label: Asc
|
||||
sort_desc_label: Desc
|
||||
pager:
|
||||
type: some
|
||||
type: mini
|
||||
options:
|
||||
items_per_page: 10
|
||||
items_per_page: 20
|
||||
offset: 0
|
||||
id: 0
|
||||
total_pages: null
|
||||
tags:
|
||||
previous: ‹‹
|
||||
next: ››
|
||||
expose:
|
||||
items_per_page: false
|
||||
items_per_page_label: 'Items per page'
|
||||
items_per_page_options: '5, 10, 25, 50'
|
||||
items_per_page_options_all: false
|
||||
items_per_page_options_all_label: '- All -'
|
||||
offset: false
|
||||
offset_label: Offset
|
||||
style:
|
||||
type: table
|
||||
row:
|
||||
@ -434,7 +447,52 @@ display:
|
||||
empty_zero: false
|
||||
hide_alter_empty: false
|
||||
plugin_id: custom
|
||||
filters: { }
|
||||
filters:
|
||||
type:
|
||||
id: type
|
||||
table: oc_case_field_data
|
||||
field: type
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
operator: in
|
||||
value: { }
|
||||
group: 1
|
||||
exposed: true
|
||||
expose:
|
||||
operator_id: type_op
|
||||
label: 'Case type'
|
||||
description: ''
|
||||
use_operator: false
|
||||
operator: type_op
|
||||
identifier: type
|
||||
required: false
|
||||
remember: false
|
||||
multiple: false
|
||||
remember_roles:
|
||||
authenticated: authenticated
|
||||
anonymous: '0'
|
||||
administrator: '0'
|
||||
overseer: '0'
|
||||
caseworker: '0'
|
||||
volunteer_co_ord: '0'
|
||||
opencase_admin: '0'
|
||||
reduce: false
|
||||
is_grouped: false
|
||||
group_info:
|
||||
label: ''
|
||||
description: ''
|
||||
identifier: ''
|
||||
optional: true
|
||||
widget: select
|
||||
multiple: false
|
||||
remember: false
|
||||
default_group: All
|
||||
default_group_multiple: { }
|
||||
group_items: { }
|
||||
entity_type: oc_case
|
||||
entity_field: type
|
||||
plugin_id: bundle
|
||||
sorts:
|
||||
created:
|
||||
id: created
|
||||
@ -447,14 +505,25 @@ display:
|
||||
exposed: false
|
||||
expose:
|
||||
label: ''
|
||||
granularity: hour
|
||||
granularity: day
|
||||
entity_type: oc_case
|
||||
entity_field: created
|
||||
plugin_id: date
|
||||
title: 'Case List'
|
||||
title: ''
|
||||
header: { }
|
||||
footer: { }
|
||||
empty: { }
|
||||
empty:
|
||||
area_text_custom:
|
||||
id: area_text_custom
|
||||
table: views
|
||||
field: area_text_custom
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
empty: true
|
||||
tokenize: false
|
||||
content: "<p>Either there are no cases involving this person, or you do not have access to them.</p>\n"
|
||||
plugin_id: text_custom
|
||||
relationships: { }
|
||||
arguments:
|
||||
actors_involved_target_id:
|
||||
@ -495,12 +564,14 @@ display:
|
||||
entity_field: actors_involved
|
||||
plugin_id: numeric
|
||||
display_extenders: { }
|
||||
use_ajax: true
|
||||
cache_metadata:
|
||||
max-age: -1
|
||||
contexts:
|
||||
- 'languages:language_content'
|
||||
- 'languages:language_interface'
|
||||
- url
|
||||
- url.query_args
|
||||
- user.roles
|
||||
tags: { }
|
||||
page_1:
|
||||
@ -511,11 +582,106 @@ display:
|
||||
display_options:
|
||||
display_extenders: { }
|
||||
path: opencase/oc_actor/%actor_id/case_list
|
||||
defaults:
|
||||
filters: false
|
||||
filter_groups: false
|
||||
filters: { }
|
||||
filter_groups:
|
||||
operator: AND
|
||||
groups:
|
||||
1: AND
|
||||
cache_metadata:
|
||||
max-age: -1
|
||||
contexts:
|
||||
- 'languages:language_content'
|
||||
- 'languages:language_interface'
|
||||
- url
|
||||
- url.query_args
|
||||
- user.roles
|
||||
tags: { }
|
||||
page_2:
|
||||
display_plugin: page
|
||||
id: page_2
|
||||
display_title: 'All Cases'
|
||||
position: 2
|
||||
display_options:
|
||||
display_extenders: { }
|
||||
display_description: ''
|
||||
arguments: { }
|
||||
defaults:
|
||||
arguments: false
|
||||
filters: false
|
||||
filter_groups: false
|
||||
empty: false
|
||||
path: opencase/all-cases
|
||||
filters:
|
||||
type:
|
||||
id: type
|
||||
table: oc_case_field_data
|
||||
field: type
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
operator: in
|
||||
value: { }
|
||||
group: 1
|
||||
exposed: true
|
||||
expose:
|
||||
operator_id: type_op
|
||||
label: 'Case type'
|
||||
description: ''
|
||||
use_operator: false
|
||||
operator: type_op
|
||||
identifier: type
|
||||
required: false
|
||||
remember: false
|
||||
multiple: false
|
||||
remember_roles:
|
||||
authenticated: authenticated
|
||||
anonymous: '0'
|
||||
administrator: '0'
|
||||
overseer: '0'
|
||||
caseworker: '0'
|
||||
volunteer_co_ord: '0'
|
||||
opencase_admin: '0'
|
||||
reduce: false
|
||||
is_grouped: false
|
||||
group_info:
|
||||
label: ''
|
||||
description: ''
|
||||
identifier: ''
|
||||
optional: true
|
||||
widget: select
|
||||
multiple: false
|
||||
remember: false
|
||||
default_group: All
|
||||
default_group_multiple: { }
|
||||
group_items: { }
|
||||
entity_type: oc_case
|
||||
entity_field: type
|
||||
plugin_id: bundle
|
||||
filter_groups:
|
||||
operator: AND
|
||||
groups:
|
||||
1: AND
|
||||
empty:
|
||||
area_text_custom:
|
||||
id: area_text_custom
|
||||
table: views
|
||||
field: area_text_custom
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
empty: true
|
||||
tokenize: false
|
||||
content: "<h1>No cases found</h1>\n<p>You do not have access to any existing cases.</p>\n<p>To <b>add a new case</b>, first search for the person you want to add a case to. If they are not on the system yet you can add them using the <b>Add actors</b> menu in the left sidebar.</p>\n"
|
||||
plugin_id: text_custom
|
||||
cache_metadata:
|
||||
max-age: -1
|
||||
contexts:
|
||||
- 'languages:language_content'
|
||||
- 'languages:language_interface'
|
||||
- url
|
||||
- url.query_args
|
||||
- user.roles
|
||||
tags: { }
|
||||
|
@ -0,0 +1,11 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies: { }
|
||||
id: contact_opencase
|
||||
label: 'Contact the OpenCase Developers'
|
||||
recipients:
|
||||
- naomi@aktivix.org
|
||||
reply: ''
|
||||
weight: 0
|
||||
message: 'Thank you for your message. The OpenCase team will get back to you ASAP.'
|
||||
redirect: ''
|
@ -0,0 +1,5 @@
|
||||
default_form: contact_opencase
|
||||
flood:
|
||||
limit: 5
|
||||
interval: 3600
|
||||
user_default_enabled: false
|
@ -3,7 +3,6 @@ status: true
|
||||
dependencies:
|
||||
config:
|
||||
- opencase_entities.oc_actor_type.client
|
||||
- opencase_entities.oc_actor_type.volunteer
|
||||
- opencase_entities.oc_case_type.volunteer_engagement
|
||||
id: oc_case.volunteer_engagement.actors_involved
|
||||
field_name: actors_involved
|
||||
@ -18,7 +17,6 @@ default_value_callback: 'Drupal\opencase_entities\Entity\OCCase::defaultVal'
|
||||
settings:
|
||||
handler_settings:
|
||||
target_bundles:
|
||||
client: client
|
||||
volunteer: volunteer
|
||||
handler: default
|
||||
field_type: entity_reference
|
||||
|
@ -15,7 +15,7 @@ content:
|
||||
settings:
|
||||
placeholder: ''
|
||||
third_party_settings: { }
|
||||
type: number_decimal
|
||||
type: number
|
||||
region: content
|
||||
field_funds_for:
|
||||
weight: 27
|
||||
|
@ -25,12 +25,10 @@ bundle: client
|
||||
mode: default
|
||||
content:
|
||||
field_asylum_status:
|
||||
weight: 35
|
||||
settings:
|
||||
size: 60
|
||||
placeholder: ''
|
||||
weight: 6
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: string_textfield
|
||||
type: options_select
|
||||
region: content
|
||||
field_client_field_1:
|
||||
weight: 26
|
||||
@ -41,20 +39,20 @@ content:
|
||||
type: string_textfield
|
||||
region: content
|
||||
field_confidentiality_form:
|
||||
weight: 39
|
||||
weight: 15
|
||||
settings:
|
||||
progress_indicator: throbber
|
||||
third_party_settings: { }
|
||||
type: file_generic
|
||||
region: content
|
||||
field_date_of_birth:
|
||||
weight: 27
|
||||
weight: 3
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: datetime_default
|
||||
region: content
|
||||
field_dependants:
|
||||
weight: 36
|
||||
weight: 12
|
||||
settings:
|
||||
size: 60
|
||||
placeholder: ''
|
||||
@ -62,7 +60,7 @@ content:
|
||||
type: string_textfield
|
||||
region: content
|
||||
field_disability:
|
||||
weight: 31
|
||||
weight: 10
|
||||
settings:
|
||||
size: 60
|
||||
placeholder: ''
|
||||
@ -70,7 +68,7 @@ content:
|
||||
type: string_textfield
|
||||
region: content
|
||||
field_ethnic_o:
|
||||
weight: 33
|
||||
weight: 7
|
||||
settings:
|
||||
size: 60
|
||||
placeholder: ''
|
||||
@ -78,39 +76,37 @@ content:
|
||||
type: string_textfield
|
||||
region: content
|
||||
field_gender_identified_with:
|
||||
weight: 30
|
||||
weight: 4
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: options_select
|
||||
region: content
|
||||
field_how_heard:
|
||||
weight: 37
|
||||
weight: 13
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: options_select
|
||||
region: content
|
||||
field_income:
|
||||
weight: 34
|
||||
weight: 11
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: options_select
|
||||
region: content
|
||||
field_languages_spoken:
|
||||
weight: 32
|
||||
settings:
|
||||
size: 60
|
||||
placeholder: ''
|
||||
weight: 9
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: string_textfield
|
||||
type: options_select
|
||||
region: content
|
||||
field_marital_:
|
||||
weight: 29
|
||||
weight: 5
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: options_select
|
||||
region: content
|
||||
field_nationality:
|
||||
weight: 28
|
||||
weight: 8
|
||||
settings:
|
||||
size: 60
|
||||
placeholder: ''
|
||||
@ -118,7 +114,7 @@ content:
|
||||
type: string_textfield
|
||||
region: content
|
||||
field_referred_by:
|
||||
weight: 38
|
||||
weight: 14
|
||||
settings:
|
||||
size: 60
|
||||
placeholder: ''
|
||||
@ -135,7 +131,7 @@ content:
|
||||
third_party_settings: { }
|
||||
phone:
|
||||
type: string_textfield
|
||||
weight: 2
|
||||
weight: 0
|
||||
region: content
|
||||
settings:
|
||||
size: 60
|
||||
@ -143,7 +139,7 @@ content:
|
||||
third_party_settings: { }
|
||||
phone2:
|
||||
type: string_textfield
|
||||
weight: 3
|
||||
weight: 1
|
||||
region: content
|
||||
settings:
|
||||
size: 60
|
||||
@ -151,7 +147,7 @@ content:
|
||||
third_party_settings: { }
|
||||
postal_address:
|
||||
type: string_textarea
|
||||
weight: 5
|
||||
weight: 2
|
||||
region: content
|
||||
settings:
|
||||
rows: 5
|
||||
|
@ -4,6 +4,7 @@ dependencies:
|
||||
config:
|
||||
- field.field.oc_actor.volunteer.field_languages_spoken
|
||||
- field.field.oc_actor.volunteer.field_nationality
|
||||
- field.field.oc_actor.volunteer.field_osic_level
|
||||
- opencase_entities.oc_actor_type.volunteer
|
||||
id: oc_actor.volunteer.default
|
||||
targetEntityType: oc_actor
|
||||
@ -12,11 +13,9 @@ mode: default
|
||||
content:
|
||||
field_languages_spoken:
|
||||
weight: 28
|
||||
settings:
|
||||
size: 60
|
||||
placeholder: ''
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: string_textfield
|
||||
type: options_select
|
||||
region: content
|
||||
field_nationality:
|
||||
weight: 27
|
||||
@ -26,6 +25,12 @@ content:
|
||||
third_party_settings: { }
|
||||
type: string_textfield
|
||||
region: content
|
||||
field_osic_level:
|
||||
weight: 29
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: options_select
|
||||
region: content
|
||||
field_sdfdsfds:
|
||||
weight: 26
|
||||
settings:
|
||||
|
@ -32,7 +32,7 @@ content:
|
||||
settings:
|
||||
placeholder: ''
|
||||
third_party_settings: { }
|
||||
type: number_decimal
|
||||
type: number
|
||||
region: content
|
||||
field_outcome:
|
||||
weight: 26
|
||||
|
@ -32,7 +32,7 @@ content:
|
||||
settings:
|
||||
placeholder: ''
|
||||
third_party_settings: { }
|
||||
type: number_decimal
|
||||
type: number
|
||||
region: content
|
||||
field_outcome:
|
||||
weight: 30
|
||||
|
@ -33,7 +33,7 @@ content:
|
||||
settings:
|
||||
placeholder: ''
|
||||
third_party_settings: { }
|
||||
type: number_decimal
|
||||
type: number
|
||||
region: content
|
||||
field_gave_list_of_agencies:
|
||||
weight: 27
|
||||
|
@ -32,7 +32,7 @@ content:
|
||||
settings:
|
||||
placeholder: ''
|
||||
third_party_settings: { }
|
||||
type: number_decimal
|
||||
type: number
|
||||
region: content
|
||||
field_outcome:
|
||||
weight: 30
|
||||
|
@ -33,7 +33,7 @@ content:
|
||||
settings:
|
||||
placeholder: ''
|
||||
third_party_settings: { }
|
||||
type: number_decimal
|
||||
type: number
|
||||
region: content
|
||||
field_level:
|
||||
weight: 26
|
||||
|
@ -32,7 +32,7 @@ content:
|
||||
settings:
|
||||
placeholder: ''
|
||||
third_party_settings: { }
|
||||
type: number_decimal
|
||||
type: number
|
||||
region: content
|
||||
field_outcome:
|
||||
weight: 30
|
||||
|
@ -27,12 +27,11 @@ bundle: client
|
||||
mode: default
|
||||
content:
|
||||
field_asylum_status:
|
||||
weight: 15
|
||||
weight: 6
|
||||
label: above
|
||||
settings:
|
||||
link_to_entity: false
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: string
|
||||
type: list_default
|
||||
region: content
|
||||
field_client_field_1:
|
||||
weight: 1
|
||||
@ -43,7 +42,7 @@ content:
|
||||
type: string
|
||||
region: content
|
||||
field_confidentiality_form:
|
||||
weight: 19
|
||||
weight: 15
|
||||
label: above
|
||||
settings:
|
||||
use_description_as_link_text: true
|
||||
@ -51,7 +50,7 @@ content:
|
||||
type: file_default
|
||||
region: content
|
||||
field_date_of_birth:
|
||||
weight: 7
|
||||
weight: 3
|
||||
label: above
|
||||
settings:
|
||||
format_type: medium
|
||||
@ -60,51 +59,6 @@ content:
|
||||
type: datetime_default
|
||||
region: content
|
||||
field_dependants:
|
||||
weight: 16
|
||||
label: above
|
||||
settings:
|
||||
link_to_entity: false
|
||||
third_party_settings: { }
|
||||
type: string
|
||||
region: content
|
||||
field_disability:
|
||||
weight: 11
|
||||
label: above
|
||||
settings:
|
||||
link_to_entity: false
|
||||
third_party_settings: { }
|
||||
type: string
|
||||
region: content
|
||||
field_ethnic_o:
|
||||
weight: 13
|
||||
label: above
|
||||
settings:
|
||||
link_to_entity: false
|
||||
third_party_settings: { }
|
||||
type: string
|
||||
region: content
|
||||
field_gender_identified_with:
|
||||
weight: 10
|
||||
label: above
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: list_default
|
||||
region: content
|
||||
field_how_heard:
|
||||
weight: 17
|
||||
label: above
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: list_default
|
||||
region: content
|
||||
field_income:
|
||||
weight: 14
|
||||
label: above
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: list_default
|
||||
region: content
|
||||
field_languages_spoken:
|
||||
weight: 12
|
||||
label: above
|
||||
settings:
|
||||
@ -112,13 +66,57 @@ content:
|
||||
third_party_settings: { }
|
||||
type: string
|
||||
region: content
|
||||
field_marital_:
|
||||
field_disability:
|
||||
weight: 10
|
||||
label: above
|
||||
settings:
|
||||
link_to_entity: false
|
||||
third_party_settings: { }
|
||||
type: string
|
||||
region: content
|
||||
field_ethnic_o:
|
||||
weight: 7
|
||||
label: above
|
||||
settings:
|
||||
link_to_entity: false
|
||||
third_party_settings: { }
|
||||
type: string
|
||||
region: content
|
||||
field_gender_identified_with:
|
||||
weight: 4
|
||||
label: above
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: list_default
|
||||
region: content
|
||||
field_how_heard:
|
||||
weight: 13
|
||||
label: above
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: list_default
|
||||
region: content
|
||||
field_income:
|
||||
weight: 11
|
||||
label: above
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: list_default
|
||||
region: content
|
||||
field_languages_spoken:
|
||||
weight: 9
|
||||
label: above
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: list_default
|
||||
region: content
|
||||
field_marital_:
|
||||
weight: 5
|
||||
label: above
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: list_default
|
||||
region: content
|
||||
field_nationality:
|
||||
weight: 8
|
||||
label: above
|
||||
@ -128,7 +126,7 @@ content:
|
||||
type: string
|
||||
region: content
|
||||
field_referred_by:
|
||||
weight: 18
|
||||
weight: 14
|
||||
label: above
|
||||
settings:
|
||||
link_to_entity: false
|
||||
@ -146,7 +144,7 @@ content:
|
||||
phone:
|
||||
label: above
|
||||
type: string
|
||||
weight: 2
|
||||
weight: 0
|
||||
region: content
|
||||
settings:
|
||||
link_to_entity: false
|
||||
@ -154,7 +152,7 @@ content:
|
||||
phone2:
|
||||
label: above
|
||||
type: string
|
||||
weight: 3
|
||||
weight: 1
|
||||
region: content
|
||||
settings:
|
||||
link_to_entity: false
|
||||
@ -162,7 +160,7 @@ content:
|
||||
postal_address:
|
||||
label: above
|
||||
type: basic_string
|
||||
weight: 5
|
||||
weight: 2
|
||||
region: content
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
|
@ -4,8 +4,10 @@ dependencies:
|
||||
config:
|
||||
- field.field.oc_actor.volunteer.field_languages_spoken
|
||||
- field.field.oc_actor.volunteer.field_nationality
|
||||
- field.field.oc_actor.volunteer.field_osic_level
|
||||
- opencase_entities.oc_actor_type.volunteer
|
||||
module:
|
||||
- options
|
||||
- user
|
||||
id: oc_actor.volunteer.default
|
||||
targetEntityType: oc_actor
|
||||
@ -15,10 +17,9 @@ content:
|
||||
field_languages_spoken:
|
||||
weight: 8
|
||||
label: above
|
||||
settings:
|
||||
link_to_entity: false
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: string
|
||||
type: list_default
|
||||
region: content
|
||||
field_nationality:
|
||||
weight: 7
|
||||
@ -28,6 +29,13 @@ content:
|
||||
third_party_settings: { }
|
||||
type: string
|
||||
region: content
|
||||
field_osic_level:
|
||||
weight: 9
|
||||
label: above
|
||||
settings: { }
|
||||
third_party_settings: { }
|
||||
type: list_default
|
||||
region: content
|
||||
field_sdfdsfds:
|
||||
weight: 1
|
||||
label: above
|
||||
|
@ -4,6 +4,8 @@ dependencies:
|
||||
config:
|
||||
- field.storage.oc_actor.field_asylum_status
|
||||
- opencase_entities.oc_actor_type.client
|
||||
module:
|
||||
- options
|
||||
id: oc_actor.client.field_asylum_status
|
||||
field_name: field_asylum_status
|
||||
entity_type: oc_actor
|
||||
@ -15,4 +17,4 @@ translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: string
|
||||
field_type: list_string
|
||||
|
@ -4,15 +4,17 @@ dependencies:
|
||||
config:
|
||||
- field.storage.oc_actor.field_languages_spoken
|
||||
- opencase_entities.oc_actor_type.client
|
||||
module:
|
||||
- options
|
||||
id: oc_actor.client.field_languages_spoken
|
||||
field_name: field_languages_spoken
|
||||
entity_type: oc_actor
|
||||
bundle: client
|
||||
label: 'Languages spoken'
|
||||
description: ''
|
||||
description: 'Hold down <b>Ctrl</b> (or the Mac equivalent) while clicking, and you can select more than one.'
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: string
|
||||
field_type: list_string
|
||||
|
@ -4,15 +4,17 @@ dependencies:
|
||||
config:
|
||||
- field.storage.oc_actor.field_languages_spoken
|
||||
- opencase_entities.oc_actor_type.volunteer
|
||||
module:
|
||||
- options
|
||||
id: oc_actor.volunteer.field_languages_spoken
|
||||
field_name: field_languages_spoken
|
||||
entity_type: oc_actor
|
||||
bundle: volunteer
|
||||
label: 'Languages spoken'
|
||||
description: ''
|
||||
description: 'Hold down <b>Ctrl</b> (or the Mac equivalent) while clicking, and you can select more than one.'
|
||||
required: false
|
||||
translatable: true
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: string
|
||||
field_type: list_string
|
||||
|
@ -0,0 +1,20 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.oc_actor.field_osic_level
|
||||
- opencase_entities.oc_actor_type.volunteer
|
||||
module:
|
||||
- options
|
||||
id: oc_actor.volunteer.field_osic_level
|
||||
field_name: field_osic_level
|
||||
entity_type: oc_actor
|
||||
bundle: volunteer
|
||||
label: 'OSIC level'
|
||||
description: ''
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: list_string
|
@ -6,7 +6,7 @@ dependencies:
|
||||
id: oc_activity.field_amount
|
||||
field_name: field_amount
|
||||
entity_type: oc_activity
|
||||
type: number_decimal
|
||||
type: decimal
|
||||
settings:
|
||||
precision: 10
|
||||
scale: 2
|
||||
|
@ -3,15 +3,21 @@ status: true
|
||||
dependencies:
|
||||
module:
|
||||
- opencase_entities
|
||||
- options
|
||||
id: oc_actor.field_asylum_status
|
||||
field_name: field_asylum_status
|
||||
entity_type: oc_actor
|
||||
type: string
|
||||
type: list_string
|
||||
settings:
|
||||
max_length: 255
|
||||
is_ascii: false
|
||||
case_sensitive: false
|
||||
module: core
|
||||
allowed_values:
|
||||
-
|
||||
value: Refused
|
||||
label: Refused
|
||||
-
|
||||
value: 'Leave to remain'
|
||||
label: 'Leave to remain'
|
||||
allowed_values_function: ''
|
||||
module: options
|
||||
locked: false
|
||||
cardinality: 1
|
||||
translatable: true
|
||||
|
@ -3,15 +3,30 @@ status: true
|
||||
dependencies:
|
||||
module:
|
||||
- opencase_entities
|
||||
- options
|
||||
id: oc_actor.field_languages_spoken
|
||||
field_name: field_languages_spoken
|
||||
entity_type: oc_actor
|
||||
type: string
|
||||
type: list_string
|
||||
settings:
|
||||
max_length: 255
|
||||
is_ascii: false
|
||||
case_sensitive: false
|
||||
module: core
|
||||
allowed_values:
|
||||
-
|
||||
value: English
|
||||
label: English
|
||||
-
|
||||
value: French
|
||||
label: French
|
||||
-
|
||||
value: Arabic
|
||||
label: Arabic
|
||||
-
|
||||
value: Kurdish
|
||||
label: Kurdish
|
||||
-
|
||||
value: Farsi
|
||||
label: Farsi
|
||||
allowed_values_function: ''
|
||||
module: options
|
||||
locked: false
|
||||
cardinality: -1
|
||||
translatable: true
|
||||
|
@ -0,0 +1,32 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- opencase_entities
|
||||
- options
|
||||
id: oc_actor.field_osic_level
|
||||
field_name: field_osic_level
|
||||
entity_type: oc_actor
|
||||
type: list_string
|
||||
settings:
|
||||
allowed_values:
|
||||
-
|
||||
value: 'Under supervision'
|
||||
label: 'Under supervision'
|
||||
-
|
||||
value: 'Level 1'
|
||||
label: 'Level 1'
|
||||
-
|
||||
value: 'Level 2'
|
||||
label: 'Level 2'
|
||||
-
|
||||
value: 'Level 3'
|
||||
label: 'Level 3'
|
||||
allowed_values_function: ''
|
||||
module: options
|
||||
locked: false
|
||||
cardinality: 1
|
||||
translatable: true
|
||||
indexes: { }
|
||||
persist_with_no_fields: false
|
||||
custom_storage: false
|
@ -6,7 +6,7 @@ dependencies:
|
||||
id: oc_case.field_fee_or_equivalent_cost
|
||||
field_name: field_fee_or_equivalent_cost
|
||||
entity_type: oc_case
|
||||
type: number_decimal
|
||||
type: decimal
|
||||
settings:
|
||||
precision: 10
|
||||
scale: 2
|
||||
|
@ -12,5 +12,8 @@ permissions:
|
||||
- 'delete activity entities'
|
||||
- 'delete case entities'
|
||||
- 'delete client entities'
|
||||
- 'edit activity entities'
|
||||
- 'edit case entities'
|
||||
- 'edit client entities'
|
||||
- 'view own cases'
|
||||
- 'view published client entities'
|
||||
|
@ -6,6 +6,8 @@ label: 'CRM Admin'
|
||||
weight: 7
|
||||
is_admin: null
|
||||
permissions:
|
||||
- 'add activity entities'
|
||||
- 'add case entities'
|
||||
- 'add client entities'
|
||||
- 'add volunteer entities'
|
||||
- 'administer oc_activity fields'
|
||||
@ -17,5 +19,11 @@ permissions:
|
||||
- 'delete case entities'
|
||||
- 'delete client entities'
|
||||
- 'delete volunteer entities'
|
||||
- 'edit activity entities'
|
||||
- 'edit case entities'
|
||||
- 'edit client entities'
|
||||
- 'edit volunteer entities'
|
||||
- 'view published activity entities'
|
||||
- 'view published case entities'
|
||||
- 'view published client entities'
|
||||
- 'view published volunteer entities'
|
||||
|
@ -14,7 +14,10 @@ permissions:
|
||||
- 'delete case entities'
|
||||
- 'delete client entities'
|
||||
- 'delete volunteer entities'
|
||||
- 'edit activity entities'
|
||||
- 'edit case entities'
|
||||
- 'edit client entities'
|
||||
- 'edit volunteer entities'
|
||||
- 'view published case entities'
|
||||
- 'view published client entities'
|
||||
- 'view published volunteer entities'
|
||||
|
@ -7,9 +7,12 @@ weight: 6
|
||||
is_admin: null
|
||||
permissions:
|
||||
- 'add activity entities'
|
||||
- 'add case entities'
|
||||
- 'add volunteer entities'
|
||||
- 'delete activity entities'
|
||||
- 'delete case entities'
|
||||
- 'delete volunteer entities'
|
||||
- 'edit activity entities'
|
||||
- 'edit case entities'
|
||||
- 'edit volunteer entities'
|
||||
- 'view published volunteer entities'
|
||||
|
@ -3,3 +3,8 @@ type: module
|
||||
description: 'Actor types, case types, activity types and user roles suited to an asylum advice group'
|
||||
core: 8.x
|
||||
package: 'OpenCase'
|
||||
dependencies:
|
||||
- contact
|
||||
- field
|
||||
- opencase_entities
|
||||
- options
|
||||
|
@ -0,0 +1,28 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.user.field_linked_opencase_actor
|
||||
- opencase_entities.oc_actor_type.volunteer
|
||||
module:
|
||||
- user
|
||||
id: user.user.field_linked_opencase_actor
|
||||
field_name: field_linked_opencase_actor
|
||||
entity_type: user
|
||||
bundle: user
|
||||
label: 'Linked OpenCase actor'
|
||||
description: 'If this user is also an actor (e.g. a volunteer or staff member) in OpenCase, link them here. This will ensure that they have access to the correct cases and that the correct cases are shown as "theirs".'
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings:
|
||||
handler: 'default:oc_actor'
|
||||
handler_settings:
|
||||
target_bundles:
|
||||
volunteer: volunteer
|
||||
sort:
|
||||
field: _none
|
||||
auto_create: false
|
||||
auto_create_bundle: ''
|
||||
field_type: entity_reference
|
@ -0,0 +1,19 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- opencase_entities
|
||||
- user
|
||||
id: user.field_linked_opencase_actor
|
||||
field_name: field_linked_opencase_actor
|
||||
entity_type: user
|
||||
type: entity_reference
|
||||
settings:
|
||||
target_type: oc_actor
|
||||
module: core
|
||||
locked: false
|
||||
cardinality: 1
|
||||
translatable: true
|
||||
indexes: { }
|
||||
persist_with_no_fields: false
|
||||
custom_storage: false
|
@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
use Drupal\Core\Routing\RouteMatchInterface;
|
||||
use Drupal\opencase_entities\CaseInvolvement;
|
||||
|
||||
/**
|
||||
* Implements hook_help().
|
||||
@ -111,3 +112,30 @@ function opencase_entities_theme_suggestions_oc_activity(array $variables) {
|
||||
$suggestions[] = 'oc_activity__' . $entity->id() . '__' . $sanitized_view_mode;
|
||||
return $suggestions;
|
||||
}
|
||||
|
||||
function opencase_views_query_alter(Drupal\views\ViewExecutable $view, $query) {
|
||||
if ($view->getBaseEntityType() && $view->getBaseEntityType()->id() == 'oc_case') {
|
||||
$query->addTag('oc_case_access');
|
||||
}
|
||||
if ($view->getBaseEntityType() && $view->getBaseEntityType()->id() == 'oc_activity') {
|
||||
$query->addTag('oc_activity_access');
|
||||
}
|
||||
}
|
||||
|
||||
function opencase_query_oc_case_access_alter($query) {
|
||||
if (\Drupal::currentUser()->hasPermission('view published case entities')) {
|
||||
return;
|
||||
}
|
||||
$linked_actor_id = CaseInvolvement::getLinkedActorId(\Drupal::currentUser());
|
||||
$query->addJoin('INNER', 'oc_case__actors_involved', 'access_filter', 'access_filter.entity_id = oc_case_field_data.id');
|
||||
$query->condition('access_filter.actors_involved_target_id', $linked_actor_id);
|
||||
}
|
||||
|
||||
function opencase_query_oc_activity_access_alter($query) {
|
||||
if (\Drupal::currentUser()->hasPermission('view published case entities')) {
|
||||
return;
|
||||
}
|
||||
$linked_actor_id = CaseInvolvement::getLinkedActorId(\Drupal::currentUser());
|
||||
$query->addJoin('INNER', 'oc_case__actors_involved', 'access_filter', 'access_filter.entity_id = oc_activity_field_data.oc_case');
|
||||
$query->condition('access_filter.actors_involved_target_id', $linked_actor_id);
|
||||
}
|
||||
|
@ -33,10 +33,6 @@ delete all client revisions:
|
||||
title: 'Delete all Client revisions'
|
||||
description: 'Role requires permission to <em>view Client revisions</em> and <em>delete rights</em> for client entities in question or <em>administer client entities</em>.'
|
||||
|
||||
view volunteer involvement in cases:
|
||||
title: 'View names of Volunteers involved in Cases'
|
||||
description: "When viewing a case record, they can see the names of the volunteers involved, but cannot click through to volunteer's details."
|
||||
|
||||
add volunteer entities:
|
||||
title: 'Create new Volunteer entities'
|
||||
|
||||
@ -78,7 +74,8 @@ edit case entities:
|
||||
title: 'Edit Case entities'
|
||||
|
||||
view published case entities:
|
||||
title: 'View published Case entities'
|
||||
title: 'View all cases'
|
||||
description: 'All users can see cases which they are involved in. This grants permission to see all cases regardless of involvement.'
|
||||
|
||||
view unpublished case entities:
|
||||
title: 'View unpublished Case entities'
|
||||
@ -107,9 +104,6 @@ delete activity entities:
|
||||
edit activity entities:
|
||||
title: 'Edit Activity entities'
|
||||
|
||||
view published activity entities:
|
||||
title: 'View published Activity entities'
|
||||
|
||||
view unpublished activity entities:
|
||||
title: 'View unpublished Activity entities'
|
||||
|
||||
|
22
modules/opencase_entities/src/CaseInvolvement.php
Normal file
22
modules/opencase_entities/src/CaseInvolvement.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\opencase_entities;
|
||||
|
||||
class CaseInvolvement {
|
||||
|
||||
public static function getLinkedActorId($account) {
|
||||
return \Drupal\user\Entity\User::load($account->id())->get('field_linked_opencase_actor')->target_id;
|
||||
}
|
||||
|
||||
public static function userIsInvolved($account, $case) {
|
||||
$actorId = self::getLinkedActorId($account);
|
||||
$involvedIds = array_column($case->actors_involved->getValue(), 'target_id');
|
||||
return in_array($actorId, $involvedIds);
|
||||
}
|
||||
|
||||
public static function userIsInvolved_activity($account, $activity) {
|
||||
$case_id = $activity->oc_case->target_id;
|
||||
$case = \Drupal::entityTypeManager()->getStorage('oc_case')->load($case_id);
|
||||
return self::userIsInvolved($account, $case);
|
||||
}
|
||||
}
|
@ -76,10 +76,13 @@ class OCCase extends RevisionableContentEntityBase implements OCCaseInterface {
|
||||
|
||||
/**
|
||||
* When creating a case, it sets the first involved party to the actor
|
||||
* id from the URL.
|
||||
* id from the URL, and the second to the author's linked actor
|
||||
* (if it exists and is different)
|
||||
*/
|
||||
public static function defaultVal() {
|
||||
return array(\Drupal::request()->query->get('actor_id'));
|
||||
$author_linked_actor_id = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id())->get('field_linked_opencase_actor')->target_id;
|
||||
$currently_viewed_actor_id = \Drupal::request()->query->get('actor_id');
|
||||
return array_unique([$currently_viewed_actor_id, $author_linked_actor_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -24,13 +24,28 @@ class OCActivityAccessControlHandler extends EntityAccessControlHandler {
|
||||
if (!$entity->isPublished()) {
|
||||
return AccessResult::allowedIfHasPermission($account, 'view unpublished activity entities');
|
||||
}
|
||||
return AccessResult::allowedIfHasPermission($account, 'view published activity entities');
|
||||
|
||||
case 'update':
|
||||
return AccessResult::allowedIfHasPermission($account, 'edit activity entities');
|
||||
|
||||
case 'delete':
|
||||
return AccessResult::allowedIfHasPermission($account, 'delete activity entities');
|
||||
return AccessResult::allowedIf(
|
||||
$account->hasPermission('view published case entities') // activity permissions are inherited from case
|
||||
|| CaseInvolvement::userIsInvolved_activity($account, $entity)
|
||||
);
|
||||
case 'update': // allowed only if a) they can see the case the activity is on and b) they can edit activities
|
||||
if (!$account->hasPermission('edit activity entities')) {
|
||||
return AccessResult::forbidden();
|
||||
} else {
|
||||
return AccessResult::allowedIf(
|
||||
$account->hasPermission('view published case entities')
|
||||
|| CaseInvolvement::userIsInvolved_activity($account, $entity)
|
||||
);
|
||||
}
|
||||
case 'delete': // allowed only if a) they can see the case the activity is on and b) they can delete activities
|
||||
if (!$account->hasPermission('delete activity entities')) {
|
||||
return AccessResult::forbidden();
|
||||
} else {
|
||||
return AccessResult::allowedIf(
|
||||
$account->hasPermission('view published case entities')
|
||||
|| CaseInvolvement::userIsInvolved_activity($account, $entity)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Unknown operation, no opinion.
|
||||
|
@ -14,6 +14,9 @@ use Drupal\Core\Access\AccessResult;
|
||||
*/
|
||||
class OCActorAccessControlHandler extends EntityAccessControlHandler {
|
||||
|
||||
|
||||
protected $viewLabelOperation = TRUE;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* Permissions are assigned by bundle.
|
||||
@ -22,21 +25,18 @@ class OCActorAccessControlHandler extends EntityAccessControlHandler {
|
||||
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
|
||||
/** @var \Drupal\opencase_entities\Entity\OCActorInterface $entity */
|
||||
$bundle = $entity->bundle();
|
||||
$route_name = \Drupal::routeMatch()->getRouteName();
|
||||
$case_routes = ['entity.oc_case.canonical', 'entity.oc_case.edit_form', 'view.cases.page_1', 'entity.oc_case.add_form'];
|
||||
$is_case_context = in_array($route_name, $case_routes);
|
||||
|
||||
switch ($operation) {
|
||||
case 'view label':
|
||||
return AccessResult::allowed();
|
||||
|
||||
case 'view':
|
||||
if (!$entity->isPublished()) {
|
||||
return AccessResult::allowedIf(
|
||||
$account->hasPermission("view unpublished $bundle entities")
|
||||
or ($is_case_context && $account->hasPermission("view unpublished $bundle entities"))
|
||||
);
|
||||
}
|
||||
return AccessResult::allowedIf(
|
||||
$account->hasPermission("view published $bundle entities")
|
||||
or ($is_case_context && $account->hasPermission("view $bundle involvement in cases"))
|
||||
);
|
||||
|
||||
case "update":
|
||||
|
@ -6,6 +6,7 @@ use Drupal\Core\Entity\EntityAccessControlHandler;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
use Drupal\opencase_entities\CaseInvolvement;
|
||||
|
||||
/**
|
||||
* Access controller for the Case entity.
|
||||
@ -24,13 +25,20 @@ class OCCaseAccessControlHandler extends EntityAccessControlHandler {
|
||||
if (!$entity->isPublished()) {
|
||||
return AccessResult::allowedIfHasPermission($account, 'view unpublished case entities');
|
||||
}
|
||||
return AccessResult::allowedIfHasPermission($account, 'view published case entities');
|
||||
|
||||
case 'update':
|
||||
return AccessResult::allowedIfHasPermission($account, 'edit case entities');
|
||||
|
||||
case 'delete':
|
||||
return AccessResult::allowedIfHasPermission($account, 'delete case entities');
|
||||
return AccessResult::allowedIf(
|
||||
$account->hasPermission('view published case entities')
|
||||
|| CaseInvolvement::userIsInvolved($account, $entity)
|
||||
);
|
||||
case 'update': // you can edit the case only if a) you can see it and b) you have the permission to edit cases.
|
||||
return AccessResult::allowedIf(
|
||||
$account->hasPermission('edit case entities')
|
||||
&& ($account->hasPermission('view published case entities') || CaseInvolvement::userIsInvolved($account, $entity))
|
||||
);
|
||||
case 'delete': // you can delete the case only if a) you can see it and b) you have the permission to delete cases.
|
||||
return AccessResult::allowedIf(
|
||||
$account->hasPermission('delete case entities')
|
||||
&& ($account->hasPermission('view published case entities') || CaseInvolvement::userIsInvolved($account, $entity))
|
||||
);
|
||||
}
|
||||
|
||||
// Unknown operation, no opinion.
|
||||
|
@ -28,7 +28,7 @@ display:
|
||||
role:
|
||||
authenticated: authenticated
|
||||
cache:
|
||||
type: tag
|
||||
type: none
|
||||
options: { }
|
||||
query:
|
||||
type: views_query
|
||||
|
@ -1,5 +1,5 @@
|
||||
opencase.manage_user_logins:
|
||||
title: 'Manager user logins'
|
||||
title: 'Manage user logins'
|
||||
description: 'Manage who can access the system'
|
||||
menu_name: opencase-admin
|
||||
url: internal:/admin/people
|
||||
|
@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
use Drupal\Core\Routing\RouteMatchInterface;
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
use Drupal\opencase\EntityTypeRelationsWidget;
|
||||
|
||||
|
||||
@ -28,14 +29,15 @@ function opencase_block_access(\Drupal\block\Entity\Block $block, $operation, \D
|
||||
'view.activities.page_1',
|
||||
'entity.oc_activity.canonical',
|
||||
'entity.oc_activity.edit_form',
|
||||
'entity.oc_activity.add_form'
|
||||
'entity.oc_activity.add_form',
|
||||
'system.menu.opencase-add-actors',
|
||||
'block.block.opencaseaddactors',
|
||||
];
|
||||
return \Drupal\Core\Access\AccessResult::forbiddenIf(!in_array($route_name, $routes_where_it_should_be_shown))
|
||||
->addCacheableDependency($block);
|
||||
return AccessResult::forbiddenIf(!in_array($route_name, $routes_where_it_should_be_shown))->addCacheableDependency($block);
|
||||
}
|
||||
|
||||
// No opinion.
|
||||
return \Drupal\Core\Access\AccessResult::neutral();
|
||||
return AccessResult::neutral();
|
||||
}
|
||||
|
||||
|
||||
@ -149,3 +151,47 @@ function opencase_uninstall() {
|
||||
Drupal::configFactory()->getEditable($config)->delete();
|
||||
}
|
||||
}
|
||||
|
||||
function opencase_views_pre_render($view) {
|
||||
if (empty($view->result) && empty($view->exposed_input)) {
|
||||
$view->exposed_widgets = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function opencase_entity_field_access($operation, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, $account, $items = NULL) {
|
||||
if ($field_definition->getName() == 'field_linked_opencase_actor'
|
||||
&& $operation == 'edit'
|
||||
&& !$account->hasPermission('administer users')) {
|
||||
return AccessResult::forbidden();
|
||||
}
|
||||
return AccessResult::neutral();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of hook_form_alter()
|
||||
* After deleting an actor or a case, redirect to the main page, which is a view of all cases.
|
||||
*/
|
||||
function opencase_form_alter(&$form, &$form_state, $form_id) {
|
||||
if (preg_match('/oc_actor_.*_delete_form/', $form_id) or (preg_match('/oc_case_.*_delete_form/', $form_id))) {
|
||||
$form['actions']['submit']['#submit'][] = '_opencase_delete_case_redirect';
|
||||
$form['actions']['cancel']['#url'] = $form_state->getFormObject()->getEntity()->toUrl();
|
||||
}
|
||||
if (preg_match('/oc_activity_.*_delete_form/', $form_id)) {
|
||||
$form['actions']['submit']['#submit'][] = '_opencase_delete_activity_redirect';
|
||||
$form['actions']['cancel']['#url'] = $form_state->getFormObject()->getEntity()->toUrl();
|
||||
}
|
||||
}
|
||||
|
||||
function _opencase_delete_case_redirect($form, &$form_state) {
|
||||
$form_state->setRedirect('view.cases.page_2'); // redirect to view of all cases
|
||||
}
|
||||
function _opencase_delete_activity_redirect($form, &$form_state) {
|
||||
$case_id = $form_state->getFormObject()->getEntity()->oc_case->target_id;
|
||||
$form_state->setRedirect('view.activities.page_1', ['case_id' => $case_id]); // redirect to the activity list
|
||||
}
|
||||
function _opencase_cancel_delete_activity_redirect($form, &$form_state) {
|
||||
$entity = $form_state->getFormObject()->getEntity();
|
||||
$form_state->setRedirect('entity.oc_activity.canonical', ['oc_activity' => $entity->id()]); // redirect to the activity
|
||||
}
|
||||
|
@ -94,14 +94,24 @@ class ContextualMenu extends BlockBase {
|
||||
|
||||
/**
|
||||
* Contextual menu for Case page
|
||||
* - Link to case list for the actor that is stored in the session
|
||||
* - Link either the case list for the actor stored in the session (because their case list page was previously loaded)
|
||||
* or the home page
|
||||
* - Link to Activity list for that case
|
||||
*/
|
||||
private function casePage() {
|
||||
$case = \Drupal::routeMatch()->getParameter('oc_case');
|
||||
$actor_id = \Drupal::service('user.private_tempstore')->get('opencase')->get('actor_id');
|
||||
if ($actor_id) { // there is not always one stored.
|
||||
$actor = \Drupal::entityTypeManager()->getStorage('oc_actor')->load($actor_id);
|
||||
$links = [$this->getCaseListLink($actor), $this->getActivityListLink($case)];
|
||||
if ($actor) { // actor may have been deleted.
|
||||
$caseListLink = $this->getCaseListLink($actor);
|
||||
} else {
|
||||
$caseListLink = $this->getCaseListLinkAll();
|
||||
}
|
||||
} else {
|
||||
$caseListLink = $this->getCaseListLinkAll();
|
||||
}
|
||||
$links = [$caseListLink, $this->getActivityListLink($case)];
|
||||
return $this->asNavLinks($links);
|
||||
}
|
||||
|
||||
@ -171,6 +181,14 @@ class ContextualMenu extends BlockBase {
|
||||
return Link::fromTextAndUrl(t($actor->getName(). ": Cases"), $url)->toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a link to the list of all cases
|
||||
*/
|
||||
private function getCaseListLinkAll() {
|
||||
$url = Url::fromRoute('view.cases.page_2');
|
||||
return Link::fromTextAndUrl(t("All cases"), $url)->toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Render given links as nav links div with heading
|
||||
*/
|
||||
|
Reference in New Issue
Block a user