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

CRM-21677 reduce unnecessary joins in reports #11889

Merged
merged 1 commit into from
Mar 29, 2018

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Mar 28, 2018

Overview

Reviewers cut of #11550 - reduce unnecessary joins to address tables in reports
Contact/CurrentEmployer
Contribute/Bookkeeping (remove copy & paste code)
Event/ParticipantCount
Event/ParticipantListing
Membership/Summary

Before

unnecessary joins to phone, email and address tables

After

join only when needed, code standardised

Technical Details

This also aligns the approach with that used in the extended report extension - there might be some notices as I have updated the extension where the signature differs from core but will need to drop a new release & people will need to be on it.

Comments

@yashodha now this one


@eileenmcnaughton
Copy link
Contributor Author

test this

@eileenmcnaughton
Copy link
Contributor Author

test this please

@eileenmcnaughton
Copy link
Contributor Author

(unrelated fail, paypal should throw an exception for that fn to work)

$this->_from .= "LEFT JOIN civicrm_email {$this->_aliases['civicrm_email']} ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_email']}.contact_id AND {$this->_aliases['civicrm_email']}.is_primary = 1\n";
}
$this->joinAddressFromContact();
$this->joinEmailFromContact();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eileenmcnaughton I don't see any email/address columns in Membership Summary report

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm - in construct I see

      'civicrm_email' => array(
        'dao' => 'CRM_Core_DAO_Email',
        'fields' => array('email' => NULL),
        'grouping' => 'contact-fields',
      ),

which seems kinda weird!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same in memberDetail too TBH - what do you think? I'm inclined to merge this as more standardised & safer than stripping out the join. We could also add more email fields/filters - but I'm wary of growing the scope for something neither of us are vested in

@eileenmcnaughton
Copy link
Contributor Author

merging based o your approval @yashodha & because it doesn't make the issue you noted worse - but we could follow up on that if we choose

@eileenmcnaughton eileenmcnaughton merged commit 775d19c into civicrm:master Mar 29, 2018
@eileenmcnaughton eileenmcnaughton deleted the min_report branch March 29, 2018 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants