X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContribute%2FBAO%2FContribution.php;h=d2c99595fbd176cc40935223ac10cd722ba5d2d5;hb=2f8a402e9f1eb5ab9cd061e9105a7c2a3935718e;hp=be6547f66de95f033a022a3dad80e6c67e4cfc13;hpb=b5b27619ebbff04079eddea91a31b42bbd8ca540;p=civicrm-core.git diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index be6547f66d..d2c99595fb 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -508,27 +508,6 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { CRM_Core_BAO_Note::add($noteParams); } - // make entry in batch entity batch table - if (!empty($params['batch_id'])) { - // in some update cases we need to get extra fields - ie an update that doesn't pass in all these params - $titleFields = [ - 'contact_id', - 'total_amount', - 'currency', - 'financial_type_id', - ]; - $retrieveRequired = 0; - foreach ($titleFields as $titleField) { - if (!isset($contribution->$titleField)) { - $retrieveRequired = 1; - break; - } - } - if ($retrieveRequired == 1) { - $contribution->find(TRUE); - } - } - CRM_Contribute_BAO_ContributionSoft::processSoftContribution($params, $contribution); $transaction->commit(); @@ -3496,6 +3475,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac */ public static function recordFinancialAccounts(&$params, $financialTrxnValues = NULL) { $skipRecords = $update = $return = $isRelatedId = FALSE; + $isUpdate = !empty($params['prevContribution']); $additionalParticipantId = []; $contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'); @@ -3529,9 +3509,6 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac if (empty($params['prevContribution'])) { $entityID = NULL; } - else { - $update = TRUE; - } $statusId = $params['contribution']->contribution_status_id; // CRM-13964 partial payment @@ -3663,7 +3640,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac $params['trxnParams'] = $trxnParams; - if (!empty($params['prevContribution'])) { + if ($isUpdate) { $updated = FALSE; $params['trxnParams']['total_amount'] = $trxnParams['total_amount'] = $params['total_amount'] = $params['prevContribution']->total_amount; $params['trxnParams']['fee_amount'] = $params['prevContribution']->fee_amount; @@ -3796,7 +3773,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac } } - if (!$update) { + else { // records finanical trxn and entity financial trxn // also make it available as return value self::recordAlwaysAccountsReceivable($trxnParams, $params); @@ -3811,7 +3788,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac } // record line items and financial items if (empty($params['skipLineItem'])) { - CRM_Price_BAO_LineItem::processPriceSet($entityId, CRM_Utils_Array::value('line_item', $params), $params['contribution'], $entityTable, $update); + CRM_Price_BAO_LineItem::processPriceSet($entityId, CRM_Utils_Array::value('line_item', $params), $params['contribution'], $entityTable, $isUpdate); } // create batch entry if batch_id is passed and