r50326 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50325‎ | r50326 | r50327 >
Date:23:10, 7 May 2009
Author:straussd
Status:deferred
Tags:
Comment:
Updated merge tool.
Modified paths:
  • /civicrm/trunk/sites/all/modules/civimerge/civimerge.module (modified) (history)

Diff [purge]

Index: civicrm/trunk/sites/all/modules/civimerge/civimerge.module
@@ -82,7 +82,7 @@
8383
8484 $start = microtime(TRUE);
8585
86 - $similar = civicluster_get_similar($primary_cid);
 86+ $similar = civicluster_get_similar($cid);
8787 //$similar = CRM_Dedupe_Finder::dupesOfContact($cid, 'Strict');
8888 //$content[] = '<div>Similarity check: ' . round(microtime(TRUE) - $start, 2) . 's</div>';
8989
@@ -209,22 +209,21 @@
210210
211211 function _civicluster_get_similar_rough($primary_cid, $min_score)
212212 {
 213+
213214 $similar = array();
 215+ $similar = _civicluster_update_scores($similar, _civicluster_get_similar_location($primary_cid, 'civicrm_email', 'email'), 20);
214216 $similar = _civicluster_update_scores($similar, _civicluster_get_similar_location($primary_cid, 'civicrm_address', 'street_address'), 10);
215217 //$similar = _civicluster_update_scores($similar, _civicluster_get_similar_location($primary_cid, 'civicrm_address', 'city'));
216 - $similar = _civicluster_update_scores($similar, _civicluster_get_similar_location($primary_cid, 'civicrm_email', 'email'), 20);
217218 $similar = _civicluster_update_scores($similar, _civicluster_get_similar_location($primary_cid, 'civicrm_phone', 'phone'), 10);
218219 $similar = _civicluster_update_scores($similar, _civicluster_get_similar_name($primary_cid, 6), 2);
219220 $similar = _civicluster_update_scores($similar, _civicluster_get_similar_name($primary_cid, 8), 3);
220221 $similar = _civicluster_update_scores($similar, _civicluster_get_similar_name($primary_cid, 10), 4);
221222 $similar = _civicluster_update_scores($similar, _civicluster_get_similar_name($primary_cid, 12), 5);
222 -
223 - //drupal_set_message(print_r($similar, TRUE));
224 -
 223+
225224 $similar_cids = array();
226225 foreach($similar as $similar_cid => $score)
227226 {
228 - if ($score >= $min_score && $similar_cid != $primary_cid && !civicluster_are_separated($primary_cid, $similar_cid))
 227+ if ($score >= $min_score && $similar_cid != $primary_cid)
229228 {
230229 $similar_cids[] = $similar_cid;
231230 }
@@ -266,12 +265,9 @@
267266 if (!is_numeric($cid))
268267 return array();
269268
270 - $sql = 'SELECT farl.entity_id AS contact_id FROM civicrm_location farl ';
271 - $sql .= 'INNER JOIN ' . $table . ' fara ON fara.location_id = farl.id ';
272 - $sql .= 'INNER JOIN ' . $table . ' neara ON fara.' . $field . ' = neara.' . $field . ' ';
273 - $sql .= 'INNER JOIN civicrm_location nearl ON neara.location_id = nearl.id ';
274 - $sql .= 'WHERE farl.entity_table = "civicrm_contact" AND nearl.entity_table = "civicrm_contact" AND nearl.entity_id = ' . $cid;
275 - //drupal_set_message($sql);
 269+ $sql = 'SELECT far.contact_id AS contact_id FROM ' . $table . ' far ';
 270+ $sql .= 'INNER JOIN ' . $table . ' near ON far.' . $field . ' = near.' . $field . ' ';
 271+ $sql .= 'WHERE near.contact_id = ' . $cid;
276272 $res =& CRM_Core_DAO::executeQuery( $sql, CRM_Core_DAO::$_nullArray );
277273 $ret = array();
278274 while ($res->fetch())

Status & tagging log