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

Declare 'amount' as required on ContributionRecur api #13290

Merged
merged 1 commit into from
Dec 17, 2018

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Declare amount as a required field on Contribution Recur create api - this improves the error message when it is not passed in but does not change it

Before

Calling ContributionRecur.create with neither id or amount fails with the message
[nativecode=1364 ** Field 'amount' doesn't have a default value]

After

Calling ContributionRecur.create with neither id or amount fails with the message
Mandatory key(s) missing from params array: amount

Technical Details

The field is not required at the DB level (it probably should be that too) but
it has no default value so you wind up with

[nativecode=1364 ** Field 'amount' doesn't have a default value]

Note that making it required at the DB level won't change the need for this
patch & is separate. The api declares what is required at the api level

  • somethings are required at the DB level but not at the api level as they are
    calculated in the BAO

Comments

This is really a bug fix rather than a change

This is effectively required already as you get a DB error without it.

The field is not required at the DB level (it probably should be that too) but
it has no default value so you wind up with

[nativecode=1364 ** Field 'amount' doesn't have a default value]

Note that making it required at the DB level won't change the need for this
patch & is separate. The api declares what is required at the api level
- somethings are required at the DB level but not at the api level as they are
calculated in the BAO
@civibot
Copy link

civibot bot commented Dec 16, 2018

(Standard links)

@eileenmcnaughton
Copy link
Contributor Author

test this please

@mattwire
Copy link
Contributor

Merge on pass

@eileenmcnaughton eileenmcnaughton merged commit c95f771 into civicrm:master Dec 17, 2018
@eileenmcnaughton eileenmcnaughton deleted the recur_required branch December 17, 2018 19:53
mattwire pushed a commit to mattwire/civicrm-core that referenced this pull request Dec 18, 2018
Declare 'amount' as required on ContributionRecur api
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants