diff --git a/CRM/Core/DAO/Phone.php b/CRM/Core/DAO/Phone.php
index 034f0d54af1e..660ca3f05276 100644
--- a/CRM/Core/DAO/Phone.php
+++ b/CRM/Core/DAO/Phone.php
@@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Core/Phone.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:661faad4886dd1a40784d465b906f447)
+ * (GenCodeChecksum:22802e5d7d8dfce93626004aaf6cd2e2)
*/
/**
@@ -258,6 +258,10 @@ public static function &fields() {
'type' => CRM_Utils_Type::T_INT,
'title' => ts('Phone Type'),
'description' => 'Which type of phone does this number belongs.',
+ 'export' => TRUE,
+ 'where' => 'civicrm_phone.phone_type_id',
+ 'headerPattern' => '',
+ 'dataPattern' => '',
'table_name' => 'civicrm_phone',
'entity' => 'Phone',
'bao' => 'CRM_Core_BAO_Phone',
diff --git a/CRM/Export/BAO/Export.php b/CRM/Export/BAO/Export.php
index b1179d3ce456..25d82d33e676 100644
--- a/CRM/Export/BAO/Export.php
+++ b/CRM/Export/BAO/Export.php
@@ -1422,20 +1422,15 @@ public static function componentPaymentFields() {
public static function setHeaderRows($field, $headerRows, $sqlColumns, $processor, $value, $phoneTypes, $imProviders, $relationQuery, $selectedPaymentFields) {
$queryFields = $processor->getQueryFields();
- // Split campaign into 2 fields for id and title
- if (substr($field, -14) == 'campaign_title') {
- $headerRows[] = ts('Campaign Title');
- }
- elseif (substr($field, -11) == 'campaign_id') {
+ if (substr($field, -11) == 'campaign_id') {
+ // @todo - set this correctly in the xml rather than here.
$headerRows[] = ts('Campaign ID');
}
elseif (isset($queryFields[$field]['title'])) {
$headerRows[] = $queryFields[$field]['title'];
}
- elseif ($field == 'phone_type_id') {
- $headerRows[] = ts('Phone Type');
- }
elseif ($field == 'provider_id') {
+ // @todo - set this correctly in the xml rather than here.
$headerRows[] = ts('IM Service Provider');
}
elseif ($processor->isRelationshipTypeKey($field)) {
diff --git a/tests/phpunit/CRM/Export/BAO/ExportTest.php b/tests/phpunit/CRM/Export/BAO/ExportTest.php
index d9472f247431..8c92cd3c1dec 100644
--- a/tests/phpunit/CRM/Export/BAO/ExportTest.php
+++ b/tests/phpunit/CRM/Export/BAO/ExportTest.php
@@ -1503,26 +1503,26 @@ protected function getBasicHeaderDefinition($isContactExport) {
66 => 'Country',
67 => 'Phone',
68 => 'Phone Extension',
- 69 => 'Email',
- 70 => 'On Hold',
- 71 => 'Use for Bulk Mail',
- 72 => 'Signature Text',
- 73 => 'Signature Html',
- 74 => 'IM Provider',
- 75 => 'IM Screen Name',
- 76 => 'OpenID',
- 77 => 'World Region',
- 78 => 'Website',
- 79 => 'Group(s)',
- 80 => 'Tag(s)',
- 81 => 'Note(s)',
- 82 => 'Phone Type',
+ 69 => 'Phone Type',
+ 70 => 'Email',
+ 71 => 'On Hold',
+ 72 => 'Use for Bulk Mail',
+ 73 => 'Signature Text',
+ 74 => 'Signature Html',
+ 75 => 'IM Provider',
+ 76 => 'IM Screen Name',
+ 77 => 'OpenID',
+ 78 => 'World Region',
+ 79 => 'Website',
+ 80 => 'Group(s)',
+ 81 => 'Tag(s)',
+ 82 => 'Note(s)',
83 => 'IM Service Provider',
];
if (!$isContactExport) {
- unset($headers[79]);
unset($headers[80]);
unset($headers[81]);
+ unset($headers[82]);
}
return $headers;
}
@@ -1801,6 +1801,7 @@ protected function getBasicSqlColumnDefinition($isContactExport) {
'country' => 'country varchar(64)',
'phone' => 'phone varchar(32)',
'phone_ext' => 'phone_ext varchar(16)',
+ 'phone_type_id' => 'phone_type_id varchar(16)',
'email' => 'email varchar(254)',
'on_hold' => 'on_hold varchar(16)',
'is_bulkmail' => 'is_bulkmail varchar(16)',
@@ -1814,7 +1815,6 @@ protected function getBasicSqlColumnDefinition($isContactExport) {
'groups' => 'groups text',
'tags' => 'tags text',
'notes' => 'notes text',
- 'phone_type_id' => 'phone_type_id varchar(255)',
'provider_id' => 'provider_id varchar(255)',
];
if (!$isContactExport) {
@@ -1998,7 +1998,7 @@ public function getContributionSqlColumns() {
'openid' => 'openid varchar(255)',
'world_region' => 'world_region varchar(128)',
'url' => 'url varchar(128)',
- 'phone_type_id' => 'phone_type_id varchar(255)',
+ 'phone_type_id' => 'phone_type_id varchar(16)',
'provider_id' => 'provider_id varchar(255)',
'financial_type' => 'financial_type varchar(64)',
'contribution_source' => 'contribution_source varchar(255)',
diff --git a/xml/schema/Core/Phone.xml b/xml/schema/Core/Phone.xml
index 29b17c1df38a..f3703dc8f585 100644
--- a/xml/schema/Core/Phone.xml
+++ b/xml/schema/Core/Phone.xml
@@ -146,6 +146,7 @@