Several CiviContribute fields cause an error in Search Builder
Recently I was trying to do a search with Search Builder including soft credits clauses and I was not able to. Instead I got an error. I found the issue related reported by Guillaume Boudrias on the old issue tracker https://issues.civicrm.org/jira/browse/CRM-20587 and I proceeded to reopened here.
Contribution fields that do not belong to the contribution table seem to cause an error when using the Search Builder.
- Contribution -> End date for Premiums
- Contribution -> Soft Credit For
- Contribution -> Batch Name
Simply using the fields results in an error page: "DB Error: no such field"
Sample error in debug mode:
Database Error Code: Unknown column 'civicrm_contribution.financial_type_id' in 'where clause', 1054
It seems we are missing a JOIN clause somewhere, though I don't know where in the code this is generated.
I assume the issue may be present with more than CiviContribute but I haven't found other problematic fields.
This issue can be reproduced on the demo sites such as http://dmaster.demo.civicrm.org
Steps to reproduce:
- Activate CiviContribute
- Go to Search Builder (civicrm/contact/search/builder)
- Select Contribution -> End date for premium -> Is not null
- Press search