2

When we use Find Contributions to generate a list of contributions for thank you e-mails, then select the All Records radio button, and then choose Thank You Letters, we see the fatal error below.

I do see code in CRM/Contribute/Form/Task/Batch.php that looks like it's meant to handle an issue like this: https://github.com/civicrm/civicrm-core/blob/67ea385e0e5cd3daed04807c1465605f059b1002/CRM/Contribute/Form/Task/Batch.php#L230

We do not get the fatal error when we use the select all checkbox instead of the All Records radio button.

I have not yet been able to replicate on the demo. (The CiviHosting Drupal 7 demo is throwing an error right now itself.)

$Fatal Error Details = Array ( 
[callback] => Array ( [0] => CRM_Core_Error [1] => handle ) 
[code] => -19 [message] => DB Error: no such field [mode] => 16     
[debug_info] => 
SELECT civicrm_contribution.id, contact_a.id as contact_id, 
civicrm_contribution.id as contribution_id,
civicrm_contribution.contribution_status_id as `contribution_status_id` 
FROM civicrm_contact contact_a LEFT JOIN civicrm_contribution ON 
civicrm_contribution.contact_id = contact_a.id WHERE ( ( 
civicrm_contribution.receive_date >= '20161017000000' ) AND ( 
civicrm_contribution.receive_date <= '20161018235959' ) AND 
civicrm_contribution.financial_type_id IN ("5", "1", "4") AND 
civicrm_contribution.financial_type_id IN ("1") AND 
civicrm_contribution.contribution_status_id IN ("1") AND 
civicrm_contribution.thankyou_date IS NULL AND 
civicrm_contribution.is_test = 0 ) AND 
(contact_a.is_deleted = 0) 
GROUP BY civicrm_contribution.id 
ORDER BY `contribution_source` desc, 
`contact_a`.`id` [
nativecode=1054 ** Unknown column 'contribution_source' in 'order clause'] 
[type] => DB_Error 
[user_info] => 
SELECT civicrm_contribution.id, contact_a.id as contact_id, 
civicrm_contribution.id as contribution_id, 
civicrm_contribution.contribution_status_id as `contribution_status_id` 
FROM civicrm_contact contact_a LEFT JOIN civicrm_contribution ON 
civicrm_contribution.contact_id = contact_a.id WHERE ( ( 
civicrm_contribution.receive_date >= '20161017000000' ) AND ( 
civicrm_contribution.receive_date <= '20161018235959' ) AND 
civicrm_contribution.financial_type_id IN ("5", "1", "4") AND 
civicrm_contribution.financial_type_id IN ("1") AND 
civicrm_contribution.contribution_status_id IN ("1") AND 
civicrm_contribution.thankyou_date IS NULL AND 
civicrm_contribution.is_test = 0 ) AND
(contact_a.is_deleted = 0) 
GROUP BY civicrm_contribution.id 
ORDER BY `contribution_source` desc, 
`contact_a`.`id` 
[nativecode=1054 ** Unknown column 'contribution_source' in 'order clause'] [to_string] => [db_error: message="DB Error: no such field" code=-19 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT civicrm_contribution.id, contact_a.id as contact_id, civicrm_contribution.id as contribution_id, civicrm_contribution.contribution_status_id as `contribution_status_id` FROM civicrm_contact contact_a LEFT JOIN civicrm_contribution ON civicrm_contribution.contact_id = contact_a.id WHERE ( ( civicrm_contribution.receive_date >= '20161017000000' ) AND ( civicrm_contribution.receive_date <= '20161018235959' ) AND civicrm_contribution.financial_type_id IN ("5", "1", "4") AND civicrm_contribution.financial_type_id IN ("1") AND civicrm_contribution.contribution_status_id IN ("1") AND civicrm_contribution.thankyou_date IS NULL AND civicrm_contribution.is_test = 0 ) AND (contact_a.is_deleted = 0) GROUP BY civicrm_contribution.id ORDER BY `contribution_source` desc, `contact_a`.`id` [nativecode=1054 ** Unknown column 'contribution_source' in 'order clause']"] )
  • sorry for the below answer - please let me know how to recreate the issue - i dont see a radio button in batch export – Ramesh - ARTECH Consultancy Oct 19 '16 at 9:02
  • I looked into this per our discussion on chat.civicrm.org yesterday - but I'm not sure how to replicate this. Could you please update the question to explain what steps you took to cause this? Do you experience the same issue on the demo server? – Jon G - Megaphone Tech Oct 19 '16 at 15:44
  • Thank you for taking a look! I've added the requested details above. – galgeek Oct 24 '16 at 1:34
2

Further investigation found that this was failing not only with contribution_source, but also for financial_type and contribution_status.

A fix has been raised to address this issue at https://github.com/civicrm/civicrm-core/pull/9516. It'll be included in 4.7.15.

0

In contribution you don't have a column called contribution_source. so, please change the column name to source also you are not using alise for the column use civicrm_contribution.source

Please try the below SQL: I guess that should work

SELECT civicrm_contribution.id, contact_a.id as contact_id, civicrm_contribution.id as contribution_id, civicrm_contribution.contribution_status_id as contribution_status_id FROM civicrm_contact contact_a LEFT JOIN civicrm_contribution ON civicrm_contribution.contact_id = contact_a.id WHERE ( ( civicrm_contribution.receive_date >= '20161017000000' ) AND ( civicrm_contribution.receive_date <= '20161018235959' ) AND civicrm_contribution.financial_type_id IN ("5", "1", "4") AND civicrm_contribution.financial_type_id IN ("1") AND civicrm_contribution.contribution_status_id IN ("1") AND civicrm_contribution.thankyou_date IS NULL AND civicrm_contribution.is_test = 0 ) AND (contact_a.is_deleted = 0) GROUP BY civicrm_contribution.id ORDER BY civicrm_contribution.source desc, contact_a.id

I guess this helps !!!

  • Ramesh, I wonder where we should try making this change. The fatal error happens when we're using Civi's web interface, with that SQL that's throwing the fatal error generated by Civi's code. – galgeek Dec 4 '16 at 0:36
  • Please try to reproduce the same issue against CiviCRM Demo - If you couldn't reproduce the issue then please try to upgrade your local CiviCRM code base - That should Fix.. – Ramesh - ARTECH Consultancy Dec 6 '16 at 3:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.