Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-20786 consolidate calls to deprecated function #10581

Merged
merged 1 commit into from
Jun 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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