CRM-11338 further fix on fee amount
[civicrm-core.git] / CRM / Dedupe / Finder.php
index 451c552667a4a98c4e6fd209b085ffcc608ce173..2268bf865df9c5ea731e223b561e19ed2ec34e0b 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | 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$
  *
  */
@@ -52,8 +52,8 @@ class CRM_Dedupe_Finder {
    *   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");
@@ -95,7 +95,7 @@ class CRM_Dedupe_Finder {
    * @return array
    *   matching contact ids
    */
-  static function dupesByParams(
+  public static function dupesByParams(
     $params,
     $ctype,
     $used = 'Unsupervised',
@@ -109,8 +109,8 @@ class CRM_Dedupe_Finder {
 
     $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;
@@ -118,9 +118,9 @@ class CRM_Dedupe_Finder {
     }
 
     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");
       }
@@ -183,8 +183,8 @@ class CRM_Dedupe_Finder {
       }
       $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");
@@ -235,7 +235,9 @@ class CRM_Dedupe_Finder {
 
     // 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])) {
@@ -306,9 +308,9 @@ class CRM_Dedupe_Finder {
           // 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])) {
@@ -325,4 +327,5 @@ class CRM_Dedupe_Finder {
     }
     return $params;
   }
+
 }