3

I have a drupal view that shows aggregated totals grouped by user from civi contribution pages.

The view has a contextual filter that takes the contribution page id as an argument.

The view works well if I pass in one argument.

I would like to be able to pass in multiple arguments, so, display contributions from contribpageID1 AND contribpageID2.

On contextual filters with drupal fields I am able, in the "more section", to select "Allow multiple values". This option isn't available on the CiviCRM Contributions: Contribution Page field.

Is this a limitation of the civi views integration? Or a setting I can't find.

Below is the query being run:

SELECT SUM(civicrm_contribution.total_amount) AS civicrm_contribution_total_amount FROM {civicrm_contribution} civicrm_contribution WHERE (( (civicrm_contribution.contribution_page_id = '12') )AND(( (civicrm_contribution.financial_type_id IN ('1')) AND (civicrm_contribution.contribution_status_id IN ('1')) AND (civicrm_contribution.is_test = '0') AND (civicrm_contribution.receive_date >= '2014-12-31 00:00:00') AND (civicrm_contribution.receive_date <= '2015-12-31 00:00:00') ))) LIMIT 20 OFFSET 0

On line 5, I want it to say ..._page_id = '12,15')...

Aggregation is turned on but the option is not there when this is turned off either.

1

It's a limitation in CiviCRM views implementation.

If you are a developer and know views api, i encourage you to propose a patch for this. You can find all the code in drupal/modules/views/civicrm.views.inc or https://github.com/civicrm/civicrm-drupal

More precisely, the function civicrm_views_get_argument return a views_handler_argument_numeric for all numeric data type. You might want to try changing that to views_handler_argument_many_to_one. But it's really a guess : i don't know if it will work and even less if it will work for every fields.

Otherwise, still with some programming knowledge, you could do a drupal module that implements hook_views_query_alter but it's more a drupal question.

  • 1
    Thanks a lot @samuelsov for your response. Knowing it doesn't currently do this helps me from going around in circles. Unfortunately my dev knowledge wouldn't stretch to creating a patch for this. I will take a look at the module option and also chat to our contract developer about creating that patch and whether we can fund it if it isn't too much. Thanks again – kimberley_p May 11 '15 at 9:08

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.