Uploaded image for project: 'Blesta Core'
  1. Blesta Core
  2. CORE-1718

Credits may fail to apply due to float precision error

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0, 3.4.4, 3.5.0-b5
    • Fix Version/s: 3.5.0
    • Component/s: None
    • Labels:
      None

      Description

      CORE-1706 fixed an issue with over applying transaction amounts. By doing so, it increased the likelyhood of encountering a floating point precision error related to applying credits, similar to CORE-629.

      An example is a credit amount of "0.0101" and an invoice it is paying for "0.0101". The values equate, but the floating point precision error causes them to be evaluated as if they do not.

      The floating point precision error should be resolved so that applying legitimate credits do not fail due to error: "One or more Amount to Pay values could not be applied to the specified invoice. Ensure that the Amount to Pay does not exceed the Amount Due on the invoice, that the invoice is open, and the sum of the Amount to Pay values do not exceed the Payment or Credit Amount."

        Issue Links

          Activity

          tyson Tyson Phillips (Inactive) created issue -
          tyson Tyson Phillips (Inactive) made changes -
          Field Original Value New Value
          Link This issue relates to CORE-1706 [ CORE-1706 ]
          tyson Tyson Phillips (Inactive) made changes -
          Link This issue relates to CORE-629 [ CORE-629 ]
          tyson Tyson Phillips (Inactive) made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          tyson Tyson Phillips (Inactive) made changes -
          Description CORE-1706 fixed an issue with over applying transaction amounts. By doing so, it increased the likelyhood of encountering a floating point precision error related to applying credits, similar to CORE-629.

          The floating point precision error should be resolved so that applying legitimate credits do not fail due to error: "One or more Amount to Pay values could not be applied to the specified invoice. Ensure that the Amount to Pay does not exceed the Amount Due on the invoice, that the invoice is open, and the sum of the Amount to Pay values do not exceed the Payment or Credit Amount."
          CORE-1706 fixed an issue with over applying transaction amounts. By doing so, it increased the likelyhood of encountering a floating point precision error related to applying credits, similar to CORE-629.

          An example is a credit amount of "0.0101" and an invoice it is paying for "0.0101". The values equate, but the floating point precision error causes them to be evaluated as if they do not.

          The floating point precision error should be resolved so that applying legitimate credits do not fail due to error: "One or more Amount to Pay values could not be applied to the specified invoice. Ensure that the Amount to Pay does not exceed the Amount Due on the invoice, that the invoice is open, and the sum of the Amount to Pay values do not exceed the Payment or Credit Amount."
          Hide
          tyson Tyson Phillips (Inactive) added a comment - - edited

          To fix yourself:

          Open /app/models/transactions.php
          Find the following line:
          if ($total !== null && $total < $apply_total)

          Update it to:
          if ($total !== null && round($total, 4) < round($apply_total, 4))

          Save the changes.

          Show
          tyson Tyson Phillips (Inactive) added a comment - - edited To fix yourself: Open /app/models/transactions.php Find the following line: if ($total !== null && $total < $apply_total) Update it to: if ($total !== null && round($total, 4) < round($apply_total, 4)) Save the changes.
          tyson Tyson Phillips (Inactive) made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              tyson Tyson Phillips (Inactive)
              Reporter:
              tyson Tyson Phillips (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                25/Jun/15