diff --git a/config/install/views.view.activities.yml b/config/install/views.view.activities.yml index 2816491..1919165 100644 --- a/config/install/views.view.activities.yml +++ b/config/install/views.view.activities.yml @@ -4,6 +4,7 @@ dependencies: config: - user.role.authenticated module: + - datetime - opencase_entities - user id: activities @@ -69,6 +70,72 @@ display: row: type: fields fields: + activity_date_time: + id: activity_date_time + table: oc_activity_field_data + field: activity_date_time + relationship: none + group_type: group + admin_label: '' + label: 'Date and time' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: value + type: datetime_custom + settings: + timezone_override: '' + date_format: 'd/m/Y - H:i' + group_column: value + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + entity_type: oc_activity + entity_field: activity_date_time + plugin_id: field name: id: name table: oc_activity_field_data @@ -263,73 +330,6 @@ display: entity_type: oc_activity entity_field: description plugin_id: field - created: - id: created - table: oc_activity_field_data - field: created - relationship: none - group_type: group - admin_label: '' - label: Created - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: true - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: value - type: timestamp - settings: - date_format: short - custom_date_format: '' - timezone: '' - group_column: value - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - entity_type: oc_activity - entity_field: created - plugin_id: field view_oc_activity: id: view_oc_activity table: oc_activity diff --git a/config/install/views.view.cases.yml b/config/install/views.view.cases.yml index 0631ddf..ba38d4a 100644 --- a/config/install/views.view.cases.yml +++ b/config/install/views.view.cases.yml @@ -477,7 +477,7 @@ display: admin_label: '' empty: true tokenize: false - content: "

Either there are no cases involving this person, or you do not have access to them.

\n" + content: "

Either there are no cases involving this person, or you do not have access to them.

To create a case, use the sidebar menu to the right

" plugin_id: text_custom relationships: { } arguments: @@ -584,7 +584,7 @@ display: admin_label: '' empty: true tokenize: false - content: "

No cases found

\n

You do not have access to any existing cases.

\n

To add a new case, 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 Add actors menu in the left sidebar.

\n" + content: "

No cases found

\n

You do not have access to any existing cases.

\n

To add a new case, first search for the person you want to create a case for, using the search bar at the top right of the screen. If they are not on the system yet, add them using the Add People tab.

\n" plugin_id: text_custom cache_metadata: max-age: -1 diff --git a/modules/opencase_default_reporting/config/optional/search_api.index.opencase_reporting_cases.yml b/modules/opencase_default_reporting/config/install/search_api.index.opencase_reporting_cases.yml similarity index 100% rename from modules/opencase_default_reporting/config/optional/search_api.index.opencase_reporting_cases.yml rename to modules/opencase_default_reporting/config/install/search_api.index.opencase_reporting_cases.yml diff --git a/modules/opencase_default_reporting/config/optional/search_api.index.opencase_reporting_clients.yml b/modules/opencase_default_reporting/config/install/search_api.index.opencase_reporting_clients.yml similarity index 100% rename from modules/opencase_default_reporting/config/optional/search_api.index.opencase_reporting_clients.yml rename to modules/opencase_default_reporting/config/install/search_api.index.opencase_reporting_clients.yml diff --git a/modules/opencase_default_reporting/config/optional/search_api.index.opencase_reporting_volunteers.yml b/modules/opencase_default_reporting/config/install/search_api.index.opencase_reporting_volunteers.yml similarity index 100% rename from modules/opencase_default_reporting/config/optional/search_api.index.opencase_reporting_volunteers.yml rename to modules/opencase_default_reporting/config/install/search_api.index.opencase_reporting_volunteers.yml diff --git a/modules/opencase_default_reporting/opencase_default_reporting.module b/modules/opencase_default_reporting/opencase_default_reporting.module index 00fb435..c1861c0 100644 --- a/modules/opencase_default_reporting/opencase_default_reporting.module +++ b/modules/opencase_default_reporting/opencase_default_reporting.module @@ -2,9 +2,9 @@ function opencase_default_reporting_uninstall() { $configs = [ -// 'search_api.index.opencase_reporting_cases', -// 'search_api.index.opencase_reporting_clients', -// 'search_api.index.opencase_reporting_volunteers', + 'search_api.index.opencase_reporting_cases', + 'search_api.index.opencase_reporting_clients', + 'search_api.index.opencase_reporting_volunteers', 'block.block.facet_asylum_status', 'block.block.facet_created', 'block.block.facet_disability', diff --git a/modules/opencase_entities/opencase_entities.install b/modules/opencase_entities/opencase_entities.install index 5209e2c..9fb0966 100644 --- a/modules/opencase_entities/opencase_entities.install +++ b/modules/opencase_entities/opencase_entities.install @@ -8,10 +8,7 @@ function opencase_entities_update_8003() { ->setLabel(t('Date and time')) ->setDescription(t('When the activity started.')) ->setRevisionable(TRUE) - ->setSettings([ - 'datetime_type' => 'date' - ]) - ->setDefaultValue('2000-01-01') + ->setDefaultValueCallback('Drupal\opencase_entities\Entity\OCActivity::currentDateTime') ->setDisplayOptions('view', [ 'type' => 'datetime_default', 'settings' => [ diff --git a/modules/opencase_entities/src/Entity/OCActivity.php b/modules/opencase_entities/src/Entity/OCActivity.php index e8849d0..aa2a824 100644 --- a/modules/opencase_entities/src/Entity/OCActivity.php +++ b/modules/opencase_entities/src/Entity/OCActivity.php @@ -9,6 +9,8 @@ use Drupal\Core\Entity\RevisionableInterface; use Drupal\Core\Entity\EntityChangedTrait; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\user\UserInterface; +use Drupal\datetime\Plugin\Field\FieldType\DateTimeItem; +use Drupal\Core\Datetime\DrupalDateTime; /** * Defines the Activity entity. @@ -81,6 +83,12 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte return array(\Drupal::request()->query->get('case_id')); } + public static function currentDateTime() { + $current_time = DrupalDateTime::createFromTimestamp(time()); + $formatted = $current_time->format(DateTimeItem::DATETIME_STORAGE_FORMAT); + \Drupal::logger("nr_debug")->notice($formatted); + return $formatted; + } /** * {@inheritdoc} */ @@ -212,12 +220,10 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte $fields['activity_date_time'] = BaseFieldDefinition::create('datetime') ->setLabel(t('Date and time')) - ->setDescription(t('When the activity started.')) + ->setDescription('') ->setRevisionable(TRUE) - ->setSettings([ - 'datetime_type' => 'date' - ]) - ->setDefaultValue('2000-01-01') + ->setRequired(TRUE) + ->setDefaultValueCallback('Drupal\opencase_entities\Entity\OCActivity::currentDateTime') ->setDisplayOptions('view', [ 'label' => 'above', 'type' => 'datetime_default', diff --git a/modules/opencase_search/opencase_search.info.yml b/modules/opencase_search/opencase_search.info.yml index 07bb6de..cd4cb0d 100644 --- a/modules/opencase_search/opencase_search.info.yml +++ b/modules/opencase_search/opencase_search.info.yml @@ -6,4 +6,3 @@ package: 'OpenCase' dependencies: - search_api - search_api_db - - opencase