progressivetech / net.ourpowerbase.sumfields

The Summary Fields extension creates read-only custom data fields that extend Contact and are automatically populated with up-to-date totals such as total lifetime contributions, last contribution amount, last attended event, etc.
Other
8 stars 29 forks source link

Add soft credit fields and hook #20

Closed colemanw closed 7 years ago

colemanw commented 7 years ago

Hi @jmcclelland I'm looking for feedback on this one. Adding a 3rd base table made things complicated, as the module is hard-coded for only two in many places. It especially made the UNION in sumfields_generate_data_based_on_current_data() quite tricky, but I think I solved it by changing it to an INSERT UPDATE from each, instead of trying to UNION multiple temp tables together. Would you try it out and let me know what you think?

colemanw commented 7 years ago

BTW I refactored the query a bit more and I think it's all working well now.

colemanw commented 7 years ago

Tidied up the admin page while I was at it:

screenshot from 2016-11-04 13 17 45

colemanw commented 7 years ago

Ok this PR is getting kinda big but we also needed a way to define new summary fields so have added in hook_civicrm_sumfields_definitions to allow other extensions to add to the list, and have refactored the rest of this extension to remove hardcoded references to particular fields/components and pull everything from metadata.

colemanw commented 7 years ago

@jmcclelland This has been running on the civicrm.org server for a few days now with no issues.

jmcclelland commented 7 years ago

Thanks coleman! Sorry I haven't had a chance to re view - I hope to take a closer look tomorrow.

colemanw commented 7 years ago

No prob. FYI I also made this little tweak to core to improve the summary fields UI:

https://issues.civicrm.org/jira/browse/CRM-19593

colemanw commented 7 years ago

@jmcclelland might be worth bumping the version & putting out a release when this is merged.

jmcclelland commented 7 years ago

Thanks coleman - these are excellent improvements!