Index: civicrm/trunk/sites/all/modules/civimerge/civimerge.module |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | |
84 | 84 | $start = microtime(TRUE); |
85 | 85 | |
86 | | - $similar = civicluster_get_similar($primary_cid); |
| 86 | + $similar = civicluster_get_similar($cid); |
87 | 87 | //$similar = CRM_Dedupe_Finder::dupesOfContact($cid, 'Strict'); |
88 | 88 | //$content[] = '<div>Similarity check: ' . round(microtime(TRUE) - $start, 2) . 's</div>'; |
89 | 89 | |
— | — | @@ -209,22 +209,21 @@ |
210 | 210 | |
211 | 211 | function _civicluster_get_similar_rough($primary_cid, $min_score) |
212 | 212 | { |
| 213 | + |
213 | 214 | $similar = array(); |
| 215 | + $similar = _civicluster_update_scores($similar, _civicluster_get_similar_location($primary_cid, 'civicrm_email', 'email'), 20); |
214 | 216 | $similar = _civicluster_update_scores($similar, _civicluster_get_similar_location($primary_cid, 'civicrm_address', 'street_address'), 10); |
215 | 217 | //$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); |
217 | 218 | $similar = _civicluster_update_scores($similar, _civicluster_get_similar_location($primary_cid, 'civicrm_phone', 'phone'), 10); |
218 | 219 | $similar = _civicluster_update_scores($similar, _civicluster_get_similar_name($primary_cid, 6), 2); |
219 | 220 | $similar = _civicluster_update_scores($similar, _civicluster_get_similar_name($primary_cid, 8), 3); |
220 | 221 | $similar = _civicluster_update_scores($similar, _civicluster_get_similar_name($primary_cid, 10), 4); |
221 | 222 | $similar = _civicluster_update_scores($similar, _civicluster_get_similar_name($primary_cid, 12), 5); |
222 | | - |
223 | | - //drupal_set_message(print_r($similar, TRUE)); |
224 | | - |
| 223 | + |
225 | 224 | $similar_cids = array(); |
226 | 225 | foreach($similar as $similar_cid => $score) |
227 | 226 | { |
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) |
229 | 228 | { |
230 | 229 | $similar_cids[] = $similar_cid; |
231 | 230 | } |
— | — | @@ -266,12 +265,9 @@ |
267 | 266 | if (!is_numeric($cid)) |
268 | 267 | return array(); |
269 | 268 | |
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; |
276 | 272 | $res =& CRM_Core_DAO::executeQuery( $sql, CRM_Core_DAO::$_nullArray ); |
277 | 273 | $ret = array(); |
278 | 274 | while ($res->fetch()) |