Skip to content

Commit

Permalink
fix #2, bump version to v.1.1.4-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich Lott committed Feb 7, 2017
1 parent ff5965f commit 58ca210
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
27 changes: 15 additions & 12 deletions CRM/CsvImportHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -483,20 +483,23 @@ public static function loadCacheRecords($filters = []) {

// Select every column except 'data'. Keep original input order (id)
// Nb. Fix ssue #2
// Certain MySQL engines don't allow selecting a field that is not in a
// GROUP BY or aggregate function. So we have to use a join to simulate
// FIRST() sort of thing. Of course this would be nicer if the groups
// were in one table and the resolutions in another (normalised data), but
// that's an optimisation I've not as yet bothered with, since the data is
// temporary and not expected to be massive.
// Certain MySQL engines (e.g. 5.7) don't allow selecting a field that is
// not in a GROUP BY or aggregate function. So we have to use a subquery +
// join to simulate FIRST() sort of thing. Of course this would be nicer if
// the groups were in one table and the resolutions in another (normalised
// data), but that's an optimisation I've not as yet bothered with, since
// the data is temporary and not expected to be massive.
$sql = "
SELECT a.fname, a.lname, a.email, min(a.id) id, COUNT(a.id) set_count,
b.contact_id, b.title, b.state, b.resolution
FROM civicrm_csv_match_cache a
SELECT a.fname, a.lname, a.email, a.id, set_count,
b.contact_id, b.title, b.state, b.resolution
FROM (
SELECT fname, lname, email, min(a.id) id, COUNT(a.id) set_count
FROM civicrm_csv_match_cache a
WHERE a.state != 'header' $wheres
GROUP BY a.fname, a.lname, a.email
) a
INNER JOIN civicrm_csv_match_cache b ON (b.id=a.id)
WHERE a.state != 'header' $wheres
GROUP BY a.fname, a.lname, a.email
ORDER BY min(a.id)
ORDER BY a.id
";
$dao = CRM_Core_DAO::executeQuery($sql, $params);
$return_values = $dao->fetchAll();
Expand Down
2 changes: 1 addition & 1 deletion info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/gpl-3.0.html</url>
</urls>
<releaseDate>2017-01-27</releaseDate>
<version>1.1.3-beta</version>
<version>1.1.4-beta</version>
<develStage>beta</develStage>
<compatibility>
<ver>4.7</ver>
Expand Down

0 comments on commit 58ca210

Please sign in to comment.