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

dev/core#830 [REF] Add unit tests on contribution recur trxn_id, contribution recur processor id #14119

Merged
merged 1 commit into from
Apr 27, 2019

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Apr 24, 2019

Overview

Clean up & additional tests for recurring contribution search fields

Before

Less tests, more special handling

After

More tests, less special handling

Technical Details

This is preliminary cleanup towards exposing cancel_reason as a search field, as committed to in proposal to add the field. This change

  • adds unit tests for the trxn_id & processor_id fields
  • makes the handling of 2 existing fields more generic
  • adds contribution recur field data to the contribution query object so it can be accessed.

Some points about the last of these. Basically we have a situation where the query object needs metadata to avoid field by field handling. We have done this is some wierd & wonderful ways with dependencies on 'import' & 'export' metadata info to the point where they were given to so many fields as to become meaningless.

I think this method is better - ie. just adding the additional metadata to the query class for all the entities it deals with. A recently merged PR means 'where' data is still available using this method.

Also I have added uniquenames to the contribution recur fields. Uniquenames no longer really matter outside

  • the query object
  • profiles
  • possibly import & export

We only really expose recurring contribution info through the query object of these so it should be safe. In a future happy
space apiv4 & namespacing will render uniquenames a distant memory.

I couldn't rip out the special handling entirely without dealing with the labels that go into the qill. I figure we should merge this & then address that - but briefly the issue is that @mattwire has just changed all the labels to not quite work in this context so we need to discuss / agree how to manage 'Recurring Contribution Trxn ID' vs'Trxn ID'.

I also didn't want to rip out the special handling fully in advance of #14118
being merged as there could be a performance regression if we let more code hit that unnecessary join line

UPDATE - the unit tests showed that if I include fields in $fields without uniqueNames they can clobber the fields from other entities. I have added a whitelist to work through this with more care

Comments

@mattwire @colemanw @seamuslee001 @monishdeb FYI - I think this is fairly straightforward but the label follow up might need more discussion.

@civibot
Copy link

civibot bot commented Apr 24, 2019

(Standard links)

@civibot civibot bot added the master label Apr 24, 2019
@seamuslee001
Copy link
Contributor

Jenkins re test this please

@eileenmcnaughton eileenmcnaughton force-pushed the recur_meta branch 2 times, most recently from df315ab to f3a07bc Compare April 25, 2019 04:56
@eileenmcnaughton
Copy link
Contributor Author

test this please

…essor id

This is preliminary cleanup towards exposing cancel_reason as a search field, as committed to in proposal to
add the field. This change

- adds unit tests for the trxn_id & processor_id fields
- makes the handling of them more generic
- adds contribution recur field data to the contribution query object so it can be accessed.

Some points about the last of these. Basically we have a situation where the query object needs metadata to
avoid field by field handling. We have done this is some wierd & wonderful ways with dependencies on 'import' &
'export' metadata info to the point where they were given to so many fields as to become meaningless.

I think this method is better - ie. just adding the additional metadata to the query class for all the entities it
deals with. A recently merged PR means 'where' data is still available using this method.

Also I have added uniquenames to the contribution recur fields. Uniquenames no longer really matter outside
- the query object
- profiles
- possibly import & export

We only really expose recurring contribution info through the query object of these so it should be safe. In a future happy
space apiv4 & namespacing will render uniquenames a distant memory.

I couldn't rip out the special handling entirely without dealing with the labels that go into the qill. I figure
we should merge this & then address that - but briefly the issue is that Matt has just changed all the labels
to not quite work in this context so we need to discuss / agree how to manage 'Recurring Contribution Trxn ID' vs
'Trxn ID'.

I also didn't want to rip out the special handling fully in advance of civicrm#14118
being merged as there could be a performance regression if we let more code hit that unnecessary join line
@eileenmcnaughton
Copy link
Contributor Author

@seamuslee001 if we merge this I'll take a look at the date fields for contribution recur search

@seamuslee001
Copy link
Contributor

This looks right to me, adding unique aliases for the fields change looks good and is backed up with some tests, I also believe we have enough tests in this area to show if this was to break anything, merging

@seamuslee001 seamuslee001 merged commit 566f14d into civicrm:master Apr 27, 2019
@seamuslee001 seamuslee001 deleted the recur_meta branch April 27, 2019 21:54
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