Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-4342

Scheduled amount of pledge payment is a string instead of a float

    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.

        Attachments

          Activity

            People

            • Assignee:
              dgg David Greenberg
              Reporter:
              solotandem Jim Berry
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 15 minutes
                15m
                Remaining:
                Remaining Estimate - 15 minutes
                15m
                Logged:
                Time Spent - Not Specified
                Not Specified