Commit 25278837 authored by Monish Deb's avatar Monish Deb

Merge branch 'master-new' into 'master'

QA fixes

See merge request extensions/syncintacct!3
parents 3027ff7c 12aa8918
......@@ -23,6 +23,7 @@ class CRM_Syncintacct_Util {
public static function fetchEntries($batchID, $entityType) {
$entityTable = ($entityType == 'GL') ? 'civicrm_contribution' : 'civicrm_grant';
$amountColumn = ($entityType == 'GL') ? 'total_amount' : 'amount_total';
$sql = "SELECT
ft.id as financial_trxn_id,
ft.trxn_date,
......@@ -34,14 +35,12 @@ class CRM_Syncintacct_Util {
ft.trxn_id AS trxn_id,
cov.label AS payment_instrument,
ft.check_number,
c.source AS source,
c.id AS contribution_id,
c.total_amount AS contribution_amount,
c.{$amountColumn} AS contribution_amount,
c.contact_id AS contact_id,
cc.display_name,
eb.batch_id AS batch_id,
ft.currency AS currency,
cov_status.label AS status,
CASE
WHEN efti.entity_id IS NOT NULL
THEN efti.amount
......@@ -65,10 +64,8 @@ class CRM_Syncintacct_Util {
LEFT JOIN civicrm_option_group cog ON cog.name = 'payment_instrument'
LEFT JOIN civicrm_option_value cov ON (cov.value = ft.payment_instrument_id AND cov.option_group_id = cog.id)
LEFT JOIN civicrm_entity_financial_trxn eftc ON (eftc.financial_trxn_id = ft.id AND eftc.entity_table = '{$entityTable}')
LEFT JOIN civicrm_contribution c ON c.id = eftc.entity_id
LEFT JOIN {$entityTable} c ON c.id = eftc.entity_id
LEFT JOIN civicrm_contact cc ON cc.id = c.contact_id
LEFT JOIN civicrm_option_group cog_status ON cog_status.name = 'contribution_status'
LEFT JOIN civicrm_option_value cov_status ON (cov_status.value = ft.status_id AND cov_status.option_group_id = cog_status.id)
LEFT JOIN civicrm_entity_financial_trxn efti ON (efti.financial_trxn_id = ft.id AND efti.entity_table = 'civicrm_financial_item')
LEFT JOIN civicrm_financial_item fi ON fi.id = efti.entity_id
LEFT JOIN civicrm_financial_account fac ON fac.id = fi.financial_account_id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment