Skip to content

Commit

Permalink
Move definition of phone_type_id to the xml.
Browse files Browse the repository at this point in the history
This has the side effect of making it such that it only gets 16 char rather than 255. I thnk this is 'ok' here but there is a separate issue open to increase the varchar for all fields on export
  • Loading branch information
eileenmcnaughton committed Jul 28, 2018
1 parent 676b112 commit 0d1d4e6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
6 changes: 5 additions & 1 deletion CRM/Core/DAO/Phone.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Core/Phone.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:661faad4886dd1a40784d465b906f447)
* (GenCodeChecksum:22802e5d7d8dfce93626004aaf6cd2e2)
*/

/**
Expand Down Expand Up @@ -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',
Expand Down
11 changes: 3 additions & 8 deletions CRM/Export/BAO/Export.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
34 changes: 17 additions & 17 deletions tests/phpunit/CRM/Export/BAO/ExportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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)',
Expand All @@ -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) {
Expand Down Expand Up @@ -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)',
Expand Down
1 change: 1 addition & 0 deletions xml/schema/Core/Phone.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
<name>phone_type_id</name>
<title>Phone Type</title>
<type>int unsigned</type>
<export>true</export>
<comment>Which type of phone does this number belongs.</comment>
<pseudoconstant>
<optionGroupName>phone_type</optionGroupName>
Expand Down

0 comments on commit 0d1d4e6

Please sign in to comment.