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

Fix for #1573: Extra columns for Contribution Detail report. #16458

Conversation

twomice
Copy link
Contributor

@twomice twomice commented Feb 3, 2020

Overview

This creates new columns for the report: Employer, Location Type, and Preferred Communication Method

Before

These columns are not available in the report.

Screen Shot 2020-02-05 at 3 56 34 PM

After

The columns are available.
columns

Technical Details

No changes are made to the (admittedly complex) existing logic of this report. We're just adding new information about entities that are already clearly defined in the report.

Comments

None.

@civibot
Copy link

civibot bot commented Feb 3, 2020

(Standard links)

@civibot civibot bot added the master label Feb 3, 2020
@eileenmcnaughton
Copy link
Contributor

@twomice don't we have a helper function that adds these fields in other reports?

@twomice
Copy link
Contributor Author

twomice commented Feb 3, 2020

@eileenmcnaughton Do we? Happy to use that, but where would I find it?

@eileenmcnaughton
Copy link
Contributor

check
class CRM_Report_Form_Contact_Summary - although I do see a deprecation notice & a recommendation to use getColumns

@twomice
Copy link
Contributor Author

twomice commented Feb 3, 2020

Thanks @eileenmcnaughton

  1. We could use CRM_Report_Form::getColumns('Contact'), which would have the effect adding a bunch more columns, but would get us 'Current Employer' for free.

  2. Same for `getColumns('Address') and 'Location Type'.

  3. I don't see a helper to add 'preferred_communication_method', though.

So, do you prefer that I use the approach in "1" and "2" above?

@eileenmcnaughton
Copy link
Contributor

In general we have been moving that way - it doesn't really make sense to have some fields available on some reports & not others

@twomice
Copy link
Contributor Author

twomice commented Feb 3, 2020

@eileenmcnaughton Okay, I'll give that a go.

@twomice twomice force-pushed the 1573_extra_columns_contribution_detail_report branch from 9e84aef to b352745 Compare February 3, 2020 20:21
@twomice
Copy link
Contributor Author

twomice commented Feb 3, 2020

@eileenmcnaughton Thanks for the help. Turns out 'employer' already exists in the report, 'location type' is easy with getColumns('Address'), and 'communication method' is the only one we really had to had code for.

However, I've got a bunch of whitespace-only changes in the PR now. Do you have a recommendation for improving that?

@eileenmcnaughton
Copy link
Contributor

@twomice so a reviewer can look at it with https://github.com/civicrm/civicrm-core/pull/16458/files?w=1 to exclude those.

Any reason not to add communication_preferences to the helper fn - it seems if it's useful here it would be useful on other reports too

@twomice twomice force-pushed the 1573_extra_columns_contribution_detail_report branch from b352745 to 74b8bdf Compare February 3, 2020 21:08
@twomice
Copy link
Contributor Author

twomice commented Feb 3, 2020

@eileenmcnaughton Good call on that helper function. That's done now. FYI, I intentionally set 'false' -for is_filter, is_order_by and is_group_by on the 'communication method' field, because those functions don't work 100% perfectly on this array-packed multi-value column. I'd like to leave those for someone to address later if they have need.

Further suggestions?

@eileenmcnaughton
Copy link
Contributor

Code all looks good now

@twomice
Copy link
Contributor Author

twomice commented Feb 3, 2020

Darn, got some failing tests. Fixing ...

@twomice twomice force-pushed the 1573_extra_columns_contribution_detail_report branch from 74b8bdf to 1754f22 Compare February 3, 2020 22:58
@twomice
Copy link
Contributor Author

twomice commented Feb 4, 2020

@eileenmcnaughton There's one failing test but it appears to be unrelated. Would you agree, and is there anything otherwise that needs doing before merge?

@eileenmcnaughton
Copy link
Contributor

test this please

@eileenmcnaughton
Copy link
Contributor

agree it looks unrelated

@eileenmcnaughton
Copy link
Contributor

I gave this a spin & the new fields show & render correctly. I didn't spot any issues - merging

@eileenmcnaughton eileenmcnaughton merged commit 3f4b536 into civicrm:master Feb 5, 2020
@twomice
Copy link
Contributor Author

twomice commented Feb 5, 2020

Thanks, @eileenmcnaughton !

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.

2 participants