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

Remove net_amount from the Back office contribution form. #12662

Merged
merged 1 commit into from
Aug 27, 2018

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Remove net_amount field from back office contribution form

Before

Field needs to be filled in & needs to match a form rule calculation

After

We just calculate it

Technical Details

Net amount is calculated in the BAO if not set so asking users to enter it does not gain us anything.

Currently we require them to calculate it & edit it if they change the fee_amount or total_amount
and we validate their data entry, and make them re-do it if they get it wrong.

Since the field is pretty hidden it's unintuitive to need to change it and
makes for a painful contribution update process.

The current behaviour dates back to svn days - however since 2015 the BAO has handled the possibilityof it not being set.

In addition we have had code issues with the comparison around currency & float comparison issues
eg. #11485
and https://lab.civicrm.org/dev/core/issues/260 ( in the latter case the data saves
correctly without net_amount and incorrectly if it is changed to meet the form validation rule.
(There was a proposal in Mar 2017 to address that #9948 (comment) by fixing the calculation but I believe just dropping the field is better).

Our unit tests test the form submissions but for some reason net_amoutn was removed from the tests
https://github.com/civicrm/civicrm-core/pull/9948/files#diff-40e2e0f106ba620465acf3a9a81f2498L1535
meaning our test coverage is more reliable without it being set.

Comments

@KarinG @JoeMurray was doing a cleanup of my local git branches & found this - we should probably merge

Net amount is calculated in the BAO if not set so asking users to enter it does not gain us anything.

Currently we require them to calculate it & edit it if they change the fee_amount or total_amount
and we validate their data entry, and make them re-do it if they get it wrong.

Since the field is pretty hidden it's unintuitive to need to change it and
makes for a painful contribution update process.

The current behaviour dates back to svn days - however since 2015 the BAO has handled the possibility
of it not being set.

In addition we have had code issues with the comparison around currency & float comparison issues
eg. civicrm#11485
and https://lab.civicrm.org/dev/core/issues/260 ( in the latter case the data saves
correctly without net_amount and incorrectly if it is changed to meet the form validation rule.
(There was a proposal in Mar 2017 to address that civicrm#9948 (comment) by fixing the calculation but I believe just dropping the field is better).

Our unit tests test the form submissions but for some reason net_amoutn was removed from the tests
https://github.com/civicrm/civicrm-core/pull/9948/files#diff-40e2e0f106ba620465acf3a9a81f2498L1535
meaning our test coverage is more reliable without it being set.
@civibot
Copy link

civibot bot commented Aug 14, 2018

(Standard links)

@jitendrapurohit
Copy link
Contributor

Tested and works as expected on the back office contribution form. Unless we are waiting for any other's input on this, I feel this is good to merge.

As the current formRule is removed, shouldn't we add another rule restricting the user to enter a lower amount in fee_amount than the total amount value? Currently View Contribution page looks like this if total = 10 and fee = 12 is submitted.

image

@eileenmcnaughton
Copy link
Contributor Author

@jitendrapurohit lower than or equal to makes sense! I guess it's not a blocker to merging this based on your review?

Copy link
Contributor

@jitendrapurohit jitendrapurohit left a comment

Choose a reason for hiding this comment

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

sure :-)

@eileenmcnaughton eileenmcnaughton merged commit cc0a70e into civicrm:master Aug 27, 2018
@eileenmcnaughton eileenmcnaughton deleted the net_amount branch August 27, 2018 06:31
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