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#2493 Default to not cleaning money for order.create api #19991

Merged
merged 1 commit into from
Apr 26, 2021

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

dev/core#2493 Default to not cleaning money for order.create api

Before

Per https://lab.civicrm.org/dev/core/-/issues/2493#note_57387 there seem to be a lot of issues now with money being truncated which is what the clean function does if called twice on the same string. By default Order v3 create api gets the same default for skipCleanMoney (FALSE) as Contribution.create api.

However, it seems implicated in some of the cases and also one that can be more easily changed since Order api always involves some wrangling (and is less used) and the most broadly used cases appear to be implicated

After

Order v3 api defaults to skipCleanMoney

Technical Details

@kcristiano does this fix the case you can replicate? @agileware-justin may fix some of the case/s you hit

Comments

@civibot
Copy link

civibot bot commented Apr 7, 2021

(Standard links)

@civibot civibot bot added the 5.36 label Apr 7, 2021
@eileenmcnaughton eileenmcnaughton changed the base branch from 5.36 to master April 7, 2021 22:46
@civibot civibot bot added master and removed 5.36 labels Apr 7, 2021
@eileenmcnaughton
Copy link
Contributor Author

I've moved the PR to master since I don't think we will get confirmation in time to merge this to 5.36.0 - will consider which branch once we have more feedback

@agileware-fj
Copy link
Contributor

Just a couple of notes on this one from my testing. The use case which I hoped this would fix involved values that had been passed through CRM_Utils_Money::format once already.

  • The total_amount does not appear to already being cleaned twice in the first place - worked even without this change.
  • This had no effect on the line items, which I would assume is the more common use case for Order API.

In both cases if the amount hadn't already been formatted, everything worked fine both before and after the change.

Adding a skipCleanMoney parameter explicitly to the Order API can't be a bad thing though, right?

@agileware-justin
Copy link
Contributor

@eileenmcnaughton thanks for the PR

@eileenmcnaughton
Copy link
Contributor Author

@agileware-fj @agileware-justin -ok so not a strong case for this being helpful - hopefully we can gather a bit more information & then decide if it's part of the fix or not then

@eileenmcnaughton
Copy link
Contributor Author

@seamuslee001 what did you decide on this?

@seamuslee001
Copy link
Contributor

I thought about this but I think on the balance of probabilities this is better in than out

@seamuslee001 seamuslee001 merged commit 7a6cf3a into civicrm:master Apr 26, 2021
@seamuslee001 seamuslee001 deleted the order branch April 26, 2021 23:40
@eileenmcnaughton
Copy link
Contributor Author

Thanks @seamuslee001 - that was my conclusion too

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.

4 participants