From 9ac33d0facc90a601965c3a338826a1a90ef4d80 Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 10 Aug 2020 18:23:53 +1200 Subject: [PATCH] Metadata fix - phone_type_id, location_type_id, gender_id --- CRM/Contact/BAO/Query.php | 2 +- CRM/Contact/DAO/Contact.php | 3 ++- CRM/Core/DAO/Phone.php | 4 +++- CRM/Dedupe/Merger.php | 2 +- CRM/Export/BAO/ExportProcessor.php | 3 +++ xml/schema/Contact/Contact.xml | 3 ++- xml/schema/Core/Phone.xml | 4 +++- 7 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 1b707301d1..6f8c8fc893 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -2189,7 +2189,7 @@ class CRM_Contact_BAO_Query { $name, $op, $value, $grouping, 'CRM_Contact_DAO_Contact', $field, - $field['title'], + $field['html']['label'] ?? $field['title'], CRM_Utils_Type::typeToString($dataType) ); if ($name === 'gender_id') { diff --git a/CRM/Contact/DAO/Contact.php b/CRM/Contact/DAO/Contact.php index f5836720f2..eb95bc6f3d 100644 --- a/CRM/Contact/DAO/Contact.php +++ b/CRM/Contact/DAO/Contact.php @@ -1216,7 +1216,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { 'gender_id' => [ 'name' => 'gender_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Gender'), + 'title' => ts('Gender ID'), 'description' => ts('FK to gender ID'), 'import' => TRUE, 'where' => 'civicrm_contact.gender_id', @@ -1229,6 +1229,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { 'localizable' => 0, 'html' => [ 'type' => 'Select', + 'label' => ts("Gender"), ], 'pseudoconstant' => [ 'optionGroupName' => 'gender', diff --git a/CRM/Core/DAO/Phone.php b/CRM/Core/DAO/Phone.php index 27089a4c79..6e7895dda2 100644 --- a/CRM/Core/DAO/Phone.php +++ b/CRM/Core/DAO/Phone.php @@ -174,7 +174,7 @@ class CRM_Core_DAO_Phone extends CRM_Core_DAO { 'location_type_id' => [ 'name' => 'location_type_id', 'type' => CRM_Utils_Type::T_INT, - 'title' => ts('Phone Location Type'), + 'title' => ts('Phone Location Type ID'), 'description' => ts('Which Location does this phone belong to.'), 'where' => 'civicrm_phone.location_type_id', 'table_name' => 'civicrm_phone', @@ -183,6 +183,7 @@ class CRM_Core_DAO_Phone extends CRM_Core_DAO { 'localizable' => 0, 'html' => [ 'type' => 'Select', + 'label' => ts("Phone Location Type"), ], 'pseudoconstant' => [ 'table' => 'civicrm_location_type', @@ -301,6 +302,7 @@ class CRM_Core_DAO_Phone extends CRM_Core_DAO { 'localizable' => 0, 'html' => [ 'type' => 'Select', + 'label' => ts("Phone Type"), ], 'pseudoconstant' => [ 'optionGroupName' => 'phone_type', diff --git a/CRM/Dedupe/Merger.php b/CRM/Dedupe/Merger.php index 3cc6e233f2..2300680614 100644 --- a/CRM/Dedupe/Merger.php +++ b/CRM/Dedupe/Merger.php @@ -1185,7 +1185,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m $rows["move_$field"] = [ 'main' => self::getFieldValueAndLabel($field, $main)['label'], 'other' => self::getFieldValueAndLabel($field, $other)['label'], - 'title' => $fields[$field]['title'], + 'title' => $fields[$field]['html']['label'] ?? $fields[$field]['title'], ]; $value = self::getFieldValueAndLabel($field, $other)['value']; diff --git a/CRM/Export/BAO/ExportProcessor.php b/CRM/Export/BAO/ExportProcessor.php index 681697984b..c1231fecb7 100644 --- a/CRM/Export/BAO/ExportProcessor.php +++ b/CRM/Export/BAO/ExportProcessor.php @@ -639,6 +639,9 @@ class CRM_Export_BAO_ExportProcessor { $queryFields['world_region']['context'] = 'country'; $queryFields['state_province']['context'] = 'province'; $queryFields['contact_id'] = ['title' => ts('Contact ID'), 'type' => CRM_Utils_Type::T_INT]; + // Set the label to gender for gender_id as we it's ... magic (not in a good way). + // In other places the query object offers e.g contribution_status & contribution_status_id + $queryFields['gender_id']['title'] = ts('Gender'); $this->queryFields = $queryFields; } diff --git a/xml/schema/Contact/Contact.xml b/xml/schema/Contact/Contact.xml index dda19acd7f..f904c09cff 100644 --- a/xml/schema/Contact/Contact.xml +++ b/xml/schema/Contact/Contact.xml @@ -654,13 +654,14 @@ gender_id - Gender + Gender ID int unsigned gender Select + /^gender$/i FK to gender ID diff --git a/xml/schema/Core/Phone.xml b/xml/schema/Core/Phone.xml index f2b95e2478..91ab823d39 100644 --- a/xml/schema/Core/Phone.xml +++ b/xml/schema/Core/Phone.xml @@ -36,7 +36,7 @@ location_type_id - Phone Location Type + Phone Location Type ID int unsigned Which Location does this phone belong to. @@ -46,6 +46,7 @@ Select + 2.0 @@ -157,6 +158,7 @@ Select + 2.2 -- 2.25.1