Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when a contribution that has donrec data is duplicated - Stripe recurring contributions #156

Open
muniodiego opened this issue Jan 27, 2023 · 4 comments
Labels
bug important status:needs work There is code, but it needs additional work before it should be reviewed.

Comments

@muniodiego
Copy link
Contributor

When a stripe recurring contribution is processed, a new contribution is generated by copying the data from the last recurring contribution. During this process, an error appears on the following line: https://lab.civicrm.org/dev/core/-/blob/5.57.2/CRM/Core/DAO.php#L2050

[error] $Fatal Error Details = Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => exceptionHandler
        )

    [code] => -19
    [message] => DB Error: no such field
    [mode] => 16
    [debug_info] => SELECT id FROM civicrm_custom_field WHERE html_type = 'File' AND id IN ( 12, 25, 118_2773, 119_2773, 120_2773, 121_2773, 122_2773, 123_2773, 124_2773, 125_2773, 126_2773, 127_2773, 128_2773, 129_2773, 130_2773, 118_3411, 119_3411, 120_3411, 121_3411, 122_3411, 123_3411, 124_3411, 125_3411, 126_3411, 127_3411, 128_3411, 129_3411, 130_3411 ) [nativecode=1054 ** Unknown column '118_2773' in 'where clause']
    [type] => DB_Error
    [user_info] => SELECT id FROM civicrm_custom_field WHERE html_type = 'File' AND id IN ( 12, 25, 118_2773, 119_2773, 120_2773, 121_2773, 122_2773, 123_2773, 124_2773, 125_2773, 126_2773, 127_2773, 128_2773, 129_2773, 130_2773, 118_3411, 119_3411, 120_3411, 121_3411, 122_3411, 123_3411, 124_3411, 125_3411, 126_3411, 127_3411, 128_3411, 129_3411, 130_3411 ) [nativecode=1054 ** Unknown column '118_2773' in 'where clause']
    [to_string] => [db_error: message="DB Error: no such field" code=-19 mode=callback callback=CRM_Core_Error::exceptionHandler prefix="" info="SELECT id FROM civicrm_custom_field WHERE html_type = 'File' AND id IN ( 12, 25, 118_2773, 119_2773, 120_2773, 121_2773, 122_2773, 123_2773, 124_2773, 125_2773, 126_2773, 127_2773, 128_2773, 129_2773, 130_2773, 118_3411, 119_3411, 120_3411, 121_3411, 122_3411, 123_3411, 124_3411, 125_3411, 126_3411, 127_3411, 128_3411, 129_3411, 130_3411 ) [nativecode=1054 ** Unknown column '118_2773' in 'where clause']"]
)

This error arises because the contribution's donrec custom field group (zwb_donation_receipt_item), has the field "is_multiple" equal to TRUE (however, CiviCRM does not support "is_multiple" = TRUE for custom field groups of contributions).

Resolved issue, if custom field group "zwb_donation_receipt_item" is created without "is_multiple" = TRUE.

https://github.com/systopia/de.systopia.donrec/blob/2.1-beta1/CRM/Donrec/DataStructure.php#L33

@bjendres
Copy link
Member

Thanks for reporting @muniodiego

@jensschuppe
Copy link
Collaborator

There's no PR while the fix seems obvious - anyone got some time for creating a PR, @muniodiego, @bjendres ?

muniodiego added a commit to ixiam/de.systopia.donrec that referenced this issue Sep 4, 2023
@muniodiego
Copy link
Contributor Author

@jensschuppe , I have created a PR: #171

@jensschuppe jensschuppe added the status:needs review Code needs review and testing. label Sep 5, 2023
@jensschuppe
Copy link
Collaborator

jensschuppe commented Sep 25, 2023

Note: this should become obsolete with a PR for CiviCRM 5.67, see #172 (comment).

Also, the proposed approach is not valid as the custom group has to be multi-value, since there can be copies of receipts which cause multiple records per contribution.

@jensschuppe jensschuppe added status:needs work There is code, but it needs additional work before it should be reviewed. and removed status:needs review Code needs review and testing. labels Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug important status:needs work There is code, but it needs additional work before it should be reviewed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants