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/financial#40 add missing financial item when altering a radio amount #14892

Merged
merged 3 commits into from
Aug 28, 2019

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Updated non-stale version of #13521 - fixes a missing line item when adjusting a radio line item - refer to that PR for more detail

Before

When adjusting a line item of radio type the changed item doesn't have an entity_financial_item record & line item

After

The above are created

Technical Details

This is largely the same as the original one but it addresses the mislinking of the financial item with the wrong trxn_id

Comments

I had some doubts about bringing this back to life since most work in this areas is stalled on @monishdeb availability at the moment. However, I was reluctant to throw away the tests. There is ALSO a larger question which stalled that PR & might stall this one which comes down to 'do a big audit' - I think this gets us to a better position (better test cover, imbalance fixed) without addressing some larger questions, but if it stalls again I'll close & we can track through gitlab.

Note that the behaviour when changing a text field line item is different to a radio field. For text fields there is an adjustment amount, for the others a reversal & a new row.

@civibot
Copy link

civibot bot commented Jul 27, 2019

(Standard links)

@seamuslee001
Copy link
Contributor

@eileenmcnaughton jenkins doesn't like the style

@eileenmcnaughton eileenmcnaughton force-pushed the lines branch 2 times, most recently from 7aeb78c to 7fb3b79 Compare July 27, 2019 05:01
@eileenmcnaughton
Copy link
Contributor Author

thanks @seamuslee001 - cheered up now

@JoeMurray
Copy link
Contributor

@monishdeb please spend up to 1h tomorrow on this, stealing as necessary from assigned projects.

Note that the behaviour when changing a text field line item is different to a radio field. For text fields there is an adjustment amount, for the others a reversal & a new row.

Please get rid of long obsoleted adjustment amount and make text fields consistent with the approved general pattern of reversal and new row.

@eileenmcnaughton
Copy link
Contributor Author

Let's keep the change in behaviour for a follow up rather than try to scope creep this PR

@monishdeb
Copy link
Member

monishdeb commented Aug 27, 2019

Hi @eileenmcnaughton I found an issue on how entity_financial_trxns record register the change in amounts of radio options. Let me explain with an example.

  1. Registered a event with radio option 'a' - $1
  2. Changed fee selection and chosen option 'b' - $2
  3. Recorded additional $1 amount.

Financial items: (3 records, including reversal amount - expected)
Screen Shot 2019-08-27 at 8 05 20 PM

Financial trxns - (2 records, each with $1 amount - expected)

Entity Financial trxns - (4 records - wrong)
Screen Shot 2019-08-27 at 8 14 12 PM

As per screenshot there is an additional record of $1 at the end (id - 255), which is wrong.

Can you please fix this issue and extend unit test to assert the entity_financial_trxns records for the adjustment made ?

@eileenmcnaughton
Copy link
Contributor Author

@monishdeb I added a check to the test - but it's only recording 3 lines - not 4 like you say - are you saying this causes a regression in the scenario you tested - or that there is an additional broken scenario?

@monishdeb
Copy link
Member

monishdeb commented Aug 28, 2019

I found it as an additional broken scenario, as I checked in a clean setup. Ok on second thought I will let it go and will try to fix it in a followup PR, but strange that UT isn't able to capture this odd behavior in entity_financial_trxns records.

I am marking with MoP tag as I am happy with the final patch, also the added UTs captures the desired change-fee use-cases for radip price options, correctly.

@eileenmcnaughton
Copy link
Contributor Author

thanks @monishdeb I think we can also merge #14408 now but I'm still struggling with the line item allocation #14763 since it fails a test but as I documented in #15143 the test doesn't really make sense to me in terms of final result

@monishdeb
Copy link
Member

Jenkins test this please

monishdeb added a commit that referenced this pull request Aug 28, 2019
 dev/financial#40 add missing financial item when altering a radio amount
@monishdeb monishdeb merged commit 2430907 into civicrm:master Aug 28, 2019
@monishdeb monishdeb merged commit 0f62ef9 into civicrm:master Aug 28, 2019
@eileenmcnaughton eileenmcnaughton deleted the lines branch August 28, 2019 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants