Skip to content

Commit

Permalink
Merge pull request #12587 from eileenmcnaughton/header_test
Browse files Browse the repository at this point in the history
Export - add tests out header output, move phone_type_id to metadata
  • Loading branch information
colemanw authored Aug 1, 2018
2 parents c1c06ae + 219c47d commit c8ef297
Show file tree
Hide file tree
Showing 4 changed files with 322 additions and 15 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
13 changes: 4 additions & 9 deletions CRM/Export/BAO/Export.php
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ public static function exportComponents(
}
else {
// return tableName and sqlColumns in test context
return array($exportTempTable, $sqlColumns);
return array($exportTempTable, $sqlColumns, $headerRows);
}

// delete the export temp table and component table
Expand Down Expand Up @@ -1413,20 +1413,15 @@ public static function componentPaymentFields() {
public static function setHeaderRows($field, $headerRows, $sqlColumns, $processor, $value, $phoneTypes, $imProviders) {

$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
Loading

0 comments on commit c8ef297

Please sign in to comment.