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

CRM-19543: contact_id should be marked as required on grant api #9296

Merged
merged 2 commits into from
Oct 20, 2016

Conversation

michaelmcandrew
Copy link
Contributor

@michaelmcandrew michaelmcandrew commented Oct 19, 2016

The UI and the API state that this is a required field, but the create_spec does not. Hence adding it.


@@ -54,6 +54,7 @@ function civicrm_api3_grant_create($params) {
* Array of parameters determined by getfields.
*/
function _civicrm_api3_grant_create_spec(&$params) {
$params['contact_id']['api.required'] = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't status_id, amount_total be included here ?

Copy link
Contributor Author

@michaelmcandrew michaelmcandrew Oct 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jitendrapurohit

According to the UI, yes they should. The API doesn't complain as if they aren't defined, they default to 0. This might be an unwanted behaviour.

It kind of makes sense in the case for the amount (since 0 is a valid amount) but not in the case of the status_id since 0 is not a valid status ID.

And it appears that 0 will never get to _civicrm_api3_api_match_pseudoconstant as 0 evaluates to empty, and therefore Not sure if there is anything we can do about that but I'll raise a seperate issue, and add the status_id and amount_total as required for this API.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created https://issues.civicrm.org/jira/browse/CRM-19543 for the associated issue we discovered...

@monishdeb monishdeb changed the title contact_id should be marked as required on grant api CRM-19543: contact_id should be marked as required on grant api Oct 20, 2016
Copy link
Contributor

@jitendrapurohit jitendrapurohit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes the neccessary field required on the api. I've tested this and think it is good to be merged.

@monishdeb monishdeb merged commit 9c09417 into civicrm:master Oct 20, 2016
@michaelmcandrew michaelmcandrew deleted the grant-api-contact-required branch January 25, 2018 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants