From 6decf4242ddac1ad4ef5daa021e014ee0dcf159f Mon Sep 17 00:00:00 2001
From: Christian Burk <omahane@gmail.com>
Date: Wed, 7 Feb 2024 15:19:35 -0600
Subject: [PATCH] VACMS-15686: Removes the temp field from everywhere

---
 ...ode.health_care_local_facility.default.yml |  9 -------
 ...care_local_facility.inline_entity_form.yml |  2 --
 ...ode.health_care_local_facility.default.yml | 10 -------
 ...h_care_local_facility.external_content.yml |  2 --
 ...e.health_care_local_facility.ief_table.yml |  2 --
 ...node.health_care_local_facility.teaser.yml |  2 --
 ...ility.field_mental_health_contact_phon.yml | 25 -----------------
 ...cal_facility.field_mental_health_phone.yml |  2 +-
 ....node.field_mental_health_contact_phon.yml | 19 -------------
 ...ion.va_node_health_care_local_facility.yml | 27 -------------------
 ...ion.va_node_health_care_local_facility.yml | 10 -------
 .../src/Service/PostFacilityStatus.php        |  6 +----
 12 files changed, 2 insertions(+), 114 deletions(-)
 delete mode 100644 config/sync/field.field.node.health_care_local_facility.field_mental_health_contact_phon.yml
 delete mode 100644 config/sync/field.storage.node.field_mental_health_contact_phon.yml

diff --git a/config/sync/core.entity_form_display.node.health_care_local_facility.default.yml b/config/sync/core.entity_form_display.node.health_care_local_facility.default.yml
index 55a7e6fcc40..1e6cfa301b7 100644
--- a/config/sync/core.entity_form_display.node.health_care_local_facility.default.yml
+++ b/config/sync/core.entity_form_display.node.health_care_local_facility.default.yml
@@ -15,7 +15,6 @@ dependencies:
     - field.field.node.health_care_local_facility.field_location_services
     - field.field.node.health_care_local_facility.field_main_location
     - field.field.node.health_care_local_facility.field_media
-    - field.field.node.health_care_local_facility.field_mental_health_contact_phon
     - field.field.node.health_care_local_facility.field_mental_health_phone
     - field.field.node.health_care_local_facility.field_meta_tags
     - field.field.node.health_care_local_facility.field_mobile
@@ -158,7 +157,6 @@ third_party_settings:
     group_locations_and_contact_info:
       children:
         - group_facility_data_from_vast
-        - field_mental_health_contact_phon
       label: 'Locations and contact information'
       region: content
       parent_name: ''
@@ -318,13 +316,6 @@ content:
     settings:
       media_types: {  }
     third_party_settings: {  }
-  field_mental_health_contact_phon:
-    type: telephone_default
-    weight: 21
-    region: content
-    settings:
-      placeholder: ''
-    third_party_settings: {  }
   field_mental_health_phone:
     type: telephone_default
     weight: 28
diff --git a/config/sync/core.entity_form_display.node.health_care_local_facility.inline_entity_form.yml b/config/sync/core.entity_form_display.node.health_care_local_facility.inline_entity_form.yml
index bb8face28e3..e8f2e84b497 100644
--- a/config/sync/core.entity_form_display.node.health_care_local_facility.inline_entity_form.yml
+++ b/config/sync/core.entity_form_display.node.health_care_local_facility.inline_entity_form.yml
@@ -16,7 +16,6 @@ dependencies:
     - field.field.node.health_care_local_facility.field_location_services
     - field.field.node.health_care_local_facility.field_main_location
     - field.field.node.health_care_local_facility.field_media
-    - field.field.node.health_care_local_facility.field_mental_health_contact_phon
     - field.field.node.health_care_local_facility.field_mental_health_phone
     - field.field.node.health_care_local_facility.field_meta_tags
     - field.field.node.health_care_local_facility.field_mobile
@@ -151,7 +150,6 @@ hidden:
   field_location_services: true
   field_main_location: true
   field_media: true
-  field_mental_health_contact_phon: true
   field_mental_health_phone: true
   field_meta_tags: true
   field_mobile: true
