From: jitendrapurohit Date: Thu, 30 Oct 2014 06:38:01 +0000 (+0530) Subject: DB error on search for account_type_code or account_code X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=6ef17211878147aafe7d7bee3650168152e9f7fe;p=civicrm-core.git DB error on search for account_type_code or account_code --- diff --git a/CRM/Contribute/BAO/Query.php b/CRM/Contribute/BAO/Query.php index 047c1fd152..f3c533946b 100644 --- a/CRM/Contribute/BAO/Query.php +++ b/CRM/Contribute/BAO/Query.php @@ -722,11 +722,19 @@ class CRM_Contribute_BAO_Query { } break; + case 'civicrm_financial_account': + if ($mode & CRM_Contact_BAO_Query::MODE_CONTACTS) { + $from = " $side JOIN civicrm_financial_account ON contact_a.id = civicrm_financial_account.contact_id "; + } + break; + case 'civicrm_accounting_code': - $from = " $side JOIN civicrm_entity_financial_account ON civicrm_entity_financial_account.entity_id = civicrm_contribution.financial_type_id AND civicrm_entity_financial_account.entity_table = 'civicrm_financial_type' "; - $from .= " INNER JOIN civicrm_financial_account ON civicrm_financial_account.id = civicrm_entity_financial_account.financial_account_id "; - $from .= " INNER JOIN civicrm_option_value cov ON cov.value = civicrm_entity_financial_account.account_relationship AND cov.name = 'Income Account is' "; - $from .= " INNER JOIN civicrm_option_group cog ON cog.id = cov.option_group_id AND cog.name = 'account_relationship' "; + if ($mode & CRM_Contact_BAO_Query::MODE_CONTRIBUTE) { + $from = " $side JOIN civicrm_entity_financial_account ON civicrm_entity_financial_account.entity_id = civicrm_contribution.financial_type_id AND civicrm_entity_financial_account.entity_table = 'civicrm_financial_type' "; + $from .= " INNER JOIN civicrm_financial_account ON civicrm_financial_account.id = civicrm_entity_financial_account.financial_account_id "; + $from .= " INNER JOIN civicrm_option_value cov ON cov.value = civicrm_entity_financial_account.account_relationship AND cov.name = 'Income Account is' "; + $from .= " INNER JOIN civicrm_option_group cog ON cog.id = cov.option_group_id AND cog.name = 'account_relationship' "; + } break; case 'civicrm_contribution_page':