Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 2.1.2, 2.1.4, 2.1.5, 2.1, 2.2.0, 2.2.1, 2.2.2
-
Fix Version/s: 2.2.3
-
Component/s: CiviPledge
-
Labels:None
Description
In class CRM_Pledge_BAO_Payment, the function create() calculates the scheduled amount as follows:
$params['scheduled_amount'] = number_format( ( $params['amount'] / $params['installments'] ), 2 );
The function number_format returns a string instead of a float which causes problems in the subsequent calculations. This should instead be calculated using the round function which returns a float.
$params['scheduled_amount'] = round( $params['amount'] / $params['installments'], 2 );
If the schuduled amount equals or exceeds 1000, then the math fails down the line. Example: if amount is 1,000, then it is treated as 1 instead of 1000.