-
-
Notifications
You must be signed in to change notification settings - Fork 814
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
CRM-19543: contact_id should be marked as required on grant api #9296
Conversation
@@ -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; |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
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...
There was a problem hiding this 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.
The UI and the API state that this is a required field, but the create_spec does not. Hence adding it.