From: Atif Shaikh Date: Mon, 14 Apr 2014 06:40:47 +0000 (+0530) Subject: CRM-13833 Further Improvements X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c9ea7d07f2b1d56e76ece5080837eeeb38ba4ef2;p=civicrm-core.git CRM-13833 Further Improvements ---------------------------------------- * CRM-13833: Implement Soft Credit Types https://issues.civicrm.org/jira/browse/CRM-13833 --- diff --git a/CRM/Utils/DeprecatedUtils.php b/CRM/Utils/DeprecatedUtils.php index 2c30fe6145..1c3849485c 100644 --- a/CRM/Utils/DeprecatedUtils.php +++ b/CRM/Utils/DeprecatedUtils.php @@ -311,7 +311,7 @@ function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = F } } } - elseif ($params['contribution_id'] || $params['trxn_id'] || $params['invoice_id']) { + elseif (!empty($params['contribution_id']) || !empty($params['trxn_id']) || !empty($params['invoice_id'])) { //when update mode check contribution id or trxn id or //invoice id $contactId = new CRM_Contribute_DAO_Contribution(); @@ -333,6 +333,14 @@ function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = F } } } + else { + if ($onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE) { + return civicrm_api3_create_error("Empty Contribution and Invoice and Transaction ID.Row was skipped."); + } + else { + return civicrm_api3_create_error("Empty Contact and External ID.Row was skipped."); + } + } break; case 'receive_date': @@ -392,14 +400,6 @@ function _civicrm_api3_deprecated_formatted_param($params, &$values, $create = F //import contribution record according to select contact type // validate contact id and external identifier. $value[$key] = $mismatchContactType = $softCreditContactIds = ''; - if (!isset($params['contribution_id']) && empty($params['contribution_id']) && $onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE) { - $errorMsg = ts("Empty Contribution Id. Row was skipped."); - return civicrm_api3_create_error($errorMsg, $value[$key]); - } - elseif (!isset($params['contribution_contact_id']) && empty($params['contribution_contact_id']) && $onDuplicate != CRM_Import_Parser::DUPLICATE_UPDATE) { - $errorMsg = ts("Empty Contact Id. Row was skipped."); - return civicrm_api3_create_error($errorMsg, $value[$key]); - } if (isset($params[$key]) && is_array($params[$key])) { foreach ($params[$key] as $softKey => $softParam) { $contactId = CRM_Utils_Array::value('contact_id', $softParam);