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

Fatal error viewing a contribution having a line item with no price field

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Critical
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.16
    • Fix Version/s: 4.7.20
    • Component/s: CiviContribute
    • Labels:
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code
    • Verified?:
      Yes

      Description

      To replicate:
      Using the API, create a contribution with `skipLineItem` = 1, and let's say it creates contribution ID 12345. Next, create a line item with the following basic params:

      $result = civicrm_api3('LineItem', 'create', array(
        'entity_id' => 12345,
        'qty' => 1,
        'unit_price' => 100,
        'line_total' => 100,
        'entity_table' => "civicrm_contribution",
        'financial_type_id' => "Donation",
      ));
      

      Everything should go great. However, when you try to view the contribution on the web, you'll get a fatal error:

      Sorry but we are not able to provide this at the moment.
      Expected one PriceSet but found 9

      Return to home page.

      The page mistakenly assumes that the line item should have a price set ID, so it attempts a PriceSet.getsingle API call without specifying the ID, yielding the error.

        Attachments

          Activity

            People

            • Assignee:
              timotten Tim Otten
              Reporter:
              andrewhunt Andrew Hunt
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: