Skip to content

Commit

Permalink
Merge pull request #14444 from eileenmcnaughton/export_up
Browse files Browse the repository at this point in the history
[REF] Minor code cleanup on string concatenation
  • Loading branch information
mattwire authored Jun 12, 2019
2 parents e6e5536 + 72c506e commit 7e82867
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions CRM/Export/BAO/Export.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,32 +349,26 @@ public static function exportComponents(
);
}

$whereClauses = ['trash_clause' => "contact_a.is_deleted != 1"];
if (!$selectAll && $componentTable) {
$from .= " INNER JOIN $componentTable ctTable ON ctTable.contact_id = contact_a.id ";
}
elseif ($componentClause) {
if (empty($where)) {
$where = "WHERE $componentClause";
}
else {
$where .= " AND $componentClause";
}
$whereClauses[] = $componentClause;
}

// CRM-13982 - check if is deleted
$excludeTrashed = TRUE;
foreach ($params as $value) {
if ($value[0] == 'contact_is_deleted') {
$excludeTrashed = FALSE;
unset($whereClauses['trash_clause']);
}
}
$trashClause = $excludeTrashed ? "contact_a.is_deleted != 1" : "( 1 )";

if (empty($where)) {
$where = "WHERE $trashClause";
$where = "WHERE " . implode(' AND ', $whereClauses);
}
else {
$where .= " AND $trashClause";
$where .= " AND " . implode(' AND ', $whereClauses);
}

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

0 comments on commit 7e82867

Please sign in to comment.