Skip to content

Commit

Permalink
Merge pull request #10581 from eileenmcnaughton/deprecated4
Browse files Browse the repository at this point in the history
CRM-20786 consolidate calls to deprecated function
  • Loading branch information
monishdeb authored Jun 29, 2017
2 parents 80640b8 + 5631674 commit 9bdff54
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
5 changes: 1 addition & 4 deletions CRM/Contribute/Import/Parser/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,7 @@ public function import($onDuplicate, &$values) {
$paramValues['contact_type'] = $this->_contactType;
}

$paramValues['version'] = 3;
//retrieve contact id using contact dedupe rule
require_once 'CRM/Utils/DeprecatedUtils.php';
$error = _civicrm_api3_deprecated_check_contact_dedupe($paramValues);
$error = $this->checkContactDuplicate($paramValues);

if (CRM_Core_Error::isAPIError($error, CRM_Core_ERROR::DUPLICATE_CONTACT)) {
$matchedIDs = explode(',', $error['error_message']['params'][0]);
Expand Down
9 changes: 1 addition & 8 deletions CRM/Event/Import/Parser/Participant.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ class CRM_Event_Import_Parser_Participant extends CRM_Event_Import_Parser {
protected $_mapperKeys;

private $_contactIdIndex;

//private $_totalAmountIndex;

private $_eventIndex;
private $_participantStatusIndex;
private $_participantRoleIndex;
Expand Down Expand Up @@ -399,11 +396,7 @@ public function import($onDuplicate, &$values) {
}

if ($this->_contactIdIndex < 0) {

//retrieve contact id using contact dedupe rule
$formatValues['contact_type'] = $this->_contactType;
$formatValues['version'] = 3;
$error = _civicrm_api3_deprecated_check_contact_dedupe($formatValues);
$error = $this->checkContactDuplicate($formatValues);

if (CRM_Core_Error::isAPIError($error, CRM_Core_ERROR::DUPLICATE_CONTACT)) {
$matchedIDs = explode(',', $error['error_message']['params'][0]);
Expand Down
16 changes: 16 additions & 0 deletions CRM/Import/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -444,4 +444,20 @@ public static function saveFileName($type) {
return $fileName;
}

/**
* Check if contact is a duplicate .
*
* @param array $formatValues
*
* @return array
*/
protected function checkContactDuplicate(&$formatValues) {
//retrieve contact id using contact dedupe rule
$formatValues['contact_type'] = $this->_contactType;
$formatValues['version'] = 3;
require_once 'CRM/Utils/DeprecatedUtils.php';
$error = _civicrm_api3_deprecated_check_contact_dedupe($formatValues);
return $error;
}

}
7 changes: 1 addition & 6 deletions CRM/Member/Import/Parser/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -415,12 +415,7 @@ public function import($onDuplicate, &$values) {
$joinDate = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('join_date', $formatted), '%Y-%m-%d');

if ($this->_contactIdIndex < 0) {

//retrieve contact id using contact dedupe rule
$formatValues['contact_type'] = $this->_contactType;
$formatValues['version'] = 3;
require_once 'CRM/Utils/DeprecatedUtils.php';
$error = _civicrm_api3_deprecated_check_contact_dedupe($formatValues);
$error = $this->checkContactDuplicate($formatValues);

if (CRM_Core_Error::isAPIError($error, CRM_Core_ERROR::DUPLICATE_CONTACT)) {
$matchedIDs = explode(',', $error['error_message']['params'][0]);
Expand Down

0 comments on commit 9bdff54

Please sign in to comment.