X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=bin%2FContributionProcessor.php;h=5432bc045f9aa020a025d75cc20331541c70cc9a;hb=2c0f8c6797d810bc6a3202b7d0c18e762f5f22ec;hp=0618eb014b3350e705e44ed515eec792ba8580a6;hpb=33a5af51060efaca1634c2a87bcbebfe6d8cf7de;p=civicrm-core.git diff --git a/bin/ContributionProcessor.php b/bin/ContributionProcessor.php index 0618eb014b..5432bc045f 100644 --- a/bin/ContributionProcessor.php +++ b/bin/ContributionProcessor.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 4.7 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2016 | + | Copyright CiviCRM LLC (c) 2004-2017 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -28,7 +28,7 @@ /** * * @package CRM - * @copyright CiviCRM LLC (c) 2004-2016 + * @copyright CiviCRM LLC (c) 2004-2017 */ class CiviContributeProcessor { static $_paypalParamsMapper = array( @@ -188,10 +188,15 @@ class CiviContributeProcessor { $params['transaction']['is_test'] = 0; } - if (self::processAPIContribution($params)) { - CRM_Core_Error::debug_log_message("Processed - {$trxnDetails['email']}, {$trxnDetails['amt']}, {$value} ..
", TRUE); + try { + if (self::processAPIContribution($params)) { + CRM_Core_Error::debug_log_message("Processed - {$trxnDetails['email']}, {$trxnDetails['amt']}, {$value} ..
", TRUE); + } + else { + CRM_Core_Error::debug_log_message("Skipped - {$trxnDetails['email']}, {$trxnDetails['amt']}, {$value} ..
", TRUE); + } } - else { + catch (CiviCRM_API3_Exception $e) { CRM_Core_Error::debug_log_message("Skipped - {$trxnDetails['email']}, {$trxnDetails['amt']}, {$value} ..
", TRUE); } } @@ -399,6 +404,10 @@ class CiviContributeProcessor { } /** + * @deprecated function. + * + * This function has probably been defunct for quite a long time. + * * @param array $params * * @return bool @@ -408,33 +417,16 @@ class CiviContributeProcessor { return FALSE; } - // add contact using dedupe rule - $dedupeParams = CRM_Dedupe_Finder::formatParams($params, 'Individual'); - $dedupeParams['check_permission'] = FALSE; - $dupeIds = CRM_Dedupe_Finder::dupesByParams($dedupeParams, 'Individual'); - // if we find more than one contact, use the first one - if (!empty($dupeIds[0])) { - $params['contact_id'] = $dupeIds[0]; - } - $contact = CRM_Contact_BAO_Contact::create($params); - if (!$contact->id) { - return FALSE; - } + $params['contact_id'] = CRM_Contact_BAO_Contact::getFirstDuplicateContact($params, 'Individual', 'Unsupervised', array(), FALSE); + + $contact = civicrm_api3('Contact', 'create', $params); // only pass transaction params to contribution::create, if available if (array_key_exists('transaction', $params)) { $params = $params['transaction']; - $params['contact_id'] = $contact->id; + $params['contact_id'] = $contact['id']; } - // handle contribution custom data - $customFields = CRM_Core_BAO_CustomField::getFields('Contribution', - FALSE, - FALSE, - CRM_Utils_Array::value('financial_type_id', - $params - ) - ); $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, CRM_Utils_Array::value('id', $params, NULL), 'Contribution' @@ -470,9 +462,7 @@ class CiviContributeProcessor { } } - $contribution = &CRM_Contribute_BAO_Contribution::create($params, - CRM_Core_DAO::$_nullArray - ); + $contribution = CRM_Contribute_BAO_Contribution::create($params); if (!$contribution->id) { return FALSE; }