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();
*/
public static function recordFinancialAccounts(&$params, $financialTrxnValues = NULL) {
$skipRecords = $update = $return = $isRelatedId = FALSE;
+ $isUpdate = !empty($params['prevContribution']);
$additionalParticipantId = [];
$contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
if (empty($params['prevContribution'])) {
$entityID = NULL;
}
- else {
- $update = TRUE;
- }
$statusId = $params['contribution']->contribution_status_id;
// CRM-13964 partial payment
$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;
}
}
- if (!$update) {
+ else {
// records finanical trxn and entity financial trxn
// also make it available as return value
self::recordAlwaysAccountsReceivable($trxnParams, $params);
}
// 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