Skip to content

Commit

Permalink
Pass ExportProcessor object instead of queryMode & ExportMode
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Aug 4, 2018
1 parent b7db605 commit 439355f
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions CRM/Export/BAO/Export.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,8 @@ public static function exportComponent($exportMode) {

/**
* Get Query Group By Clause
* @param int $exportMode
* @param \CRM_Export_BAO_ExportProcessor $processor
* Export Mode
* @param string $queryMode
* Query Mode
* @param array $returnProperties
* Return Properties
* @param object $query
Expand All @@ -134,8 +132,10 @@ public static function exportComponent($exportMode) {
* @return string $groupBy
* Group By Clause
*/
public static function getGroupBy($exportMode, $queryMode, $returnProperties, $query) {
public static function getGroupBy($processor, $returnProperties, $query) {
$groupBy = '';
$exportMode = $processor->getExportMode();
$queryMode = $processor->getQueryMode();
if (!empty($returnProperties['tags']) || !empty($returnProperties['groups']) ||
CRM_Utils_Array::value('notes', $returnProperties) ||
// CRM-9552
Expand Down Expand Up @@ -364,7 +364,7 @@ public static function exportComponents(
}
}

list($relationQuery, $allRelContactArray) = self::buildRelatedContactArray($selectAll, $ids, $exportMode, $componentTable, $returnProperties, $queryMode);
list($relationQuery, $allRelContactArray) = self::buildRelatedContactArray($selectAll, $ids, $processor, $componentTable, $returnProperties);

// make sure the groups stuff is included only if specifically specified
// by the fields param (CRM-1969), else we limit the contacts outputted to only
Expand Down Expand Up @@ -409,7 +409,7 @@ public static function exportComponents(

$queryString = "$select $from $where $having";

$groupBy = self::getGroupBy($exportMode, $queryMode, $returnProperties, $query);
$groupBy = self::getGroupBy($processor, $returnProperties, $query);

$queryString .= $groupBy;

Expand Down Expand Up @@ -1701,15 +1701,16 @@ protected static function getIDsForRelatedContact($ids, $exportMode) {
/**
* @param $selectAll
* @param $ids
* @param $exportMode
* @param \CRM_Export_BAO_ExportProcessor $processor
* @param $componentTable
* @param $returnProperties
* @param $queryMode
*
* @return array
*/
protected static function buildRelatedContactArray($selectAll, $ids, $exportMode, $componentTable, $returnProperties, $queryMode) {
protected static function buildRelatedContactArray($selectAll, $ids, $processor, $componentTable, $returnProperties) {
$allRelContactArray = $relationQuery = array();

$queryMode = $processor->getQueryMode();
$exportMode = $processor->getExportMode();
foreach (self::$relationshipTypes as $rel => $dnt) {
if ($relationReturnProperties = CRM_Utils_Array::value($rel, $returnProperties)) {
$allRelContactArray[$rel] = array();
Expand Down

0 comments on commit 439355f

Please sign in to comment.