Remove net_amount from the Back office contribution form. #12662
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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