diff --git a/config/sync/core.entity_view_display.node.health_care_local_facility.default.yml b/config/sync/core.entity_view_display.node.health_care_local_facility.default.yml
index 8a2ea63cebb..6a3cafd15c3 100644
--- a/config/sync/core.entity_view_display.node.health_care_local_facility.default.yml
+++ b/config/sync/core.entity_view_display.node.health_care_local_facility.default.yml
@@ -15,7 +15,6 @@ dependencies:
     - field.field.node.health_care_local_facility.field_location_services
     - field.field.node.health_care_local_facility.field_main_location
     - field.field.node.health_care_local_facility.field_media
-    - field.field.node.health_care_local_facility.field_mental_health_contact_phon
     - field.field.node.health_care_local_facility.field_mental_health_phone
     - field.field.node.health_care_local_facility.field_meta_tags
     - field.field.node.health_care_local_facility.field_mobile
@@ -95,7 +94,6 @@ third_party_settings:
     group_locations_and_contact_info:
       children:
         - group_facility_data_from_vast
-        - field_mental_health_contact_phon
       label: 'Locations and contact information'
       parent_name: ''
       region: content
@@ -202,14 +200,6 @@ content:
     third_party_settings: {  }
     weight: 0
     region: content
-  field_mental_health_contact_phon:
-    type: telephone_link
-    label: inline
-    settings:
-      title: ''
-    third_party_settings: {  }
-    weight: 20
-    region: content
   field_mental_health_phone:
     type: telephone_link
     label: inline
diff --git a/config/sync/core.entity_view_display.node.health_care_local_facility.external_content.yml b/config/sync/core.entity_view_display.node.health_care_local_facility.external_content.yml
index c148f6326ce..1fb0bbe2a06 100644
--- a/config/sync/core.entity_view_display.node.health_care_local_facility.external_content.yml
+++ b/config/sync/core.entity_view_display.node.health_care_local_facility.external_content.yml
@@ -16,7 +16,6 @@ dependencies:
     - field.field.node.health_care_local_facility.field_location_services
     - field.field.node.health_care_local_facility.field_main_location
     - field.field.node.health_care_local_facility.field_media
-    - field.field.node.health_care_local_facility.field_mental_health_contact_phon
     - field.field.node.health_care_local_facility.field_mental_health_phone
     - field.field.node.health_care_local_facility.field_meta_tags
     - field.field.node.health_care_local_facility.field_mobile
@@ -268,7 +267,6 @@ hidden:
   field_location_services: true
   field_main_location: true
   field_media: true
-  field_mental_health_contact_phon: true
   field_meta_tags: true
   field_meta_title: true
   field_operating_status_facility: true
diff --git a/config/sync/core.entity_view_display.node.health_care_local_facility.ief_table.yml b/config/sync/core.entity_view_display.node.health_care_local_facility.ief_table.yml
index 54d54c1bd56..d978097d787 100644
--- a/config/sync/core.entity_view_display.node.health_care_local_facility.ief_table.yml
+++ b/config/sync/core.entity_view_display.node.health_care_local_facility.ief_table.yml
@@ -16,7 +16,6 @@ dependencies:
     - field.field.node.health_care_local_facility.field_location_services
     - field.field.node.health_care_local_facility.field_main_location
     - field.field.node.health_care_local_facility.field_media
-    - field.field.node.health_care_local_facility.field_mental_health_contact_phon
     - field.field.node.health_care_local_facility.field_mental_health_phone
     - field.field.node.health_care_local_facility.field_meta_tags
     - field.field.node.health_care_local_facility.field_mobile
@@ -120,7 +119,6 @@ hidden:
   field_local_health_care_service_: true
   field_location_services: true
   field_main_location: true
-  field_mental_health_contact_phon: true
   field_mental_health_phone: true
   field_meta_tags: true
   field_mobile: true
diff --git a/config/sync/core.entity_view_display.node.health_care_local_facility.teaser.yml b/config/sync/core.entity_view_display.node.health_care_local_facility.teaser.yml
index 45398d62610..23950b24f12 100644
--- a/config/sync/core.entity_view_display.node.health_care_local_facility.teaser.yml
+++ b/config/sync/core.entity_view_display.node.health_care_local_facility.teaser.yml
@@ -16,7 +16,6 @@ dependencies:
     - field.field.node.health_care_local_facility.field_location_services
     - field.field.node.health_care_local_facility.field_main_location
     - field.field.node.health_care_local_facility.field_media
