Precision issue if you use a logic hook to calculate a value triggered by scheduler #10573
Labels
Priority:Important
Issues & PRs that are important; broken functions, errors - there are workarounds
Severity: Moderate
Key function failed, but no or little impact
Type: Bug
Bugs within the core SuiteCRM codebase
Issue
We have a scheduler that creates an object once a night with sub-objects with amounts (relationship). After the object is saved, we calculate in a before_save logic hook the total sum of all amounts (in sub objects) and write the calculated sum into a field.
If you edit the object and save it again, the calculation works. The amount is correct. However, if the calculation is triggered from the scheduler, the field is formatted incorrectly. It seems as if the precision of the field is simply added after the calculated value.
This is what it looks like after the scheduler has calculated the field:
This is what it looks like when you edit the field
And this happens if you save the object manually (edit->save) without making any changes (the logic hook runs again)
Thats how we calculate the sum
That's the vardefs of the sum field
How is it possible that the scheduler gives us an incorrect sum?
Possible Fix
No response
Steps to Reproduce the Issue
Context
No response
Version
7.14.5
What browser are you currently using?
Chrome
Browser Version
No response
Environment Information
7.4.3-4ubuntu2.19
Operating System and Version
Ubuntu
The text was updated successfully, but these errors were encountered: