+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
* $Id$
*
*/
* @param array $cids
* Contact ids to limit the search to.
*
- * @return array array of (cid1, cid2, weight) dupe triples
+ * @return array
+ * array of (cid1, cid2, weight) dupe triples
*/
public static function dupes($rgid, $cids = array()) {
- $rgBao = new CRM_Dedupe_BAO_RuleGroup();
- $rgBao->id = $rgid;
+ $rgBao = new CRM_Dedupe_BAO_RuleGroup();
+ $rgBao->id = $rgid;
$rgBao->contactIds = $cids;
if (!$rgBao->find(TRUE)) {
CRM_Core_Error::fatal("Dedupe rule not found for selected contacts");
* @param int $ruleGroupID
* The id of the dedupe rule we should be using.
*
- * @return array matching contact ids
+ * @return array
+ * matching contact ids
*/
- static function dupesByParams(
+ public static function dupesByParams(
$params,
$ctype,
$used = 'Unsupervised',
$foundByID = FALSE;
if ($ruleGroupID) {
- $rgBao = new CRM_Dedupe_BAO_RuleGroup();
- $rgBao->id = $ruleGroupID;
+ $rgBao = new CRM_Dedupe_BAO_RuleGroup();
+ $rgBao->id = $ruleGroupID;
$rgBao->contact_type = $ctype;
if ($rgBao->find(TRUE)) {
$foundByID = TRUE;
}
if (!$foundByID) {
- $rgBao = new CRM_Dedupe_BAO_RuleGroup();
+ $rgBao = new CRM_Dedupe_BAO_RuleGroup();
$rgBao->contact_type = $ctype;
- $rgBao->used = $used;
+ $rgBao->used = $used;
if (!$rgBao->find(TRUE)) {
CRM_Core_Error::fatal("$used rule for $ctype does not exist");
}
* @param int $gid
* Contact group id (currently, works only with non-smart groups).
*
- * @return array array of (cid1, cid2, weight) dupe triples
+ * @return array
+ * array of (cid1, cid2, weight) dupe triples
*/
public static function dupesInGroup($rgid, $gid) {
$cids = array_keys(CRM_Contact_BAO_Group::getMember($gid));
- if ( !empty($cids) ) {
+ if (!empty($cids)) {
return self::dupes($rgid, $cids);
}
return array();
* @param string $ctype
* Contact type of the given contact.
*
- * @return array array of dupe contact_ids
+ * @return array
+ * array of dupe contact_ids
*/
public static function dupesOfContact($cid, $used = 'Unsupervised', $ctype = NULL) {
// if not provided, fetch the contact type from the database
}
$ctype = $dao->contact_type;
}
- $rgBao = new CRM_Dedupe_BAO_RuleGroup();
- $rgBao->used = $used;
+ $rgBao = new CRM_Dedupe_BAO_RuleGroup();
+ $rgBao->used = $used;
$rgBao->contact_type = $ctype;
if (!$rgBao->find(TRUE)) {
CRM_Core_Error::fatal("$used rule for $ctype does not exist");
* @param string $ctype
* Contact type of the given contact.
*
- * @return array valid $params array for dedupe
+ * @return array
+ * valid $params array for dedupe
*/
public static function formatParams($fields, $ctype) {
$flat = array();
// handle {birth,deceased}_date
foreach (array(
- 'birth_date', 'deceased_date') as $date) {
+ 'birth_date',
+ 'deceased_date',
+ ) as $date) {
if (!empty($fields[$date])) {
$flat[$date] = $fields[$date];
if (is_array($flat[$date])) {
// FIXME: we also need to do some hacking for id and name fields, see CRM-3902’s comments
$fixes = array(
'address_name' => 'name',
- 'country' => 'country_id',
+ 'country' => 'country_id',
'state_province' => 'state_province_id',
- 'county' => 'county_id',
+ 'county' => 'county_id',
);
foreach ($fixes as $orig => $target) {
if (!empty($flat[$orig])) {
}
return $params;
}
+
}