From 7fedcca56cd12276a36f3d8cba89cf9cc6d0fd50 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Thu, 25 Aug 2016 19:38:18 +0530 Subject: [PATCH] CRM-16189, fixed sql to retrieve payments and set is_payment=false for deferred payments ---------------------------------------- * CRM-16189: Improve support for Accrual Method bookkeeping https://issues.civicrm.org/jira/browse/CRM-16189 Conflicts: CRM/Core/BAO/FinancialTrxn.php --- CRM/Contribute/BAO/Contribution.php | 6 +----- CRM/Core/BAO/FinancialTrxn.php | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index d1cbe5b895..99c909c8e9 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -4068,9 +4068,6 @@ WHERE eft.financial_trxn_id IN ({$trxnId}, {$baseTrxnId['financialTrxnId']}) $info['payLater'] = $contributionIsPayLater; $rows = array(); if ($getTrxnInfo && $baseTrxnId) { - $arRelationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' ")); - $arAccount = CRM_Contribute_PseudoConstant::financialAccountType($financialTypeId, $arRelationTypeId); - // Need to exclude fee trxn rows so filter out rows where TO FINANCIAL ACCOUNT is expense account $sql = " SELECT GROUP_CONCAT(fa.`name`) as financial_account, @@ -4086,12 +4083,11 @@ WHERE eft.financial_trxn_id IN ({$trxnId}, {$baseTrxnId['financialTrxnId']}) LEFT JOIN civicrm_financial_item fi ON fi.id = ef.entity_id INNER JOIN civicrm_financial_account fa ON fa.id = fi.financial_account_id - WHERE con.id = %1 AND ft.to_financial_account_id <> %3 + WHERE con.id = %1 AND ft.is_payment = 1 GROUP BY ft.id"; $queryParams = array( 1 => array($contributionId, 'Integer'), 2 => array($feeFinancialAccount, 'Integer'), - 3 => array($arAccount, 'Integer'), ); $resultDAO = CRM_Core_DAO::executeQuery($sql, $queryParams); $statuses = CRM_Contribute_PseudoConstant::contributionStatus(); diff --git a/CRM/Core/BAO/FinancialTrxn.php b/CRM/Core/BAO/FinancialTrxn.php index fb03325fa8..cea11b3809 100644 --- a/CRM/Core/BAO/FinancialTrxn.php +++ b/CRM/Core/BAO/FinancialTrxn.php @@ -635,7 +635,6 @@ WHERE pp.participant_id = {$entityId} AND ft.to_financial_account_id != {$toFina 'status_id' => $contributionDetails->contribution_status_id, 'payment_instrument_id' => $contributionDetails->payment_instrument_id, 'check_number' => $contributionDetails->check_number, - 'is_payment' => 1, ); $deferredRevenues = array(); -- 2.25.1