Merge pull request #13943 from mlutfy/setMessageError
[civicrm-core.git] / CRM / Utils / Hook.php
index 92989a902534cb7c4a605b9482377d6cb7a95cf8..e759533aa49d275662ea9f6fdaa9cb5841c4078a 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018                                |
+ | Copyright CiviCRM LLC (c) 2004-2019                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CiviCRM_Hook
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
  */
 abstract class CRM_Utils_Hook {
 
@@ -1263,12 +1263,17 @@ abstract class CRM_Utils_Hook {
    *   SQL columns.
    * @param int $exportMode
    *   Export mode ( contact, contribution, etc...).
+   * @param string $componentTable
+   *   Name of temporary table
+   * @param array $ids
+   *   Array of object's ids
    *
    * @return mixed
    */
-  public static function export(&$exportTempTable, &$headerRows, &$sqlColumns, &$exportMode) {
-    return self::singleton()->invoke(array('exportTempTable', 'headerRows', 'sqlColumns', 'exportMode'), $exportTempTable, $headerRows, $sqlColumns, $exportMode,
-      self::$_nullObject, self::$_nullObject,
+  public static function export(&$exportTempTable, &$headerRows, &$sqlColumns, &$exportMode, &$componentTable, &$ids) {
+    return self::singleton()->invoke(array('exportTempTable', 'headerRows', 'sqlColumns', 'exportMode', 'componentTable', 'ids'),
+      $exportTempTable, $headerRows, $sqlColumns,
+      $exportMode, $componentTable, $ids,
       'civicrm_export'
     );
   }
@@ -1292,6 +1297,29 @@ abstract class CRM_Utils_Hook {
     );
   }
 
+  /**
+   * Check for duplicate contacts
+   *
+   * @param array $dedupeParams
+   *   Array of params for finding duplicates: [
+   *    '{parameters returned by CRM_Dedupe_Finder::formatParams}
+   *    'check_permission' => TRUE/FALSE;
+   *    'contact_type' => $contactType;
+   *    'rule' = $rule;
+   *    'rule_group_id' => $ruleGroupID;
+   *    'excludedContactIDs' => $excludedContactIDs;
+   * @param array $dedupeResults
+   *   Array of results ['handled' => TRUE/FALSE, 'ids' => array of IDs of duplicate contacts]
+   * @param array $contextParams
+   *   The context if relevant, eg. ['event_id' => X]
+   *
+   * @return mixed
+   */
+  public static function findDuplicates($dedupeParams, &$dedupeResults, $contextParams) {
+    return self::singleton()
+      ->invoke(array('dedupeParams', 'dedupeResults', 'contextParams'), $dedupeParams, $dedupeResults, $contextParams, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_findDuplicates');
+  }
+
   /**
    * This hook is called AFTER EACH email has been processed by the script bin/EmailProcessor.php
    *
@@ -2473,4 +2501,17 @@ abstract class CRM_Utils_Hook {
     );
   }
 
+  /**
+   * ALlow Extensions to custom process IPN hook data such as sending Google Analyitcs information based on the IPN
+   * @param array $IPNData - Array of IPN Data
+   * @return mixed
+   */
+  public static function postIPNProcess(&$IPNData) {
+    return self::singleton()->invoke(array('IPNData'),
+      $IPNData, self::$_nullObject, self::$_nullObject,
+      self::$_nullObject, self::$_nullObject, self::$_nullObject,
+      'civicrm_postIPNProcess'
+    );
+  }
+
 }