-    - field.field.node.health_care_local_facility.field_mental_health_contact_phon
     - field.field.node.health_care_local_facility.field_mental_health_phone
     - field.field.node.health_care_local_facility.field_meta_tags
     - field.field.node.health_care_local_facility.field_mobile
@@ -96,7 +95,6 @@ hidden:
   field_location_services: true
   field_main_location: true
   field_media: true
-  field_mental_health_contact_phon: true
   field_mental_health_phone: true
   field_meta_tags: true
   field_mobile: true
diff --git a/config/sync/field.field.node.health_care_local_facility.field_mental_health_contact_phon.yml b/config/sync/field.field.node.health_care_local_facility.field_mental_health_contact_phon.yml
deleted file mode 100644
index f62a8a60d62..00000000000
--- a/config/sync/field.field.node.health_care_local_facility.field_mental_health_contact_phon.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-uuid: 85b46732-b695-42f5-be09-413287698196
-langcode: en
-status: true
-dependencies:
-  config:
-    - field.storage.node.field_mental_health_contact_phon
-    - node.type.health_care_local_facility
-  module:
-    - telephone
-    - tmgmt_content
-third_party_settings:
-  tmgmt_content:
-    excluded: false
-id: node.health_care_local_facility.field_mental_health_contact_phon
-field_name: field_mental_health_contact_phon
-entity_type: node
-bundle: health_care_local_facility
-label: 'Mental health contact phone number'
-description: 'Enter the number Veterans should call to access mental health services at your facility, for example 202-555-1234, ext. 23. If your facility doesn''t offer these services, enter the most appropriate system number. This number will be displayed everywhere your facility appears across VA.gov. <a href="/help/va-medical-centers-vamcs/about-locations-content-for-vamcs/how-to-edit-a-vamc-facility"  target="_blank">View guidelines for editing VAMC facilities (opens in a new tab)</a>'
-required: false
-translatable: false
-default_value: {  }
-default_value_callback: ''
-settings: {  }
-field_type: telephone
diff --git a/config/sync/field.field.node.health_care_local_facility.field_mental_health_phone.yml b/config/sync/field.field.node.health_care_local_facility.field_mental_health_phone.yml
index ff107baf8ee..4643e7ea8e2 100644
--- a/config/sync/field.field.node.health_care_local_facility.field_mental_health_phone.yml
+++ b/config/sync/field.field.node.health_care_local_facility.field_mental_health_phone.yml
@@ -16,7 +16,7 @@ field_name: field_mental_health_phone
 entity_type: node
 bundle: health_care_local_facility
 label: 'Mental health phone number'
-description: ''
+description: 'Enter the number Veterans should call to access mental health services at your facility, for example 202-555-1234, ext. 23. If your facility doesn''t offer these services, enter the most appropriate system number. This number will be displayed everywhere your facility appears across VA.gov. <a href="/help/va-medical-centers-vamcs/about-locations-content-for-vamcs/how-to-edit-a-vamc-facility"  target="_blank">View guidelines for editing VAMC facilities (opens in a new tab)</a>'
 required: false
 translatable: false
 default_value: {  }
diff --git a/config/sync/field.storage.node.field_mental_health_contact_phon.yml b/config/sync/field.storage.node.field_mental_health_contact_phon.yml
deleted file mode 100644
index a32d2da3892..00000000000
--- a/config/sync/field.storage.node.field_mental_health_contact_phon.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-uuid: 0b19fe89-c843-4663-a729-1244f4931208
-langcode: en
-status: true
-dependencies:
-  module:
-    - node
-    - telephone
-id: node.field_mental_health_contact_phon
-field_name: field_mental_health_contact_phon
-entity_type: node
-type: telephone
-settings: {  }
-module: telephone
-locked: false
-cardinality: 1
-translatable: true
-indexes: {  }
-persist_with_no_fields: false
-custom_storage: false
diff --git a/config/sync/migrate_plus.migration.va_node_health_care_local_facility.yml b/config/sync/migrate_plus.migration.va_node_health_care_local_facility.yml
index 37047c74c8c..d3e34ad4e62 100644
--- a/config/sync/migrate_plus.migration.va_node_health_care_local_facility.yml
+++ b/config/sync/migrate_plus.migration.va_node_health_care_local_facility.yml
@@ -80,10 +80,6 @@ source:
       name: phone-main
       label: phone-main
       selector: properties/phone/main
