Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extends the query to include contacts that might have no contributions #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sumfields.php
Original file line number Diff line number Diff line change
Expand Up @@ -470,11 +470,11 @@ function sumfields_generate_data_based_on_current_data($session = NULL) {

foreach ($temp_sql as $table => $data) {
// Calculate data and insert into temp table
$query = "INSERT INTO `{$data['temp_table']}` SELECT contact_id, "
$query = "INSERT INTO `{$data['temp_table']}` SELECT IFNULL(contact_id,c.id) as contact_id, "
. implode(",\n", $data['triggers'])
. " FROM `$table` AS t2 "
. "JOIN civicrm_contact AS c ON t2.contact_id = c.id ";
$query .= ' GROUP BY contact_id';
. "RIGHT OUTER JOIN civicrm_contact AS c ON t2.contact_id = c.id ";
$query .= ' GROUP BY IFNULL(contact_id,c.id)';
CRM_Core_DAO::executeQuery($query);

// Move temp data into custom field table
Expand Down