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

Cast result of getContributionBalance to float to match comment block. #15621

Merged
merged 1 commit into from
Oct 27, 2019

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Oct 26, 2019

Overview

Fix CRM_Contribute_BAO_Contribution::getContributionBalance to always return a float per the comment block

Before

could be null

After

will be a float - 0 for null

Technical Details

Without this it is possible for it to return 'null' which is not useful / in keeping. I did a bit of an audit & did not find places where this would cause an === comparison to fail

Comments

Without this it is possible for it to return 'null' which is not useful / in keeping. I did a bit of an audit &
did not find places where this would cause an === comparison to fail
@civibot
Copy link

civibot bot commented Oct 26, 2019

(Standard links)

@seamuslee001
Copy link
Contributor

I believe this is correct we should be getting a floated value back not 'null'. tests have also passed so merging

@seamuslee001 seamuslee001 merged commit 19788b7 into civicrm:master Oct 27, 2019
@seamuslee001 seamuslee001 deleted the float branch October 27, 2019 02:13
@mattwire
Copy link
Contributor

@eileenmcnaughton @seamuslee001 Just a note that I've recently been doing some custom work based (sort of) on the additionalpayment form and realised that there is no easy way via the API to do getContributionBalance which is pretty useful for showing people how much they have left to pay...
So I added this API to my mjwshared extension and thought it might make a useful addition to core at some point: https://lab.civicrm.org/extensions/mjwshared/blob/master/api/v3/Contribution/Getbalance.php

@eileenmcnaughton
Copy link
Contributor Author

@mattwire we should talk with @colemanw on how to add that to apiv4 - although perhaps on the Order api not contribution. I've been thinking about that & the fact we should start doing some mockups in gitlab on how the apiv4 order api should look. I feel like we can create something with a better developer experience in apiv4

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