Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
F
Financial
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 80
    • Issues 80
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Create a new issue
  • Issue Boards
  • Development
  • Financial
  • Issues
  • #124

Closed
Open
Opened Apr 28, 2020 by Martin@martinh

Contribution page profile for honoree (db error)

Hi there, we're getting a database error originating from how the profile is used in the honoree section of a contribution page.

No profile is selected here in our admin, so it appears to be using the "Honoree individual" reserved profile, which includes some contact/individual fields. To this we've added a new field that is a custom field on the Contribution object (more specifically we created this field on the contribution so the end user could enter notes relating to why they are honoring this person, so that you have an idea of the use case).

With this configuration, when a user fills out the contribution page with an honoree and enters text in this field, the contribution fails with a database error. This is shown in the Civi log:

[message] => DB Error: constraint violation

[debug_info] => INSERT INTO civicrm_value_honoree_infor_17 ( note_53,entity_id ) VALUES ( 'my note text',32747 ) ON DUPLICATE KEY UPDATE note_53 = 'my note text' [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (db_name.civicrm_value_honoree_infor_17, CONSTRAINT FK_civicrm_value_honoree_infor_17_entity_id FOREIGN KEY (entity_id) REFERENCES civicrm_contribution (id) ON DELETE CASCADE)]

What appears to be happening is that the entity_id that's being passed through to create the custom field value is that for a contact, rather than the contribution's id. In this case 32747 is the ID for a contact that was attempting to be created, not a contribution.

Edited Apr 28, 2020 by Martin
To upload designs, you'll need to enable LFS and have admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: dev/financial#124