CRM-16632 - Fix calculation of contribution fees
[civicrm-core.git] / CRM / Profile / Form.php
index 295b5043c1f3c3a9093ab191a7c092a76de34e85..cf276a1c374b9e15d1361a6f229ec24dc3954d5f 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$
  *
  */
@@ -53,14 +53,14 @@ class CRM_Profile_Form extends CRM_Core_Form {
   protected $_skipPermission = FALSE;
 
   /**
-   * The contact id that we are editing
+   * The contact id that we are editing.
    *
    * @var int
    */
   protected $_id;
 
   /**
-   * The group id that we are editing
+   * The group id that we are editing.
    *
    * @var int
    */
@@ -72,45 +72,51 @@ class CRM_Profile_Form extends CRM_Core_Form {
   protected $_ufGroup = array('name' => 'unknown');
 
   /**
-   * The group id that we are passing in url
+   * The group id that we are passing in url.
    *
    * @var int
    */
   public $_grid;
 
   /**
-   * Name of button for saving matching contacts
+   * Name of button for saving matching contacts.
    * @var
    */
   protected $_duplicateButtonName;
   /**
-   * The title of the category we are editing
+   * The title of the category we are editing.
    *
    * @var string
    */
   protected $_title;
 
   /**
-   * The fields needed to build this form
+   * The fields needed to build this form.
    *
    * @var array
    */
   public $_fields;
 
   /**
-   * store contact details
+   * store contact details.
    *
    * @var array
    */
   protected $_contact;
 
   /**
-   * Do we allow updates of the contact
+   * Do we allow updates of the contact.
    *
    * @var int
    */
   public $_isUpdateDupe = 0;
 
+  /**
+   * Dedupe using a specific rule (CRM-6131).
+   * Not currently exposed in profile settings, but can be set in a buildForm hook.
+   */
+  public $_ruleGroupID = NULL;
+
   public $_isAddCaptcha = FALSE;
 
   protected $_isPermissionedChecksum = FALSE;
@@ -123,7 +129,7 @@ class CRM_Profile_Form extends CRM_Core_Form {
   protected $_context;
 
   /**
-   * THe contact type for registration case
+   * THe contact type for registration case.
    *
    * @var string
    */
@@ -145,7 +151,7 @@ class CRM_Profile_Form extends CRM_Core_Form {
   protected $_isContactActivityProfile = FALSE;
 
   /**
-   * Activity Id connected to the profile
+   * Activity Id connected to the profile.
    *
    * @var string
    */
@@ -588,7 +594,7 @@ class CRM_Profile_Form extends CRM_Core_Form {
   }
 
   /**
-   * Build the form object
+   * Build the form object.
    *
    * @return void
    */
@@ -836,7 +842,7 @@ class CRM_Profile_Form extends CRM_Core_Form {
   }
 
   /**
-   * Validate profile and provided activity Id
+   * Validate profile and provided activity Id.
    *
    * @param int $activityId
    * @param int $contactId
@@ -876,7 +882,7 @@ class CRM_Profile_Form extends CRM_Core_Form {
   }
 
   /**
-   * Global form rule
+   * Global form rule.
    *
    * @param array $fields
    *   The input form values.
@@ -946,7 +952,8 @@ class CRM_Profile_Form extends CRM_Core_Form {
       $ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams,
         $ctype,
         $ruleType,
-        $exceptions
+        $exceptions,
+        $form->_ruleGroupID
       );
       if ($ids) {
         if ($form->_isUpdateDupe == 2) {
@@ -1354,7 +1361,7 @@ class CRM_Profile_Form extends CRM_Core_Form {
   }
 
   /**
-   * Use the form name to create the tpl file name
+   * Use the form name to create the tpl file name.
    *
    * @return string
    */
@@ -1379,4 +1386,5 @@ class CRM_Profile_Form extends CRM_Core_Form {
     $fileName = $this->checkTemplateFileExists('extra.');
     return $fileName ? $fileName : parent::overrideExtraTemplateFileName();
   }
+
 }