-    -
-      name: phone-mental-health
-      label: phone-mental-health
-      selector: properties/phone/mental_health_clinic
     -
       name: state
       label: state
@@ -179,29 +175,6 @@ process:
         'Other Outpatient Services (OOS)': 6
         'Extended Care Site (Community Living Center) (Stand-Alone)': 7
         'Residential Care Site (MH RRTP/DRRTP) (Stand-Alone)': 8
-  field_mental_health_phone:
-    plugin: str_replace
-    search:
-      - (
-      - )
-      - X
-      - ' '
-      - ext
-      - Ext
-      - .
-      - ','
-      - x
-    replace:
-      - ''
-      - '-'
-      - x
-      - ''
-      - x
-      - x
-      - ''
-      - ''
-      - ', ext. '
-    source: phone-mental-health
   field_phone_number:
     plugin: str_replace
     search:
diff --git a/docroot/modules/custom/va_gov_migrate/config/install/migrate_plus.migration.va_node_health_care_local_facility.yml b/docroot/modules/custom/va_gov_migrate/config/install/migrate_plus.migration.va_node_health_care_local_facility.yml
index 084789f101e..e56fd1a0a3a 100644
--- a/docroot/modules/custom/va_gov_migrate/config/install/migrate_plus.migration.va_node_health_care_local_facility.yml
+++ b/docroot/modules/custom/va_gov_migrate/config/install/migrate_plus.migration.va_node_health_care_local_facility.yml
@@ -86,10 +86,6 @@ source:
       name: phone-main
       label: phone-main
       selector: properties/phone/main
-    -
-      name: phone-mental-health
-      label: phone-mental-health
-      selector: properties/phone/mental_health_clinic
     -
       name: state
       label: state
@@ -191,12 +187,6 @@ process:
         'Other Outpatient Services (OOS)': 6
         'Extended Care Site (Community Living Center) (Stand-Alone)': 7
         'Residential Care Site (MH RRTP/DRRTP) (Stand-Alone)': 8
-  field_mental_health_phone:
-    # Covert all ext variants to x and then replace it with, ', ext. ' last.
-    plugin: str_replace
-    search: ['(', ')', 'X', ' ', 'ext', 'Ext', '.', ',', 'x']
-    replace: ['', '-', 'x', '', 'x', 'x', '', '', ', ext. ']
-    source: phone-mental-health
   field_phone_number:
     # Covert all ext variants to x and then replace it with, ', ext. ' last.
     plugin: str_replace
diff --git a/docroot/modules/custom/va_gov_post_api/src/Service/PostFacilityStatus.php b/docroot/modules/custom/va_gov_post_api/src/Service/PostFacilityStatus.php
index 382bb18dd31..84f0cf929a5 100644
--- a/docroot/modules/custom/va_gov_post_api/src/Service/PostFacilityStatus.php
+++ b/docroot/modules/custom/va_gov_post_api/src/Service/PostFacilityStatus.php
@@ -412,12 +412,8 @@ protected function shouldPushSystem(NodeInterface $entity) {
    *   The mental health phone number.
    */
   protected function getFacilityMentalHealthPhone(): string {
-    // This is the original and life-long field.
     $mental_health_phone = $this->getFieldSafe('field_mental_health_phone');
-    // This is the temporary shuffle field that will be removed once conversion
-    // to fully edited is complete.
-    $mental_health_contact = $this->getFieldSafe('field_mental_health_contact_phon');
-    return (!empty($mental_health_contact)) ? $mental_health_contact : $mental_health_phone;
+    return $mental_health_phone;
   }
 
   /**