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

API fails to create line item record when creating contribution record

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.2.0, 4.2.1
    • Fix Version/s: 4.2.2
    • Component/s: CiviContribute
    • Labels:

      Description

      Each completed contribution record is supposed to have an associated line item record in the table civicrm_line_item. When you create a contribution using the web UI, an associated line item record is created. However, when you create a contribution using the API, the line item record is not created.

      This causes a fatal error when you try to use the web UI to update a contribution that was created with the API. (Specifically, the error occurs when CRM_Contribute_Form_Contribution::postProcess tries to look up a price set using a price set ID from the non-existent line item.)

      You can reproduce the error on the demo site. Go to the API explorer (http://drupal.demo.civicrm.org/civicrm/ajax/doc) and use it to create a contribution record, then go to the web interface and edit the contribution. When you try to save your changes, you'll get an "unexpected error" page.

      This bug was first raised on the forum: http://forum.civicrm.org/index.php/topic,26000.msg109932.html

      It seems likely that this problem is due to the logic for creating contributions being put in the Form layer rather than the BAO layer.

      Additional Note: Looks like there may also be an issue using the API to update an existing contribution. This needs more investigation as it might be an artifact of the create problem.

        Attachments

          Activity

            People

            • Assignee:
              ravish.nair Ravish Nair
              Reporter:
              kirk Kirk Jackson
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: