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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/v3/Grant.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ 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...

$params['grant_type_id']['api.required'] = 1;
$params['status_id']['api.required'] = 1;
$params['amount_total']['api.required'] = 1;
$params['status_id']['api.aliases'] = array('grant_status');
}

Expand Down