Skip to content

Commit

Permalink
PE-657 Remove BTS Technology Catalog functionality (#637)
Browse files Browse the repository at this point in the history
  • Loading branch information
odensc authored Jan 9, 2025
1 parent 370b4c5 commit 6d0b955
Show file tree
Hide file tree
Showing 168 changed files with 56 additions and 9,711 deletions.
10 changes: 0 additions & 10 deletions web/modules/custom/employees/employees.links.action.yml

This file was deleted.

57 changes: 0 additions & 57 deletions web/modules/custom/employees/employees.links.menu.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,3 @@
# BTS catalog menu placed via toolbar menu
# This first view could have been creatd by the view ui menu widget, but to keep
# everything together, it is placed via route here.
employees.bts_manage_catalog:
title: 'Manage items'
description: 'Manage techonology catalog items'
route_name: view.manage_technology_catalog_items.page
weight: 1
menu_name: bts-catalog
employees.bts_capabilities:
title: 'Capability'
description: 'Manage business capabilities for BTS catalog'
route_name: entity.taxonomy_vocabulary.overview_form
route_parameters:
taxonomy_vocabulary: 'bts_business_capability'
weight: 2
menu_name: bts-catalog
employees.bts_priority:
title: 'Priority'
description: 'Manage business priorities for BTS catalog'
route_name: entity.taxonomy_vocabulary.overview_form
route_parameters:
taxonomy_vocabulary: 'bts_business_priority'
weight: 3
menu_name: bts-catalog
employees.bts_bureau:
title: 'Bureaus'
description: 'Manage bureaus for BTS catalog'
route_name: entity.taxonomy_vocabulary.overview_form
route_parameters:
taxonomy_vocabulary: 'bureaus'
weight: 4
menu_name: bts-catalog
employees.bts_cloud_service_type:
title: 'Cloud service'
description: 'Manage cloud service types for BTS catalog'
route_name: entity.taxonomy_vocabulary.overview_form
route_parameters:
taxonomy_vocabulary: 'cloud_service_type'
weight: 5
menu_name: bts-catalog
employees.bts_hosting_environment:
title: 'Hosting'
description: 'Manage hosting environment types for BTS catalog'
route_name: entity.taxonomy_vocabulary.overview_form
route_parameters:
taxonomy_vocabulary: 'hosting_environment'
weight: 6
menu_name: bts-catalog
employees.bts_support_model:
title: 'Support model'
description: 'Manage support models for BTS catalog'
route_name: entity.taxonomy_vocabulary.overview_form
route_parameters:
taxonomy_vocabulary: 'support_model'
weight: 7
menu_name: bts-catalog
# 311 Supervisor menu items
employees.manage_multnomah_contacts:
title: 'Multnomah Contacts'
Expand Down
20 changes: 9 additions & 11 deletions web/modules/custom/employees/employees.module
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ function employees_form_alter(&$form, &$form_state, $form_id)
case "node_resource_edit_form":
$form['actions']['submit']['#submit'][] = '_resource_node_form_submit';
// Intentionally avoid using "break" here. Not a bug.
case "node_bts_catalog_item_form":
case "node_bts_catalog_item_edit_form":
case "node_event_form":
case "node_event_edit_form":
case "node_news_form":
Expand All @@ -151,7 +149,7 @@ function _resource_node_form_submit($form, FormStateInterface $form_state) {
);

// This is a bit of a hack as it forces the redirect to execute immediately instead of allowing
// Drupal's native form processing to handle it. But our redirect gets overwritten by other
// Drupal's native form processing to handle it. But our redirect gets overwritten by other
// redirects if left to the default handling.
$url = $form_state->getRedirect()->setAbsolute()->toString();
$response = new RedirectResponse($url);
Expand Down Expand Up @@ -235,7 +233,7 @@ function _validate_remote_document_in_media_library(&$form, FormStateInterface $
$form_state->setErrorByName('field_media_media_remote][0][value', 'This field is required.');
return;
}

// Get eFiles file size and MIME type
try {
$headers = get_headers($remote_document_url, 1);
Expand Down Expand Up @@ -278,7 +276,7 @@ function _validate_send_reviewer_notification_date(&$form, FormStateInterface $f
$notification_date = $form_state->getValue("field_send_reviewer_notification")[0]['value'];
if ($notification_date) {
$notification_date = date_create($notification_date)->getTimestamp();

if ($notification_date <= time()) {
$form_state->setErrorByName('field_send_reviewer_notification][0][value', 'Send reviewer notification email date must be a future date. You can also clear an existing date if you no longer want a reminder set.');
} elseif (!$form_state->getValue("field_reviewer")[0]['target_id']) {
Expand Down Expand Up @@ -724,7 +722,7 @@ function _content_updated_recently()
}

/**
* Retrieve a view of content with reviewer notifications and use it to send
* Retrieve a view of content with reviewer notifications and use it to send
* emails to reviewers as appropriate.
*/
function _send_reviewer_notifications()
Expand Down Expand Up @@ -768,20 +766,20 @@ function _send_reviewer_notifications()

$notification_date = $result->_entity->get("field_send_reviewer_notification")->value;
$notification_date = date_create($notification_date)->getTimestamp();

$last_notification_date = \Drupal::keyValue('employees')->get("last_reviewer_notification_date.$entity_type.$id");
if (empty($last_notification_date)) {
$last_notification_date = 0; // Equivalent to 1/1/1970 in Unix epoch format
}

// Create list of email recipients
$to_emails = [];
// $to_emails[] = $result->_entity->getOwner()->mail->value;
$reviewers = $result->_entity->get("field_reviewer");
foreach ($reviewers->referencedEntities() as $reviewer) {
$to_emails[] = $reviewer->mail->value;
}

// Send reviewer notification email if an email hasn't already been sent
// TODO: Remove "TRUE" debugging override
if (!empty($to_emails) && ($last_notification_date < $notification_date)) {
Expand All @@ -795,7 +793,7 @@ function _send_reviewer_notifications()
$params['title'] = 'Employees.portland.gov scheduled reviewer notification: ' . $result->_entity->get('title')->value . $environment_name;
// Cron is run with the anonymous user. Set the language code to EN.
$langcode = 'en';

$sent_successfully = _send_email($key, implode(',', $to_emails), $langcode, $params, '[email protected]');

// Record email timestamp to avoid resending email again on following days
Expand Down Expand Up @@ -1005,7 +1003,7 @@ function employees_toolbar_alter(&$items) {
if (!in_array('administrator', $account->getRoles())) {
$items['administration']['tab']['#attributes']['class'][] = 'd-none';
$items['administration']['tray']['toolbar_administration']['#attributes']['class'][] = 'd-none';
// Some views like /my-content are displayed in the Claro theme which doesn't have the `d-none` CSS
// Some views like /my-content are displayed in the Claro theme which doesn't have the `d-none` CSS
// class defined so apply a style directly to the elements instead
$items['administration']['tab']['#attributes']['style'][] = 'display: none !important;';
$items['administration']['tray']['toolbar_administration']['#attributes']['style'][] = 'display: none !important;';
Expand Down
29 changes: 0 additions & 29 deletions web/sites/default/config/block.block.applicationexception.yml

This file was deleted.

This file was deleted.

This file was deleted.

29 changes: 0 additions & 29 deletions web/sites/default/config/block.block.westy_btscatalogtype.yml

This file was deleted.

29 changes: 0 additions & 29 deletions web/sites/default/config/block.block.westy_bureaus.yml

This file was deleted.

29 changes: 0 additions & 29 deletions web/sites/default/config/block.block.westy_businesscapability.yml

This file was deleted.

29 changes: 0 additions & 29 deletions web/sites/default/config/block.block.westy_businesspriority.yml

This file was deleted.

29 changes: 0 additions & 29 deletions web/sites/default/config/block.block.westy_supportmodel.yml

This file was deleted.

Loading

0 comments on commit 6d0b955

Please sign in to comment.