0

I'm trying to create a view that will tell our logged-in Drupal users when their next scheduled contribution is slated to happen. Everything is working well until I add the field "CiviCRM Recurring Contributions: Next Contribution Date". When that happens, my preview gives the error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'civicrm_contribution_recur.next_sched_contribution' in 'field list'

The Views SQL query shows this field being called:

civicrm_contribution_recur.next_sched_contribution AS civicrm_contribution_recur_next_sched_contribution

That is the correct table, but the field name is incorrect. It should be next_sched_contribution_date. I've tried searching in the CiviCRM Entity Github repo, but I can't find where the (incorrect) field name is being generated. Where would I look to find the error? Or am I looking in the wrong place entirely and it's not a CiviCRM Entity issue at all? I want to help, I just don't know where to correct it.

We're using Drupal 7, CiviCRM 4.6.21, CiviCRM Entity module 7.x-2.0-beta3. The type of view is "CiviCRM Recurring Contribution profile."

  • Hi Allen - I am not clear. Are using the civicrm_entity module. if so is your view built on the standard 'contribution' or on the entity contribution base – petednz - fuzion Nov 11 '16 at 5:36
  • 1
    Hi Pete, thanks for asking and helping me remember what I forgot to post. :) I've updated the question. Yes on the CiviCRM-Entity module. Using the view type of "CiviCRM Recurring Contribution profile", not the "CiviCRM Recurring Entity." – Allen Hutchison Nov 11 '16 at 5:40
  • 1
    In the future, the best place to get support for CiviCRM Entity is via the module's issue queue, drupal.org/project/issues/… – jackrabbithanna Apr 18 '17 at 0:24
1

I just ran into this - got it working - (4.6 line numbers) - just need to update the field names (see below). After applying the patch clear caches (the views cache in particular).

I do not have CiviCRM Entity installed for this project - this is a straight up CiviCRM Views integration/fix.

diff --git a/drupal/modules/views/components/civicrm.contribute.inc b/drupal/modules/views/components/civicrm.contribute.inc
index e666a45..1b4a20f 100644
--- a/drupal/modules/views/components/civicrm.contribute.inc
+++ b/drupal/modules/views/components/civicrm.contribute.inc
@@ -1023,7 +1023,7 @@ function _civicrm_contribute_data(&$data, $enabled) {
     ),
   );
   //Recurring Contribution End Date
-  $data['civicrm_contribution_recur']['next_sched_contribution'] = array(
+  $data['civicrm_contribution_recur']['next_sched_contribution_date'] = array(
     'title' => t('Next Contribution Date'),
     'help' => t('The Next Contribution Date.'),
     'field' => array(
@@ -1040,7 +1040,7 @@ function _civicrm_contribute_data(&$data, $enabled) {
   );
   civicrm_views_add_date_arguments($data['civicrm_contribution_recur'], array(
     'title' => 'Recurring Contribution Next Date',
-      'name' => 'next_sched_contribution',
+      'name' => 'next_sched_contribution_date',
     ));
   //How many times has the contribution failed
   $data['civicrm_contribution_recur']['failure_count'] = array(
2

That particular table is exposed to Views by the Core CiviCRM module, not CiviCRM entity. I haven't exposed that entity to Drupal yet, but its on the todo list.

I have added some code to CiviCRM Entity to fix this...

Its available in the latest -dev release from the CiviCRM Entity project page and will be in beta7 when it is released

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.