Skip to content

Commit

Permalink
Merge pull request #22851 from JMAConsulting/civiGrantFields
Browse files Browse the repository at this point in the history
CiviGrant - Don't return grant fields as contact fields
  • Loading branch information
demeritcowboy authored Feb 28, 2022
2 parents 4e526e7 + 6b7cb68 commit b7b95cf
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions ext/civigrant/CRM/Grant/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@
class CRM_Grant_BAO_Query extends CRM_Contact_BAO_Query_Interface {

/**
* Get grant fields.
* Unused.
*
* This function is meant to return extra contact fields, but grants are not contacts.
*
* @return array
*/
public function &getFields() {
return CRM_Grant_BAO_Grant::exportableFields();
$fields = [];
return $fields;
// return CRM_Grant_BAO_Grant::exportableFields();
}

/**
Expand Down Expand Up @@ -65,6 +69,11 @@ public static function select(&$query) {
$query->_tables['grant_note'] = 1;
}

if (!empty($query->_returnProperties['grant_id'])) {
$query->_select['grant_id'] = "civicrm_grant.id as grant_id";
$query->_element['grant_id'] = 1;
}

if ($query->_mode & CRM_Contact_BAO_Query::MODE_GRANT) {
$query->_select['grant_amount_requested'] = 'civicrm_grant.amount_requested as grant_amount_requested';
$query->_select['grant_amount_granted'] = 'civicrm_grant.amount_granted as grant_amount_granted';
Expand Down

0 comments on commit b7b95cf

Please sign in to comment.