X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;ds=sidebyside;f=CRM%2FGrant%2FBAO%2FGrant.php;h=7873796c1804a214343c8592bb4c4d62f81793e9;hb=22e263ad985b62de5cf7bdaf09555bfb3f0cd322;hp=c4ae493175ad18f5e6c26e802bb9bae093b6172a;hpb=51daafaadd025703b2f8d6e3d27898e3768908f9;p=civicrm-core.git diff --git a/CRM/Grant/BAO/Grant.php b/CRM/Grant/BAO/Grant.php index c4ae493175..7873796c18 100644 --- a/CRM/Grant/BAO/Grant.php +++ b/CRM/Grant/BAO/Grant.php @@ -1,7 +1,7 @@ copyValues($params); if ($grant->find(TRUE)) { @@ -148,17 +145,18 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant { } /** - * function to add grant + * Add grant * - * @param array $params reference array contains the values submitted by the form - * @param array $ids reference array contains the id + * @param array $params + * Reference array contains the values submitted by the form. + * @param array $ids + * Reference array contains the id. * - * @access public * @static * * @return object */ - static function add(&$params, &$ids) { + public static function add(&$params, &$ids) { if (!empty($ids['grant_id'])) { CRM_Utils_Hook::pre('edit', 'Grant', $ids['grant_id'], $params); @@ -210,7 +208,7 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant { $grantTypes = CRM_Core_PseudoConstant::get('CRM_Grant_DAO_Grant', 'grant_type_id'); if (empty($params['skipRecentView'])) { - if(!isset($grant->contact_id) || !isset($grant->grant_type_id)){ + if (!isset($grant->contact_id) || !isset($grant->grant_type_id)){ $grant->find(TRUE); } $title = CRM_Contact_BAO_Contact::displayName($grant->contact_id) . ' - ' . ts('Grant') . ': ' . $grantTypes[$grant->grant_type_id]; @@ -227,7 +225,7 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant { ); } - // add the recently created Grant + // add the recently created Grant CRM_Utils_Recent::add($title, $url, $grant->id, @@ -249,13 +247,14 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant { } /** - * function to create the event + * Create the event * - * @param array $params reference array contains the values submitted by the form - * @param array $ids reference array contains the id + * @param array $params + * Reference array contains the values submitted by the form. + * @param array $ids + * Reference array contains the id. * * @return object - * @access public * @static * */ @@ -274,7 +273,7 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant { if (!$id) { $id = CRM_Utils_Array::value('contact_id', $params); } - if (!empty($params['note']) || CRM_Utils_Array::value('id', CRM_Utils_Array::value('note',$ids))) { + if (!empty($params['note']) || CRM_Utils_Array::value('id', CRM_Utils_Array::value('note', $ids))) { $noteParams = array( 'entity_table' => 'civicrm_grant', 'note' => $params['note'] = $params['note'] ? $params['note'] : "null", @@ -283,7 +282,7 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant { 'modified_date' => date('Ymd'), ); - CRM_Core_BAO_Note::add($noteParams, $ids['note']); + CRM_Core_BAO_Note::add($noteParams, (array) CRM_Utils_Array::value('note', $ids)); } // Log the information on successful add/edit of Grant $logParams = array( @@ -312,17 +311,16 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant { } /** - * Function to delete the Contact + * Delete the Contact * - * @param $id + * @param int $id + * Contact id. * * @return bool - * @internal param int $cid contact id * - * @access public * @static */ - static function deleteContact($id) { + public static function deleteContact($id) { $grant = new CRM_Grant_DAO_Grant(); $grant->contact_id = $id; $grant->delete(); @@ -330,16 +328,16 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant { } /** - * Function to delete the grant + * Delete the grant * - * @param int $id grant id + * @param int $id + * Grant id. * * @return bool|mixed - * @access public * @static * */ - static function del($id) { + public static function del($id) { CRM_Utils_Hook::pre('delete', 'Grant', $id, CRM_Core_DAO::$_nullArray); $grant = new CRM_Grant_DAO_Grant(); @@ -363,13 +361,12 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant { } /** - * combine all the exportable fields from the lower levels object + * Combine all the exportable fields from the lower levels object * * @return array array of exportable Fields - * @access public * @static */ - static function &exportableFields() { + public static function &exportableFields() { if (!self::$_exportableFields) { if (!self::$_exportableFields) { self::$_exportableFields = array(); @@ -404,7 +401,9 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant { ); $fields = CRM_Grant_DAO_Grant::export(); - $grantNote = array('grant_note' => array('title' => ts('Grant Note'), + $grantNote = array( + 'grant_note' => array( + 'title' => ts('Grant Note'), 'name' => 'grant_note', 'data_type' => CRM_Utils_Type::T_TEXT, )); @@ -418,19 +417,15 @@ class CRM_Grant_BAO_Grant extends CRM_Grant_DAO_Grant { } /** - * Function to get grant record count for a Contact + * Get grant record count for a Contact * - * @param $contactID - * - * @internal param int $contactId Contact ID + * @param int $contactID * * @return int count of grant records - * @access public * @static */ - static function getContactGrantCount($contactID) { + public static function getContactGrantCount($contactID) { $query = "SELECT count(*) FROM civicrm_grant WHERE civicrm_grant.contact_id = {$contactID} "; return CRM_Core_DAO::singleValueQuery($query); } } -