if (!empty($this->_relatedObjects['membership'])) {
foreach ($this->_relatedObjects['membership'] as $membership) {
if ($membership->id) {
- $values['membership_id'] = $membership->id;
+ $values['isMembership'] = TRUE;
// need to set the membership values here
$template->assign('membership_assign', 1);
if (CRM_Utils_Array::value('contribution_mode', $params) == 'membership') {
$isRelatedId = TRUE;
}
-
+
$entityID[] = $entityId;
if (!empty($additionalParticipantId)) {
$entityID += $additionalParticipantId;
$params['trxnParams']['payment_instrument_id'] = $params['prevContribution']->payment_instrument_id;
$params['trxnParams']['check_number'] = $params['prevContribution']->check_number;
}
-
+
//if financial type is changed
if (!empty($params['financial_type_id']) &&
$params['contribution']->financial_type_id != $params['prevContribution']->financial_type_id) {
$contributionDAO->contribution_status_id = $statusId;
$contributionDAO->cancel_date = 'null';
$contributionDAO->cancel_reason = NULL;
+ $netAmount = !empty($trxnsData['net_amount']) ? $trxnsData['net_amount'] : $trxnsData['total_amount'];
+ $contributionDAO->net_amount = $contributionDAO->net_amount + $netAmount;
$contributionDAO->save();
//Change status of financial record too
}
/**
+ * function to get list of payments displayed by Contribute_Page_PaymentInfo
+ *
* @param $id
* @param $component
* @param bool $getTrxnInfo
$paymentBalance = CRM_Core_BAO_FinancialTrxn::getPartialPaymentWithType($id, $entity, FALSE, $total);
$contributionIsPayLater = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $contributionId, 'is_pay_later');
+
+ $feeRelationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Expense Account is' "));
+ $financialTypeId = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $contributionId, 'financial_type_id');
+ $feeFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($financialTypeId, $feeRelationTypeId);
+
if ($paymentBalance == 0 && $contributionIsPayLater) {
$paymentBalance = $total;
}
$info['payLater'] = $contributionIsPayLater;
$rows = array();
if ($getTrxnInfo && $baseTrxnId) {
+ // Need to exclude fee trxn rows so filter out rows where TO FINANCIAL ACCOUNT is expense account
$sql = "
SELECT ft.total_amount, con.financial_type_id, ft.payment_instrument_id, ft.trxn_date, ft.trxn_id, ft.status_id, ft.check_number
FROM civicrm_contribution con
LEFT JOIN civicrm_entity_financial_trxn eft ON (eft.entity_id = con.id AND eft.entity_table = 'civicrm_contribution')
- LEFT JOIN civicrm_financial_trxn ft ON ft.id = eft.financial_trxn_id
+ LEFT JOIN civicrm_financial_trxn ft ON ft.id = eft.financial_trxn_id AND ft.to_financial_account_id != {$feeFinancialAccount}
WHERE con.id = {$contributionId}
";