4

The table "civicrm_line_item" has a field called "contribution_id". For the most part, this field is filled in. But there are many records where the "contribution_id" field is NULL. I have seen this with happen no matter what the "entity_table" value is.

Why is "contribution_id sometimes NULL? What would cause this? (I have seen this in version 4.5.x and version 4.6.5)

1
  • I've noticed this when importing participants/memberships. Could it be the same thing that you're seeing?
    – Nicholai
    Jul 29, 2015 at 13:29

2 Answers 2

1

For every contribution, a line_item is being created. The contribution_id field is the FK reference to the civicrm_contribution table.

If I manually delete the Contribution record related to the Contact, the contribution gets deleted from civicrm_contribution table, which results in contribution_id to be NULL in civicrm_line_item.

2
  • I would have thought that if a contribution is deleted the line items linked to it should also been deleted.
    – JoAnne
    Jul 30, 2015 at 13:54
  • @JoAnne - I believe the line items aren't deleted for auditing/bookkeeping reasons. I could be wrong! Aug 29, 2015 at 17:13
0

Here's one context where a civicrm_line_item record is created with contribution_id NULL:
Line Items should be created for all Membership Signup/Renewal and Participant Registration transactions

See also:
Line item for membership entity should be created even when Record Payment is not checked

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.